From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH v5 12/17] xen/libxc: sched: DOMCTL_*vcpuaffinity works with hard and soft affinity Date: Tue, 3 Dec 2013 12:08:01 +0100 Message-ID: <1386068881.5338.276.camel@Solace> References: <20131202180129.29026.81543.stgit@Solace> <20131202182908.29026.23720.stgit@Solace> <529DBA3F02000078001093CF@nat28.tlf.novell.com> <529DBB4A02000078001093E5@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7919767269404599580==" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Vnnpo-0007Ur-96 for xen-devel@lists.xenproject.org; Tue, 03 Dec 2013 11:08:08 +0000 In-Reply-To: <529DBB4A02000078001093E5@nat28.tlf.novell.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: Jan Beulich Cc: Marcus Granado , Justin Weaver , Ian Campbell , Li Yechen , George Dunlap , Andrew Cooper , Juergen Gross , Ian Jackson , Matt Wilson , xen-devel , Keir Fraser , Elena Ufimtseva List-Id: xen-devel@lists.xenproject.org --===============7919767269404599580== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-SOV16sBtVjCUyGHr9g68" --=-SOV16sBtVjCUyGHr9g68 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On mar, 2013-12-03 at 10:06 +0000, Jan Beulich wrote: > >>> On 03.12.13 at 11:02, "Jan Beulich" wrote: > >>>> On 02.12.13 at 19:29, Dario Faggioli wro= te: > >> + goto setvcpuaffinity_out; > >> + > >> + /* > >> + * We both set a new affinity and report back to the call= er what > >> + * the scheduler will be effectively using. > >> + */ > >> + if ( vcpuaff->flags & XEN_VCPUAFFINITY_HARD ) > >> + { > >> + ret =3D xenctl_bitmap_to_bitmap(cpumask_bits(new_affi= nity), > >> + &vcpuaff->cpumap_hard, > >> + vcpuaff->cpumap_hard.nr= _bits); > >=20 > > There's no code above range checking vcpuaff->cpumap_hard.nr_bits, > > yet xenctl_bitmap_to_bitmap() uses the passed in value to write into > > the array pointed to by the first argument. Why is this not > > xenctl_bitmap_to_cpumask() in the first place? >=20 > And just to make it explicit - with fundamental flaws like this, I'm > not certain anymore whether we really ought to rush this series > in for 4.4. >=20 Well, I certainly have no intention to say that this isn't something that I overlooked. Just for the sake of completeness, that's what's required to fix it: diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 9eecb5e..cd817f3 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -661,7 +661,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_d= omctl) { ret =3D xenctl_bitmap_to_bitmap(cpumask_bits(new_affinity)= , &vcpuaff->cpumap_hard, - vcpuaff->cpumap_hard.nr_bits= ); + nr_cpu_ids); if ( !ret ) ret =3D vcpu_set_hard_affinity(v, new_affinity); if ( ret ) @@ -679,7 +679,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_d= omctl) { ret =3D xenctl_bitmap_to_bitmap(cpumask_bits(new_affinity)= , &vcpuaff->cpumap_soft, - vcpuaff->cpumap_soft.nr_bits= ); + nr_cpu_ids); if ( !ret) ret =3D vcpu_set_soft_affinity(v, new_affinity); if ( ret ) That being said, I definitely won't interfere with the decision of taking it or not for 4.4. Just let me know. :-) Thanks and Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-SOV16sBtVjCUyGHr9g68 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) iEYEABECAAYFAlKdu5EACgkQk4XaBE3IOsS8ogCdE04YBlbZMUR3dDjc7FwDL5Ab hpYAnjMn1OyyPtFgFRgNIAGtX1c71K3w =B2GP -----END PGP SIGNATURE----- --=-SOV16sBtVjCUyGHr9g68-- --===============7919767269404599580== 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 --===============7919767269404599580==--