2

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")

dspeyer
  • 2,904
  • 1
  • 18
  • 24
  • `smp_send_reschedule` seems to be the function to send resched IPI: https://elixir.bootlin.com/linux/v4.3/ident/smp_send_reschedule. Called from [kernel/sched/core.c](https://elixir.bootlin.com/linux/v4.3/source/kernel/sched/core.c) functions resched_curr, wake_up_idle_cpu, kick_process, ttwu_queue_remote, wake_up_if_idle. None of them have predefined tracepoint or software perf event. You may try to define perf probe for the functions. There was patch for arm to add trace to IPI - https://lore.kernel.org/patchwork/patch/413825/ ARM: trace: Add tracepoint for the Inter Processor Interrupt – osgx Mar 08 '20 at 04:08

1 Answers1

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.

osgx
  • 90,338
  • 53
  • 357
  • 513
  • 1
    While trying to instrument `smp_send_reschedule` I found the following article (no affiliation) which describes the process of adding a probe, https://eastrivervillage.com/Custom-perf-with-custom-kernel/ – Nixus Aug 25 '21 at 13:40