Re: [PATCH 1/9] KVM: MMU: fix decoding cache type from MTRR

From: Xiao Guangrong
Date: Wed May 06 2015 - 22:11:02 EST




On 05/07/2015 05:42 AM, David Matlack wrote:
On Thu, Apr 30, 2015 at 3:24 AM, <guangrong.xiao@xxxxxxxxxxxxxxx> wrote:
From: Xiao Guangrong <guangrong.xiao@xxxxxxxxxxxxxxx>

There are some bugs in current get_mtrr_type();
1: bit 2 of mtrr_state->enabled is corresponding bit 11 of IA32_MTRR_DEF_TYPE

bit 1, not bit 2. (code is correct though)

Oh, i counted the bit from 1, my fault. :(


MSR which completely control MTRR's enablement that means other bits are
ignored if it is cleared

2: the fixed MTRR ranges are controlled by bit 1 of mtrr_state->enabled (bit 10

bit 0, not bit 1. (code is correct though)

Ditto. Will update the changelog in v2. Thank you for pointing it out.


of IA32_MTRR_DEF_TYPE)

3: if MTRR is disabled, UC is applied to all of physical memory rather than
mtrr_state->def_type

kvm_get_guest_memory_type defaults to MTRR_TYPE_WRBACK, not
mtrr_state->def_type, when get_mtrr_type returns 0xFF.


Yeah, that confused me. Based on the comment of vmx_get_mt_mask():
* a. VT-d without snooping control feature: can't guarantee the
* result, try to trust guest.
we need to completely follow guest's MTRR under this case.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/