All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/domctl: don't waste domain CPUID slot for all zero data
@ 2016-03-22 12:56 Jan Beulich
  2016-03-22 15:10 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2016-03-22 12:56 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 979 bytes --]

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 <jbeulich@suse.com>

--- 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;




[-- Attachment #2: x86-domctl-CPUID-unused.patch --]
[-- Type: text/plain, Size: 1036 bytes --]

x86/domctl: don't waste domain CPUID slot 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 <jbeulich@suse.com>

--- 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;

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/domctl: don't waste domain CPUID slot for all zero data
  2016-03-22 12:56 [PATCH] x86/domctl: don't waste domain CPUID slot for all zero data Jan Beulich
@ 2016-03-22 15:10 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2016-03-22 15:10 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Keir Fraser

On 22/03/16 12:56, Jan Beulich wrote:

slot => slots in the subject.

> 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 <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-22 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-22 12:56 [PATCH] x86/domctl: don't waste domain CPUID slot for all zero data Jan Beulich
2016-03-22 15:10 ` Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.