Skip to content

Commit 45ed695

Browse files
Nicolas Pitrerostedt
authored andcommitted
ARM64: add IPI tracepoints
The strings used to list IPIs in /proc/interrupts are reused for tracing purposes. While at it, the code is slightly cleaned up so the ipi_types array indices are no longer offset by IPI_RESCHEDULE whose value is 0 anyway. Link: http://lkml.kernel.org/p/1406318733-26754-5-git-send-email-nicolas.pitre@linaro.org Acked-by: Will Deacon <will.deacon@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 365ec7b commit 45ed695

File tree

1 file changed

+39
-26
lines changed

1 file changed

+39
-26
lines changed

arch/arm64/kernel/smp.c

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
#include <asm/tlbflush.h>
5151
#include <asm/ptrace.h>
5252

53+
#define CREATE_TRACE_POINTS
54+
#include <trace/events/ipi.h>
55+
5356
/*
5457
* as from 2.5, kernels no longer have an init_tasks structure
5558
* so we need some other way of telling a new secondary core
@@ -307,8 +310,6 @@ void __init smp_prepare_boot_cpu(void)
307310
set_my_cpu_offset(per_cpu_offset(smp_processor_id()));
308311
}
309312

310-
static void (*smp_cross_call)(const struct cpumask *, unsigned int);
311-
312313
/*
313314
* Enumerate the possible CPU set from the device tree and build the
314315
* cpu logical map array containing MPIDR values related to logical
@@ -463,32 +464,15 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
463464
}
464465
}
465466

467+
static void (*__smp_cross_call)(const struct cpumask *, unsigned int);
466468

467469
void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int))
468470
{
469-
smp_cross_call = fn;
471+
__smp_cross_call = fn;
470472
}
471473

472-
void arch_send_call_function_ipi_mask(const struct cpumask *mask)
473-
{
474-
smp_cross_call(mask, IPI_CALL_FUNC);
475-
}
476-
477-
void arch_send_call_function_single_ipi(int cpu)
478-
{
479-
smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
480-
}
481-
482-
#ifdef CONFIG_IRQ_WORK
483-
void arch_irq_work_raise(void)
484-
{
485-
if (smp_cross_call)
486-
smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK);
487-
}
488-
#endif
489-
490-
static const char *ipi_types[NR_IPI] = {
491-
#define S(x,s) [x - IPI_RESCHEDULE] = s
474+
static const char *ipi_types[NR_IPI] __tracepoint_string = {
475+
#define S(x,s) [x] = s
492476
S(IPI_RESCHEDULE, "Rescheduling interrupts"),
493477
S(IPI_CALL_FUNC, "Function call interrupts"),
494478
S(IPI_CALL_FUNC_SINGLE, "Single function call interrupts"),
@@ -497,12 +481,18 @@ static const char *ipi_types[NR_IPI] = {
497481
S(IPI_IRQ_WORK, "IRQ work interrupts"),
498482
};
499483

484+
static void smp_cross_call(const struct cpumask *target, unsigned int ipinr)
485+
{
486+
trace_ipi_raise(target, ipi_types[ipinr]);
487+
__smp_cross_call(target, ipinr);
488+
}
489+
500490
void show_ipi_list(struct seq_file *p, int prec)
501491
{
502492
unsigned int cpu, i;
503493

504494
for (i = 0; i < NR_IPI; i++) {
505-
seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i + IPI_RESCHEDULE,
495+
seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i,
506496
prec >= 4 ? " " : "");
507497
for_each_online_cpu(cpu)
508498
seq_printf(p, "%10u ",
@@ -522,6 +512,24 @@ u64 smp_irq_stat_cpu(unsigned int cpu)
522512
return sum;
523513
}
524514

515+
void arch_send_call_function_ipi_mask(const struct cpumask *mask)
516+
{
517+
smp_cross_call(mask, IPI_CALL_FUNC);
518+
}
519+
520+
void arch_send_call_function_single_ipi(int cpu)
521+
{
522+
smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
523+
}
524+
525+
#ifdef CONFIG_IRQ_WORK
526+
void arch_irq_work_raise(void)
527+
{
528+
if (__smp_cross_call)
529+
smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK);
530+
}
531+
#endif
532+
525533
static DEFINE_RAW_SPINLOCK(stop_lock);
526534

527535
/*
@@ -553,8 +561,10 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
553561
unsigned int cpu = smp_processor_id();
554562
struct pt_regs *old_regs = set_irq_regs(regs);
555563

556-
if (ipinr >= IPI_RESCHEDULE && ipinr < IPI_RESCHEDULE + NR_IPI)
557-
__inc_irq_stat(cpu, ipi_irqs[ipinr - IPI_RESCHEDULE]);
564+
if ((unsigned)ipinr < NR_IPI) {
565+
trace_ipi_entry(ipi_types[ipinr]);
566+
__inc_irq_stat(cpu, ipi_irqs[ipinr]);
567+
}
558568

559569
switch (ipinr) {
560570
case IPI_RESCHEDULE:
@@ -599,6 +609,9 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
599609
pr_crit("CPU%u: Unknown IPI message 0x%x\n", cpu, ipinr);
600610
break;
601611
}
612+
613+
if ((unsigned)ipinr < NR_IPI)
614+
trace_ipi_exit(ipi_types[ipinr]);
602615
set_irq_regs(old_regs);
603616
}
604617

0 commit comments

Comments
 (0)