xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Juergen Gross <juergen.gross@ts.fujitsu.com>,
	David Vrabel <david.vrabel@citrix.com>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH] sched: fix race between sched_move_domain() and vcpu_wake()
Date: Fri, 11 Oct 2013 13:49:00 +0200	[thread overview]
Message-ID: <1381492140.5006.40.camel@Abyss.lan> (raw)
In-Reply-To: <5257E1DB.8070002@eu.citrix.com>


[-- Attachment #1.1: Type: text/plain, Size: 1386 bytes --]

On ven, 2013-10-11 at 12:32 +0100, George Dunlap wrote:
> On 11/10/13 12:15, Dario Faggioli wrote:
> > On ven, 2013-10-11 at 11:32 +0100, George Dunlap wrote:

> >> But I think this patch is still not quite right: both v->processor and
> >> per_cpu(schedule_data, ...).schedule_lock may change under your feet; so
> >> you always need to do the lock in a loop, checking to make sure that you
> >> *still* have the right lock after you have actually grabbed it.
> >>
> > Which, if I'm not mistaken, we sort of get for free it we go Jan's way,
> > don't we?
> 
> You mean, we could just call vcpu_schedule_lock..() instead of writing a 
> bespoke loop code?  Sure, that's definitely an advantage.
> 
Yes, provided we go Jan's way and have it return the lock.

That way, we'll have vcpu_schedule_lock() responsible for both finding
the proper lock, and doing it in the right way (with the loop, as you're
suggesting above), and returning it to the caller.

That would mean result in code that is both correct and looks better (no
per_cpu().schedule_lock in the caller), so it's a win win. :-)

Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2013-10-11 11:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-10 17:29 [PATCH] sched: fix race between sched_move_domain() and vcpu_wake() David Vrabel
2013-10-10 18:01 ` Andrew Cooper
2013-10-10 18:27   ` Keir Fraser
2013-10-11  7:12     ` Jan Beulich
2013-10-11  8:07       ` Keir Fraser
2013-10-11  9:02         ` Andrew Cooper
2013-10-11  9:32           ` Jan Beulich
2013-10-11  9:36             ` David Vrabel
2013-10-11  9:37               ` Jan Beulich
2013-10-11 12:20             ` Jan Beulich
2013-10-11 14:39               ` George Dunlap
2013-10-11 14:45               ` George Dunlap
2013-10-11 15:00                 ` Processed: " xen
2013-10-11 10:36       ` George Dunlap
2013-10-11  6:37 ` Juergen Gross
2013-10-11 10:32 ` George Dunlap
2013-10-11 11:15   ` Dario Faggioli
2013-10-11 11:32     ` George Dunlap
2013-10-11 11:49       ` Dario Faggioli [this message]
2013-10-11 12:03         ` Jan Beulich
2013-10-11 11:47 ` Keir Fraser

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=1381492140.5006.40.camel@Abyss.lan \
    --to=dario.faggioli@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=juergen.gross@ts.fujitsu.com \
    --cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).