Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 79eaabc61dfb ("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

authored by

Anup Patel and committed by
Thomas Gleixner
a33d16dc 1690eeb0

+9 -3
+8 -2
drivers/irqchip/irq-riscv-imsic-state.c
··· 477 477 lpriv = per_cpu_ptr(imsic->lpriv, cpu); 478 478 479 479 bitmap_free(lpriv->dirty_bitmap); 480 + kfree(lpriv->vectors); 480 481 } 481 482 482 483 free_percpu(imsic->lpriv); ··· 491 490 int cpu, i; 492 491 493 492 /* Allocate per-CPU private state */ 494 - imsic->lpriv = __alloc_percpu(struct_size(imsic->lpriv, vectors, global->nr_ids + 1), 495 - __alignof__(*imsic->lpriv)); 493 + imsic->lpriv = alloc_percpu(typeof(*imsic->lpriv)); 496 494 if (!imsic->lpriv) 497 495 return -ENOMEM; 498 496 ··· 510 510 /* Setup lazy timer for synchronization */ 511 511 timer_setup(&lpriv->timer, imsic_local_timer_callback, TIMER_PINNED); 512 512 #endif 513 + 514 + /* Allocate vector array */ 515 + lpriv->vectors = kcalloc(global->nr_ids + 1, sizeof(*lpriv->vectors), 516 + GFP_KERNEL); 517 + if (!lpriv->vectors) 518 + goto fail_local_cleanup; 513 519 514 520 /* Setup vector array */ 515 521 for (i = 0; i <= global->nr_ids; i++) {
+1 -1
drivers/irqchip/irq-riscv-imsic-state.h
··· 40 40 #endif 41 41 42 42 /* Local vector table */ 43 - struct imsic_vector vectors[]; 43 + struct imsic_vector *vectors; 44 44 }; 45 45 46 46 struct imsic_priv {