Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932434AbcCJVIc (ORCPT ); Thu, 10 Mar 2016 16:08:32 -0500 Received: from mx2.suse.de ([195.135.220.15]:42951 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932637AbcCJVHi (ORCPT ); Thu, 10 Mar 2016 16:07:38 -0500 Date: Thu, 10 Mar 2016 22:07:18 +0100 From: Borislav Petkov To: Toshi Kani Cc: Paul Gortmaker , Richard Purdie , Toshi Kani , Bruce Ashfield , "Hart, Darren" , "saul.wold" , linux-kernel@vger.kernel.org Subject: Re: runtime regression with "x86/mm/pat: Emulate PAT when it is disabled" Message-ID: <20160310210718.GE2194@pd.tnic> References: <1457393912.15454.419.camel@hpe.com> <20160307235328.GD26051@windriver.com> <1457398578.15454.421.camel@hpe.com> <1457400913.15454.435.camel@hpe.com> <20160310144250.GG23251@windriver.com> <1457628591.15454.542.camel@hpe.com> <20160310172029.GA2194@pd.tnic> <1457640261.15454.551.camel@hpe.com> <20160310192053.GD2194@pd.tnic> <1457641451.15454.561.camel@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1457641451.15454.561.camel@hpe.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1642 Lines: 56 On Thu, Mar 10, 2016 at 01:24:11PM -0700, Toshi Kani wrote: > I am not familiar with PPRO_FEATURES, That's the feature bits of the "qemu32" model, and others, in qemu. > but shouldn't 'flags' in /proc/cpuinfo show "pat" when X86_FEATURE_PAT is set? static void early_init_intel(struct cpuinfo_x86 *c) ... /* * There is a known erratum on Pentium III and Core Solo * and Core Duo CPUs. * " Page with PAT set to WC while associated MTRR is UC * may consolidate to UC " * Because of this erratum, it is better to stick with * setting WC in MTRR rather than using PAT on these CPUs. * * Enable PAT WC only on P4, Core 2 or later CPUs. */ if (c->x86 == 6 && c->x86_model < 15) clear_cpu_cap(c, X86_FEATURE_PAT); --- which also gives a hint as to how we should fix this: pat_enabled() needs to look at that feature bit too: --- diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index faec01e7a17d..359c30d9a78c 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c @@ -56,7 +56,7 @@ early_param("nopat", nopat); bool pat_enabled(void) { - return !!__pat_enabled; + return !!__pat_enabled && static_cpu_has(X86_FEATURE_PAT); } EXPORT_SYMBOL_GPL(pat_enabled); --- Makes sense? > pat_init() is being called as part of MTRR setup because PAT > initialization requires the same CPU rendezvous operation implemented > in the MTRR code. ... which means, PAT depends on MTRR being present. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --