[PATCH v4 17/26] genirq: Add request_percpu_irq_affinity() helper

Marc Zyngier posted 26 patches 1 month, 3 weeks ago
[PATCH v4 17/26] genirq: Add request_percpu_irq_affinity() helper
Posted by Marc Zyngier 1 month, 3 weeks ago
While it would be nice to simply make request_percpu_irq() take
an affinity mask, the churn is likely to be on the irritating side
given that most drivers do not give a damn about affinities.

So take the more innocuous path to provide a helper that parallels
request_percpu_irq(), with an affinity as a bonus argument.

Yes, request_percpu_irq_affinity() is a bit of a mouthful.

Tested-by: Will Deacon <will@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 include/linux/interrupt.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 81506ab759b81..fa62ab556ee32 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -196,6 +196,15 @@ request_percpu_irq(unsigned int irq, irq_handler_t handler,
 				    devname, NULL, percpu_dev_id);
 }
 
+static inline int __must_check
+request_percpu_irq_affinity(unsigned int irq, irq_handler_t handler,
+			    const char *devname, const cpumask_t *affinity,
+			    void __percpu *percpu_dev_id)
+{
+	return __request_percpu_irq(irq, handler, 0,
+				    devname, affinity, percpu_dev_id);
+}
+
 extern int __must_check
 request_percpu_nmi(unsigned int irq, irq_handler_t handler, const char *name,
 		   const struct cpumask *affinity, void __percpu *dev_id);
-- 
2.47.3
Re: [PATCH v4 17/26] genirq: Add request_percpu_irq_affinity() helper
Posted by Jonathan Cameron 1 month ago
On Mon, 20 Oct 2025 13:29:34 +0100
Marc Zyngier <maz@kernel.org> wrote:

> While it would be nice to simply make request_percpu_irq() take
> an affinity mask, the churn is likely to be on the irritating side
> given that most drivers do not give a damn about affinities.

Only 37 instances. I'd have been tempted to do it anyway :)

> 
> So take the more innocuous path to provide a helper that parallels
> request_percpu_irq(), with an affinity as a bonus argument.
> 
> Yes, request_percpu_irq_affinity() is a bit of a mouthful.
> 
> Tested-by: Will Deacon <will@kernel.org>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Re: [PATCH v4 17/26] genirq: Add request_percpu_irq_affinity() helper
Posted by Marc Zyngier 1 month ago
On Wed, 12 Nov 2025 18:27:35 +0000,
Jonathan Cameron <jonathan.cameron@huawei.com> wrote:
> 
> On Mon, 20 Oct 2025 13:29:34 +0100
> Marc Zyngier <maz@kernel.org> wrote:
> 
> > While it would be nice to simply make request_percpu_irq() take
> > an affinity mask, the churn is likely to be on the irritating side
> > given that most drivers do not give a damn about affinities.
> 
> Only 37 instances. I'd have been tempted to do it anyway :)

I'm leaving this as an exercise for people who enjoy cross-subsystem
patch series!

> 
> > 
> > So take the more innocuous path to provide a helper that parallels
> > request_percpu_irq(), with an affinity as a bonus argument.
> > 
> > Yes, request_percpu_irq_affinity() is a bit of a mouthful.
> > 
> > Tested-by: Will Deacon <will@kernel.org>
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.
[tip: irq/core] genirq: Add request_percpu_irq_affinity() helper
Posted by tip-bot2 for Marc Zyngier 1 month, 2 weeks ago
The following commit has been merged into the irq/core branch of tip:

Commit-ID:     c734af3b2b95f0ac6ed87c50e7602a6beeaf534f
Gitweb:        https://git.kernel.org/tip/c734af3b2b95f0ac6ed87c50e7602a6beeaf534f
Author:        Marc Zyngier <maz@kernel.org>
AuthorDate:    Mon, 20 Oct 2025 13:29:34 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 27 Oct 2025 17:16:35 +01:00

genirq: Add request_percpu_irq_affinity() helper

While it would be nice to simply make request_percpu_irq() take an affinity
mask, the churn is likely to be on the irritating side given that most
drivers do not give a damn about affinities.

So take the more innocuous path to provide a helper that parallels
request_percpu_irq(), with an affinity as a bonus argument.

Yes, request_percpu_irq_affinity() is a bit of a mouthful.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Will Deacon <will@kernel.org>
Link: https://patch.msgid.link/20251020122944.3074811-18-maz@kernel.org
---
 include/linux/interrupt.h |  9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 81506ab..fa62ab5 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -196,6 +196,15 @@ request_percpu_irq(unsigned int irq, irq_handler_t handler,
 				    devname, NULL, percpu_dev_id);
 }
 
+static inline int __must_check
+request_percpu_irq_affinity(unsigned int irq, irq_handler_t handler,
+			    const char *devname, const cpumask_t *affinity,
+			    void __percpu *percpu_dev_id)
+{
+	return __request_percpu_irq(irq, handler, 0,
+				    devname, affinity, percpu_dev_id);
+}
+
 extern int __must_check
 request_percpu_nmi(unsigned int irq, irq_handler_t handler, const char *name,
 		   const struct cpumask *affinity, void __percpu *dev_id);