All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Josh Whitehead <josh.whitehead@dornerworks.com>,
	Robert VanVossen <robert.vanvossen@dornerworks.com>,
	Dario Faggioli <dfaggioli@suse.com>
Subject: [Xen-devel] [PATCH 1/2] xen/sched: fix locking in a653sched_free_vdata()
Date: Wed, 25 Sep 2019 09:05:02 +0200	[thread overview]
Message-ID: <20190925070503.13850-2-jgross@suse.com> (raw)
In-Reply-To: <20190925070503.13850-1-jgross@suse.com>

The arinc653 scheduler's free_vdata() function is missing proper
locking: as it is modifying the scheduler's private vcpu list it needs
to take the scheduler lock during that operation.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched_arinc653.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/common/sched_arinc653.c b/xen/common/sched_arinc653.c
index 72b988ea5f..d47b747ef4 100644
--- a/xen/common/sched_arinc653.c
+++ b/xen/common/sched_arinc653.c
@@ -442,16 +442,22 @@ a653sched_alloc_vdata(const struct scheduler *ops, struct vcpu *vc, void *dd)
 static void
 a653sched_free_vdata(const struct scheduler *ops, void *priv)
 {
+    a653sched_priv_t *sched_priv = SCHED_PRIV(ops);
     arinc653_vcpu_t *av = priv;
+    unsigned long flags;
 
     if (av == NULL)
         return;
 
+    spin_lock_irqsave(&sched_priv->lock, flags);
+
     if ( !is_idle_vcpu(av->vc) )
         list_del(&av->list);
 
     xfree(av);
     update_schedule_vcpus(ops);
+
+    spin_unlock_irqrestore(&sched_priv->lock, flags);
 }
 
 /**
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-09-25  7:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25  7:05 [Xen-devel] [PATCH 0/2] xen/sched: fix freeing of per-vcpu data Juergen Gross
2019-09-25  7:05 ` Juergen Gross [this message]
2019-09-25  8:41   ` [Xen-devel] [PATCH 1/2] xen/sched: fix locking in a653sched_free_vdata() Jan Beulich
2019-09-25 10:59   ` Dario Faggioli
2019-09-27  7:23     ` Jürgen Groß
2019-09-27  8:20       ` Jan Beulich
2019-09-27  8:27         ` Jürgen Groß
2019-09-25  7:05 ` [Xen-devel] [PATCH 2/2] xen/sched: fix freeing per-vcpu data in sched_move_domain() Juergen Gross
2019-09-25  8:41   ` Jan Beulich
2019-09-25 10:58   ` Dario Faggioli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190925070503.13850-2-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=dfaggioli@suse.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=josh.whitehead@dornerworks.com \
    --cc=robert.vanvossen@dornerworks.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.