问题
When a process wakes another process on the same core, a sched:sched_wakeup event is generated with both PIDs. This is great for finding relationships between processes.
When a process wakes another process on a different core, the second core generates an irq_vectors:reschedule_entry event on whichever process is unlucky enough to catch the IPI, followed by a sched:sched_wakeup event from that victim process.
What I can't find is the original process on the first core that does the waking. The one that sends the reschedule IPI.
Is there any event associated with sending a reschedule interrupt, or with anything else in the process?
(In case it isn't apparent, I'm using "perf record", not "perf stat")
回答1:
Brendan Gregg in his book "BPF Performance Tools" says that there is no perf event or tracepoint for main rescheduling IPI interrupt function smp_send_reschedule()
There is a special SMP call not covered by those functions, smp_send_reschedule(), which is traced via native_smp_send_reschedule(). I hope that a future kernel version supports SMP call tracepoints to simplify tracing of these calls.
In 2013 there was a patch proposed to add tracing to IPI on ARM platform: https://lore.kernel.org/patchwork/patch/413825 ARM: trace: Add tracepoint for the Inter Processor Interrupt
smp_send_reschedule is called from several places including kernel/sched/core.c functions resched_curr
, wake_up_idle_cpu
, kick_process
, ttwu_queue_remote
, wake_up_if_idle
, but they have no tracing for IPI code path. You may try to add some perf probe to some functions.
来源:https://stackoverflow.com/questions/29736822/perf-event-for-sending-reschedule-interrupt