Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751697AbbEGCK6 (ORCPT ); Wed, 6 May 2015 22:10:58 -0400 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 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,382,1427785200"; d="scan'208";a="706446000" Message-ID: <554AC8EE.50607@linux.intel.com> Date: Thu, 07 May 2015 10:07:42 +0800 From: Xiao Guangrong User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: David Matlack CC: Paolo Bonzini , Gleb Natapov , Marcelo Tosatti , kvm list , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/9] KVM: MMU: fix decoding cache type from MTRR References: <1430389490-24602-1-git-send-email-guangrong.xiao@linux.intel.com> <1430389490-24602-12-git-send-email-guangrong.xiao@linux.intel.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1464 Lines: 42 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/