From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH] x86/domctl: don't waste domain CPUID slot for all zero data Date: Tue, 22 Mar 2016 06:56:23 -0600 Message-ID: <56F14F0702000078000DF2B4@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part685FC2E7.1__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aiLrI-00051s-CE for xen-devel@lists.xenproject.org; Tue, 22 Mar 2016 12:56:28 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: Andrew Cooper , Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part685FC2E7.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline domain_cpuid() returns all zeroes anyway when not finding a match, so there's no need to explicitly store such a set of values. Signed-off-by: Jan Beulich --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -714,7 +714,7 @@ long arch_do_domctl( =20 case XEN_DOMCTL_set_cpuid: { - xen_domctl_cpuid_t *ctl =3D &domctl->u.cpuid; + const xen_domctl_cpuid_t *ctl =3D &domctl->u.cpuid; cpuid_input_t *cpuid, *unused =3D NULL; =20 if ( d =3D=3D currd ) /* no domain_pause() */ @@ -742,7 +742,12 @@ long arch_do_domctl( =20 domain_pause(d); =20 - if ( i < MAX_CPUID_INPUT ) + if ( !(ctl->eax | ctl->ebx | ctl->ecx | ctl->edx) ) + { + if ( i < MAX_CPUID_INPUT ) + cpuid->input[0] =3D XEN_CPUID_INPUT_UNUSED; + } + else if ( i < MAX_CPUID_INPUT ) *cpuid =3D *ctl; else if ( unused ) *unused =3D *ctl; --=__Part685FC2E7.1__= Content-Type: text/plain; name="x86-domctl-CPUID-unused.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-domctl-CPUID-unused.patch" x86/domctl: don't waste domain CPUID slot for all zero data=0A=0Adomain_cpu= id() returns all zeroes anyway when not finding a match, so=0Athere's no = need to explicitly store such a set of values.=0A=0ASigned-off-by: Jan = Beulich =0A=0A--- a/xen/arch/x86/domctl.c=0A+++ = b/xen/arch/x86/domctl.c=0A@@ -714,7 +714,7 @@ long arch_do_domctl(=0A =0A = case XEN_DOMCTL_set_cpuid:=0A {=0A- xen_domctl_cpuid_t *ctl = =3D &domctl->u.cpuid;=0A+ const xen_domctl_cpuid_t *ctl =3D = &domctl->u.cpuid;=0A cpuid_input_t *cpuid, *unused =3D NULL;=0A = =0A if ( d =3D=3D currd ) /* no domain_pause() */=0A@@ -742,7 = +742,12 @@ long arch_do_domctl(=0A =0A domain_pause(d);=0A =0A- = if ( i < MAX_CPUID_INPUT )=0A+ if ( !(ctl->eax | ctl->ebx | = ctl->ecx | ctl->edx) )=0A+ {=0A+ if ( i < MAX_CPUID_INPUT= )=0A+ cpuid->input[0] =3D XEN_CPUID_INPUT_UNUSED;=0A+ = }=0A+ else if ( i < MAX_CPUID_INPUT )=0A *cpuid =3D = *ctl;=0A else if ( unused )=0A *unused =3D *ctl;=0A --=__Part685FC2E7.1__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --=__Part685FC2E7.1__=--