lkml.org 
[lkml]   [2016]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] x86/mm/pat: Change pat_disable() to emulate PAT table
From
Date
On Fri, 2016-03-11 at 16:54 +0100, Borislav Petkov wrote:
> 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.

Sorry, I meant to say -- "How about renaming pat_disable_init() to
pat_disable_setup()?" since I thought you had suggested to rename
pat_disable_init() to pat_setup().  I am still in favor of having a
separate setup func for the disabled case.

> > 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;

Hmm...  I do not think I understand this.  When pat_bsp_init() calls
pat_disable(), 'pat' has been set to the "Full PAT support" setup.  So, we
need to reset 'pat' to the "No PAT" setup.  How is this handled in your
case?


> >  - 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.

I think this leads more complication in the end.  pat_init() covers (too)
many scenarios already, and moving the disabled setup case out will
simplify it, IMHO.

Thanks,
-Toshi

\
 
 \ /
  Last update: 2016-03-11 20:01    [W:0.088 / U:1.916 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site