genirq: Make interrupt context enforcing work unconditionally
cover genirq: Make interrupt context enforcing work unconditionally
While looking at GENERIC_PENDING_IRQ I stumbled over the fact, that the interrupt context enforcement for ARM[64] which was attempted by
commit 1b57d91b969c ("irqchip/gic-v2, v3: Prevent SW resends entirely")
actually never worked because handle_enforce_irqctx() is a wrapper around the actual check and that wrapper is only providing the informatuib when GENERIC_PENDING_IRQ is set. That's not the case for ARM[64].
Make it available unconditionally and clean up the now pointless wrapper.
Thanks,
tglx
--- internals.h | 8 -------- irqdesc.c | 2 +- resend.c | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-)
PATCH 1/2 genirq: Make handle_enforce_irqctx() unconditionally available
Commit 1b57d91b969c ("irqchip/gic-v2, v3: Prevent SW resends entirely") sett the flag which enforces interrupt handling in interrupt context and prevents software base resends for ARM GIC v2/v3.
But it missed that the helper function which checks the flag was hidden behind CONFIG_GENERIC_PENDING_IRQ, which is not set by ARM[64].
Make the helper unconditionally available so that the enforcement actually works.
--- kernel/irq/internals.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
kernel/irq/internals.h +3 -6
@@ -441,10 +441,6 @@ static inline struct cpumask *irq_desc_g {return desc->pending_mask; } -static inline bool handle_enforce_irqctx (struct irq_data *data) -{ -return irqd_is_handle_enforce_irqctx (data); -}bool irq_fixup_move_pending (struct irq_desc *desc,bool force_clear);#else /* CONFIG_GENERIC_PENDING_IRQ */ static inline bool irq_can_move_pcntxt (struct irq_data *data)
@@ -471,11 +467,12 @@ static inline bool irq_fixup_move_pendin {return false; } +#endif /* !CONFIG_GENERIC_PENDING_IRQ */ +static inline bool handle_enforce_irqctx (struct irq_data *data) { -return false; +return irqd_is_handle_enforce_irqctx (data); } -#endif /* !CONFIG_GENERIC_PENDING_IRQ */ #if !defined(CONFIG_IRQ_DOMAIN ) || !defined(CONFIG_IRQ_DOMAIN_HIERARCHY )static inline int irq_domain_activate_irq (struct irq_data *data,bool reserve)
[tip: irq/core] genirq: Make handle_enforce_irqctx() unconditionally available
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 8d187a77f04c14fb459a5301d69f733a5a1396bc Gitweb: https://git.kernel.org/tip/8d187a77f04c14fb459a5301d69f733a5a1396bc Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 10 Dec 2024 11:20:43 +01:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 15 Jan 2025 10:56:21 +01:00
genirq: Make handle_enforce_irqctx() unconditionally available
Commit 1b57d91b969c ("irqchip/gic-v2, v3: Prevent SW resends entirely") sett the flag which enforces interrupt handling in interrupt context and prevents software base resends for ARM GIC v2/v3.
But it missed that the helper function which checks the flag was hidden behind CONFIG_GENERIC_PENDING_IRQ, which is not set by ARM[64].
Make the helper unconditionally available so that the enforcement actually works.
--- kernel/irq/internals.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
kernel/irq/internals.h +3 -6
@@ -441,10 +441,6 @@ static inline struct cpumask *irq_desc_get_pending_mask(struct irq_desc *desc) {return desc->pending_mask; } -static inline bool handle_enforce_irqctx (struct irq_data *data) -{ -return irqd_is_handle_enforce_irqctx (data); -}bool irq_fixup_move_pending (struct irq_desc *desc,bool force_clear);#else /* CONFIG_GENERIC_PENDING_IRQ */ static inline bool irq_can_move_pcntxt (struct irq_data *data)
@@ -471,11 +467,12 @@ static inline bool irq_fixup_move_pending(struct irq_desc *desc, bool fclear) {return false; } +#endif /* !CONFIG_GENERIC_PENDING_IRQ */ +static inline bool handle_enforce_irqctx (struct irq_data *data) { -return false; +return irqd_is_handle_enforce_irqctx (data); } -#endif /* !CONFIG_GENERIC_PENDING_IRQ */ #if !defined(CONFIG_IRQ_DOMAIN ) || !defined(CONFIG_IRQ_DOMAIN_HIERARCHY )static inline int irq_domain_activate_irq (struct irq_data *data,bool reserve)
PATCH 2/2 genirq: Remove handle_enforce_irqctx() wrapper
In reply to Thomas GleixnerNow that it is unconditionally available, remove the wrapper.
--- kernel/irq/internals.h | 5 ----- kernel/irq/irqdesc.c | 2 +- kernel/irq/resend.c | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-)
kernel/irq/internals.h +0 -5
@@ -469,11 +469,6 @@ static inline bool irq_fixup_move_pendin }#endif /* !CONFIG_GENERIC_PENDING_IRQ */ -static inline bool handle_enforce_irqctx (struct irq_data *data) -{ -return irqd_is_handle_enforce_irqctx (data); -} -#if !defined(CONFIG_IRQ_DOMAIN ) || !defined(CONFIG_IRQ_DOMAIN_HIERARCHY )static inline int irq_domain_activate_irq (struct irq_data *data,bool reserve) {
kernel/irq/irqdesc.c +1 -1
@@ -708,7 +708,7 @@ int handle_irq_desc(struct irq_desc *desreturn -EINVAL ; data =irq_desc_get_irq_data (desc); -if (WARN_ON_ONCE (!in_hardirq () &&handle_enforce_irqctx (data))) +if (WARN_ON_ONCE (!in_hardirq () &&irqd_is_handle_enforce_irqctx (data)))return -EPERM ;generic_handle_irq_desc (desc);
kernel/irq/resend.c +1 -1
@@ -53,7 +53,7 @@ static int irq_sw_resend(struct irq_desc* Validate whether this interrupt can be safely injected from * non interrupt context */ -if (handle_enforce_irqctx (&desc->irq_data)) +if (irqd_is_handle_enforce_irqctx (&desc->irq_data))return -EINVAL ;/*
[tip: irq/core] genirq: Remove handle_enforce_irqctx() wrapper
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 9620301cc27f6dc6197236a55a44fac8e64be0a1 Gitweb: https://git.kernel.org/tip/9620301cc27f6dc6197236a55a44fac8e64be0a1 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 10 Dec 2024 11:20:45 +01:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 15 Jan 2025 10:56:22 +01:00
genirq: Remove handle_enforce_irqctx() wrapper
Now that it is unconditionally available, remove the wrapper.
--- kernel/irq/internals.h | 5 ----- kernel/irq/irqdesc.c | 2 +- kernel/irq/resend.c | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-)
kernel/irq/internals.h +0 -5
@@ -469,11 +469,6 @@ static inline bool irq_fixup_move_pending(struct irq_desc *desc, bool fclear) }#endif /* !CONFIG_GENERIC_PENDING_IRQ */ -static inline bool handle_enforce_irqctx (struct irq_data *data) -{ -return irqd_is_handle_enforce_irqctx (data); -} -#if !defined(CONFIG_IRQ_DOMAIN ) || !defined(CONFIG_IRQ_DOMAIN_HIERARCHY )static inline int irq_domain_activate_irq (struct irq_data *data,bool reserve) {
kernel/irq/irqdesc.c +1 -1
@@ -708,7 +708,7 @@ int handle_irq_desc(struct irq_desc *desc)return -EINVAL ; data =irq_desc_get_irq_data (desc); -if (WARN_ON_ONCE (!in_hardirq () &&handle_enforce_irqctx (data))) +if (WARN_ON_ONCE (!in_hardirq () &&irqd_is_handle_enforce_irqctx (data)))return -EPERM ;generic_handle_irq_desc (desc);
kernel/irq/resend.c +1 -1
@@ -53,7 +53,7 @@ static int irq_sw_resend(struct irq_desc *desc)* Validate whether this interrupt can be safely injected from * non interrupt context */ -if (handle_enforce_irqctx (&desc->irq_data)) +if (irqd_is_handle_enforce_irqctx (&desc->irq_data))return -EINVAL ;/*