<html><head></head><body><div id="editor_version_1.35.4_KNW5574c" style="word-break:break-word"><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6">Apologize that I have to go directly to function names to explain :)</div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6">  - rte_eal_intr_init creates eal_intr_thread_main which starts eal_intr_handle_interrupts</div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6">  - rte_mp_channel_init creates mp_handle which processes messages registered by rte_mp_action_register</div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6">  - then, eal_mp_dev_hotplug_init calls rte_mp_action_register to register handle_primary_request for EAL_DEV_MP_ACTION_REQUEST</div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6"><br></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6">At this point the whole messaging mechanism starts to function: When primary attaches/detaches devices, it sends EAL_DEV_MP_ACTION_REQUEST, and handle_primary_request invokes __handle_primary_request, which calls local_dev_probe/remove. In the end it goes to for example rte_eth_dev_attach_secondary.</div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6"><br></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6">Now, if secondary is somewhere after eal_mp_dev_hotplug_init but before memory init done, it will crash due to memory access violation.</div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6"><br></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6">Thanks</div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6">Zhihong</div></div><div class="history-quote-wrapper" style="word-break:break-word" id="lark-mail-quote-168567678"><div id="lark-mail-quote-e77977a4fe25862009dfa52d0be6c562"><div class="adit-html-block__attr history-quote-meta-wrapper history-quote-gap-tag" style="padding:12px;background:rgb(245,246,247);color:rgb(31,35,41);border-radius:4px;margin-top:24px;margin-bottom:12px" id="lark-mail-meta-73zasn75l"><div style="margin:0px" class="history-quote-line quote-head-meta-line"><div class="">From: "Burakov, Anatoly"<<a class="quote-head-meta-mailto" target="_blank" rel="noopener noreferrer" href="mailto:anatoly.burakov@intel.com" style="text-decoration:none;color:inherit">anatoly.burakov@intel.com</a>></div></div><div style="margin:0px" class="history-quote-line quote-head-meta-line"><div class="">Date:  Thu, Jun 1, 2023, 20:26</div></div><div style="margin:0px" class="history-quote-line quote-head-meta-line"><div class="">Subject:  [External] Re: [PATCH] eal/linux: register mp hotplug callback after memory init</div></div><div style="margin:0px" class="history-quote-line quote-head-meta-line"><div class="">To: "Zhihong Wang"<<a class="quote-head-meta-mailto" target="_blank" rel="noopener noreferrer" href="mailto:wangzhihong.wzh@bytedance.com" style="text-decoration:none;color:inherit">wangzhihong.wzh@bytedance.com</a>>, <<a class="quote-head-meta-mailto" target="_blank" rel="noopener noreferrer" href="mailto:dev@dpdk.org" style="text-decoration:none;color:inherit">dev@dpdk.org</a>>, <<a class="quote-head-meta-mailto" target="_blank" rel="noopener noreferrer" href="mailto:qi.z.zhang@intel.com" style="text-decoration:none;color:inherit">qi.z.zhang@intel.com</a>></div></div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class="">On 5/31/2023 7:55 AM, Zhihong Wang wrote:</div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class="">> Secondary would crash if it tries to handle mp requests before memory</div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class="">> init, since globals such as eth_dev_shared_data_lock are not accessible</div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class="">> to it at this moment.</div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class="">> ---</div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class=""><br></div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class="">Please correct me if I'm wrong, but if init is not completed, none of </div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class="">the IPC stuff is initialized either, and any hotplug requests would not </div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class="">trigger any callbacks in the first place?</div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class="">-- </div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class="">Thanks,</div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class="">Anatoly</div></div><div style="font-size:14px;margin-top:4px;margin-bottom:4px;line-height:1.6" class="history-quote-line"><div class=""><br></div></div></div></div></body></html>