Skip to content

Commit 835f442

Browse files
Valentin SchneiderMarc Zyngier
authored andcommitted
irqchip/gic-v3-its: Limit memreserve cpuhp state lifetime
The new memreserve cpuhp callback only needs to survive up until a point where every CPU in the system has booted once. Beyond that, it becomes a no-op and can be put in the bin. Signed-off-by: Valentin Schneider <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d23bc2b commit 835f442

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

drivers/irqchip/irq-gic-v3-its.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5203,6 +5203,15 @@ int its_cpu_init(void)
52035203
return 0;
52045204
}
52055205

5206+
static void rdist_memreserve_cpuhp_cleanup_workfn(struct work_struct *work)
5207+
{
5208+
cpuhp_remove_state_nocalls(gic_rdists->cpuhp_memreserve_state);
5209+
gic_rdists->cpuhp_memreserve_state = CPUHP_INVALID;
5210+
}
5211+
5212+
static DECLARE_WORK(rdist_memreserve_cpuhp_cleanup_work,
5213+
rdist_memreserve_cpuhp_cleanup_workfn);
5214+
52065215
static int its_cpu_memreserve_lpi(unsigned int cpu)
52075216
{
52085217
struct page *pend_page;
@@ -5231,6 +5240,10 @@ static int its_cpu_memreserve_lpi(unsigned int cpu)
52315240
}
52325241

52335242
out:
5243+
/* Last CPU being brought up gets to issue the cleanup */
5244+
if (cpumask_equal(&cpus_booted_once_mask, cpu_possible_mask))
5245+
schedule_work(&rdist_memreserve_cpuhp_cleanup_work);
5246+
52345247
gic_data_rdist()->flags |= RD_LOCAL_MEMRESERVE_DONE;
52355248
return ret;
52365249
}
@@ -5425,13 +5438,16 @@ int __init its_lpi_memreserve_init(void)
54255438
if (!efi_enabled(EFI_CONFIG_TABLES))
54265439
return 0;
54275440

5441+
gic_rdists->cpuhp_memreserve_state = CPUHP_INVALID;
54285442
state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
54295443
"irqchip/arm/gicv3/memreserve:online",
54305444
its_cpu_memreserve_lpi,
54315445
NULL);
54325446
if (state < 0)
54335447
return state;
54345448

5449+
gic_rdists->cpuhp_memreserve_state = state;
5450+
54355451
return 0;
54365452
}
54375453

include/linux/irqchip/arm-gic-v3.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ struct rdists {
624624
u64 flags;
625625
u32 gicd_typer;
626626
u32 gicd_typer2;
627+
int cpuhp_memreserve_state;
627628
bool has_vlpis;
628629
bool has_rvpeid;
629630
bool has_direct_lpi;

0 commit comments

Comments
 (0)