Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932686AbcCKPzB (ORCPT ); Fri, 11 Mar 2016 10:55:01 -0500 Received: from mail.skyhub.de ([78.46.96.112]:36413 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932101AbcCKPy7 (ORCPT ); Fri, 11 Mar 2016 10:54:59 -0500 Date: Fri, 11 Mar 2016 16:54:39 +0100 From: Borislav Petkov To: Toshi Kani Cc: "mingo@kernel.org" , "hpa@zytor.com" , "tglx@linutronix.de" , "mcgrof@suse.com" , "jgross@suse.com" , "paul.gortmaker@windriver.com" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/2] x86/mm/pat: Change pat_disable() to emulate PAT table Message-ID: <20160311155439.GF4312@pd.tnic> References: <1457671546-13486-1-git-send-email-toshi.kani@hpe.com> <1457671546-13486-2-git-send-email-toshi.kani@hpe.com> <20160311091229.GA4347@pd.tnic> <1457713660.6393.55.camel@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1457713660.6393.55.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: 1390 Lines: 44 On Fri, Mar 11, 2016 at 09:27:40AM -0700, Toshi Kani wrote: > How about pat_disable_setup()?  It's only used for the disabled case, so > I'd prefer to keep the word "disable". What for? Renaming pat_init() to pat_setup() is perfectly fine as it sets up PAT after looking at pat_disabled() setting and after looking at the CPU vendor. Sounds like a perfectly sane design to me. > Yes, calling pat_init() from pat_disable() works too. I changed it in this > way because: >  - pat_bsp_init() calls pat_disabled() in an error case. It is simpler to > avoid a recursive call to pat_init(). So do this: static inline void pat_disable(const char *reason) { if (!__pat_enabled) return; >  - pat_bsp_init() has two different error paths, 1) call pat_disable() and > return, and 2) goto done and call pat_init_cache_modes(). We can remove > case 2) to keep the error handling consistent in this way. Above. > > Then you don't have to add yet another static disable_init_done but rely > > on boot_cpu_done which gets set in pat_init(). > > Right, but it will do 'boot_cpu_done = true' twice, and this implicit > recursive call may cause an issue in future if someone makes change > carelessly. So move boot_cpu_done into pat_bsp_init() and make it protect that function from a being called a second time. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply.