From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: "Hansen, Dave" <dave.hansen@intel.com>,
"bp@alien8.de" <bp@alien8.de>,
"Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
Cc: "Gross, Jurgen" <jgross@suse.com>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"andi.shyti@linux.intel.com" <andi.shyti@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"hannes@cmpxchg.org" <hannes@cmpxchg.org>
Subject: Re: [PATCH v2] x86/mm: Fix PAT bit missing from page protection modify mask
Date: Wed, 07 Jun 2023 23:33:05 +0200 [thread overview]
Message-ID: <20819659.0c2gjJ1VT2@jkrzyszt-mobl2.ger.corp.intel.com> (raw)
In-Reply-To: <ad762335fd209fd8c1555401bc03e196eb53caef.camel@intel.com>
On Wednesday, 7 June 2023 23:12:13 CEST Edgecombe, Rick P wrote:
> On Wed, 2023-06-07 at 19:11 +0200, Janusz Krzysztofik wrote:
> > 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.
>
> So since _PAGE_PSE is actually the same value as _PAGE_PAT, you don't
> actually need to have _PAGE_PSE in _HPAGE_CHG_MASK in order to get
> functional correctness. Is that right?
As soon as we add _PAGE_PAT to _PAGE_CHG_MASK -- yes, that's right. But we
may still want to add _PAGE_PSE to _HPAGE_CHG_MASK to have the need for that
bit explicitly documented.
>
> I think it is still a little hidden (even before this) and I wonder
> about separating out the common bits into, like, _COMMON_PAGE_CHG_MASK
> or something. Then setting specific PAGE and HPAGE bits (like
> _PAGE_PAT, _PAGE_PSE and _PAGE_PAT_LARGE) in their specific define.
> Would it be more readable that way?
Yes, I think that's a good idea, and I can use it in my patch.
The question if _PAGE_PAT vel _PAGE_PSE added to _PAGE_CHG_MASK is really
harmless for pte_modify() and its users is still open for me though.
Thanks,
Janusz
next prev parent reply other threads:[~2023-06-07 21:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 15:23 Janusz Krzysztofik
2023-06-07 15:31 ` Dave Hansen
2023-06-07 17:11 ` Janusz Krzysztofik
2023-06-07 21:12 ` Edgecombe, Rick P
2023-06-07 21:33 ` Janusz Krzysztofik [this message]
2023-06-07 22:47 ` Edgecombe, Rick P
2023-06-08 13:19 ` Janusz Krzysztofik
2023-06-08 5:15 ` Juergen Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20819659.0c2gjJ1VT2@jkrzyszt-mobl2.ger.corp.intel.com \
--to=janusz.krzysztofik@linux.intel.com \
--cc=andi.shyti@linux.intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hannes@cmpxchg.org \
--cc=hpa@zytor.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®