* [PATCH 1/2] alpha: marvel: Fix irq_set_status_flags to use correct IRQ number
@ 2026-05-28 23:05 Matt Turner
2026-05-28 23:05 ` [PATCH 2/2] alpha: marvel: Fix lock ordering in init_io7_irqs() Matt Turner
2026-05-29 10:13 ` [PATCH 1/2] alpha: marvel: Fix irq_set_status_flags to use correct IRQ number Magnus Lindholm
0 siblings, 2 replies; 4+ messages in thread
From: Matt Turner @ 2026-05-28 23:05 UTC (permalink / raw)
To: linux-alpha
Cc: linux-kernel, Richard Henderson, Magnus Lindholm,
Thomas Gleixner, Matt Turner, stable
Pass base + i to irq_set_status_flags() to match the IRQ number
used in irq_set_chip_and_handler(). Previously, IRQ_LEVEL was set
on the wrong (low-numbered) IRQ descriptors rather than the IO7
IRQs at base + i.
Cc: stable@vger.kernel.org
Fixes: 08876fe8519c ("alpha: marvel: Convert irq_chip functions")
Signed-off-by: Matt Turner <mattst88@gmail.com>
---
arch/alpha/kernel/sys_marvel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git ./arch/alpha/kernel/sys_marvel.c ./arch/alpha/kernel/sys_marvel.c
index 1f99b03effc2..bebeea3c286d 100644
--- ./arch/alpha/kernel/sys_marvel.c
+++ ./arch/alpha/kernel/sys_marvel.c
@@ -275,7 +275,7 @@ init_io7_irqs(struct io7 *io7,
/* Set up the lsi irqs. */
for (i = 0; i < 128; ++i) {
irq_set_chip_and_handler(base + i, lsi_ops, handle_level_irq);
- irq_set_status_flags(i, IRQ_LEVEL);
+ irq_set_status_flags(base + i, IRQ_LEVEL);
}
/* Disable the implemented irqs in hardware. */
@@ -289,7 +289,7 @@ init_io7_irqs(struct io7 *io7,
/* Set up the msi irqs. */
for (i = 128; i < (128 + 512); ++i) {
irq_set_chip_and_handler(base + i, msi_ops, handle_level_irq);
- irq_set_status_flags(i, IRQ_LEVEL);
+ irq_set_status_flags(base + i, IRQ_LEVEL);
}
for (i = 0; i < 16; ++i)
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] alpha: marvel: Fix lock ordering in init_io7_irqs()
2026-05-28 23:05 [PATCH 1/2] alpha: marvel: Fix irq_set_status_flags to use correct IRQ number Matt Turner
@ 2026-05-28 23:05 ` Matt Turner
2026-05-29 10:16 ` Magnus Lindholm
2026-05-29 10:13 ` [PATCH 1/2] alpha: marvel: Fix irq_set_status_flags to use correct IRQ number Magnus Lindholm
1 sibling, 1 reply; 4+ messages in thread
From: Matt Turner @ 2026-05-28 23:05 UTC (permalink / raw)
To: linux-alpha
Cc: linux-kernel, Richard Henderson, Magnus Lindholm,
Thomas Gleixner, Matt Turner, stable
Move irq_set_chip_and_handler() and irq_set_status_flags() calls
outside the io7->irq_lock raw spinlock. These functions take
sparse_irq_lock, which is a mutex, and taking a sleeping lock while
holding a raw spinlock is invalid. The raw spinlock only needs to
protect the hardware CSR accesses.
This fixes the following lockdep splat during boot:
[ BUG: Invalid wait context ]
swapper/0/0 is trying to lock:
sparse_irq_lock{....}-{4:4}, at: irq_mark_irq
other info that might help us debug this:
context-{5:5}
1 lock held by swapper/0/0:
#0: &io7->irq_lock{....}-{2:2}, at: init_io7_irqs.constprop.0
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Matt Turner <mattst88@gmail.com>
---
arch/alpha/kernel/sys_marvel.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git ./arch/alpha/kernel/sys_marvel.c ./arch/alpha/kernel/sys_marvel.c
index bebeea3c286d..a37707e05e34 100644
--- ./arch/alpha/kernel/sys_marvel.c
+++ ./arch/alpha/kernel/sys_marvel.c
@@ -263,6 +263,18 @@ init_io7_irqs(struct io7 *io7,
*/
printk(" Interrupts reported to CPU at PE %u\n", boot_cpuid);
+ /* Set up the lsi irqs. */
+ for (i = 0; i < 128; ++i) {
+ irq_set_chip_and_handler(base + i, lsi_ops, handle_level_irq);
+ irq_set_status_flags(base + i, IRQ_LEVEL);
+ }
+
+ /* Set up the msi irqs. */
+ for (i = 128; i < (128 + 512); ++i) {
+ irq_set_chip_and_handler(base + i, msi_ops, handle_level_irq);
+ irq_set_status_flags(base + i, IRQ_LEVEL);
+ }
+
raw_spin_lock(&io7->irq_lock);
/* set up the error irqs */
@@ -272,12 +284,6 @@ init_io7_irqs(struct io7 *io7,
io7_redirect_irq(io7, &io7->csrs->STV_CTL.csr, boot_cpuid);
io7_redirect_irq(io7, &io7->csrs->HEI_CTL.csr, boot_cpuid);
- /* Set up the lsi irqs. */
- for (i = 0; i < 128; ++i) {
- irq_set_chip_and_handler(base + i, lsi_ops, handle_level_irq);
- irq_set_status_flags(base + i, IRQ_LEVEL);
- }
-
/* Disable the implemented irqs in hardware. */
for (i = 0; i < 0x60; ++i)
init_one_io7_lsi(io7, i, boot_cpuid);
@@ -285,13 +291,6 @@ init_io7_irqs(struct io7 *io7,
init_one_io7_lsi(io7, 0x74, boot_cpuid);
init_one_io7_lsi(io7, 0x75, boot_cpuid);
-
- /* Set up the msi irqs. */
- for (i = 128; i < (128 + 512); ++i) {
- irq_set_chip_and_handler(base + i, msi_ops, handle_level_irq);
- irq_set_status_flags(base + i, IRQ_LEVEL);
- }
-
for (i = 0; i < 16; ++i)
init_one_io7_msi(io7, i, boot_cpuid);
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] alpha: marvel: Fix irq_set_status_flags to use correct IRQ number
2026-05-28 23:05 [PATCH 1/2] alpha: marvel: Fix irq_set_status_flags to use correct IRQ number Matt Turner
2026-05-28 23:05 ` [PATCH 2/2] alpha: marvel: Fix lock ordering in init_io7_irqs() Matt Turner
@ 2026-05-29 10:13 ` Magnus Lindholm
1 sibling, 0 replies; 4+ messages in thread
From: Magnus Lindholm @ 2026-05-29 10:13 UTC (permalink / raw)
To: Matt Turner
Cc: linux-alpha, linux-kernel, Richard Henderson, Thomas Gleixner, stable
On Fri, May 29, 2026 at 1:05 AM Matt Turner <mattst88@gmail.com> wrote:
>
> Pass base + i to irq_set_status_flags() to match the IRQ number
> used in irq_set_chip_and_handler(). Previously, IRQ_LEVEL was set
> on the wrong (low-numbered) IRQ descriptors rather than the IO7
> IRQs at base + i.
>
> Cc: stable@vger.kernel.org
> Fixes: 08876fe8519c ("alpha: marvel: Convert irq_chip functions")
> Signed-off-by: Matt Turner <mattst88@gmail.com>
> ---
> arch/alpha/kernel/sys_marvel.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git ./arch/alpha/kernel/sys_marvel.c ./arch/alpha/kernel/sys_marvel.c
> index 1f99b03effc2..bebeea3c286d 100644
> --- ./arch/alpha/kernel/sys_marvel.c
> +++ ./arch/alpha/kernel/sys_marvel.c
> @@ -275,7 +275,7 @@ init_io7_irqs(struct io7 *io7,
> /* Set up the lsi irqs. */
> for (i = 0; i < 128; ++i) {
> irq_set_chip_and_handler(base + i, lsi_ops, handle_level_irq);
> - irq_set_status_flags(i, IRQ_LEVEL);
> + irq_set_status_flags(base + i, IRQ_LEVEL);
> }
>
> /* Disable the implemented irqs in hardware. */
> @@ -289,7 +289,7 @@ init_io7_irqs(struct io7 *io7,
> /* Set up the msi irqs. */
> for (i = 128; i < (128 + 512); ++i) {
> irq_set_chip_and_handler(base + i, msi_ops, handle_level_irq);
> - irq_set_status_flags(i, IRQ_LEVEL);
> + irq_set_status_flags(base + i, IRQ_LEVEL);
> }
>
> for (i = 0; i < 16; ++i)
> --
> 2.53.0
>
This looks correct to me. irq_set_status_flags() should use the same Linux
IRQ number as irq_set_chip_and_handler(), i.e. base + i, otherwise IRQ_LEVEL
is applied to the wrong low-numbered descriptors rather than the IO7 IRQs.
Reviewed-by: Magnus Lindholm <linmag7@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] alpha: marvel: Fix lock ordering in init_io7_irqs()
2026-05-28 23:05 ` [PATCH 2/2] alpha: marvel: Fix lock ordering in init_io7_irqs() Matt Turner
@ 2026-05-29 10:16 ` Magnus Lindholm
0 siblings, 0 replies; 4+ messages in thread
From: Magnus Lindholm @ 2026-05-29 10:16 UTC (permalink / raw)
To: Matt Turner
Cc: linux-alpha, linux-kernel, Richard Henderson, Thomas Gleixner, stable
On Fri, May 29, 2026 at 1:05 AM Matt Turner <mattst88@gmail.com> wrote:
>
> Move irq_set_chip_and_handler() and irq_set_status_flags() calls
> outside the io7->irq_lock raw spinlock. These functions take
> sparse_irq_lock, which is a mutex, and taking a sleeping lock while
> holding a raw spinlock is invalid. The raw spinlock only needs to
> protect the hardware CSR accesses.
>
> This fixes the following lockdep splat during boot:
>
> [ BUG: Invalid wait context ]
> swapper/0/0 is trying to lock:
> sparse_irq_lock{....}-{4:4}, at: irq_mark_irq
> other info that might help us debug this:
> context-{5:5}
> 1 lock held by swapper/0/0:
> #0: &io7->irq_lock{....}-{2:2}, at: init_io7_irqs.constprop.0
>
> Cc: stable@vger.kernel.org
> Assisted-by: Claude:claude-opus-4-6
> Signed-off-by: Matt Turner <mattst88@gmail.com>
> ---
> arch/alpha/kernel/sys_marvel.c | 25 ++++++++++++-------------
> 1 file changed, 12 insertions(+), 13 deletions(-)
>
> diff --git ./arch/alpha/kernel/sys_marvel.c ./arch/alpha/kernel/sys_marvel.c
> index bebeea3c286d..a37707e05e34 100644
> --- ./arch/alpha/kernel/sys_marvel.c
> +++ ./arch/alpha/kernel/sys_marvel.c
> @@ -263,6 +263,18 @@ init_io7_irqs(struct io7 *io7,
> */
> printk(" Interrupts reported to CPU at PE %u\n", boot_cpuid);
>
> + /* Set up the lsi irqs. */
> + for (i = 0; i < 128; ++i) {
> + irq_set_chip_and_handler(base + i, lsi_ops, handle_level_irq);
> + irq_set_status_flags(base + i, IRQ_LEVEL);
> + }
> +
> + /* Set up the msi irqs. */
> + for (i = 128; i < (128 + 512); ++i) {
> + irq_set_chip_and_handler(base + i, msi_ops, handle_level_irq);
> + irq_set_status_flags(base + i, IRQ_LEVEL);
> + }
> +
> raw_spin_lock(&io7->irq_lock);
>
> /* set up the error irqs */
> @@ -272,12 +284,6 @@ init_io7_irqs(struct io7 *io7,
> io7_redirect_irq(io7, &io7->csrs->STV_CTL.csr, boot_cpuid);
> io7_redirect_irq(io7, &io7->csrs->HEI_CTL.csr, boot_cpuid);
>
> - /* Set up the lsi irqs. */
> - for (i = 0; i < 128; ++i) {
> - irq_set_chip_and_handler(base + i, lsi_ops, handle_level_irq);
> - irq_set_status_flags(base + i, IRQ_LEVEL);
> - }
> -
> /* Disable the implemented irqs in hardware. */
> for (i = 0; i < 0x60; ++i)
> init_one_io7_lsi(io7, i, boot_cpuid);
> @@ -285,13 +291,6 @@ init_io7_irqs(struct io7 *io7,
> init_one_io7_lsi(io7, 0x74, boot_cpuid);
> init_one_io7_lsi(io7, 0x75, boot_cpuid);
>
> -
> - /* Set up the msi irqs. */
> - for (i = 128; i < (128 + 512); ++i) {
> - irq_set_chip_and_handler(base + i, msi_ops, handle_level_irq);
> - irq_set_status_flags(base + i, IRQ_LEVEL);
> - }
> -
> for (i = 0; i < 16; ++i)
> init_one_io7_msi(io7, i, boot_cpuid);
>
> --
> 2.53.0
>
With the preceding irq_set_status_flags(base + i, ...) fix applied, this
looks correct to me. The generic IRQ descriptor setup is moved outside
io7->irq_lock, while the raw spinlock still protects the IO7 hardware CSR
accesses. That matches the lockdep report and avoids taking sparse_irq_lock
from raw-spinlock context.
Reviewed-by: Magnus Lindholm <linmag7@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-29 10:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-28 23:05 [PATCH 1/2] alpha: marvel: Fix irq_set_status_flags to use correct IRQ number Matt Turner
2026-05-28 23:05 ` [PATCH 2/2] alpha: marvel: Fix lock ordering in init_io7_irqs() Matt Turner
2026-05-29 10:16 ` Magnus Lindholm
2026-05-29 10:13 ` [PATCH 1/2] alpha: marvel: Fix irq_set_status_flags to use correct IRQ number Magnus Lindholm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®