[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1457713660.6393.55.camel@hpe.com>
Date: Fri, 11 Mar 2016 09:27:40 -0700
From: Toshi Kani <toshi.kani@....com>
To: Borislav Petkov <bp@...en8.de>
Cc: "mingo@...nel.org" <mingo@...nel.org>, "bp@...e.de" <bp@...e.de>,
"hpa@...or.com" <hpa@...or.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mcgrof@...e.com" <mcgrof@...e.com>,
"jgross@...e.com" <jgross@...e.com>,
"paul.gortmaker@...driver.com" <paul.gortmaker@...driver.com>,
"x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] x86/mm/pat: Change pat_disable() to emulate PAT
table
On Fri, 2016-03-11 at 09:12 +0000, Borislav Petkov wrote:
> On Thu, Mar 10, 2016 at 09:45:45PM -0700, Toshi Kani wrote:
:
> >
> > -static inline void pat_disable(const char *reason)
> > +void pat_disable(const char *reason)
> > {
> > + if (boot_cpu_done) {
> > + pr_info("x86/PAT: PAT cannot be disabled after
> > initialized\n");
>
> pr_err()
Will do.
>
> > + return;
> > + }
> > +
> > __pat_enabled = 0;
> > pr_info("x86/PAT: %s\n", reason);
> > +
> > + pat_disable_init();
>
> Why can't you call pat_init() here simply? It checks pat_enabled(). You
> can call it pat_setup() or so if it looks confusing to call an init
> function in a disable function...
How about pat_disable_setup()? It's only used for the disabled case, so
I'd prefer to keep the word "disable".
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().
- 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.
> 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.
> Also, I don't see the static_cpu_has() check I suggested yesterday - we
> need to check the feature bits if PAT gets disabled early on some old
> Intels.
Sorry, I should have mentioned it. I ended up not needing this change. The
table in patch 2/2 covers this case as:
MTRR PAT ACTION
====================================================================
E D MTRR calls pat_init() -> PAT disabled per cpu_has_pat
That is, the check with cpu_has_pat in pat_bsp_init() calls pat_disable()
in this case. I preferred this way because it will continue to log a
message "PAT not supported by CPU.", and keeps __pat_enabled as the single
variable to manage the PAT state.
Thanks,
-Toshi
Powered by blists - more mailing lists