[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 4/6] X86: MPX IA32_BNDCFGS msr save/restore
>>> On 28.11.13 at 07:36, "Liu, Jinsong" <jinsong.liu@xxxxxxxxx> wrote: > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -702,6 +702,48 @@ static int hvm_load_tsc_adjust(struct domain *d, > hvm_domain_context_t *h) > HVM_REGISTER_SAVE_RESTORE(TSC_ADJUST, hvm_save_tsc_adjust, > hvm_load_tsc_adjust, 1, HVMSR_PER_VCPU); > > +static int hvm_save_msr_bndcfgs(struct domain *d, hvm_domain_context_t *h) > +{ > + struct vcpu *v; > + struct hvm_msr_bndcfgs ctxt = {0}; > + int err = 0; > + > + for_each_vcpu ( d, v ) > + { > + hvm_funcs.save_msr_bndcfgs(v, &ctxt); > + > + err = hvm_save_entry(MSR_BNDCFGS, v->vcpu_id, h, &ctxt); > + if ( err ) > + break; > + } > + > + return err; > +} > + > +static int hvm_load_msr_bndcfgs(struct domain *d, hvm_domain_context_t *h) > +{ > + unsigned int vcpuid = hvm_load_instance(h); > + struct vcpu *v; > + struct hvm_msr_bndcfgs ctxt; > + > + if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL ) > + { > + dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no vcpu%u\n", > + d->domain_id, vcpuid); > + return -EINVAL; > + } > + > + if ( hvm_load_entry(MSR_BNDCFGS, h, &ctxt) != 0 ) > + return -EINVAL; > + > + hvm_funcs.load_msr_bndcfgs(v, &ctxt); > + > + return 0; > +} > + > +HVM_REGISTER_SAVE_RESTORE(MSR_BNDCFGS, hvm_save_msr_bndcfgs, > + hvm_load_msr_bndcfgs, 1, HVMSR_PER_VCPU); That's exactly the non-extensible model I expected you to use, and that I tried to keep you from following with pointing out that the vPMU also has at least one MSR not currently saved/restored properly. Instead I think we should have a generic MSR save/restore type, pairing MSR indices and values in an array like fashion. If the restoring host doesn't know how to handle any one of them, the restore would fail. Extending it with further MSR values would then become a much smaller change than the full blown addition of a new save/restore type. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |