All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] IPI numbering cleanup
@ 2015-12-18  9:16 Marc Zyngier
  2015-12-18  9:16 ` [PATCH 1/2] ARM: Remove IPI_CALL_FUNC_SINGLE Marc Zyngier
  2015-12-18  9:16 ` [PATCH 2/2] ARM: Make IPI_CPU_BACKTRACE a "non-secure" SGI Marc Zyngier
  0 siblings, 2 replies; 8+ messages in thread
From: Marc Zyngier @ 2015-12-18  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

Daniel Thompson reported[1] that IPI_CPU_BACKTRACE failed to fire on
one of his platforms because SGI15 was already used by the secure
firmware.

In order to move this IPI to the non-secure side, this series drops
IPI_CALL_FUNC_SINGLE (which has been deprecated for a while). This
allows the last non-secure SGI to be reallocated to IPI_CPU_BACKTRACE.

       M.

[1]: https://lkml.org/lkml/2015/12/16/375

Marc Zyngier (2):
  ARM: Remove IPI_CALL_FUNC_SINGLE
  ARM: Make IPI_CPU_BACKTRACE a "non-secure" SGI

 arch/arm/include/asm/hardirq.h |  2 +-
 arch/arm/kernel/smp.c          | 12 ++----------
 2 files changed, 3 insertions(+), 11 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] ARM: Remove IPI_CALL_FUNC_SINGLE
  2015-12-18  9:16 [PATCH 0/2] IPI numbering cleanup Marc Zyngier
@ 2015-12-18  9:16 ` Marc Zyngier
  2015-12-18  9:16 ` [PATCH 2/2] ARM: Make IPI_CPU_BACKTRACE a "non-secure" SGI Marc Zyngier
  1 sibling, 0 replies; 8+ messages in thread
From: Marc Zyngier @ 2015-12-18  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

Since 9a46ad6d6df3 ("smp: make smp_call_function_many() use logic
similar to smp_call_function_single()"), the core IPI handling
has been simplified, and generic_smp_call_function_interrupt is
now the same as generic_smp_call_function_single_interrupt.

This means that one of IPI_CALL_FUNC and IPI_CALL_FUNC_SINGLE has
become redundant. We can then safely drop IPI_CALL_FUNC_SINGLE,
and use only IPI_CALL_FUNC.

This has the advantage of reducing the number of SGI IDs we're using
(a fairly scarse resource).

Tested on a dual A7 board.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/include/asm/hardirq.h |  2 +-
 arch/arm/kernel/smp.c          | 10 +---------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h
index fe3ea77..3d7351c 100644
--- a/arch/arm/include/asm/hardirq.h
+++ b/arch/arm/include/asm/hardirq.h
@@ -5,7 +5,7 @@
 #include <linux/threads.h>
 #include <asm/irq.h>
 
-#define NR_IPI	8
+#define NR_IPI	7
 
 typedef struct {
 	unsigned int __softirq_pending;
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index b263613..d50a77d 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -69,7 +69,6 @@ enum ipi_msg_type {
 	IPI_TIMER,
 	IPI_RESCHEDULE,
 	IPI_CALL_FUNC,
-	IPI_CALL_FUNC_SINGLE,
 	IPI_CPU_STOP,
 	IPI_IRQ_WORK,
 	IPI_COMPLETION,
@@ -475,7 +474,6 @@ static const char *ipi_types[NR_IPI] __tracepoint_string = {
 	S(IPI_TIMER, "Timer broadcast interrupts"),
 	S(IPI_RESCHEDULE, "Rescheduling interrupts"),
 	S(IPI_CALL_FUNC, "Function call interrupts"),
-	S(IPI_CALL_FUNC_SINGLE, "Single function call interrupts"),
 	S(IPI_CPU_STOP, "CPU stop interrupts"),
 	S(IPI_IRQ_WORK, "IRQ work interrupts"),
 	S(IPI_COMPLETION, "completion interrupts"),
@@ -525,7 +523,7 @@ 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_SINGLE);
+	smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC);
 }
 
 #ifdef CONFIG_IRQ_WORK
@@ -620,12 +618,6 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
 		irq_exit();
 		break;
 
-	case IPI_CALL_FUNC_SINGLE:
-		irq_enter();
-		generic_smp_call_function_single_interrupt();
-		irq_exit();
-		break;
-
 	case IPI_CPU_STOP:
 		irq_enter();
 		ipi_cpu_stop(cpu);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] ARM: Make IPI_CPU_BACKTRACE a "non-secure" SGI
  2015-12-18  9:16 [PATCH 0/2] IPI numbering cleanup Marc Zyngier
  2015-12-18  9:16 ` [PATCH 1/2] ARM: Remove IPI_CALL_FUNC_SINGLE Marc Zyngier
@ 2015-12-18  9:16 ` Marc Zyngier
  2015-12-18  9:34   ` Russell King - ARM Linux
  2015-12-18 11:20   ` Daniel Thompson
  1 sibling, 2 replies; 8+ messages in thread
From: Marc Zyngier @ 2015-12-18  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

Having IPI_CPU_BACKTRACE as SGI15 may not work if the kernel is
running in non-secure mode and that the secure firmware has
decided to follow ARM's recommendations that SGI8-15 should
be reserved for secure purpose.

Now that we are "only" using SGI0-6, change IPI_CPU_BACKTRACE
to use SGI7, which makes it more likely to work.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index d50a77d..fe517f1 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -72,7 +72,7 @@ enum ipi_msg_type {
 	IPI_CPU_STOP,
 	IPI_IRQ_WORK,
 	IPI_COMPLETION,
-	IPI_CPU_BACKTRACE = 15,
+	IPI_CPU_BACKTRACE,
 };
 
 static DECLARE_COMPLETION(cpu_running);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] ARM: Make IPI_CPU_BACKTRACE a "non-secure" SGI
  2015-12-18  9:16 ` [PATCH 2/2] ARM: Make IPI_CPU_BACKTRACE a "non-secure" SGI Marc Zyngier
@ 2015-12-18  9:34   ` Russell King - ARM Linux
  2015-12-18  9:48     ` Marc Zyngier
  2015-12-18 11:20   ` Daniel Thompson
  1 sibling, 1 reply; 8+ messages in thread
From: Russell King - ARM Linux @ 2015-12-18  9:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 18, 2015 at 09:16:13AM +0000, Marc Zyngier wrote:
> Having IPI_CPU_BACKTRACE as SGI15 may not work if the kernel is
> running in non-secure mode and that the secure firmware has
> decided to follow ARM's recommendations that SGI8-15 should
> be reserved for secure purpose.
> 
> Now that we are "only" using SGI0-6, change IPI_CPU_BACKTRACE
> to use SGI7, which makes it more likely to work.

We should add a comment to the enum explaining this, so it's obvious
for the future - best place is after the IPI_CPU_BACKTRACE entry.
Not everyone checks the git logs for these kinds of details.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] ARM: Make IPI_CPU_BACKTRACE a "non-secure" SGI
  2015-12-18  9:34   ` Russell King - ARM Linux
@ 2015-12-18  9:48     ` Marc Zyngier
  2015-12-18  9:52       ` Russell King - ARM Linux
  0 siblings, 1 reply; 8+ messages in thread
From: Marc Zyngier @ 2015-12-18  9:48 UTC (permalink / raw)
  To: linux-arm-kernel

On 18/12/15 09:34, Russell King - ARM Linux wrote:
> On Fri, Dec 18, 2015 at 09:16:13AM +0000, Marc Zyngier wrote:
>> Having IPI_CPU_BACKTRACE as SGI15 may not work if the kernel is
>> running in non-secure mode and that the secure firmware has
>> decided to follow ARM's recommendations that SGI8-15 should
>> be reserved for secure purpose.
>>
>> Now that we are "only" using SGI0-6, change IPI_CPU_BACKTRACE
>> to use SGI7, which makes it more likely to work.
> 
> We should add a comment to the enum explaining this, so it's obvious
> for the future - best place is after the IPI_CPU_BACKTRACE entry.
> Not everyone checks the git logs for these kinds of details.

Indeed. How about something like this:

diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index fe517f1..37312f6 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -73,6 +73,11 @@ enum ipi_msg_type {
 	IPI_IRQ_WORK,
 	IPI_COMPLETION,
 	IPI_CPU_BACKTRACE,
+	/*
+	 * SGI8-15 can be reserved by secure firmware, and thus may
+	 * not be usable by the kernel. Please keep the above limited
+	 * to at most 8 entries.
+	 */
 };

 static DECLARE_COMPLETION(cpu_running);

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] ARM: Make IPI_CPU_BACKTRACE a "non-secure" SGI
  2015-12-18  9:48     ` Marc Zyngier
@ 2015-12-18  9:52       ` Russell King - ARM Linux
  0 siblings, 0 replies; 8+ messages in thread
From: Russell King - ARM Linux @ 2015-12-18  9:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 18, 2015 at 09:48:51AM +0000, Marc Zyngier wrote:
> On 18/12/15 09:34, Russell King - ARM Linux wrote:
> > On Fri, Dec 18, 2015 at 09:16:13AM +0000, Marc Zyngier wrote:
> >> Having IPI_CPU_BACKTRACE as SGI15 may not work if the kernel is
> >> running in non-secure mode and that the secure firmware has
> >> decided to follow ARM's recommendations that SGI8-15 should
> >> be reserved for secure purpose.
> >>
> >> Now that we are "only" using SGI0-6, change IPI_CPU_BACKTRACE
> >> to use SGI7, which makes it more likely to work.
> > 
> > We should add a comment to the enum explaining this, so it's obvious
> > for the future - best place is after the IPI_CPU_BACKTRACE entry.
> > Not everyone checks the git logs for these kinds of details.
> 
> Indeed. How about something like this:

Yep.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] ARM: Make IPI_CPU_BACKTRACE a "non-secure" SGI
  2015-12-18  9:16 ` [PATCH 2/2] ARM: Make IPI_CPU_BACKTRACE a "non-secure" SGI Marc Zyngier
  2015-12-18  9:34   ` Russell King - ARM Linux
@ 2015-12-18 11:20   ` Daniel Thompson
  2015-12-18 11:29     ` Marc Zyngier
  1 sibling, 1 reply; 8+ messages in thread
From: Daniel Thompson @ 2015-12-18 11:20 UTC (permalink / raw)
  To: linux-arm-kernel

On 18/12/15 09:16, Marc Zyngier wrote:
> Having IPI_CPU_BACKTRACE as SGI15 may not work if the kernel is
> running in non-secure mode and that the secure firmware has
> decided to follow ARM's recommendations that SGI8-15 should
> be reserved for secure purpose.
>
> Now that we are "only" using SGI0-6, change IPI_CPU_BACKTRACE
> to use SGI7, which makes it more likely to work.
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

Tested-by: Daniel Thompson <daniel.thompson@linaro.org>

> ---
>   arch/arm/kernel/smp.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
> index d50a77d..fe517f1 100644
> --- a/arch/arm/kernel/smp.c
> +++ b/arch/arm/kernel/smp.c
> @@ -72,7 +72,7 @@ enum ipi_msg_type {
>   	IPI_CPU_STOP,
>   	IPI_IRQ_WORK,
>   	IPI_COMPLETION,
> -	IPI_CPU_BACKTRACE = 15,
> +	IPI_CPU_BACKTRACE,
>   };
>
>   static DECLARE_COMPLETION(cpu_running);
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] ARM: Make IPI_CPU_BACKTRACE a "non-secure" SGI
  2015-12-18 11:20   ` Daniel Thompson
@ 2015-12-18 11:29     ` Marc Zyngier
  0 siblings, 0 replies; 8+ messages in thread
From: Marc Zyngier @ 2015-12-18 11:29 UTC (permalink / raw)
  To: linux-arm-kernel

On 18/12/15 11:20, Daniel Thompson wrote:
> On 18/12/15 09:16, Marc Zyngier wrote:
>> Having IPI_CPU_BACKTRACE as SGI15 may not work if the kernel is
>> running in non-secure mode and that the secure firmware has
>> decided to follow ARM's recommendations that SGI8-15 should
>> be reserved for secure purpose.
>>
>> Now that we are "only" using SGI0-6, change IPI_CPU_BACKTRACE
>> to use SGI7, which makes it more likely to work.
>>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> 
> Tested-by: Daniel Thompson <daniel.thompson@linaro.org>

Thanks Daniel, much appreciated.

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-12-18 11:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18  9:16 [PATCH 0/2] IPI numbering cleanup Marc Zyngier
2015-12-18  9:16 ` [PATCH 1/2] ARM: Remove IPI_CALL_FUNC_SINGLE Marc Zyngier
2015-12-18  9:16 ` [PATCH 2/2] ARM: Make IPI_CPU_BACKTRACE a "non-secure" SGI Marc Zyngier
2015-12-18  9:34   ` Russell King - ARM Linux
2015-12-18  9:48     ` Marc Zyngier
2015-12-18  9:52       ` Russell King - ARM Linux
2015-12-18 11:20   ` Daniel Thompson
2015-12-18 11:29     ` Marc Zyngier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.