From: Jan Beulich Date: Wed, 23 Mar 2016 10:05:23 +0000 (+0100) Subject: x86/domctl: don't waste domain CPUID slots for all zero data X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~1509 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0fa4c7f25dd0756fcc96de0824deb7763a7fa739;p=xen.git x86/domctl: don't waste domain CPUID slots for all zero data 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 Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index b34a295836..b7c7f424c4 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -714,7 +714,7 @@ long arch_do_domctl( case XEN_DOMCTL_set_cpuid: { - xen_domctl_cpuid_t *ctl = &domctl->u.cpuid; + const xen_domctl_cpuid_t *ctl = &domctl->u.cpuid; cpuid_input_t *cpuid, *unused = NULL; if ( d == currd ) /* no domain_pause() */ @@ -742,7 +742,12 @@ long arch_do_domctl( domain_pause(d); - if ( i < MAX_CPUID_INPUT ) + if ( !(ctl->eax | ctl->ebx | ctl->ecx | ctl->edx) ) + { + if ( i < MAX_CPUID_INPUT ) + cpuid->input[0] = XEN_CPUID_INPUT_UNUSED; + } + else if ( i < MAX_CPUID_INPUT ) *cpuid = *ctl; else if ( unused ) *unused = *ctl;