Re: [RFC PATCH v2 6/8] treewide: Trace IPIs sent via smp_send_reschedule()

Valentin Schneider
2022-11-17T14:25:34Z

On 17/11/22 10:12, Peter Zijlstra wrote:
> On Wed, Nov 02, 2022 at 06:33:34PM +0000, Valentin Schneider wrote:
>
>> diff --git a/kernel/smp.c b/kernel/smp.c
>> index c4d561cf50d45..44fa4b9b1f46b 100644
>> --- a/kernel/smp.c
>> +++ b/kernel/smp.c
>> @@ -167,6 +167,14 @@ send_call_function_ipi_mask(const struct cpumask *mask)
>> arch_send_call_function_ipi_mask(mask);
>> }
>>
>> +void smp_send_reschedule(int cpu)
>> +{
>> + /* XXX scheduler_ipi is inline :/ */
>> + trace_ipi_send_cpumask(cpumask_of(cpu), _RET_IP_, NULL);
>> + arch_smp_send_reschedule(cpu);
>> +}
>> +EXPORT_SYMBOL_GPL(smp_send_reschedule);
>
> Yeah, no.. I see some crazy archs do this, but no we're not exporting
> this in generic.

So the list is: ia64, powerpc, riscv
and they all seem to do it because of KVM:
c4cb768f0277 ("[IA64] export smp_send_reschedule")
de56a948b918 ("KVM: PPC: Add support for Book3S processors in hypervisor mode")
d3d7a0ce020e ("RISC-V: Export kernel symbols for kvm")

Other archs get out of it either because their smp_send_reschedule() is
inline (e.g. x86), or because they don't allow building KVM as a module
(e.g. arm64).

If I can cobble the tracepoint+reschedule in an inline helper, then that
wouldn't require any new exports - I'm fighting a bit with the header maze
ATM, but hopefully I can get somewhere with this.