Skip to content

Commit

Permalink
arm/arm64: Use gic_ipi_send_single() to inject single IPI
Browse files Browse the repository at this point in the history
Currently, arm use gic_ipi_send_mask() to inject single IPI, which
make the procedure a little complex. We use gic_ipi_send_single()
instead as some other archs.

Signed-off-by: Jingyi Wang <wangjingyi11@huawei.com>
  • Loading branch information
Jingyi Wang authored and intel-lab-lkp committed Mar 29, 2021
1 parent 3866bb7 commit 95352e1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
16 changes: 13 additions & 3 deletions arch/arm/kernel/smp.c
Expand Up @@ -534,6 +534,8 @@ static const char *ipi_types[NR_IPI] __tracepoint_string = {
};

static void smp_cross_call(const struct cpumask *target, unsigned int ipinr);
static void smp_cross_call_single(const struct cpumask *target, int cpu,
unsigned int ipinr);

void show_ipi_list(struct seq_file *p, int prec)
{
Expand Down Expand Up @@ -564,14 +566,15 @@ void arch_send_wakeup_ipi_mask(const struct cpumask *mask)

void arch_send_call_function_single_ipi(int cpu)
{
smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC);
smp_cross_call_single(cpumask_of(cpu), cpu, IPI_CALL_FUNC);
}

#ifdef CONFIG_IRQ_WORK
void arch_irq_work_raise(void)
{
int cpu = smp_processor_id();
if (arch_irq_work_has_interrupt())
smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK);
smp_cross_call(cpumask_of(cpu), cpu, IPI_IRQ_WORK);
}
#endif

Expand Down Expand Up @@ -707,6 +710,13 @@ static void smp_cross_call(const struct cpumask *target, unsigned int ipinr)
__ipi_send_mask(ipi_desc[ipinr], target);
}

static void smp_cross_call_single(const struct cpumask *target, int cpu,
unsigned int ipinr)
{
trace_ipi_raise_rcuidle(target, ipi_types[ipinr]);
__ipi_send_single(ipi_desc[ipinr], cpu);
}

static void ipi_setup(int cpu)
{
int i;
Expand Down Expand Up @@ -744,7 +754,7 @@ void __init set_smp_ipi_range(int ipi_base, int n)

void smp_send_reschedule(int cpu)
{
smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE);
smp_cross_call_single(cpumask_of(cpu), cpu, IPI_RESCHEDULE);
}

void smp_send_stop(void)
Expand Down
16 changes: 13 additions & 3 deletions arch/arm64/kernel/smp.c
Expand Up @@ -801,6 +801,8 @@ static const char *ipi_types[NR_IPI] __tracepoint_string = {
};

static void smp_cross_call(const struct cpumask *target, unsigned int ipinr);
static void smp_cross_call_single(const struct cpumask *target, int cpu,
unsigned int ipinr);

unsigned long irq_err_count;

Expand All @@ -827,7 +829,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)

void arch_send_call_function_single_ipi(int cpu)
{
smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC);
smp_cross_call_single(cpumask_of(cpu), cpu, IPI_CALL_FUNC);
}

#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL
Expand All @@ -840,7 +842,8 @@ void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
#ifdef CONFIG_IRQ_WORK
void arch_irq_work_raise(void)
{
smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK);
int cpu = smp_processor_id();
smp_cross_call_single(cpumask_of(cpu), cpu, IPI_IRQ_WORK);
}
#endif

Expand Down Expand Up @@ -957,6 +960,13 @@ static void smp_cross_call(const struct cpumask *target, unsigned int ipinr)
__ipi_send_mask(ipi_desc[ipinr], target);
}

static void smp_cross_call_single(const struct cpumask *target, int cpu,
unsigned int ipinr)
{
trace_ipi_raise(target, ipi_types[ipinr]);
__ipi_send_single(ipi_desc[ipinr], cpu);
}

static void ipi_setup(int cpu)
{
int i;
Expand Down Expand Up @@ -1007,7 +1017,7 @@ void __init set_smp_ipi_range(int ipi_base, int n)

void smp_send_reschedule(int cpu)
{
smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE);
smp_cross_call_single(cpumask_of(cpu), cpu, IPI_RESCHEDULE);
}

#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
Expand Down

0 comments on commit 95352e1

Please sign in to comment.