From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH] sched: fix race between sched_move_domain() and vcpu_wake() Date: Fri, 11 Oct 2013 13:49:00 +0200 Message-ID: <1381492140.5006.40.camel@Abyss.lan> References: <1381426196-11392-1-git-send-email-david.vrabel@citrix.com> <5257D3D2.4020907@eu.citrix.com> <1381490132.5006.33.camel@Abyss.lan> <5257E1DB.8070002@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1137599908708363195==" Return-path: In-Reply-To: <5257E1DB.8070002@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: Andrew Cooper , Juergen Gross , David Vrabel , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --===============1137599908708363195== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-hwqaKpjmmuZRkkP6PHeN" --=-hwqaKpjmmuZRkkP6PHeN Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 y= ou > >> *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? >=20 > You mean, we could just call vcpu_schedule_lock..() instead of writing a= =20 > bespoke loop code? Sure, that's definitely an advantage. >=20 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 --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-hwqaKpjmmuZRkkP6PHeN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) iEYEABECAAYFAlJX5awACgkQk4XaBE3IOsSeigCfbzVnG8lv8zVeCdkBAKccgjBv SrUAoI+xjXyKmNJq4eJOXX681w96JdDC =ScEa -----END PGP SIGNATURE----- --=-hwqaKpjmmuZRkkP6PHeN-- --===============1137599908708363195== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============1137599908708363195==--