All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm_pmu: Use disable_irq_nosync when disabling SPI in CPU teardown hook
@ 2018-02-26 16:10 Will Deacon
  2018-02-28 13:57 ` Mark Rutland
  0 siblings, 1 reply; 4+ messages in thread
From: Will Deacon @ 2018-02-26 16:10 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 6de3f79112cc ("arm_pmu: explicitly enable/disable SPIs at hotplug")
moved all of the arm_pmu IRQ enable/disable calls to the CPU hotplug hooks,
regardless of whether they are implemented as PPIs or SPIs. This can
lead to us sleeping from atomic context due to disable_irq blocking:

 | BUG: sleeping function called from invalid context at kernel/irq/manage.c:112
 | in_atomic(): 1, irqs_disabled(): 128, pid: 15, name: migration/1
 | no locks held by migration/1/15.
 | irq event stamp: 192
 | hardirqs last  enabled at (191): [<00000000803c2507>]
 | _raw_spin_unlock_irq+0x2c/0x4c
 | hardirqs last disabled at (192): [<000000007f57ad28>] multi_cpu_stop+0x9c/0x140
 | softirqs last  enabled at (0): [<0000000004ee1b58>]
 | copy_process.isra.77.part.78+0x43c/0x1504
 | softirqs last disabled at (0): [<          (null)>]           (null)
 | CPU: 1 PID: 15 Comm: migration/1 Not tainted 4.16.0-rc3-salvator-x #1651
 | Hardware name: Renesas Salvator-X board based on r8a7796 (DT)
 | Call trace:
 |  dump_backtrace+0x0/0x140
 |  show_stack+0x14/0x1c
 |  dump_stack+0xb4/0xf0
 |  ___might_sleep+0x1fc/0x218
 |  __might_sleep+0x70/0x80
 |  synchronize_irq+0x40/0xa8
 |  disable_irq+0x20/0x2c
 |  arm_perf_teardown_cpu+0x80/0xac

Since the interrupt is always CPU-affine and this code is running with
interrupts disabled, we can just use disable_irq_nosync as we know there
isn't a concurrent invocation of the handler to worry about.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 drivers/perf/arm_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 0c2ed11c0603..f63db346c219 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -638,7 +638,7 @@ static int arm_perf_teardown_cpu(unsigned int cpu, struct hlist_node *node)
 		if (irq_is_percpu_devid(irq))
 			disable_percpu_irq(irq);
 		else
-			disable_irq(irq);
+			disable_irq_nosync(irq);
 	}
 
 	per_cpu(cpu_armpmu, cpu) = NULL;
-- 
2.1.4

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

* [PATCH] arm_pmu: Use disable_irq_nosync when disabling SPI in CPU teardown hook
  2018-02-26 16:10 [PATCH] arm_pmu: Use disable_irq_nosync when disabling SPI in CPU teardown hook Will Deacon
@ 2018-02-28 13:57 ` Mark Rutland
  2018-02-28 14:23   ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Rutland @ 2018-02-28 13:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 26, 2018 at 04:10:56PM +0000, Will Deacon wrote:
> Commit 6de3f79112cc ("arm_pmu: explicitly enable/disable SPIs at hotplug")
> moved all of the arm_pmu IRQ enable/disable calls to the CPU hotplug hooks,
> regardless of whether they are implemented as PPIs or SPIs. This can
> lead to us sleeping from atomic context due to disable_irq blocking:

> Acked-by: Acked-by: Mark Rutland <mark.rutland@arm.com>

I think something went wrong here when you applied the tag. ;)

Mark.

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

* [PATCH] arm_pmu: Use disable_irq_nosync when disabling SPI in CPU teardown hook
  2018-02-28 13:57 ` Mark Rutland
@ 2018-02-28 14:23   ` Geert Uytterhoeven
  2018-02-28 14:27     ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2018-02-28 14:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 28, 2018 at 2:57 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> On Mon, Feb 26, 2018 at 04:10:56PM +0000, Will Deacon wrote:
>> Commit 6de3f79112cc ("arm_pmu: explicitly enable/disable SPIs at hotplug")
>> moved all of the arm_pmu IRQ enable/disable calls to the CPU hotplug hooks,
>> regardless of whether they are implemented as PPIs or SPIs. This can
>> lead to us sleeping from atomic context due to disable_irq blocking:
>
>> Acked-by: Acked-by: Mark Rutland <mark.rutland@arm.com>
>
> I think something went wrong here when you applied the tag. ;)

In case of respinning:
Fixes: 6de3f79112cc26bf ("arm_pmu: explicitly enable/disable SPIs at hotplug")

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH] arm_pmu: Use disable_irq_nosync when disabling SPI in CPU teardown hook
  2018-02-28 14:23   ` Geert Uytterhoeven
@ 2018-02-28 14:27     ` Will Deacon
  0 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2018-02-28 14:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 28, 2018 at 03:23:28PM +0100, Geert Uytterhoeven wrote:
> On Wed, Feb 28, 2018 at 2:57 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> > On Mon, Feb 26, 2018 at 04:10:56PM +0000, Will Deacon wrote:
> >> Commit 6de3f79112cc ("arm_pmu: explicitly enable/disable SPIs at hotplug")
> >> moved all of the arm_pmu IRQ enable/disable calls to the CPU hotplug hooks,
> >> regardless of whether they are implemented as PPIs or SPIs. This can
> >> lead to us sleeping from atomic context due to disable_irq blocking:
> >
> >> Acked-by: Acked-by: Mark Rutland <mark.rutland@arm.com>
> >
> > I think something went wrong here when you applied the tag. ;)
> 
> In case of respinning:
> Fixes: 6de3f79112cc26bf ("arm_pmu: explicitly enable/disable SPIs at hotplug")

This is already pushed to fixes/core, so I'll leave it up to Catalin whether
he wants to rebase it for that.

Will

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

end of thread, other threads:[~2018-02-28 14:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-26 16:10 [PATCH] arm_pmu: Use disable_irq_nosync when disabling SPI in CPU teardown hook Will Deacon
2018-02-28 13:57 ` Mark Rutland
2018-02-28 14:23   ` Geert Uytterhoeven
2018-02-28 14:27     ` Will Deacon

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.