diff mbox series

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

Message ID 20250318073415.6652-1-anderson.choi@boeing.com (mailing list archive)
State New
Headers show
Series [v2] xen/arinc653: call xfree() with local IRQ enabled | expand

Commit Message

Choi, Anderson March 18, 2025, 7:34 a.m. UTC
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()
Signed-off-by: Anderson Choi <anderson.choi@boeing.com>

---
Changes:
v1 -> v2
  * changed the title to show clearly which scheduler is modified
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jürgen Groß March 18, 2025, 7:42 a.m. UTC | #1
On 18.03.25 08:34, Anderson Choi wrote:
> 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()
> Signed-off-by: Anderson Choi <anderson.choi@boeing.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen
Nathan Studer March 18, 2025, 3:06 p.m. UTC | #2
On 18/03/25 03:42, Juergen Gross wrote:
> On 18.03.25 08:34, Anderson Choi wrote:
> > 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()
> > Signed-off-by: Anderson Choi <anderson.choi@boeing.com>
> 
> Reviewed-by: Juergen Gross <jgross@suse.com>

Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
diff mbox series

Patch

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index a82c0d7314a1..a297e64affe6 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -457,10 +457,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);
 }
 
 /**