From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH v3 09/14] xen: sched: DOMCTL_*vcpuaffinity works with hard and soft affinity Date: Fri, 22 Nov 2013 19:55:52 +0100 Message-ID: <1385146552.21426.73.camel@Solace> References: <20131118175544.31002.79574.stgit@Solace> <20131118181756.31002.15256.stgit@Solace> <528BA24A0200007800104A52@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8369888979838161503==" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VjvtY-0002i1-0E for xen-devel@lists.xenproject.org; Fri, 22 Nov 2013 18:56:00 +0000 In-Reply-To: <528BA24A0200007800104A52@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 --===============8369888979838161503== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-LuVemw+13R/9Epp9hTv+" --=-LuVemw+13R/9Epp9hTv+ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable So, about this, in the new version of this series I'm releasing right now. On mar, 2013-11-19 at 16:39 +0000, Jan Beulich wrote: > >>> On 18.11.13 at 19:17, Dario Faggioli wrot= e: > > --- a/xen/common/domctl.c > > +++ b/xen/common/domctl.c > > @@ -617,19 +617,65 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_= t)=20 > > 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); > > + if ( op->u.vcpuaffinity.flags & XEN_VCPUAFFINITY_SOFT ) > > + ret =3D vcpu_set_soft_affinity(v, new_affinity); >=20 > You're discarding an eventual error indicator from > vcpu_set_hard_affinity() here. >=20 I fixed this. > > + > > + if ( ret ) > > + goto setvcpuaffinity_out; >=20 > Considering that you're going to return an error here, the caller > may expect that the call did nothing, even if > vcpu_set_hard_affinity() succeeded and vcpu_set_soft_affinity() > failed. I know this is ugly to handle... >=20 And this too. > > + > > + /* > > + * Report back to the caller what the "effective affinity"= , that > > + * is the intersection of cpupool's pcpus, the (new?) hard > > + * affinity and the (new?) soft-affinity. > > + */ > > + if ( !guest_handle_is_null(op->u.vcpuaffinity.eff_cpumap.b= itmap) ) > > { > > - ret =3D vcpu_set_affinity(v, new_affinity); > > - free_cpumask_var(new_affinity); > > + online =3D cpupool_online_cpumask(v->domain->cpupool); > > + cpumask_and(new_affinity, online, v->cpu_hard_affinity= ); > > + if ( op->u.vcpuaffinity.flags & XEN_VCPUAFFINITY_SOFT) > > + cpumask_and(new_affinity, new_affinity, > > + v->cpu_soft_affinity); > > + > > + ret =3D cpumask_to_xenctl_bitmap( > > + &op->u.vcpuaffinity.eff_cpumap, new_affinity); >=20 > Considering that you have two bitmaps available from the caller, > can't you just return both when both flags are set? >=20 Well, it's true that there are two cpumaps, but only one is meant to be an output parameter. Also, I think this is more useful like this, i.e., returning either: - hard-affinity&online - hard-affinity&soft-affinity&online, As it can be seen in the libxl patch (in the new series). Therefore, I kept this interface as it was here, also considering that: - it's pretty late to re-re-redesign; - neither this nor the xc one are stable interfaces, so we can come back and revisit this later, if we want to. Do you think this could be acceptable? 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) --=-LuVemw+13R/9Epp9hTv+ 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) iEYEABECAAYFAlKPqLgACgkQk4XaBE3IOsR6kACfdWlRX5lu98IYuuXirAMNH8YQ RQUAn0oWeQU3xgbj4Yrhee8IXVOFVuNw =4fK/ -----END PGP SIGNATURE----- --=-LuVemw+13R/9Epp9hTv+-- --===============8369888979838161503== 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 --===============8369888979838161503==--