示例#1
0
    // --------------------------------------------------------------------
    void rma_receiver::handle_message_no_chunk_data()
    {
        chunk_fetch_ = true;
        // get the remote chunk block memory region details
        auto &cb = header_->chunk_header_ptr()->chunk_rma;
        LOG_DEBUG_MSG("receiver " << hexpointer(this)
            << "Fetching RMA chunk chunk data with "
            << "size " << decnumber(cb.size_)
            << "rkey " << hexpointer(cb.rkey_)
            << "addr " << hexpointer(cb.data_.cpos_));

        // we need a local memory region to read the chunks into
        chunk_region_ = memory_pool_->allocate_region(cb.size_);
        chunk_region_->set_message_length(cb.size_);
        uint64_t          rkey1 = cb.rkey_;
        const void *remoteAddr1 = cb.data_.cpos_;
        // add it to the list of rma regions to fetch
        rma_regions_.push_back(chunk_region_);
        LOG_DEBUG_MSG("receiver " << hexpointer(this)
            << "Fetching chunk region with size " << decnumber(cb.size_));
        rma_count_ = 1;

        // if the message region requires rma-get, we can get it now as well
        if (!header_->message_piggy_back())
        {
            auto &mc = header_->message_chunk_ptr()->message_rma;
            message_region_ = memory_pool_->allocate_region(mc.size_);
            message_region_->set_message_length(mc.size_);
            uint64_t          rkey2 = mc.rkey_;
            const void *remoteAddr2 = mc.data_.cpos_;
            // add it to the list of rma regions to fetch
            rma_regions_.push_back(message_region_);
            LOG_DEBUG_MSG("receiver " << hexpointer(this)
                << "Fetching message region with size " << decnumber(mc.size_));
            ++rma_count_;
            // call the rma read function for the message chunk
            read_one_chunk(src_addr_, message_region_, remoteAddr2, rkey2);
        }

        // call the rma read function for the chunk-info chunk
        // we do this last so that a completion does not come before the message
        // chunk read has been triggered - this would cause the rma receive to decrement
        // the counter and might hit zero before we had sent the second request
        read_one_chunk(src_addr_, chunk_region_, remoteAddr1, rkey1);
    }
