From: Juergen Gross <jgross@suse.com>
To: Steven Noonan <steven@uplinklabs.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Linux-X86 <x86@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
stefan.bader@canonical.com,
Linux Kernel mailing List <linux-kernel@vger.kernel.org>,
xen-devel@lists.xensource.com,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
ville.syrjala@linux.intel.com,
David Vrabel <david.vrabel@citrix.com>,
Jan Beulich <jbeulich@suse.com>,
toshi.kani@hp.com, plagnioj@jcrosoft.com, tomi.valkeinen@ti.com,
bhelgaas@google.com
Subject: Re: [PATCH V6 01/18] x86: Make page cache mode a real type
Date: Thu, 22 Jan 2015 11:15:52 +0100 [thread overview]
Message-ID: <54C0CDD8.2010205@suse.com> (raw)
In-Reply-To: <CAKbGBLhzOPXqWuDwEoqnvC05c1cFgXrJMHFmeCjwUYcff==F3A@mail.gmail.com>
On 01/22/2015 08:11 AM, Steven Noonan wrote:
> On Mon, Nov 3, 2014 at 5:01 AM, Juergen Gross <jgross@suse.com> wrote:
>> At the moment there are a lot of places that handle setting or getting
>> the page cache mode by treating the pgprot bits equal to the cache mode.
>> This is only true because there are a lot of assumptions about the setup
>> of the PAT MSR. Otherwise the cache type needs to get translated into
>> pgprot bits and vice versa.
>>
>> This patch tries to prepare for that by introducing a separate type
>> for the cache mode and adding functions to translate between those and
>> pgprot values.
>>
>> To avoid too much performance penalty the translation between cache mode
>> and pgprot values is done via tables which contain the relevant
>> information. Write-back cache mode is hard-wired to be 0, all other
>> modes are configurable via those tables. For large pages there are
>> translation functions as the PAT bit is located at different positions
>> in the ptes of 4k and large pages.
>>
>> Based-on-patch-by: Stefan Bader <stefan.bader@canonical.com>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
>> ---
...
>> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
>> index 66dba36..a9776ba 100644
>> --- a/arch/x86/mm/init.c
>> +++ b/arch/x86/mm/init.c
>> @@ -27,6 +27,35 @@
>>
>> #include "mm_internal.h"
>>
>> +/*
>> + * Tables translating between page_cache_type_t and pte encoding.
>> + * Minimal supported modes are defined statically, modified if more supported
>> + * cache modes are available.
>> + * Index into __cachemode2pte_tbl is the cachemode.
>> + * Index into __pte2cachemode_tbl are the caching attribute bits of the pte
>> + * (_PAGE_PWT, _PAGE_PCD, _PAGE_PAT) at index bit positions 0, 1, 2.
>> + */
>> +uint16_t __cachemode2pte_tbl[_PAGE_CACHE_MODE_NUM] = {
>> + [_PAGE_CACHE_MODE_WB] = 0,
>> + [_PAGE_CACHE_MODE_WC] = _PAGE_PWT,
>> + [_PAGE_CACHE_MODE_UC_MINUS] = _PAGE_PCD,
>> + [_PAGE_CACHE_MODE_UC] = _PAGE_PCD | _PAGE_PWT,
>> + [_PAGE_CACHE_MODE_WT] = _PAGE_PCD,
>> + [_PAGE_CACHE_MODE_WP] = _PAGE_PCD,
>> +};
>> +EXPORT_SYMBOL_GPL(__cachemode2pte_tbl);
>> +uint8_t __pte2cachemode_tbl[8] = {
>> + [__pte2cm_idx(0)] = _PAGE_CACHE_MODE_WB,
>> + [__pte2cm_idx(_PAGE_PWT)] = _PAGE_CACHE_MODE_WC,
>> + [__pte2cm_idx(_PAGE_PCD)] = _PAGE_CACHE_MODE_UC_MINUS,
>> + [__pte2cm_idx(_PAGE_PWT | _PAGE_PCD)] = _PAGE_CACHE_MODE_UC,
>> + [__pte2cm_idx(_PAGE_PAT)] = _PAGE_CACHE_MODE_WB,
>> + [__pte2cm_idx(_PAGE_PWT | _PAGE_PAT)] = _PAGE_CACHE_MODE_WC,
>> + [__pte2cm_idx(_PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS,
>> + [__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC,
>> +};
>> +EXPORT_SYMBOL_GPL(__pte2cachemode_tbl);
>> +
>
> I notice these two symbols are exported GPL-only. This breaks builds
> of several out-of-tree non-GPL modules such as the NVIDIA driver, and
> VMware modules, etc. What is the appropriate code path for proprietary
> modules to use when setting page cache mode flags? Alternatively, is
> it possible for these EXPORT_SYMBOL_GPLs to be changed to
> EXPORT_SYMBOL?
I don't mind you sending a patch to change this. I won't object such a
patch. OTOH this is more kind of a political question and I don't want
to spend my time on arguing.
Juergen
next prev parent reply other threads:[~2015-01-22 10:16 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 13:01 [PATCH V6 00/18] x86: Full support of PAT Juergen Gross
2014-11-03 13:01 ` [PATCH V6 01/18] x86: Make page cache mode a real type Juergen Gross
2014-11-16 10:54 ` [tip:x86/mm] " tip-bot for Juergen Gross
2015-01-22 7:11 ` [PATCH V6 01/18] " Steven Noonan
2015-01-22 10:15 ` Juergen Gross [this message]
2015-01-22 11:06 ` Thomas Gleixner
2015-01-22 11:11 ` Juergen Gross
2014-11-03 13:01 ` [PATCH V6 02/18] x86: Use new cache mode type in include/asm/fb.h Juergen Gross
2014-11-16 10:54 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 03/18] x86: Use new cache mode type in drivers/video/fbdev/gbefb.c Juergen Gross
2014-11-07 8:16 ` Tomi Valkeinen
2014-11-07 8:16 ` Tomi Valkeinen
2014-11-16 10:55 ` [tip:x86/mm] x86: Use new cache mode type in drivers/video/fbdev/ gbefb.c tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 04/18] x86: Use new cache mode type in drivers/video/fbdev/vermilion Juergen Gross
2014-11-16 10:55 ` [tip:x86/mm] x86: Use new cache mode type in drivers/video/fbdev/ vermilion tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 05/18] x86: Use new cache mode type in arch/x86/pci Juergen Gross
2014-11-16 10:55 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 06/18] x86: Use new cache mode type in arch/x86/mm/init_64.c Juergen Gross
2014-11-16 10:55 ` [tip:x86/mm] x86: Use new cache mode type in arch/x86/mm/ init_64.c tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 07/18] x86: Use new cache mode type in asm/pgtable.h Juergen Gross
2014-11-16 10:56 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 08/18] x86: Use new cache mode type in mm/iomap_32.c Juergen Gross
2014-11-16 10:56 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 09/18] x86: Use new cache mode type in track_pfn_remap() and track_pfn_insert() Juergen Gross
2014-11-16 10:56 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 10/18] x86: Remove looking for setting of _PAGE_PAT_LARGE in pageattr.c Juergen Gross
2014-11-03 16:44 ` Thomas Gleixner
2014-11-16 10:57 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 11/18] x86: Use new cache mode type in setting page attributes Juergen Gross
2014-11-16 10:57 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 12/18] x86: Use new cache mode type in mm/ioremap.c Juergen Gross
2014-11-16 10:57 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 13/18] x86: Use new cache mode type in memtype related functions Juergen Gross
2014-11-16 10:57 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:02 ` [PATCH V6 14/18] x86: Clean up pgtable_types.h Juergen Gross
2014-11-16 10:58 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:02 ` [PATCH V6 15/18] x86: Support PAT bit in pagetable dump for lower levels Juergen Gross
2014-11-16 10:58 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:02 ` [PATCH V6 16/18] x86: Respect PAT bit when copying pte values between large and normal pages Juergen Gross
2014-11-16 10:58 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:02 ` [PATCH V6 17/18] x86: Enable PAT to use cache mode translation tables Juergen Gross
2014-11-16 10:58 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:02 ` [PATCH V6 18/18] xen: Support Xen pv-domains using PAT Juergen Gross
2014-11-16 10:59 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 16:43 ` [PATCH V6 00/18] x86: Full support of PAT Toshi Kani
2014-11-14 6:30 ` Juergen Gross
2014-11-16 13:08 ` Ingo Molnar
2014-11-17 4:42 ` Jürgen Groß
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=54C0CDD8.2010205@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=steven@uplinklabs.net \
--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 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.