[xen master] x86/domctl: Avoid redundant zeroing in XEN_DOMCTL_get_vcpu_msrs

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen master] x86/domctl: Avoid redundant zeroing in XEN_DOMCTL_get_vcpu_msrs

patchbot
commit fe66b42da63b820ae75dd9dd2987b32f0631ec4e
Author:     Andrew Cooper <[hidden email]>
AuthorDate: Fri Dec 1 13:16:12 2017 +0000
Commit:     Andrew Cooper <[hidden email]>
CommitDate: Thu Dec 14 18:05:45 2017 +0000

    x86/domctl: Avoid redundant zeroing in XEN_DOMCTL_get_vcpu_msrs
   
    Zero the msr structure once at initialisation time, and avoid re-zeroing the
    reserved field every time the structure is used.
   
    Signed-off-by: Andrew Cooper <[hidden email]>
    Acked-by: Jan Beulich <[hidden email]>
---
 xen/arch/x86/domctl.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 075ee92..036fdcd 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1284,7 +1284,7 @@ long arch_do_domctl(
     case XEN_DOMCTL_set_vcpu_msrs:
     {
         struct xen_domctl_vcpu_msrs *vmsrs = &domctl->u.vcpu_msrs;
-        struct xen_domctl_vcpu_msr msr;
+        struct xen_domctl_vcpu_msr msr = {};
         struct vcpu *v;
         static const uint32_t msrs_to_send[] = {
             MSR_INTEL_MISC_FEATURES_ENABLES,
@@ -1347,7 +1347,6 @@ long arch_do_domctl(
                     if ( i < vmsrs->msr_count && !ret )
                     {
                         msr.index = msrs_to_send[j];
-                        msr.reserved = 0;
                         msr.value = val;
                         if ( copy_to_guest_offset(vmsrs->msrs, i, &msr, 1) )
                             ret = -EFAULT;
@@ -1362,7 +1361,6 @@ long arch_do_domctl(
                         if ( i < vmsrs->msr_count && !ret )
                         {
                             msr.index = MSR_AMD64_DR0_ADDRESS_MASK;
-                            msr.reserved = 0;
                             msr.value = v->arch.pv_vcpu.dr_mask[0];
                             if ( copy_to_guest_offset(vmsrs->msrs, i, &msr, 1) )
                                 ret = -EFAULT;
@@ -1377,7 +1375,6 @@ long arch_do_domctl(
                         if ( i < vmsrs->msr_count && !ret )
                         {
                             msr.index = MSR_AMD64_DR1_ADDRESS_MASK + j;
-                            msr.reserved = 0;
                             msr.value = v->arch.pv_vcpu.dr_mask[1 + j];
                             if ( copy_to_guest_offset(vmsrs->msrs, i, &msr, 1) )
                                 ret = -EFAULT;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog