Skip to contentSkip to conversation

arm: Some IPI injection optimization

RFC PATCH In review Jingyi Wang 3 participants 10 messages Mar 29, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover arm: Some IPI injection optimization

This series optimize arm IPI injection process by making use of ICC_SGI1R IRM bit and implementing gic_ipi_send_single().

Jingyi Wang (3):
irqchip/gic-v3: Make use of ICC_SGI1R IRM bit irqchip/gic-v3: Implement gic_ipi_send_single() arm/arm64: Use gic_ipi_send_single() to inject single IPI

 arch/arm/kernel/smp.c        | 16 +++++++++++++---
 arch/arm64/kernel/smp.c      | 16 +++++++++++++---
 drivers/irqchip/irq-gic-v3.c | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 6 deletions(-)
Signature · 1 line
2.19.1
#1 lore raw

RFC PATCH 1/3 irqchip/gic-v3: Make use of ICC_SGI1R IRM bit

IRM, bit[40] in ICC_SGI1R, determines how the generated SGIs are distributed to PEs. If the bit is set, interrupts are routed to all PEs in the system excluding "self". We use cpumask to determine if this bit should be set and make use of that.

This will reduce vm trap when broadcast IPIs are sent.

---
 drivers/irqchip/irq-gic-v3.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/irqchip/irq-gic-v3.c +12 -0
index eb0ee356a629..8ecc1b274ea8 100644
@@ -1127,6 +1127,7 @@ static void gic_send_sgi(u64 cluster_id, u16 tlist, unsigned int irq)
 static void gic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
 {
 	int cpu;
+	cpumask_t tmp;
 
 	if (WARN_ON(d->hwirq >= 16))
 		return;
@@ -1137,6 +1138,17 @@ static void gic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
 	 */
 	wmb();
 
+	if (!cpumask_and(&tmp, mask, cpumask_of(smp_processor_id()))) {
+		/* Set Interrupt Routing Mode bit */
+		u64 val;
+		val = (d->hwirq) << ICC_SGI1R_SGI_ID_SHIFT;
+		val |= BIT_ULL(ICC_SGI1R_IRQ_ROUTING_MODE_BIT);
+		gic_write_sgi1r(val);
+
+		isb();
+		return;
+	}
+
 	for_each_cpu(cpu, mask) {
 		u64 cluster_id = MPIDR_TO_SGI_CLUSTER_ID(cpu_logical_map(cpu));
 		u16 tlist;
Signature · 1 line
2.19.1
maintainer
#2 lore raw

Re: [RFC PATCH 1/3] irqchip/gic-v3: Make use of ICC_SGI1R IRM bit

Quoted 7 lines · Jingyi Wang

IRM, bit[40] in ICC_SGI1R, determines how the generated SGIs are distributed to PEs. If the bit is set, interrupts are routed to all PEs in the system excluding "self". We use cpumask to determine if this bit should be set and make use of that.

This will reduce vm trap when broadcast IPIs are sent.

I remember writing similar code about 4 years ago, only to realise what:

- the cost of computing the resulting mask is pretty high for large machines
- Linux almost never sends broadcast IPIs, so the complexity was all in vain

What changed? Please provide supporting data showing how many IPIs we actually save, and for which workload.

Quoted 19 lines
---
 drivers/irqchip/irq-gic-v3.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/irqchip/irq-gic-v3.c +1 -0
index eb0ee356a629..8ecc1b274ea8 100644
@@ -1127,6 +1127,7 @@ static void gic_send_sgi(u64 cluster_id, u16 tlist, unsigned int irq)
 static void gic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
 {
 	int cpu;
+	cpumask_t tmp;
 
 	if (WARN_ON(d->hwirq >= 16))
 		return;

drivers/irqchip/irq-gic-v3.c static void gic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask) · line 1141

Quoted 4 lines
drivers/irqchip/irq-gic-v3.c +1 -0
@@ -1137,6 +1138,17 @@ static void gic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
 	 */
 	wmb();
 
+	if (!cpumask_and(&tmp, mask, cpumask_of(smp_processor_id()))) {

Are you sure this does the right thing? This is checking that the current CPU is not part of the mask. But it not checking that the mask is actually "all but self".

This means you are potentially sending IPIs to CPUs that are not part of the mask, making performance potentially worse.

Thanks,

	M.
Quoted 17 lines
drivers/irqchip/irq-gic-v3.c +10 -0
+		/* Set Interrupt Routing Mode bit */
+		u64 val;
+		val = (d->hwirq) << ICC_SGI1R_SGI_ID_SHIFT;
+		val |= BIT_ULL(ICC_SGI1R_IRQ_ROUTING_MODE_BIT);
+		gic_write_sgi1r(val);
+
+		isb();
+		return;
+	}
+
 	for_each_cpu(cpu, mask) {
 		u64 cluster_id = MPIDR_TO_SGI_CLUSTER_ID(cpu_logical_map(cpu));
 		u16 tlist;
Signature · 1 line
2.19.1
Signature · 1 line
Without deviation from the norm, progress is not possible.
#3 lore raw

Re: [RFC PATCH 1/3] irqchip/gic-v3: Make use of ICC_SGI1R IRM bit

Quoted 13 lines · Marc Zyngier
Quoted 7 lines · Jingyi Wang

IRM, bit[40] in ICC_SGI1R, determines how the generated SGIs are distributed to PEs. If the bit is set, interrupts are routed to all PEs in the system excluding "self". We use cpumask to determine if this bit should be set and make use of that.

This will reduce vm trap when broadcast IPIs are sent.

I remember writing similar code about 4 years ago, only to realise what:

Quoted 7 lines

- the cost of computing the resulting mask is pretty high for large machines
- Linux almost never sends broadcast IPIs, so the complexity was all in vain

What changed? Please provide supporting data showing how many IPIs we actually save, and for which workload.

Maybe we can implement send_IPI_allbutself hooks as other some other archs instead of computing cpumask here?

Quoted 28 lines
Quoted 19 lines
---
  drivers/irqchip/irq-gic-v3.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)
drivers/irqchip/irq-gic-v3.c +1 -0
index eb0ee356a629..8ecc1b274ea8 100644
@@ -1127,6 +1127,7 @@ static void gic_send_sgi(u64 cluster_id, u16 tlist, unsigned int irq)
  static void gic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
  {
  	int cpu;
+	cpumask_t tmp;
 
  	if (WARN_ON(d->hwirq >= 16))
  		return;

drivers/irqchip/irq-gic-v3.c static void gic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask) · line 1141

Quoted 4 lines
drivers/irqchip/irq-gic-v3.c +1 -0
@@ -1137,6 +1138,17 @@ static void gic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
  	 */
  	wmb();
 
+	if (!cpumask_and(&tmp, mask, cpumask_of(smp_processor_id()))) {

Are you sure this does the right thing? This is checking that the current CPU is not part of the mask. But it not checking that the mask is actually "all but self".

Quoted 7 lines

This means you are potentially sending IPIs to CPUs that are not part of the mask, making performance potentially worse.

Thanks,

	M.

I will fix that,thanks.

Quoted 18 lines
Quoted 17 lines
drivers/irqchip/irq-gic-v3.c +10 -0
+		/* Set Interrupt Routing Mode bit */
+		u64 val;
+		val = (d->hwirq) << ICC_SGI1R_SGI_ID_SHIFT;
+		val |= BIT_ULL(ICC_SGI1R_IRQ_ROUTING_MODE_BIT);
+		gic_write_sgi1r(val);
+
+		isb();
+		return;
+	}
+
  	for_each_cpu(cpu, mask) {
  		u64 cluster_id = MPIDR_TO_SGI_CLUSTER_ID(cpu_logical_map(cpu));
  		u16 tlist;
Signature · 1 line
2.19.1
maintainer
#4 lore raw

Re: [RFC PATCH 1/3] irqchip/gic-v3: Make use of ICC_SGI1R IRM bit

Quoted 22 lines · Jingyi Wang
Quoted 18 lines · Marc Zyngier
Quoted 7 lines · Jingyi Wang

IRM, bit[40] in ICC_SGI1R, determines how the generated SGIs are distributed to PEs. If the bit is set, interrupts are routed to all PEs in the system excluding "self". We use cpumask to determine if this bit should be set and make use of that.

This will reduce vm trap when broadcast IPIs are sent.

I remember writing similar code about 4 years ago, only to realise what:

- the cost of computing the resulting mask is pretty high for large machines
- Linux almost never sends broadcast IPIs, so the complexity was all in vain

Quoted 4 lines
Quoted 2 lines

What changed? Please provide supporting data showing how many IPIs we actually save, and for which workload.

Maybe we can implement send_IPI_allbutself hooks as other some other archs instead of computing cpumask here?

The question remains: how often is that used? x86 uses it only for NMI (we don't broadcast our pseudo-NMI) and reboot, it seems. Anything I missed? Do we have a different use case on arm64?

At the moment, this doesn't seem very useful.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
#5 lore raw

RFC PATCH 2/3 irqchip/gic-v3: Implement gic_ipi_send_single()

In reply to Jingyi Wang

We implement gic_ipi_send_single() to make single ipi injection easier.

---
 drivers/irqchip/irq-gic-v3.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
drivers/irqchip/irq-gic-v3.c +22 -0
index 8ecc1b274ea8..5c44e1e719d6 100644
@@ -1124,6 +1124,26 @@ static void gic_send_sgi(u64 cluster_id, u16 tlist, unsigned int irq)
 	gic_write_sgi1r(val);
 }
 
+static void gic_ipi_send_single(struct irq_data *d, unsigned int cpu)
+{
+	unsigned long mpidr;
+	u64 cluster_id;
+	u16 tlist;
+
+	if (WARN_ON(d->hwirq >= 16))
+		return;
+
+	wmb();
+
+	mpidr = cpu_logical_map(cpu);
+	cluster_id = MPIDR_TO_SGI_CLUSTER_ID(mpidr);
+	tlist = 1 << (mpidr & 0xf);
+
+	gic_send_sgi(cluster_id, tlist, d->hwirq);
+
+	isb();
+}
+
 static void gic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
 {
 	int cpu;
@@ -1279,6 +1299,7 @@ static struct irq_chip gic_chip = {
 	.irq_nmi_setup		= gic_irq_nmi_setup,
 	.irq_nmi_teardown	= gic_irq_nmi_teardown,
 	.ipi_send_mask		= gic_ipi_send_mask,
+	.ipi_send_single	= gic_ipi_send_single,
 	.flags			= IRQCHIP_SET_TYPE_MASKED |
 				  IRQCHIP_SKIP_SET_WAKE |
 				  IRQCHIP_MASK_ON_SUSPEND,
@@ -1298,6 +1319,7 @@ static struct irq_chip gic_eoimode1_chip = {
 	.irq_nmi_setup		= gic_irq_nmi_setup,
 	.irq_nmi_teardown	= gic_irq_nmi_teardown,
 	.ipi_send_mask		= gic_ipi_send_mask,
+	.ipi_send_single	= gic_ipi_send_single,
 	.flags			= IRQCHIP_SET_TYPE_MASKED |
 				  IRQCHIP_SKIP_SET_WAKE |
 				  IRQCHIP_MASK_ON_SUSPEND,
Signature · 1 line
2.19.1
#6 lore raw

RFC PATCH 3/3 arm/arm64: Use gic_ipi_send_single() to inject single IPI

In reply to Jingyi Wang

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.

---
 arch/arm/kernel/smp.c   | 16 +++++++++++++---
 arch/arm64/kernel/smp.c | 16 +++++++++++++---
 2 files changed, 26 insertions(+), 6 deletions(-)
arch/arm/kernel/smp.c +13 -3
index 74679240a9d8..369ce529cdd8 100644
@@ -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)
 {
@@ -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
 
@@ -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;
@@ -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)
arch/arm64/kernel/smp.c +13 -3
index 357590beaabb..d290b6dc5a6e 100644
@@ -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;
 
@@ -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
@@ -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
 
@@ -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;
@@ -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
Signature · 1 line
2.19.1
maintainer
#7 lore raw

Re: [RFC PATCH 3/3] arm/arm64: Use gic_ipi_send_single() to inject single IPI

Quoted 16 lines · Jingyi Wang

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.

---
 arch/arm/kernel/smp.c   | 16 +++++++++++++---
 arch/arm64/kernel/smp.c | 16 +++++++++++++---
 2 files changed, 26 insertions(+), 6 deletions(-)
arch/arm/kernel/smp.c +0 -0
index 74679240a9d8..369ce529cdd8 100644

arch/arm/kernel/smp.c static const char *ipi_types[NR_IPI] __tracepoint_string = { · line 538

Quoted 5 lines
arch/arm/kernel/smp.c +2 -0
@@ -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);

Why does this function need to take both a cpumask *and* a cpu, given that they represent the same thing?

Quoted 8 lines
arch/arm/kernel/smp.c +0 -1
 void show_ipi_list(struct seq_file *p, int prec)
 {
@@ -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);

arch/arm/kernel/smp.c void arch_send_wakeup_ipi_mask(const struct cpumask *mask) · line 577

Quoted 10 lines
arch/arm/kernel/smp.c +3 -1
+	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);

Why isn't that a call to smp_cross_call_single()?

arch/arm/kernel/smp.c static void smp_cross_call(const struct cpumask *target, unsigned int ipinr) · line 716

Quoted 11 lines
arch/arm/kernel/smp.c +4 -0
 }
 #endif
 
@@ -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]);

Why don't you compute the cpumask here^^?

arch/arm64/kernel/smp.c

Quoted 19 lines
arch/arm/kernel/smp.c +4 -1
+	__ipi_send_single(ipi_desc[ipinr], cpu);
+}
+
 static void ipi_setup(int cpu)
 {
 	int i;
@@ -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)
arch/arm64/kernel/smp.c +0 -0
index 357590beaabb..d290b6dc5a6e 100644

Similar comments for the arm64 side.

Overall, this needs to be backed by data that indicates that there is an actual benefit for this extra complexity.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
#8 lore raw

Re: [RFC PATCH 3/3] arm/arm64: Use gic_ipi_send_single() to inject single IPI

Quoted 39 lines · Marc Zyngier
Quoted 16 lines · Jingyi Wang

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.

---
  arch/arm/kernel/smp.c   | 16 +++++++++++++---
  arch/arm64/kernel/smp.c | 16 +++++++++++++---
  2 files changed, 26 insertions(+), 6 deletions(-)
arch/arm/kernel/smp.c +0 -0
index 74679240a9d8..369ce529cdd8 100644

arch/arm/kernel/smp.c static const char *ipi_types[NR_IPI] __tracepoint_string = { · line 538

Quoted 5 lines
arch/arm/kernel/smp.c +2 -0
@@ -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);

Why does this function need to take both a cpumask *and* a cpu, given that they represent the same thing?
I was intended to use the extra param to reuse trace_ipi_raise_rcuidle.

Quoted 11 lines
arch/arm/kernel/smp.c +1 -1
  void show_ipi_list(struct seq_file *p, int prec)
  {
@@ -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);
  }
 
Quoted 10 lines

arch/arm/kernel/smp.c void arch_send_wakeup_ipi_mask(const struct cpumask *mask) · line 577

