From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752418AbbC0U6h (ORCPT ); Fri, 27 Mar 2015 16:58:37 -0400 Received: from g2t2354.austin.hp.com ([15.217.128.53]:42080 "EHLO g2t2354.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751882AbbC0U6f (ORCPT ); Fri, 27 Mar 2015 16:58:35 -0400 Message-ID: <1427488817.31093.54.camel@misato.fc.hp.com> Subject: Re: [PATCH v1 02/47] x86: mtrr: generalize run time disabling of MTRR From: Toshi Kani To: "Luis R. Rodriguez" Cc: luto@amacapital.net, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, jgross@suse.com, JBeulich@suse.com, bp@suse.de, suresh.b.siddha@intel.com, venkatesh.pallipadi@intel.com, airlied@redhat.com, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, x86@kernel.org, xen-devel@lists.xenproject.org, "Luis R. Rodriguez" , Ingo Molnar , Daniel Vetter , Antonino Daplas , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Dave Hansen , Stefan Bader , konrad.wilk@oracle.com, ville.syrjala@linux.intel.com, david.vrabel@citrix.com, bhelgaas@google.com, Roger Pau =?ISO-8859-1?Q?Monn=E9?= , xen-devel@lists.xensource.com Date: Fri, 27 Mar 2015 14:40:17 -0600 In-Reply-To: <1426893517-2511-3-git-send-email-mcgrof@do-not-panic.com> References: <1426893517-2511-1-git-send-email-mcgrof@do-not-panic.com> <1426893517-2511-3-git-send-email-mcgrof@do-not-panic.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 Fri, 2015-03-20 at 16:17 -0700, Luis R. Rodriguez wrote: : > @@ -734,6 +742,7 @@ void __init mtrr_bp_init(void) > } > > if (mtrr_if) { > + mtrr_enabled = true; > set_num_var_ranges(); > init_table(); > if (use_intel()) { get_mtrr_state(); After setting mtrr_enabled to true, get_mtrr_state() reads MSR_MTRRdefType and sets 'mtrr_state.enabled', which also indicates if MTRRs are enabled or not on the system. So, potentially, we could have a case that mtrr_enabled is set to true, but mtrr_state.enabled is set to disabled when MTRRs are disabled by BIOS. Thanks, -Toshi ps. I recently cleaned up this part of the MTRR code in the patch below, which is currently available in the -mm & -next trees. https://lkml.org/lkml/2015/3/24/1063 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Toshi Kani Date: Fri, 27 Mar 2015 20:40:17 +0000 Subject: Re: [PATCH v1 02/47] x86: mtrr: generalize run time disabling of MTRR Message-Id: <1427488817.31093.54.camel@misato.fc.hp.com> List-Id: References: <1426893517-2511-1-git-send-email-mcgrof@do-not-panic.com> <1426893517-2511-3-git-send-email-mcgrof@do-not-panic.com> In-Reply-To: <1426893517-2511-3-git-send-email-mcgrof@do-not-panic.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: "Luis R. Rodriguez" Cc: luto@amacapital.net, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, jgross@suse.com, JBeulich@suse.com, bp@suse.de, suresh.b.siddha@intel.com, venkatesh.pallipadi@intel.com, airlied@redhat.com, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, x86@kernel.org, xen-devel@lists.xenproject.org, "Luis R. Rodriguez" , Ingo Molnar , Daniel Vetter , Antonino Daplas , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Dave Hansen , Stefan Bader , konrad.wilk@oracle.com, ville.syrjala@linux.intel.com, david.vrabel@citrix.com, bhelgaas@google.com, Roger Pau =?ISO-8859-1?Q?Monn=E9?= , xen-devel@lists.xensource.com On Fri, 2015-03-20 at 16:17 -0700, Luis R. Rodriguez wrote: : > @@ -734,6 +742,7 @@ void __init mtrr_bp_init(void) > } > > if (mtrr_if) { > + mtrr_enabled = true; > set_num_var_ranges(); > init_table(); > if (use_intel()) { get_mtrr_state(); After setting mtrr_enabled to true, get_mtrr_state() reads MSR_MTRRdefType and sets 'mtrr_state.enabled', which also indicates if MTRRs are enabled or not on the system. So, potentially, we could have a case that mtrr_enabled is set to true, but mtrr_state.enabled is set to disabled when MTRRs are disabled by BIOS. Thanks, -Toshi ps. I recently cleaned up this part of the MTRR code in the patch below, which is currently available in the -mm & -next trees. https://lkml.org/lkml/2015/3/24/1063