* [PATCH v2] x86/HVM: drop stale check from hvm_load_cpu_msrs()
@ 2022-12-06 13:00 Jan Beulich
2022-12-06 14:11 ` Andrew Cooper
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2022-12-06 13:00 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Wei Liu, Roger Pau Monné
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@suse.com>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] x86/HVM: drop stale check from hvm_load_cpu_msrs()
2022-12-06 13:00 [PATCH v2] x86/HVM: drop stale check from hvm_load_cpu_msrs() Jan Beulich
@ 2022-12-06 14:11 ` Andrew Cooper
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2022-12-06 14:11 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Wei Liu, Roger Pau Monne
On 06/12/2022 13:00, Jan Beulich wrote:
> 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@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-06 14:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06 13:00 [PATCH v2] x86/HVM: drop stale check from hvm_load_cpu_msrs() Jan Beulich
2022-12-06 14:11 ` 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.