mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
Revert "irqchip/riscv-imsic: Embed the vector array in lpriv"
The __alloc_percpu() fails when the number of IDs are greater than 959
because size parameter of __alloc_percpu() must be less than 32768 (aka
PCPU_MIN_UNIT_SIZE). This failure is observed with KVMTOOL when AIA is
trap-n-emulated by in-kernel KVM because in this case KVM guest has 2047
interrupt IDs.
To address this issue, don't embed vector array in struct imsic_local_priv
until __alloc_percpu() support size parameter greater than 32768.
This reverts commit 79eaabc61d ("irqchip/riscv-imsic: Embed the vector
array in lpriv").
Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20251223143544.1504217-1-anup.patel@oss.qualcomm.com
This commit is contained in:
parent
1690eeb0cb
commit
a33d16dc87
2 changed files with 9 additions and 3 deletions
|
|
@ -477,6 +477,7 @@ static void __init imsic_local_cleanup(void)
|
|||
lpriv = per_cpu_ptr(imsic->lpriv, cpu);
|
||||
|
||||
bitmap_free(lpriv->dirty_bitmap);
|
||||
kfree(lpriv->vectors);
|
||||
}
|
||||
|
||||
free_percpu(imsic->lpriv);
|
||||
|
|
@ -490,8 +491,7 @@ static int __init imsic_local_init(void)
|
|||
int cpu, i;
|
||||
|
||||
/* Allocate per-CPU private state */
|
||||
imsic->lpriv = __alloc_percpu(struct_size(imsic->lpriv, vectors, global->nr_ids + 1),
|
||||
__alignof__(*imsic->lpriv));
|
||||
imsic->lpriv = alloc_percpu(typeof(*imsic->lpriv));
|
||||
if (!imsic->lpriv)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -511,6 +511,12 @@ static int __init imsic_local_init(void)
|
|||
timer_setup(&lpriv->timer, imsic_local_timer_callback, TIMER_PINNED);
|
||||
#endif
|
||||
|
||||
/* Allocate vector array */
|
||||
lpriv->vectors = kcalloc(global->nr_ids + 1, sizeof(*lpriv->vectors),
|
||||
GFP_KERNEL);
|
||||
if (!lpriv->vectors)
|
||||
goto fail_local_cleanup;
|
||||
|
||||
/* Setup vector array */
|
||||
for (i = 0; i <= global->nr_ids; i++) {
|
||||
vec = &lpriv->vectors[i];
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ struct imsic_local_priv {
|
|||
#endif
|
||||
|
||||
/* Local vector table */
|
||||
struct imsic_vector vectors[];
|
||||
struct imsic_vector *vectors;
|
||||
};
|
||||
|
||||
struct imsic_priv {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue