关于rte_keepalive_register_relay_callback调用时机的困惑咨询
rte_keepalive_register_relay_callback() Trigger Condition Great question—this sort of documentation inconsistency is definitely frustrating, so let’s get this sorted out clearly:
The Short Answer
The callback registered via rte_keepalive_register_relay_callback() is triggered when a core is detected as dead, not when it’s confirmed alive. The documentation’s claim that it’s called "when confirming core liveness" is almost certainly a mistake or misstatement.
Detailed Explanation
Let’s ground this in how DPDK’s keepalive subsystem works:
- The keepalive module monitors registered cores by expecting periodic "heartbeat" signals from each core.
- If a core fails to send its heartbeat within the configured timeout window, the module marks that core as unresponsive (dead).
- At this point, any callback registered via
rte_keepalive_register_relay_callback()is invoked. The callback receives the keepalive context and the ID of the dead core, letting you handle the failure (e.g., log the event, trigger failover logic).
Looking at the actual function’s parameter definition in DPDK’s codebase reinforces this:
The callback prototype is:
void (*callback)(struct rte_keepalive *keepcfg, const int id_core);
And the associated code comments explicitly state this callback is for notifying of core death, not liveness.
The documentation’s conflicting wording is likely an oversight—common in large projects where docs and code can drift slightly over time.
内容的提问来源于stack exchange,提问作者hermit.crab

