Re: [PATCH 4/6] kvm: nVMX: support EPT accessed/dirty bits

From: Paolo Bonzini
Date: Fri Mar 31 2017 - 12:27:06 EST




On 31/03/2017 18:24, Radim KrÄmÃÅ wrote:
>> + if (is_guest_mode(vcpu)
>> + && !(exit_qualification & EPT_VIOLATION_GVA_TRANSLATED)) {
>> + /*
>> + * Fix up exit_qualification according to whether guest
>> + * page table accesses are reads or writes.
>> + */
>> + u64 eptp = nested_ept_get_cr3(vcpu);
>> + exit_qualification &= ~EPT_VIOLATION_ACC_WRITE;
>> + if (eptp & VMX_EPT_AD_ENABLE_BIT)
>> + exit_qualification |= EPT_VIOLATION_ACC_WRITE;
> I think this would be better without unconditional clearing
>
> if (!(eptp & VMX_EPT_AD_ENABLE_BIT))
> exit_qualification &= ~EPT_VIOLATION_ACC_WRITE;

Yeah, this is a remnant of my (failed) attempt at emulating A/D bits
when the processor doesn't support it. Which worked, only it's not
compliant enough to include it in the final series.

As for the two nits you found, shall I repost or are you okay with
fixing it yourself?

Paolo