From: Thomas Gleixner <tglx@linutronix.de>
To: Juergen Gross <jgross@suse.com>
Cc: hpa@zytor.com, x86@kernel.org, mingo@redhat.com,
stefan.bader@canonical.com, linux-kernel@vger.kernel.org,
xen-devel@lists.xensource.com, konrad.wilk@oracle.com,
ville.syrjala@linux.intel.com, david.vrabel@citrix.com,
jbeulich@suse.com, toshi.kani@hp.com, plagnioj@jcrosoft.com,
tomi.valkeinen@ti.com, bhelgaas@google.com
Subject: Re: [PATCH 10/17] x86: Use new cache mode type in setting page attributes
Date: Mon, 3 Nov 2014 11:31:04 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.11.1411031122150.5308@nanos> (raw)
In-Reply-To: <54572182.8080005@suse.com>
On Mon, 3 Nov 2014, Juergen Gross wrote:
> On 10/31/2014 04:34 PM, Thomas Gleixner wrote:
> > On Fri, 31 Oct 2014, Juergen Gross wrote:
> > > --- a/arch/x86/mm/pageattr.c
> > > +++ b/arch/x86/mm/pageattr.c
> > > @@ -1304,12 +1304,6 @@ static int __change_page_attr_set_clr(struct
> > > cpa_data *cpa, int checkalias)
> > > return 0;
> > > }
> > >
> > > -static inline int cache_attr(pgprot_t attr)
> > > -{
> > > - return pgprot_val(attr) &
> > > - (_PAGE_PAT | _PAGE_PAT_LARGE | _PAGE_PWT | _PAGE_PCD);
> > > -}
> > > -
> > > static int change_page_attr_set_clr(unsigned long *addr, int numpages,
> > > pgprot_t mask_set, pgprot_t mask_clr,
> > > int force_split, int in_flag,
> > > @@ -1390,7 +1384,7 @@ static int change_page_attr_set_clr(unsigned long
> > > *addr, int numpages,
> > > * No need to flush, when we did not set any of the caching
> > > * attributes:
> > > */
> > > - cache = cache_attr(mask_set);
> > > + cache = !!pgprot2cachemode(mask_set);
> >
> > So this loses _PAGE_PAT_LARGE, right ?
>
> change_page_attr_set_clr() is never called with _PAGE_PAT_LARGE set in
> mask, so this is no problem.
Ok. The we should have a separate patch which removes it first with a
proper explanation and then the one which uses pgprot2cachemode().
> BTW: correct handling of the PAT bit for large pages is added in
> patch 15. There have been places in the kernel respecting
> _PAGE_PAT_LARGE, but handling has never been complete up to now.
Yes. I've seen that.
> > > int _set_memory_wb(unsigned long addr, int numpages)
> > > {
> > > + /* WB cache mode is hard wired to all cache attribute bits being 0 */
> >
> > I like the comment, but shouldn't we compile time check that
> > assumption somewhere?
>
> There is a comment in patch 1 where the page_cache_mode enum is set up.
> The translation functions between page_cache_mode and protection values
> have a special check for "0" built in. Isn't this enough?
>
> BTW: How would you check this assumption at compile time? The
> translation between WB cache mode and protection values is done only
> dynamically...
Indeed.
Thanks,
tglx
next prev parent reply other threads:[~2014-11-03 10:31 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-31 14:00 [PATCH 00/17] x86: Full support of PAT Juergen Gross
2014-10-31 14:00 ` [PATCH 01/17] x86: Make page cache mode a real type Juergen Gross
2014-10-31 19:42 ` Borislav Petkov
2014-10-31 20:23 ` Konrad Rzeszutek Wilk
2014-10-31 20:35 ` Borislav Petkov
2014-11-03 6:36 ` Juergen Gross
2014-11-03 10:31 ` Thomas Gleixner
2014-10-31 20:28 ` Thomas Gleixner
2014-10-31 14:00 ` [PATCH 02/17] x86: Use new cache mode type in include/asm/fb.h Juergen Gross
2014-10-31 14:00 ` [PATCH 03/17] x86: Use new cache mode type in drivers/video/fbdev/gbefb.c Juergen Gross
2014-10-31 14:00 ` [PATCH 04/17] x86: Use new cache mode type in drivers/video/fbdev/vermilion Juergen Gross
2014-10-31 14:00 ` [PATCH 05/17] x86: Use new cache mode type in arch/x86/pci Juergen Gross
2014-10-31 14:00 ` [PATCH 06/17] x86: Use new cache mode type in arch/x86/mm/init_64.c Juergen Gross
2014-10-31 14:00 ` [PATCH 07/17] x86: Use new cache mode type in asm/pgtable.h Juergen Gross
2014-10-31 14:00 ` [PATCH 08/17] x86: Use new cache mode type in mm/iomap_32.c Juergen Gross
2014-10-31 14:00 ` [PATCH 09/17] x86: Use new cache mode type in track_pfn_remap() and track_pfn_insert() Juergen Gross
2014-10-31 14:00 ` [PATCH 10/17] x86: Use new cache mode type in setting page attributes Juergen Gross
2014-10-31 15:34 ` Thomas Gleixner
2014-11-03 6:32 ` Juergen Gross
2014-11-03 10:31 ` Thomas Gleixner [this message]
2014-10-31 14:00 ` [PATCH 11/17] x86: Use new cache mode type in mm/ioremap.c Juergen Gross
2014-10-31 14:00 ` [PATCH 12/17] x86: Use new cache mode type in memtype related functions Juergen Gross
2014-10-31 14:00 ` [PATCH 13/17] x86: Clean up pgtable_types.h Juergen Gross
2014-10-31 14:00 ` [PATCH 14/17] x86: Support PAT bit in pagetable dump for lower levels Juergen Gross
2014-10-31 14:00 ` [PATCH 15/17] x86: Respect PAT bit when copying pte values between large and normal pages Juergen Gross
2014-10-31 14:00 ` [PATCH 16/17] x86: Enable PAT to use cache mode translation tables Juergen Gross
2014-10-31 14:00 ` [PATCH 17/17] xen: Support Xen pv-domains using PAT Juergen Gross
2014-10-31 14:06 ` [PATCH 00/17] x86: Full support of PAT Ingo Molnar
2014-10-31 14:08 ` Juergen Gross
2014-10-31 18:53 ` Thomas Gleixner
2014-11-03 6:44 ` 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=alpine.DEB.2.11.1411031122150.5308@nanos \
--to=tglx@linutronix.de \
--cc=bhelgaas@google.com \
--cc=david.vrabel@citrix.com \
--cc=hpa@zytor.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=plagnioj@jcrosoft.com \
--cc=stefan.bader@canonical.com \
--cc=tomi.valkeinen@ti.com \
--cc=toshi.kani@hp.com \
--cc=ville.syrjala@linux.intel.com \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xensource.com \
/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®