MCPcopy Create free account
hub / github.com/F-Stack/f-stack / request_sync

Function request_sync

dpdk/lib/eal/common/malloc_mp.c:628–692  ·  view source on GitHub ↗

synchronously request memory map sync, this is only called whenever primary * process initiates the allocation. */

Source from the content-addressed store, hash-verified

626 * process initiates the allocation.
627 */
628int
629request_sync(void)
630{
631 struct rte_mp_msg msg;
632 struct rte_mp_reply reply;
633 struct malloc_mp_req *req = (struct malloc_mp_req *)msg.param;
634 struct timespec ts;
635 int i, ret = -1;
636
637 memset(&msg, 0, sizeof(msg));
638 memset(&reply, 0, sizeof(reply));
639
640 /* no need to create tailq entries as this is entirely synchronous */
641
642 msg.num_fds = 0;
643 msg.len_param = sizeof(*req);
644 strlcpy(msg.name, MP_ACTION_SYNC, sizeof(msg.name));
645
646 /* sync request carries no data */
647 req->t = REQ_TYPE_SYNC;
648 req->id = get_unique_id();
649
650 ts.tv_nsec = 0;
651 ts.tv_sec = MP_TIMEOUT_S;
652
653 /* there may be stray timeout still waiting */
654 do {
655 ret = rte_mp_request_sync(&msg, &reply, &ts);
656 } while (ret != 0 && rte_errno == EEXIST);
657 if (ret != 0) {
658 /* if IPC is unsupported, behave as if the call succeeded */
659 if (rte_errno != ENOTSUP)
660 RTE_LOG(ERR, EAL, "Could not send sync request to secondary process\n");
661 else
662 ret = 0;
663 goto out;
664 }
665
666 if (reply.nb_received != reply.nb_sent) {
667 RTE_LOG(ERR, EAL, "Not all secondaries have responded\n");
668 goto out;
669 }
670
671 for (i = 0; i < reply.nb_received; i++) {
672 struct malloc_mp_req *resp =
673 (struct malloc_mp_req *)reply.msgs[i].param;
674 if (resp->t != REQ_TYPE_SYNC) {
675 RTE_LOG(ERR, EAL, "Unexpected response from secondary\n");
676 goto out;
677 }
678 if (resp->id != req->id) {
679 RTE_LOG(ERR, EAL, "Wrong request ID\n");
680 goto out;
681 }
682 if (resp->result != REQ_RESULT_SUCCESS) {
683 RTE_LOG(ERR, EAL, "Secondary process failed to synchronize\n");
684 goto out;
685 }

Callers 2

try_expand_heap_primaryFunction · 0.70
malloc_heap_freeFunction · 0.70

Calls 5

memsetFunction · 0.85
get_unique_idFunction · 0.85
rte_mp_request_syncFunction · 0.70
strlcpyFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected