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

Re: [Xen-devel] [PATCH 16/27] x86/svm: Improvements using named features



On 04/01/17 14:52, Boris Ostrovsky wrote:
> On 01/04/2017 07:39 AM, Andrew Cooper wrote:
>> This avoids calling into hvm_cpuid() to obtain information which is directly
>> available.  In particular, this avoids the need to overload flag_dr_dirty
>> because of hvm_cpuid() being unavailable svm_save_dr()
> "unavailabe in" (or from)

Will fix.

>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>> ---
>> CC: Jan Beulich <JBeulich@xxxxxxxx>
>> CC: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
>> CC: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
>> ---
>>  xen/arch/x86/hvm/svm/svm.c | 33 ++++++++-------------------------
>>  1 file changed, 8 insertions(+), 25 deletions(-)
>>
>> diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
>> index de20f64..8f6737c 100644
>> --- a/xen/arch/x86/hvm/svm/svm.c
>> +++ b/xen/arch/x86/hvm/svm/svm.c
>> @@ -173,7 +173,7 @@ static void svm_save_dr(struct vcpu *v)
>>      v->arch.hvm_vcpu.flag_dr_dirty = 0;
>>      vmcb_set_dr_intercepts(vmcb, ~0u);
>>  
>> -    if ( flag_dr_dirty & 2 )
>> +    if ( v->domain->arch.cpuid->extd.dbext )
>>      {
>>          svm_intercept_msr(v, MSR_AMD64_DR0_ADDRESS_MASK, MSR_INTERCEPT_RW);
>>          svm_intercept_msr(v, MSR_AMD64_DR1_ADDRESS_MASK, MSR_INTERCEPT_RW);
>> @@ -196,8 +196,6 @@ static void svm_save_dr(struct vcpu *v)
>>  
>>  static void __restore_debug_registers(struct vmcb_struct *vmcb, struct vcpu 
>> *v)
>>  {
>> -    unsigned int ecx;
>> -
>>      if ( v->arch.hvm_vcpu.flag_dr_dirty )
>>          return;
>>  
>> @@ -205,8 +203,8 @@ static void __restore_debug_registers(struct vmcb_struct 
>> *vmcb, struct vcpu *v)
>>      vmcb_set_dr_intercepts(vmcb, 0);
>>  
>>      ASSERT(v == current);
>> -    hvm_cpuid(0x80000001, NULL, NULL, &ecx, NULL);
>> -    if ( test_bit(X86_FEATURE_DBEXT & 31, &ecx) )
>> +
>> +    if ( v->domain->arch.cpuid->extd.dbext )
>>      {
>>          svm_intercept_msr(v, MSR_AMD64_DR0_ADDRESS_MASK, 
>> MSR_INTERCEPT_NONE);
>>          svm_intercept_msr(v, MSR_AMD64_DR1_ADDRESS_MASK, 
>> MSR_INTERCEPT_NONE);
>> @@ -217,9 +215,6 @@ static void __restore_debug_registers(struct vmcb_struct 
>> *vmcb, struct vcpu *v)
>>          wrmsrl(MSR_AMD64_DR1_ADDRESS_MASK, v->arch.hvm_svm.dr_mask[1]);
>>          wrmsrl(MSR_AMD64_DR2_ADDRESS_MASK, v->arch.hvm_svm.dr_mask[2]);
>>          wrmsrl(MSR_AMD64_DR3_ADDRESS_MASK, v->arch.hvm_svm.dr_mask[3]);
>> -
>> -        /* Can't use hvm_cpuid() in svm_save_dr(): v != current. */
>> -        v->arch.hvm_vcpu.flag_dr_dirty |= 2;
> Should v->arch.hvm_vcpu.flag_dr_dirty be converted to bool then?

Hmm.  That is how the code was before c/s c097f54912, so yes - I will
switch it back.

~Andrew

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

 


Rackspace

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