Quoted 7 lines
arch/arm/kernel/smp.c +2 -1
  #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);

Why isn't that a call to smp_cross_call_single()?

I ignored that, thanks.

Quoted 36 lines

arch/arm/kernel/smp.c static void smp_cross_call(const struct cpumask *target, unsigned int ipinr) · line 716

Quoted 11 lines
arch/arm/kernel/smp.c +4 -0
  }
  #endif
 
@@ -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]);

Why don't you compute the cpumask here^^?

arch/arm64/kernel/smp.c

Quoted 19 lines
arch/arm/kernel/smp.c +4 -1
+	__ipi_send_single(ipi_desc[ipinr], cpu);
+}
+
  static void ipi_setup(int cpu)
  {
  	int i;
@@ -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)
arch/arm64/kernel/smp.c +0 -0
index 357590beaabb..d290b6dc5a6e 100644

Similar comments for the arm64 side.

Quoted 7 lines

Overall, this needs to be backed by data that indicates that there is an actual benefit for this extra complexity.

Thanks,

	M.

Firstly, I implemented exitless-IPIs to reduce VM trap caused by sending IPI as what x86 does here:
https://patchwork.kernel.org/project/kvm/cover/[email protected]/
Then I realized that sending ipi mask usually cause sending IPIs all but self as IRM bit defines.
So do you think we can use IRM if we can avoid extra cost like computing mask, or using broadcast IPIs is just meaningless for now?

