[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 5/8] x86/hvm: Introduce hvm_save_cpu_msrs_one func
> -----Original Message----- > From: Alexandru Isaila [mailto:aisaila@xxxxxxxxxxxxxxx] > Sent: 29 May 2018 15:59 > To: xen-devel@xxxxxxxxxxxxx > Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxx>; Wei Liu <wei.liu2@xxxxxxxxxx>; > jbeulich@xxxxxxxx; Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>; Paul > Durrant <Paul.Durrant@xxxxxxxxxx>; Alexandru Isaila > <aisaila@xxxxxxxxxxxxxxx> > Subject: [PATCH v5 5/8] x86/hvm: Introduce hvm_save_cpu_msrs_one func > > This is used to save data from a single instance. > > Signed-off-by: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx> > --- > xen/arch/x86/hvm/hvm.c | 59 ++++++++++++++++++++++++++++----------- > ----------- > 1 file changed, 33 insertions(+), 26 deletions(-) > > diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c > index e8ecabf..4a22283 100644 > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -1354,6 +1354,38 @@ static const uint32_t msrs_to_send[] = { > }; > static unsigned int __read_mostly msr_count_max = > ARRAY_SIZE(msrs_to_send); > > +static int hvm_save_cpu_msrs_one(struct vcpu *v, struct hvm_msr *ctxt) > +{ > + unsigned int i; > + > + for ( i = 0; i < ARRAY_SIZE(msrs_to_send); ++i ) > + { > + uint64_t val; > + int rc = guest_rdmsr(v, msrs_to_send[i], &val); > + > + /* > + * It is the programmers responsibility to ensure that > + * msrs_to_send[] contain generally-read/write MSRs. > + * X86EMUL_EXCEPTION here implies a missing feature, and that the > + * guest doesn't have access to the MSR. > + */ > + if ( rc == X86EMUL_EXCEPTION ) > + continue; > + > + if ( rc != X86EMUL_OKAY ) > + { > + ASSERT_UNREACHABLE(); > + return -ENXIO; > + } > + > + if ( !val ) > + continue; /* Skip empty MSRs. */ > + ctxt->msr[ctxt->count].index = msrs_to_send[i]; > + ctxt->msr[ctxt->count++].val = val; > + } > + return 0; > +} > + > static int hvm_save_cpu_msrs(struct domain *d, hvm_domain_context_t > *h) > { > struct vcpu *v; > @@ -1370,32 +1402,7 @@ static int hvm_save_cpu_msrs(struct domain *d, > hvm_domain_context_t *h) > ctxt = (struct hvm_msr *)&h->data[h->cur]; > ctxt->count = 0; > > - for ( i = 0; i < ARRAY_SIZE(msrs_to_send); ++i ) > - { > - uint64_t val; > - int rc = guest_rdmsr(v, msrs_to_send[i], &val); > - > - /* > - * It is the programmers responsibility to ensure that > - * msrs_to_send[] contain generally-read/write MSRs. > - * X86EMUL_EXCEPTION here implies a missing feature, and that the > - * guest doesn't have access to the MSR. > - */ > - if ( rc == X86EMUL_EXCEPTION ) > - continue; > - > - if ( rc != X86EMUL_OKAY ) > - { > - ASSERT_UNREACHABLE(); > - return -ENXIO; > - } > - > - if ( !val ) > - continue; /* Skip empty MSRs. */ > - > - ctxt->msr[ctxt->count].index = msrs_to_send[i]; > - ctxt->msr[ctxt->count++].val = val; > - } > + hvm_save_cpu_msrs_one(v, ctxt); No check for the return value here means you're not going to propagate a potential -ENXIO. Paul > > if ( hvm_funcs.save_msr ) > hvm_funcs.save_msr(v, ctxt); > -- > 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |