[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <38324471.J2Yia2DhmK@jkrzyszt-mobl2.ger.corp.intel.com>
Date: Wed, 07 Jun 2023 19:11:04 +0200
From: Janusz Krzysztofik <janusz.krzysztofik@...ux.intel.com>
To: Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...el.com>
Cc: Juergen Gross <jgross@...e.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
Andi Shyti <andi.shyti@...ux.intel.com>,
intel-gfx@...ts.freedesktop.org,
Johannes Weiner <hannes@...xchg.org>,
Janusz Krzysztofik <janusz.krzysztofik@...ux.intel.com>
Subject: Re: [PATCH v2] x86/mm: Fix PAT bit missing from page protection modify mask
On Wednesday, 7 June 2023 17:31:24 CEST Dave Hansen wrote:
> On 6/7/23 08:23, Janusz Krzysztofik wrote:
> >
> > Extend bitmask used by pgprot_modify() for selecting bits to be preserved
> > with _PAGE_PAT bit. However, since that bit can be reused as _PAGE_PSE,
> > and the _PAGE_CHG_MASK symbol, primarly used by pte_modify(), is likely
> > intentionally defined with that bit not set, keep that symbol unchanged.
>
> I'm really having a hard time parsing what that last sentence is saying.
>
> Could you try again, please?
OK, but then I need to get my doubts addressed by someone first, otherwise I'm
not able to provide a better justification from my heart.
The issue needs to be fixed by including _PAGE_PAT bit into a bitmask used
by pgprot_modify() for selecting bits to be preserved. We can either do
that internally to pgprot_modify() (my initial proposal, which my poorly
worded paragraph was still trying to describe and justify), or by making
_PAGE_PAT a part of _PAGE_CHG_MASK, as suggested by Borislav and reflected in
my v2 changelog. But for the latter, I think we need to make sure that we
don't break other users of _PAGE_CHG_MASK. Maybe Borislav can confirm that's
the case.
Since _PAGE_PAT is the same as _PAGE_PSE, _HPAGE_CHG_MASK -- a huge pmds'
counterpart of _PAGE_CHG_MASK, introduced by commit c489f1257b8c ("thp: add
pmd_modify"), defined as (_PAGE_CHG_MASK | _PAGE_PSE) -- will no longer differ
from _PAGE_CHG_MASK as soon as we add _PAGE_PAT bit to the latter. If such
modification of _PAGE_CHG_MASK was irrelevant to its users then one may ask
why a new symbol was introduced instead of reusing the existing one with that
otherwise irrelevant bit (_PAGE_PSE in that case) added. I've initially
assumed that keeping _PAGE_CHG_MASK without _PAGE_PSE (vel _PAGE_PAT) included
into it was intentional for some reason. Maybe Johannes Weiner, the author of
that patch (adding him to Cc:), could shed more light on that.
Thanks,
Janusz
Powered by blists - more mailing lists