From: Juergen Gross <jgross@suse.com>
To: Thomas Gleixner <tglx@linutronix.de>
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, 03 Nov 2014 07:32:34 +0100 [thread overview]
Message-ID: <54572182.8080005@suse.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1410311617260.5308@nanos>
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.
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.
>
>> int set_memory_uc(unsigned long addr, int numpages)
>> @@ -1456,7 +1451,7 @@ int set_memory_uc(unsigned long addr, int numpages)
>> * for now UC MINUS. see comments in ioremap_nocache()
>> */
>> ret = reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE,
>> - _PAGE_CACHE_UC_MINUS, NULL);
>> + _PAGE_CACHE_UC_MINUS, NULL);
>
> That should be in the patch which added the _PAGE_CACHE_UC_MINUS
>
>> 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...
Thanks for the review,
Juergen
next prev parent reply other threads:[~2014-11-03 6:32 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 [this message]
2014-11-03 10:31 ` Thomas Gleixner
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=54572182.8080005@suse.com \
--to=jgross@suse.com \
--cc=bhelgaas@google.com \
--cc=david.vrabel@citrix.com \
--cc=hpa@zytor.com \
--cc=jbeulich@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=tglx@linutronix.de \
--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;
as well as URLs for NNTP newsgroup(s).