arm/time: Use static irqaction

When stopping a core deinit_timer_interrupt is called in non-alloc
context, which causes xfree in release_irq to fail an assert.

To fix this, switch to a statically allocated irqaction that does not
need to be freed in release_irq.

Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
Reviewed-by: Mykola Kvach <mykola_kvach@epam.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>

v3->v4:
* make irqactions static
* collect RBs

v2->v3:
* no changes

v1->v2:
* use percpu actions
This commit is contained in:
Mykyta Poturai authored and Julien Grall committed 2025-11-16 12:22:30 +00:00
1 parent c53f71b2ee
commit a7e82dab15
1 file changed
+17 -4
+17 -4
View File
@@ -303,9 +303,15 @@ static void check_timer_irq_cfg(unsigned int irq, const char *which)
"WARNING: %s-timer IRQ%u is not level triggered.\n", which, irq);
}
static DEFINE_PER_CPU_READ_MOSTLY(struct irqaction, irq_hyp);
static DEFINE_PER_CPU_READ_MOSTLY(struct irqaction, irq_virt);
/* Set up the timer interrupt on this CPU */
void init_timer_interrupt(void)
{
struct irqaction *hyp_action = &this_cpu(irq_hyp);
struct irqaction *virt_action = &this_cpu(irq_virt);
/* Sensible defaults */
WRITE_SYSREG64(0, CNTVOFF_EL2); /* No VM-specific offset */
/* Do not let the VMs program the physical timer, only read the physical counter */
@@ -314,10 +320,17 @@ void init_timer_interrupt(void)
WRITE_SYSREG(0, CNTHP_CTL_EL2); /* Hypervisor's timer disabled */
isb();
request_irq(timer_irq[TIMER_HYP_PPI], 0, htimer_interrupt,
"hyptimer", NULL);
request_irq(timer_irq[TIMER_VIRT_PPI], 0, vtimer_interrupt,
"virtimer", NULL);
hyp_action->name = "hyptimer";
hyp_action->handler = htimer_interrupt;
hyp_action->dev_id = NULL;
hyp_action->free_on_release = 0;
setup_irq(timer_irq[TIMER_HYP_PPI], 0, hyp_action);
virt_action->name = "virtimer";
virt_action->handler = vtimer_interrupt;
virt_action->dev_id = NULL;
virt_action->free_on_release = 0;
setup_irq(timer_irq[TIMER_VIRT_PPI], 0, virt_action);
check_timer_irq_cfg(timer_irq[TIMER_HYP_PPI], "hypervisor");
check_timer_irq_cfg(timer_irq[TIMER_VIRT_PPI], "virtual");
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.