From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753489AbbCWTp1 (ORCPT ); Mon, 23 Mar 2015 15:45:27 -0400 Received: from g4t3427.houston.hp.com ([15.201.208.55]:35273 "EHLO g4t3427.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753338AbbCWTpX (ORCPT ); Mon, 23 Mar 2015 15:45:23 -0400 Message-ID: <1427138833.31093.24.camel@misato.fc.hp.com> Subject: Re: [PATCH v3 4/5] mtrr, x86: Clean up mtrr_type_lookup() From: Toshi Kani To: Ingo Molnar Cc: "akpm@linux-foundation.org" , "hpa@zytor.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "linux-mm@kvack.org" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "dave.hansen@intel.com" , "Elliott, Robert (Server Storage)" , "pebolle@tiscali.nl" Date: Mon, 23 Mar 2015 13:27:13 -0600 In-Reply-To: References: <1426282421-25385-1-git-send-email-toshi.kani@hp.com> <1426282421-25385-5-git-send-email-toshi.kani@hp.com> ,<20150316075821.GA16062@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2015-03-16 at 21:24 +0000, Kani, Toshimitsu wrote: > > On Mar 16, 2015, at 3:58 AM, Ingo Molnar wrote: > >> * Toshi Kani wrote: : > > >> + if (!(mtrr_state.have_fixed) || > >> + !(mtrr_state.enabled & MTRR_STATE_MTRR_FIXED_ENABLED)) > > > > Btw., can MTRR_STATE_MTRR_FIXED_ENABLED ever be set in > > mtrr_state.enabled, without mtrr_state.have_fixed being set? > > Yes, I believe the arch allows the fixed entries disabled > while MTRRs are enabled. I expect the most of systems > implement the fixed entries, though. Sorry, I noticed I had mis-read your question before... No, MTRR_STATE_MTRR_FIXED_ENABLED may not be set without mtrr_state.have_fixed being set. mtrr_state.have_fixed indicates if the CPU supports MTRR fixed ranges. So, they can be only enabled when the CPU has ones. > > AFAICS get_mtrr_state() will only ever fill in mtrr_state with fixed > > MTRRs if mtrr_state.have_fixed != 0 - but I might be mis-reading the > > (rather convoluted) flow of code ... > > I will check the code next week. Yes, you are right that get_mtrr_state() only fills in mtrr_state.fixed_ranges[] when mtrr_state.have_fixed is set. This is because the MSRs containing the fixed ranges are only valid when this flag is set. Thanks, -Toshi