[PATCH v3 8/8] genirq: Provide an IRQ affinity mask in non-SMP configs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Marc Zyngier <maz@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>
- Subject: [PATCH v3 8/8] genirq: Provide an IRQ affinity mask in non-SMP configs
- From: Samuel Holland <samuel@xxxxxxxxxxxx>
- Date: Fri, 1 Jul 2022 15:00:56 -0500
- Cc: Samuel Holland <samuel@xxxxxxxxxxxx>, Andy Shevchenko <andy.shevchenko@xxxxxxxxx>, Bartosz Golaszewski <brgl@xxxxxxxx>, Bjorn Helgaas <bhelgaas@xxxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Broadcom internal kernel review list <bcm-kernel-feedback-list@xxxxxxxxxxxx>, Chris Zankel <chris@xxxxxxxxxx>, Colin Ian King <colin.king@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, Dexuan Cui <decui@xxxxxxxxxxxxx>, Florian Fainelli <f.fainelli@xxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Ivan Kokshaysky <ink@xxxxxxxxxxxxxxxxxxxx>, "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Joerg Roedel <joro@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Julia Lawall <Julia.Lawall@xxxxxxxx>, "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx>, Kees Cook <keescook@xxxxxxxxxxxx>, Krzysztof Wilczyński <kw@xxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>, Lorenzo Pieralisi <lpieralisi@xxxxxxxxxx>, Mark Rutland <mark.rutland@xxxxxxx>, Matt Turner <mattst88@xxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, Maximilian Heyne <mheyne@xxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Rich Felker <dalias@xxxxxxxx>, Richard Henderson <rth@xxxxxxxxxxxxxxx>, Rikard Falkeborn <rikard.falkeborn@xxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Serge Semin <fancer.lancer@xxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>, Sven Schnelle <svens@xxxxxxxxxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, Wei Liu <wei.liu@xxxxxxxxxx>, Wei Xu <xuwei5@xxxxxxxxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Yoshinori Sato <ysato@xxxxxxxxxxxxx>, iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx, iommu@xxxxxxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-hyperv@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linux-pci@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, x86@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Feedback-id: i0ad843c9:Fastmail
- In-reply-to: <20220701200056.46555-1-samuel@sholland.org>
- References: <20220701200056.46555-1-samuel@sholland.org>
IRQ affinity masks are not allocated in uniprocessor configurations.
This requires special case non-SMP code in drivers for irqchips which
have per-CPU enable or mask registers.
Since IRQ affinity is always the same in a uniprocessor configuration,
we can provide a correct affinity mask without allocating one per IRQ.
By returning a real cpumask from irq_data_get_affinity_mask even when
SMP is disabled, irqchip drivers which iterate over that mask will
automatically do the right thing.
Signed-off-by: Samuel Holland <samuel@xxxxxxxxxxxx>
---
Changes in v3:
- Use cpumask_of(0) instead of cpu_possible_mask
include/linux/irq.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 02073f7a156e..996e22744edd 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -151,7 +151,9 @@ struct irq_common_data {
#endif
void *handler_data;
struct msi_desc *msi_desc;
+#ifdef CONFIG_SMP
cpumask_var_t affinity;
+#endif
#ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
cpumask_var_t effective_affinity;
#endif
@@ -882,13 +884,19 @@ static inline int irq_data_get_node(struct irq_data *d)
static inline
const struct cpumask *irq_data_get_affinity_mask(struct irq_data *d)
{
+#ifdef CONFIG_SMP
return d->common->affinity;
+#else
+ return cpumask_of(0);
+#endif
}
static inline void irq_data_update_affinity(struct irq_data *d,
const struct cpumask *m)
{
+#ifdef CONFIG_SMP
cpumask_copy(d->common->affinity, m);
+#endif
}
static inline const struct cpumask *irq_get_affinity_mask(int irq)
--
2.35.1
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]