示例#2
0
static void realloc_request_list(struct Verify_Request_List **history_request_list)
{
	*history_request_list = (struct Verify_Request_List *)malloc(sizeof(struct Verify_Request_List));	
	if(*history_request_list == NULL)
	{
		LOG_DEBUG_MSG("Failed memory allocation. \n");
		return;
	}

	LOG_DEBUG_MSG("_log_request_list : 0x%08X \n", _log_request_list);

	(*history_request_list)->crash_pointer 		= NULL;
	(*history_request_list)->crash_request_count= 0;
	(*history_request_list)->request_count 		= 0;
	(*history_request_list)->head = NULL;
	(*history_request_list)->tail = NULL;
	(*history_request_list)->next = NULL;

	_normal_request_count_after_crash = 0;
	_normal_request_count_before_crash = 0;	
示例#3
0
static void destory_request_list(struct Verify_Request_List *list)
{
	struct Verify_Request_Info *del_info 	= NULL;
	struct Verify_Request_Info *next_info 	= NULL;

	LOG_DEBUG_MSG("Destroy History Request List START, Verify_Request_List : 0x%08X \n", list);

	if(list == NULL)
		return ;

	if(list->crash_pointer != NULL)
	{
		free(list->crash_pointer);
		list->crash_pointer = NULL;
	}

	if(list->head != NULL)
		del_info = list->head;

	while(del_info != NULL)
	{	
		if(del_info->next != NULL)
			next_info = del_info->next; 	
		else 
			next_info = NULL;

		if(del_info->crash_pages_in_request != NULL)
		{
			free(del_info->crash_pages_in_request); 
			del_info->crash_pages_in_request = NULL;
		}

		del_info->request_start_lsn = 0;
		del_info->request_sectors = 0;
		del_info->request_status = 0;
		del_info->next = NULL;

		free(del_info);
		del_info = next_info;
	}

	list->head = NULL;
	list->tail = NULL;
	list->next = NULL;
	list->crash_pointer = NULL;
	list->request_count = 0;
	list->crash_request_count = 0;
	
	free(list);	
示例#4
0
    // --------------------------------------------------------------------
    void rma_receiver::read_one_chunk(
        fi_addr_t src_addr, region_type *get_region,
        const void *remoteAddr, uint64_t rkey)
    {
        // post the rdma read/get
        LOG_DEBUG_MSG("rma_receiver " << hexpointer(this)
            << "RDMA Get fi_read :"
            << "client " << hexpointer(endpoint_)
            << "fi_addr " << hexpointer(src_addr_)
            << "tag " << hexuint64(header_->tag())
            << "local addr " << hexpointer(get_region->get_address())
            << "local desc " << hexpointer(get_region->get_desc())
            << "size " << hexlength(get_region->get_message_length())
            << "rkey " << hexpointer(rkey)
            << "remote cpos " << hexpointer(remoteAddr));

        // count reads
        ++rma_reads_;

        ssize_t ret = 0;
        for (std::size_t k = 0; true; ++k)
        {
            LOG_EXCLUSIVE(
                // write a pattern and dump out data for debugging purposes
                uint32_t *buffer =
                    reinterpret_cast<uint32_t*>(get_region->get_address());
                std::fill(buffer, buffer + get_region->get_size()/4, 0xDEADC0DE);
                LOG_TRACE_MSG(
                    CRC32_MEM(get_region->get_address(), c.size_,
                        "(RDMA GET region (pre-fi_read))"));
            );

            ret = fi_read(endpoint_,
                get_region->get_address(),
                get_region->get_message_length(),
                get_region->get_desc(),
                src_addr_,
                (uint64_t)(remoteAddr), rkey, this);
            if (ret == -FI_EAGAIN)
            {
                LOG_ERROR_MSG("receiver " << hexpointer(this)
                    << "reposting fi_read...\n");
                hpx::util::detail::yield_k(k, "libfabric::receiver::async_read");
                continue;
            }
            if (ret) throw fabric_error(ret, "fi_read");
            break;
        }
示例#5
0
static void *listenForMessages( void *ptr )
{  
    struct sockaddr_in si_me;
    struct sockaddr_in si_other;
    socklen_t slen = sizeof(si_other);
    ssize_t readBytes = 0;
    char buf[BUFLEN+1]; //add space fer terminating \0
    char msgId[MSGIDLEN+1]; //add space fer terminating \0
    int port = PORT;

    DLT_REGISTER_APP("GNSS", "GNSS-SERVICE");
    DLT_REGISTER_CONTEXT(gContext,"GSRV", "Global Context");

    LOG_DEBUG(gContext,"GNSSService listening on port %d...",port);

    if((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
    {
        LOG_ERROR_MSG(gContext,"socket() failed!");
        exit(EXIT_FAILURE);
    }

    memset((char *) &si_me, 0, sizeof(si_me));
    si_me.sin_family = AF_INET;

    si_me.sin_port = htons(port);
    si_me.sin_addr.s_addr = htonl(INADDR_ANY);
    if(bind(s, (struct sockaddr *)&si_me, (socklen_t)sizeof(si_me)) == -1)
    {
         LOG_ERROR_MSG(gContext,"bind() failed!");
         exit(EXIT_FAILURE);
    }

    while(isRunning == true)
    {
        //use select to introduce a timeout - alloy shutdown even when no data are received
        fd_set readfs;    /* file descriptor set */
        int    maxfd;     /* maximum file desciptor used */        
        int res;
        struct timeval Timeout;
        /* set timeout value within input loop */
        Timeout.tv_usec = 0;  /* milliseconds */
        Timeout.tv_sec  = 1;  /* seconds */
        FD_SET(s, &readfs);
        maxfd = s+1;
        /* block until input becomes available */
        res = select(maxfd, &readfs, NULL, NULL, &Timeout);

        if (res > 0)
        {
                    
            readBytes = recvfrom(s, buf, BUFLEN, 0, (struct sockaddr *)&si_other, (socklen_t *)&slen);
    
            if(readBytes < 0)
            {
                LOG_ERROR_MSG(gContext,"recvfrom() failed!");
                exit(EXIT_FAILURE);
            }
            buf[readBytes] = '\0';

            LOG_DEBUG_MSG(gContext,"------------------------------------------------");

            LOG_DEBUG(gContext,"Received Packet from %s:%d", 
                      inet_ntoa(si_other.sin_addr), ntohs(si_other.sin_port));

            sscanf(buf, "%*[^'$']$%" STRINGIFY(MSGIDLEN) "[^',']", msgId);

            LOG_DEBUG(gContext,"MsgID:%s", msgId);
            LOG_DEBUG(gContext,"Len:%u", (unsigned int)strlen(buf));
            LOG_DEBUG(gContext,"Data:%s", buf);

            LOG_DEBUG_MSG(gContext,"------------------------------------------------");

            if(strcmp("GVGNSPOS", msgId) == 0)
            {
                 processGVGNSPOS(buf);
            }
            else if(strcmp("GVGNSTIM", msgId) == 0)
            {
                 processGVGNSTIM(buf);
            }
            else if(strcmp("GVGNSSAT", msgId) == 0)
            {
                 processGVGNSSAT(buf);
            }
            //handling of old logs for backward compatibility 
            else if(strcmp("GVGNSP", msgId) == 0)
            {
                 processGVGNSP(buf);
            }
            else if(strcmp("GVGNSC", msgId) == 0)
            {
                 processGVGNSC(buf);
            }
            else if(strcmp("GVGNSAC", msgId) == 0)
            {
                 processGVGNSAC(buf);
            }            
        }

    }

    close(s);

    return EXIT_SUCCESS;
}
示例#6
0
static void insert_request_list(struct Verify_Request_Info *info, enum VERI_ERROR_NUM status)
{
	if(_log_request_list == NULL)
	{
		LOG_DEBUG_MSG("History Request List is not allocation.\n");
		return;
	}

	if(_current_step != verify_get_current_step())
	{
		realloc_request_list(&_log_request_list);	
		_current_step = verify_get_current_step();
		insert_manager_list(&_log_request_list, _current_step);
	}
	
	if(_log_request_list->request_count == 0)
	{
		_log_request_list->head = info;
		_log_request_list->tail = info;
	}
	else
	{
		_log_request_list->tail->next = info;
		_log_request_list->tail = info;
	}

	_log_request_list->request_count++;	

	if(_log_request_list->crash_request_count == 0)
	{
		_normal_request_count_before_crash++;			
		
		if(_normal_request_count_before_crash > MAX_NORMAL_REQUEST + 1)
		{
			struct Verify_Request_Info *temp =	_log_request_list->head;
			_log_request_list->head = _log_request_list->head->next;
			free(temp);
			_log_request_list->request_count--;	
			_normal_request_count_before_crash--;
		}
	}
	else 
	{
		_normal_request_count_after_crash++;		
		
		if(_normal_request_count_after_crash >= MAX_NORMAL_REQUEST && status < VERI_EREQUEST)
		{
			realloc_request_list(&_log_request_list);	
			insert_manager_list(&_log_request_list, _current_step);
			return;
		}
	}

	if(status >= VERI_EREQUEST)
	{
		_normal_request_count_after_crash = 0;

		if(_log_request_list->crash_request_count == 0)
		{
			LOG_DEBUG_MSG("Create, Insert Crash Info (lsn : 0x%08X, sectors : %d, count before crash : %d, count after crash : %d, crash index : %d) \n", info->request_start_lsn, info->request_sectors, _normal_request_count_before_crash, _normal_request_count_after_crash, _log_request_list->crash_request_count);

			_log_request_list->crash_pointer = (struct Verify_Request_Info **)malloc(sizeof(struct Verify_Request_Info *) * DEFAULT_CRASH_ALLOC_COUNT);					
			if(_log_request_list->crash_pointer == NULL)
			{
				LOG_DEBUG_MSG("Failed memory allocation. \n");
				return;
			}
			memset(&*(_log_request_list->crash_pointer), 0, sizeof(struct Verify_Request_Info *) * DEFAULT_CRASH_ALLOC_COUNT);			
			_log_request_list->crash_pointer[_log_request_list->crash_request_count] = info;	
		}
		else if(_log_request_list->crash_request_count != 0 &&
				_log_request_list->crash_request_count % DEFAULT_CRASH_ALLOC_COUNT == 0)
		{
			struct Verify_Request_Info **temp = NULL;
			uint alloc_count = ((_log_request_list->crash_request_count / DEFAULT_CRASH_ALLOC_COUNT) + 1) * DEFAULT_CRASH_ALLOC_COUNT;
			LOG_DEBUG_MSG("Reset, Insert Crash Info (lsn : 0x%08X, sectors : %d, count before crash : %d, count after crash : %d,  crash index : %d) \n", info->request_start_lsn, info->request_sectors, _normal_request_count_before_crash, _normal_request_count_after_crash, _log_request_list->crash_request_count);
			
			temp = (struct Verify_Request_Info **)malloc(sizeof(struct Verify_Request_Info *) * alloc_count);					
			if(temp == NULL)
			{
				LOG_DEBUG_MSG("Failed memory allocation. \n");
				return;
			}		
			
			memset(&*temp, 0, sizeof(struct Verify_Request_Info *) * alloc_count);			
			memcpy(&*temp, &*(_log_request_list->crash_pointer), sizeof(struct Verify_Request_Info *) * _log_request_list->crash_request_count);

			free(_log_request_list->crash_pointer);		
			
			_log_request_list->crash_pointer = temp;			
			_log_request_list->crash_pointer[_log_request_list->crash_request_count] = info;		
		}
		else 
		{
			LOG_DEBUG_MSG("Insert Crash Info (lsn : 0x%08X, sectors : %d, count before crash : %d, count after crash : %d, crash index : %d) \n", info->request_start_lsn, info->request_sectors, _normal_request_count_before_crash, _normal_request_count_after_crash, _log_request_list->crash_request_count);
			_log_request_list->crash_pointer[_log_request_list->crash_request_count] = info;		
		}

		_log_request_list->crash_request_count++;
	}	
示例#7
0
 ~unique_lock()
 {
     LOG_DEBUG_MSG("Destroying unique_lock RAII");
 }
示例#8
0
 unique_lock(Mutex& m, std::try_to_lock_t t) : std::unique_lock<Mutex>(m, t)
 {
     LOG_DEBUG_MSG("Creating unique_lock try_to_lock_t RAII");
 }
示例#9
0
 unique_lock(Mutex &m) : std::unique_lock<Mutex>(m)
 {
     LOG_DEBUG_MSG("Creating unique_lock RAII");
 }
示例#10
0
 ~scoped_lock()
 {
     LOG_DEBUG_MSG("Destroying scoped_lock RAII");
 }
示例#11
0
 scoped_lock(Mutex &m) : std::lock_guard<Mutex>(m)
 {
     LOG_DEBUG_MSG("Creating scoped_lock RAII");
 }