From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH v2 09/16] xen: sched: DOMCTL_*vcpuaffinity works with hard and soft affinity Date: Thu, 14 Nov 2013 17:21:37 +0100 Message-ID: <1384446097.29902.164.camel@Abyss> References: <20131113190852.18086.5437.stgit@Solace> <20131113191224.18086.96107.stgit@Solace> <5284E16A.2080200@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2582162468088357558==" Return-path: In-Reply-To: <5284E16A.2080200@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: Marcus Granado , Keir Fraser , Ian Campbell , Li Yechen , Andrew Cooper , Juergen Gross , Ian Jackson , xen-devel@lists.xen.org, Jan Beulich , Justin Weaver , Matt Wilson , Elena Ufimtseva List-Id: xen-devel@lists.xenproject.org --===============2582162468088357558== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-yL5fu2FCoJUs2yOjD2fQ" --=-yL5fu2FCoJUs2yOjD2fQ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On gio, 2013-11-14 at 14:42 +0000, George Dunlap wrote: > On 13/11/13 19:12, Dario Faggioli wrote: > > @@ -617,19 +617,49 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_= t) u_domctl) > > if ( op->cmd =3D=3D XEN_DOMCTL_setvcpuaffinity ) > > { > > cpumask_var_t new_affinity; > > + cpumask_t *online; > > =20 > > ret =3D xenctl_bitmap_to_cpumask( > > &new_affinity, &op->u.vcpuaffinity.cpumap); > > - if ( !ret ) > > + if ( ret ) > > + break; > > + > > + ret =3D -EINVAL; > > + if ( op->u.vcpuaffinity.flags & XEN_VCPUAFFINITY_HARD ) > > + ret =3D vcpu_set_hard_affinity(v, new_affinity); > > + else if ( op->u.vcpuaffinity.flags & XEN_VCPUAFFINITY_SOFT= ) > > + ret =3D vcpu_set_soft_affinity(v, new_affinity); >=20 > Wait, why are we making this a bitmask of flags, if we can only set one= =20 > at a time? Shouldn't it instead be a simple enum? >=20 Right. I had a split mind about which one way to go between the ones you outline here and, apparently, ended up with the worst possible combination, i.e., something in the middle! :-P > Or alternately (which is what I was expecting when I saw it was=20 > 'flags'), shouldn't it allow you to set both at the same time? (i.e.,=20 > take away the 'else' here?) >=20 Indeed. I'll take this path. > > else > > { > > - ret =3D cpumask_to_xenctl_bitmap( > > - &op->u.vcpuaffinity.cpumap, v->cpu_hard_affinity); > > + if ( op->u.vcpuaffinity.flags & XEN_VCPUAFFINITY_HARD ) > > + ret =3D cpumask_to_xenctl_bitmap( > > + &op->u.vcpuaffinity.cpumap, v->cpu_hard_affinity); > > + else if ( op->u.vcpuaffinity.flags & XEN_VCPUAFFINITY_SOFT= ) > > + ret =3D cpumask_to_xenctl_bitmap( > > + &op->u.vcpuaffinity.cpumap, v->cpu_soft_affinity); > > + else > > + ret =3D -EINVAL; >=20 > Asking for both the hard and soft affinities at the same time shouldn't= =20 > return just the hard affinity. It should either return an error, or do= =20 > something interesting like return the intersection of the two. >=20 Right again. Given what we said above, I think I'll go for the intersection. > Other than that, I think this looks good. >=20 Cool, I'll respin with these changes ASAP. 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) --=-yL5fu2FCoJUs2yOjD2fQ 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) iEYEABECAAYFAlKE+JEACgkQk4XaBE3IOsS01ACghRzT8ExTRVDIPiKqNftYMvEF jGwAniR1THPJrQv02etW9gmK5a/Rg5w+ =DBYh -----END PGP SIGNATURE----- --=-yL5fu2FCoJUs2yOjD2fQ-- --===============2582162468088357558== 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 --===============2582162468088357558==--