From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 1/9] KVM: MMU: fix decoding cache type from MTRR Date: Thu, 07 May 2015 10:07:42 +0800 Message-ID: <554AC8EE.50607@linux.intel.com> References: <1430389490-24602-1-git-send-email-guangrong.xiao@linux.intel.com> <1430389490-24602-12-git-send-email-guangrong.xiao@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Paolo Bonzini , Gleb Natapov , Marcelo Tosatti , kvm list , "linux-kernel@vger.kernel.org" To: David Matlack Return-path: Received: from mga01.intel.com ([192.55.52.88]:54186 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751202AbbEGCKz (ORCPT ); Wed, 6 May 2015 22:10:55 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 05/07/2015 05:42 AM, David Matlack wrote: > On Thu, Apr 30, 2015 at 3:24 AM, wrote: >> From: Xiao Guangrong >> >> 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.