* [PATCH] genirq: Ensure flags in lock guard is consistently initialized
@ 2025-05-12 22:16 Nathan Chancellor
2025-05-13 5:22 ` Jiri Slaby
2025-05-13 7:46 ` [tip: irq/core] " tip-bot2 for Nathan Chancellor
0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2025-05-12 22:16 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Peter Zijlstra, Jiri Slaby, linux-kernel, llvm, Nathan Chancellor
After the conversion to locking guards within the interrupt core code,
several builds with clang show the "Interrupts were enabled early"
WARN() in start_kernel() on boot.
In class_irqdesc_lock_constructor(), _t.flags is initialized via
__irq_get_desc_lock() within the _t initializer list. However, the C11
standard 6.7.9.23 states that the evaluation of the initialization list
expressions are indeterminately sequenced relative to one another,
meaning _t.flags could be initialized by __irq_get_desc_lock() then be
initialized to zero due to flags being absent from the initializer list.
To ensure _t.flags is consistently initialized, move the call to
__irq_get_desc_lock() and the assignment of its result to _t.lock out of
the designated initializer.
Fixes: 0f70a49f3fa3 ("genirq: Provide conditional lock guards")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
kernel/irq/internals.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index bd2db6ebb98e..476a20fd9bfc 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -176,10 +176,10 @@ __DEFINE_UNLOCK_GUARD(irqdesc_lock, struct irq_desc,
static inline class_irqdesc_lock_t class_irqdesc_lock_constructor(unsigned int irq, bool bus,
unsigned int check)
{
- class_irqdesc_lock_t _t = {
- .bus = bus,
- .lock = __irq_get_desc_lock(irq, &_t.flags, bus, check),
- };
+ class_irqdesc_lock_t _t = { .bus = bus, };
+
+ _t.lock = __irq_get_desc_lock(irq, &_t.flags, bus, check);
+
return _t;
}
---
base-commit: c1ab449df871d6ce9189cb0a9efcd37d2ead10f0
change-id: 20250512-irq-guards-fix-flags-init-1243eabe3401
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] genirq: Ensure flags in lock guard is consistently initialized
2025-05-12 22:16 [PATCH] genirq: Ensure flags in lock guard is consistently initialized Nathan Chancellor
@ 2025-05-13 5:22 ` Jiri Slaby
2025-05-13 7:46 ` [tip: irq/core] " tip-bot2 for Nathan Chancellor
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2025-05-13 5:22 UTC (permalink / raw)
To: Nathan Chancellor, Thomas Gleixner; +Cc: Peter Zijlstra, linux-kernel, llvm
On 13. 05. 25, 0:16, Nathan Chancellor wrote:
> After the conversion to locking guards within the interrupt core code,
> several builds with clang show the "Interrupts were enabled early"
> WARN() in start_kernel() on boot.
>
> In class_irqdesc_lock_constructor(), _t.flags is initialized via
> __irq_get_desc_lock() within the _t initializer list. However, the C11
> standard 6.7.9.23 states that the evaluation of the initialization list
> expressions are indeterminately sequenced relative to one another,
> meaning _t.flags could be initialized by __irq_get_desc_lock() then be
> initialized to zero due to flags being absent from the initializer list.
>
> To ensure _t.flags is consistently initialized, move the call to
> __irq_get_desc_lock() and the assignment of its result to _t.lock out of
> the designated initializer.
>
> Fixes: 0f70a49f3fa3 ("genirq: Provide conditional lock guards")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip: irq/core] genirq: Ensure flags in lock guard is consistently initialized
2025-05-12 22:16 [PATCH] genirq: Ensure flags in lock guard is consistently initialized Nathan Chancellor
2025-05-13 5:22 ` Jiri Slaby
@ 2025-05-13 7:46 ` tip-bot2 for Nathan Chancellor
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Nathan Chancellor @ 2025-05-13 7:46 UTC (permalink / raw)
To: linux-tip-commits
Cc: Nathan Chancellor, Thomas Gleixner, Jiri Slaby, x86, linux-kernel,
maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: b5fcb6898202858ae8425bf0cd9cb5704735bd02
Gitweb: https://git.kernel.org/tip/b5fcb6898202858ae8425bf0cd9cb5704735bd02
Author: Nathan Chancellor <nathan@kernel.org>
AuthorDate: Tue, 13 May 2025 00:16:55 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 13 May 2025 09:37:18 +02:00
genirq: Ensure flags in lock guard is consistently initialized
After the conversion to locking guards within the interrupt core code,
several builds with clang show the "Interrupts were enabled early"
WARN() in start_kernel() on boot.
In class_irqdesc_lock_constructor(), _t.flags is initialized via
__irq_get_desc_lock() within the _t initializer list. However, the C11
standard 6.7.9.23 states that the evaluation of the initialization list
expressions are indeterminately sequenced relative to one another,
meaning _t.flags could be initialized by __irq_get_desc_lock() then be
initialized to zero due to flags being absent from the initializer list.
To ensure _t.flags is consistently initialized, move the call to
__irq_get_desc_lock() and the assignment of its result to _t.lock out of
the designated initializer.
Fixes: 0f70a49f3fa3 ("genirq: Provide conditional lock guards")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/all/20250513-irq-guards-fix-flags-init-v1-1-1dca3f5992d6@kernel.org
---
kernel/irq/internals.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index bd2db6e..476a20f 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -176,10 +176,10 @@ __DEFINE_UNLOCK_GUARD(irqdesc_lock, struct irq_desc,
static inline class_irqdesc_lock_t class_irqdesc_lock_constructor(unsigned int irq, bool bus,
unsigned int check)
{
- class_irqdesc_lock_t _t = {
- .bus = bus,
- .lock = __irq_get_desc_lock(irq, &_t.flags, bus, check),
- };
+ class_irqdesc_lock_t _t = { .bus = bus, };
+
+ _t.lock = __irq_get_desc_lock(irq, &_t.flags, bus, check);
+
return _t;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-13 7:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-12 22:16 [PATCH] genirq: Ensure flags in lock guard is consistently initialized Nathan Chancellor
2025-05-13 5:22 ` Jiri Slaby
2025-05-13 7:46 ` [tip: irq/core] " tip-bot2 for Nathan Chancellor
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.