Thanks,
Jingyi

#9 lore raw

Re: [RFC PATCH 3/3] arm/arm64: Use gic_ipi_send_single() to inject single IPI

In reply to Jingyi Wang
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]

Hi Jingyi,

[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on tip/irq/core]
[also build test ERROR on arm64/for-next/core linux/master linus/master v5.12-rc5 next-20210329] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jingyi-Wang/arm-Some-IPI-injection-optimization/20210329-170909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 6e457914935a3161eeb74e319abf9fd511aa1e4d
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/95352e149ae94e5ec8917b2e7e764dc62f85a377
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jingyi-Wang/arm-Some-IPI-injection-optimization/20210329-170909 git checkout 95352e149ae94e5ec8917b2e7e764dc62f85a377
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

arch/arm/kernel/smp.c:573:6: warning: no previous prototype for 'arch_irq_work_raise' [-Wmissing-prototypes]
573 | void arch_irq_work_raise(void)
| ^~~~~~~~~~~~~~~~~~~
arch/arm/kernel/smp.c: In function 'arch_irq_work_raise':

>> arch/arm/kernel/smp.c:577:3: error: too many arguments to function 'smp_cross_call'
     577 |   smp_cross_call(cpumask_of(cpu), cpu, IPI_IRQ_WORK);
         |   ^~~~~~~~~~~~~~
   arch/arm/kernel/smp.c:536:13: note: declared here
     536 | static void smp_cross_call(const struct cpumask *target, unsigned int ipinr);
         |             ^~~~~~~~~~~~~~

arch/arm/kernel/smp.c: At top level:
arch/arm/kernel/smp.c:785:6: warning: no previous prototype for 'panic_smp_self_stop' [-Wmissing-prototypes]
785 | void panic_smp_self_stop(void)
| ^~~~~~~~~~~~~~~~~~~
arch/arm/kernel/smp.c:797:5: warning: no previous prototype for 'setup_profiling_timer' [-Wmissing-prototypes]
797 | int setup_profiling_timer(unsigned int multiplier)
| ^~~~~~~~~~~~~~~~~~~~~

vim +/smp_cross_call +577 arch/arm/kernel/smp.c

571
572 #ifdef CONFIG_IRQ_WORK

 > 573	void arch_irq_work_raise(void)
   574	{
   575		int cpu = smp_processor_id();
   576		if (arch_irq_work_has_interrupt())
 > 577			smp_cross_call(cpumask_of(cpu), cpu, IPI_IRQ_WORK);

578 }
579 #endif
580

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org