Skip to contentSkip to conversation

xen/sched: call xfree() after local IRQ is enabled

PATCH In review Anderson Choi 2 participants 3 messages Mar 18, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/sched: call xfree() after local IRQ is enabled

xen panic is observed with the following configuration.

1. Debug xen build (CONFIG_DEBUG=y)
2. dom1 of an ARINC653 domain
3. shutdown dom1 with xl command

$ xl shutdown <domain_name>

(XEN) **************************************** (XEN) Panic on CPU 2:
(XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/xmalloc_tlsf.c:714 (XEN) ****************************************

panic was triggered since xfree() was called with local IRQ disabled and therefore assertion failed.

Fix this by calling xfree() after local IRQ is enabled.

Fixes 19049f8d796a sched: fix locking in a653sched_free_vdata()
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/common/sched/arinc653.c +2 -1
index 0a3733c04e90..b95492e1d96f 100644
@@ -463,10 +463,11 @@ a653sched_free_udata(const struct scheduler *ops, void *priv)
     if ( !is_idle_unit(av->unit) )
         list_del(&av->list);
 
-    xfree(av);
     update_schedule_units(ops);
 
     spin_unlock_irqrestore(&sched_priv->lock, flags);
+
+    xfree(av);
 }
 
 /**
Signature · 1 line
2.34.1
#1 lore raw
Quoted 14 lines · Anderson Choi

xen panic is observed with the following configuration.

1. Debug xen build (CONFIG_DEBUG=y)
2. dom1 of an ARINC653 domain
3. shutdown dom1 with xl command

$ xl shutdown <domain_name>

(XEN) **************************************** (XEN) Panic on CPU 2:
(XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/xmalloc_tlsf.c:714 (XEN) ****************************************

Quoted 7 lines

panic was triggered since xfree() was called with local IRQ disabled and therefore assertion failed.

Fix this by calling xfree() after local IRQ is enabled.

Fixes 19049f8d796a sched: fix locking in a653sched_free_vdata()

Just one nit on the patch title: There's no mention at all there of which scheduler it is. Imo "sched" there would better be replaced by the scheduler name.

Jan

Quoted 21 lines
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/common/sched/arinc653.c +2 -1
index 0a3733c04e90..b95492e1d96f 100644
@@ -463,10 +463,11 @@ a653sched_free_udata(const struct scheduler *ops, void *priv)
     if ( !is_idle_unit(av->unit) )
         list_del(&av->list);
 
-    xfree(av);
     update_schedule_units(ops);
 
     spin_unlock_irqrestore(&sched_priv->lock, flags);
+
+    xfree(av);
 }
 
 /**
#2 lore raw

Jan,

Quoted 22 lines

EXT email: be mindful of links/attachments.

Quoted 19 lines · Anderson Choi

xen panic is observed with the following configuration.

1. Debug xen build (CONFIG_DEBUG=y)
2. dom1 of an ARINC653 domain
3. shutdown dom1 with xl command

$ xl shutdown <domain_name>

(XEN) **************************************** (XEN) Panic on CPU 2:
(XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/xmalloc_tlsf.c:714 (XEN) ****************************************

panic was triggered since xfree() was called with local IRQ disabled and therefore assertion failed.

Fix this by calling xfree() after local IRQ is enabled.

Quoted 9 lines
Quoted 2 lines
Fixes 19049f8d796a sched: fix locking in a653sched_free_vdata()

Just one nit on the patch title: There's no mention at all there of which scheduler it is. Imo "sched" there would better be replaced by the scheduler name.

Jan

Quoted 1 line

---

...

Thanks for the comment. I have just submitted patch v2 with the following title.

[PATCH v2] xen/arinc653: call xfree() with local IRQ enabled

Regards,
Anderson