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

Re: [Xen-devel] How to get a few MSR values from userspace?



>>> On 21.12.12 at 13:45, Razvan Cojocaru <rzvncj@xxxxxxxxx> wrote:
> I need access to some MSR values that are not currently being saved in 
> struct hvm_hw_cpu. Among them are MSR_IA32_MC0_CTL, MSR_IA32_MISC_ENABLE 
> and MSR_IA32_ENERGY_PERF_BIAS.

I can't see why, and this is quite likely related to the reason for
them not being accessible in the first place.

> The way I'm approaching this that I'll patch xen/arch/x86/hvm/vmx/vmx.c 
> and xen/arch/x86/hvm/svm/svm.c, and add this in vmx_save_cpu_state() and 
> svm_save_cpu_state(), respectively:
> 
> hvm_msr_read_intercept(MSR_IA32_MC0_CTL, &data->msr_mc0_ctl);
> 
> and so on, for the other registers (after adding the msr_mc0_ctl member 
> to struct hvm_hw_cpu, of course). I would also have to do the reverse 
> operation (using hvm_msr_write_intercept()) in vmx_load_cpu_state().
> 
> My questions:
> 
> 1. Does it seem architecturally sound to perform the described 
> modifications?

Not to me, no. These records are use for save/restore/migrate,
and so far there hasn't been a need to include here the MSRs you
mention.

> Can I use hvm_msr_xxx_intercept() for both the VMX and 
> the SVM code?

For MSR_IA32_MC0_CTL, why not? These should be fine for
anything that is architectural to x86.

The other two MSRs are Intel specific iirc, and hence wouldn't
be validly dealt with in vendor independent code.

> 2. It seems repetitive to have duplicated code in both 
> vmx_save_cpu_state() and svm_save_cpu_state(), does it make more sense 
> to have it like that anyway (in case, for example, the SVM way to 
> retrieve that register could change in the future)?

Is what you want was explained well enough to become reasonable,
and if the amount of code duplication would become significant, then
consolidating what is common between both would certainly make
sense.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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