[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] x86/HVM: drop stale check from hvm_load_cpu_msrs()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 6 Dec 2022 14:00:04 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Uo1HI2wxCeGOb4dkJghuzUxBu03Az2/vKx/ZOpRpwB4=; b=Z+Gs+8qg59/QhPH4GJja6VBGY04IlZ7hIqIcOaoiCDt9jOvNIEo28gRRvk8S5Rual4NN69QKkecvckjs65sfuSdR+E9Xd4O51SmTgvb+3dnSNrvaJQ1qmCvsVHZC4rRCdcGaINmwTPOBxUgefJ+aBSc9GJP0wX2J72jWH1s7hw4f5x2tK1zJW6Kr3TjRB3qV9xAr1kCjgStH1BRWop2Wkc/jAqizH7kFOKCFDp6/PGC/pAIcA7YytZ9mxjNismSXyloQwcyP6ZQe7BDGB99JIt/CXjLpeVsqUm+M4zLvSpaK7R58mytTbnz1i9fqzVhFBxxmaBC5fGFSspf1Jqfc3w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SPsoZGiqjMT/WL/tNk9X914l0ikxfyNR4rCwaG3Oqch+OcdzUoz7CAZd/BwC19y02mktArfIwoDhNDYIkGtlaBjqb/Rgs/zAY7AQkwo1V8Qrqot4OzQOSYtgl5d0Ym++QezNwPSyzPQrWEOs7sZTwIAMRdUIStgm+AJP8KGX6eWBYoYZt81lJZu0Nc2HU9DY/lYgpxK35kM8/O9KphOraGSLkYE1SGh3y7+5de3y86YR9lkvWQMK5LVqrnPUIeyh7s8EUdQD56CehqCX0blenaPXhNlOqugZFJPtx2bx4Bc+BlU5gBTbklqQdWCbSlTHvefvQG//WlcOH72CRktJ9A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 06 Dec 2022 13:00:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Up until f61685a66903 ("x86: remove defunct init/load/save_msr()
hvm_funcs") the check of the _rsvd field served as an error check for
the earlier hvm_funcs.save_msr() invocation. With that invocation gone
the check makes no sense anymore: It is effectively dead code due to the
checking of the field in the earlier loop.

While dropping the conditional also eliminate the "err" local variable
(using a non-standard name anyway), replaced by suitable new/adjusted
"return" statements.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v2: Remove "err". Amend description.

--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1428,7 +1428,6 @@ static int cf_check hvm_load_cpu_msrs(st
     struct vcpu *v;
     const struct hvm_save_descriptor *desc;
     struct hvm_msr *ctxt;
-    int err = 0;
 
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
@@ -1479,7 +1478,7 @@ static int cf_check hvm_load_cpu_msrs(st
             return -EOPNOTSUPP;
     /* Checking finished */
 
-    for ( i = 0; !err && i < ctxt->count; ++i )
+    for ( i = 0; i < ctxt->count; ++i )
     {
         switch ( ctxt->msr[i].index )
         {
@@ -1495,17 +1494,15 @@ static int cf_check hvm_load_cpu_msrs(st
             rc = guest_wrmsr(v, ctxt->msr[i].index, ctxt->msr[i].val);
 
             if ( rc != X86EMUL_OKAY )
-                err = -ENXIO;
+                return -ENXIO;
             break;
 
         default:
-            if ( !ctxt->msr[i]._rsvd )
-                err = -ENXIO;
-            break;
+            return -ENXIO;
         }
     }
 
-    return err;
+    return 0;
 }
 
 /* We need variable length data chunks for XSAVE area and MSRs, hence



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.