[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230130005725.3517597-3-sdonthineni@nvidia.com>
Date: Sun, 29 Jan 2023 18:57:22 -0600
From: Shanker Donthineni <sdonthineni@...dia.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Marc Zyngier <maz@...nel.org>, Michael Walle <michael@...le.cc>
CC: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Hans de Goede <hdegoede@...hat.com>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Shanker Donthineni <sdonthineni@...dia.com>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH 2/5] genirq: Allocate IRQ descriptors at boot time for !SPARSEIRQ
Remove the use of statically allocated arrays for IRQ descriptors.
Instead, allocate the necessary NR_IRQ descriptors during the boot
time in early_irq_init().
Signed-off-by: Shanker Donthineni <sdonthineni@...dia.com>
---
kernel/irq/irqdesc.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 21a968bc468b..a4911f7ebb07 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -556,27 +556,24 @@ int __init early_irq_init(void)
#else /* !CONFIG_SPARSE_IRQ */
-struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
- [0 ... NR_IRQS-1] = {
- .handle_irq = handle_bad_irq,
- .depth = 1,
- .lock = __RAW_SPIN_LOCK_UNLOCKED(irq_desc->lock),
- }
-};
+static struct irq_desc *irq_descs;
int __init early_irq_init(void)
{
- int count, i, node = first_online_node;
+ int i, node = first_online_node;
struct irq_desc *desc;
init_irq_default_affinity();
printk(KERN_INFO "NR_IRQS: %d\n", NR_IRQS);
- desc = irq_desc;
- count = ARRAY_SIZE(irq_desc);
+ desc = kmalloc_array(NR_IRQS, sizeof(*desc), GFP_KERNEL | __GFP_ZERO);
+ if (desc == NULL)
+ return -ENOMEM;
+
+ irq_descs = desc;
- for (i = 0; i < count; i++) {
+ for (i = 0; i < NR_IRQS; i++) {
desc[i].kstat_irqs = alloc_percpu(unsigned int);
alloc_masks(&desc[i], node);
raw_spin_lock_init(&desc[i].lock);
@@ -593,7 +590,7 @@ int __init early_irq_init(void)
struct irq_desc *irq_to_desc(unsigned int irq)
{
- return (irq < NR_IRQS) ? irq_desc + irq : NULL;
+ return (irq < NR_IRQS) ? irq_descs + irq : NULL;
}
EXPORT_SYMBOL(irq_to_desc);
--
2.25.1
Powered by blists - more mailing lists