All of lore.kernel.org
 help / color / mirror / Atom feed
From: Demi Marie Obenour <demi@invisiblethingslab.com>
To: Andrew Cooper <Andrew.Cooper3@citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Roger Pau Monne" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
	"George Dunlap" <George.Dunlap@citrix.com>,
	"Tim (Xen.org)" <tim@xen.org>
Subject: Re: [PATCH 6/8] x86: Derive XEN_MSR_PAT from its individual entries
Date: Tue, 6 Dec 2022 17:51:20 -0500	[thread overview]
Message-ID: <Y4/HfLMVPLOmiphM@itl-email> (raw)
In-Reply-To: <ac0605b2-5c1c-09f2-9526-1aa7e777e7dc@citrix.com>

[-- Attachment #1: Type: text/plain, Size: 1907 bytes --]

On Tue, Dec 06, 2022 at 11:32:16AM +0000, Andrew Cooper wrote:
> On 06/12/2022 04:33, Demi Marie Obenour wrote:
> > This avoids it being a magic constant that is difficult for humans to
> > decode.  Use a _Static_assert to check that the old and new values are
> > identical.
> >
> > Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
> > ---
> >  xen/arch/x86/include/asm/processor.h | 22 +++++++++++++++++++++-
> >  1 file changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
> > index 8e2816fae9b97bd4e153a30cc3802971fe0355af..64b75e444947c64e2e5eba457deec92a873d7a63 100644
> > --- a/xen/arch/x86/include/asm/processor.h
> > +++ b/xen/arch/x86/include/asm/processor.h
> > @@ -92,13 +92,33 @@
> >                            X86_EFLAGS_NT|X86_EFLAGS_DF|X86_EFLAGS_IF|    \
> >                            X86_EFLAGS_TF)
> >  
> > +/* Individual entries in IA32_CR_PAT */
> > +#define MSR_PAT_UC  _AC(0x00, ULL)
> > +#define MSR_PAT_WC  _AC(0x01, ULL)
> > +#define MSR_PAT_RESERVED_1  _AC(0x02, ULL)
> > +#define MSR_PAT_RESERVED_2  _AC(0x03, ULL)
> > +#define MSR_PAT_WT  _AC(0x04, ULL)
> > +#define MSR_PAT_WP  _AC(0x05, ULL)
> > +#define MSR_PAT_WB  _AC(0x06, ULL)
> > +#define MSR_PAT_UCM _AC(0x07, ULL)
> 
> This isn't really correct.  Constants for MSRs typically live in
> msr-index.h, but these are architectural x86 memory types.
> 
> These ought be
> 
> #define X86_MT_$X ...  (skipping the two reserved values)
> 
> in x86-defns.h, and the PAT_TYPE_*, MTRR_TYPE_* and EPT_EMT_* constants
> want removing.
> 
> There are two minor restrictions (EPT can't have UCM, MTRR can't have
> WC),

The code seems to indicate otherwise: it behaves as if both EPT and MTRR
cannot have UCM.
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2022-12-06 22:52 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06  4:33 [PATCH 0/8] Make PAT handling less brittle Demi Marie Obenour
2022-12-06  4:33 ` [PATCH 1/8] x86/mm: Avoid hard-coding PAT in get_page_from_l1e() Demi Marie Obenour
2022-12-06 10:42   ` Andrew Cooper
2022-12-06 11:07     ` Jan Beulich
2022-12-06 11:05   ` Jan Beulich
2022-12-06  4:33 ` [PATCH 2/8] p2m-pt: Avoid hard-coding Xen's PAT Demi Marie Obenour
2022-12-06 10:59   ` Andrew Cooper
2022-12-06 11:10     ` Jan Beulich
2022-12-06  4:33 ` [PATCH 3/8] x86/mm/shadow: avoid assuming a specific Xen PAT Demi Marie Obenour
2022-12-06 11:00   ` Andrew Cooper
2022-12-06  4:33 ` [PATCH 4/8] efi: Avoid hard-coding the various PAT constants Demi Marie Obenour
2022-12-06 11:15   ` Jan Beulich
2022-12-06 11:17   ` Andrew Cooper
2022-12-06 11:40     ` Jan Beulich
2022-12-06 17:38     ` Demi Marie Obenour
2022-12-06  4:33 ` [PATCH 5/8] x86/mm/shadow: do not open-code PAGE_CACHE_ATTRS Demi Marie Obenour
2022-12-06 11:17   ` Jan Beulich
2022-12-06  4:33 ` [PATCH 6/8] x86: Derive XEN_MSR_PAT from its individual entries Demi Marie Obenour
2022-12-06 11:32   ` Andrew Cooper
2022-12-06 11:43     ` Jan Beulich
2022-12-06 17:44     ` Demi Marie Obenour
2022-12-06 22:51     ` Demi Marie Obenour [this message]
2022-12-06 11:35   ` Jan Beulich
2022-12-06  4:33 ` [PATCH 7/8] x86/mm: make code robust to future PAT changes Demi Marie Obenour
2022-12-06 12:01   ` Jan Beulich
2022-12-06 12:06   ` Andrew Cooper
2022-12-06 17:55     ` Demi Marie Obenour
2022-12-07  9:41       ` Jan Beulich
2022-12-07 12:14         ` Andrew Cooper
2022-12-06  4:33 ` [RFC PATCH 8/8] Use Linux's PAT Demi Marie Obenour
2022-12-06 11:38   ` Andrew Cooper
2022-12-06 18:01     ` Demi Marie Obenour
2022-12-06 18:12       ` Marek Marczykowski-Górecki
2022-12-06 19:47         ` Demi Marie Obenour
2022-12-06 20:53           ` Marek Marczykowski-Górecki
2022-12-13  1:31         ` Demi Marie Obenour

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=Y4/HfLMVPLOmiphM@itl-email \
    --to=demi@invisiblethingslab.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=George.Dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=marmarek@invisiblethingslab.com \
    --cc=roger.pau@citrix.com \
    --cc=tim@xen.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.