Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "Hansen, Dave" <dave.hansen@intel.com>,
	"janusz.krzysztofik@linux.intel.com"
	<janusz.krzysztofik@linux.intel.com>,
	"bp@alien8.de" <bp@alien8.de>
Cc: "Gross, Jurgen" <jgross@suse.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>
Subject: Re: [Intel-gfx] [PATCH v2] x86/mm: Fix PAT bit missing from page protection modify mask
Date: Wed, 7 Jun 2023 22:47:36 +0000	[thread overview]
Message-ID: <8bcfad6697316e200f78bd13e737345dc0436404.camel@intel.com> (raw)
In-Reply-To: <20819659.0c2gjJ1VT2@jkrzyszt-mobl2.ger.corp.intel.com>

On Wed, 2023-06-07 at 23:33 +0200, Janusz Krzysztofik wrote:
> > 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.

_PAGE_PSE is already in _HPAGE_CHG_MASK though, right? I'm confused.

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

When you say "vel", this is similar to the english acronym "AKA" I
think?

So I think you mean, when you add _PAGE_PAT to _PAGE_CHG_MASK, you are
also adding _PAGE_PSE to it. So does that cause any problems? I see,
good question... 

vm_page_prot is used when creating PTEs and huge PMDs, and the setter
only uses _PAGE_CHG_MASK, even though it won't actually know where that
prot is going to end up.

Having _PAGE_PAT/PSE in _PAGE_CHG_MASK certainly doesn't make it easier
to think about. One thing it's favor though is vm_page_prot is not
applied to page table entries that are pointing to other page table
entries (PSE = 0). So you shouldn't accidentally set PSE=1. And
_PAGE_PSE shouldn't be being set in there, so you also shouldn't
accidentally be setting PAT=1.

But yea, I see why you are concerned. I would /guess/ it would be ok
functionally. That probably doesn't help much...

  reply	other threads:[~2023-06-07 22:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07 15:23 [Intel-gfx] [PATCH v2] x86/mm: Fix PAT bit missing from page protection modify mask 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
2023-06-07 22:47         ` Edgecombe, Rick P [this message]
2023-06-08 13:19           ` Janusz Krzysztofik
2023-06-08  5:15       ` Juergen Gross
2023-06-07 23:38 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for x86/mm: Fix PAT bit missing from page protection modify mask (rev2) Patchwork
2023-06-07 23:52 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-06-08 17:47 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

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=8bcfad6697316e200f78bd13e737345dc0436404.camel@intel.com \
    --to=rick.p.edgecombe@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=janusz.krzysztofik@linux.intel.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.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