Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1662453 > unrolled thread
| Started by | Vlastimil Babka <vbabka@suse.cz> |
|---|---|
| First post | 2017-06-09 16:00 +0200 |
| Last post | 2017-06-13 12:10 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] x86, mm: disable 1GB direct mapping when disabling 2MB mapping Vlastimil Babka <vbabka@suse.cz> - 2017-06-09 16:00 +0200
Re: [PATCH] x86, mm: disable 1GB direct mapping when disabling 2MB mapping Ingo Molnar <mingo@kernel.org> - 2017-06-11 10:00 +0200
Re: [PATCH] x86, mm: disable 1GB direct mapping when disabling 2MB mapping Vlastimil Babka <vbabka@suse.cz> - 2017-06-12 09:30 +0200
[tip:x86/urgent] x86/mm: Disable 1GB direct mappings when disabling 2MB mappings tip-bot for Vlastimil Babka <tipbot@zytor.com> - 2017-06-13 12:10 +0200
| From | Vlastimil Babka <vbabka@suse.cz> |
|---|---|
| Date | 2017-06-09 16:00 +0200 |
| Subject | [PATCH] x86, mm: disable 1GB direct mapping when disabling 2MB mapping |
| Message-ID | <tQsCe-2cm-23@gated-at.bofh.it> |
The kmemleak and debug_pagealloc features both disable using huge pages for direct mapping so they can do cpa() on page level granularity in any context. However they only do that for 2MB pages, which means 1GB pages can still be used if the CPU supports it, unless disabled by a boot param, which is non-obvious. Disable also 1GB pages when disabling 2MB pages. Signed-off-by: Vlastimil Babka <vbabka@suse.cz> --- arch/x86/mm/init.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index cbc87ea98751..20282dfce0fa 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -170,6 +170,10 @@ static void __init probe_page_size_mask(void) */ if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled()) page_size_mask |= 1 << PG_LEVEL_2M; + else + direct_gbpages = 0; +#else + direct_gbpages = 0; #endif /* Enable PSE if available */ -- 2.13.1
[toc] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2017-06-11 10:00 +0200 |
| Subject | Re: [PATCH] x86, mm: disable 1GB direct mapping when disabling 2MB mapping |
| Message-ID | <tR5WV-2lr-7@gated-at.bofh.it> |
| In reply to | #1662453 |
* Vlastimil Babka <vbabka@suse.cz> wrote: > The kmemleak and debug_pagealloc features both disable using huge pages for > direct mapping so they can do cpa() on page level granularity in any context. > However they only do that for 2MB pages, which means 1GB pages can still be > used if the CPU supports it, unless disabled by a boot param, which is > non-obvious. Disable also 1GB pages when disabling 2MB pages. > > Signed-off-by: Vlastimil Babka <vbabka@suse.cz> > --- > arch/x86/mm/init.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c > index cbc87ea98751..20282dfce0fa 100644 > --- a/arch/x86/mm/init.c > +++ b/arch/x86/mm/init.c > @@ -170,6 +170,10 @@ static void __init probe_page_size_mask(void) > */ > if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled()) > page_size_mask |= 1 << PG_LEVEL_2M; > + else > + direct_gbpages = 0; > +#else > + direct_gbpages = 0; > #endif > > /* Enable PSE if available */ So I agree with the fix, but I think it would be much cleaner to eliminate the outer #ifdef: #if !defined(CONFIG_KMEMCHECK) and put it into the condition, like this: if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled() && !IS_ENABLED(CONFIG_KMEMCHECK)) page_size_mask |= 1 << PG_LEVEL_2M; else direct_gbpages = 0; without any #ifdeffery. This makes it much more readable all around, and also makes it obvious that when the 2MB size bit is not set then gbpages are disabled as well. Thanks, Ingo
[toc] | [prev] | [next] | [standalone]
| From | Vlastimil Babka <vbabka@suse.cz> |
|---|---|
| Date | 2017-06-12 09:30 +0200 |
| Subject | Re: [PATCH] x86, mm: disable 1GB direct mapping when disabling 2MB mapping |
| Message-ID | <tRrXs-7Al-13@gated-at.bofh.it> |
| In reply to | #1663073 |
On 06/11/2017 09:57 AM, Ingo Molnar wrote:
> So I agree with the fix, but I think it would be much cleaner to eliminate the
> outer #ifdef:
>
> #if !defined(CONFIG_KMEMCHECK)
>
> and put it into the condition, like this:
>
> if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled() && !IS_ENABLED(CONFIG_KMEMCHECK))
Right, that's better, thanks.
----8<----
From: Vlastimil Babka <vbabka@suse.cz>
Date: Fri, 9 Jun 2017 15:41:22 +0200
Subject: [PATCH v2] x86, mm: disable 1GB direct mapping when disabling 2MB
mapping
The kmemleak and debug_pagealloc features both disable using huge pages for
direct mapping so they can do cpa() on page level granularity in any context.
However they only do that for 2MB pages, which means 1GB pages can still be
used if the CPU supports it, unless disabled by a boot param, which is
non-obvious. Disable also 1GB pages when disabling 2MB pages.
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
arch/x86/mm/init.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index cbc87ea98751..b11afaf04c9d 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -161,16 +161,17 @@ static int page_size_mask;
static void __init probe_page_size_mask(void)
{
-#if !defined(CONFIG_KMEMCHECK)
/*
* For CONFIG_KMEMCHECK or pagealloc debugging, identity mapping will
* use small pages.
* This will simplify cpa(), which otherwise needs to support splitting
* large pages into small in interrupt context, etc.
*/
- if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled())
+ if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled() &&
+ !IS_ENABLED(CONFIG_KMEMCHECK))
page_size_mask |= 1 << PG_LEVEL_2M;
-#endif
+ else
+ direct_gbpages = 0;
/* Enable PSE if available */
if (boot_cpu_has(X86_FEATURE_PSE))
--
2.13.1
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Vlastimil Babka <tipbot@zytor.com> |
|---|---|
| Date | 2017-06-13 12:10 +0200 |
| Subject | [tip:x86/urgent] x86/mm: Disable 1GB direct mappings when disabling 2MB mappings |
| Message-ID | <tRQVQ-6DL-47@gated-at.bofh.it> |
| In reply to | #1663284 |
Commit-ID: d9ee35acfabbc909c3be4360cd5655a006628b2e
Gitweb: http://git.kernel.org/tip/d9ee35acfabbc909c3be4360cd5655a006628b2e
Author: Vlastimil Babka <vbabka@suse.cz>
AuthorDate: Mon, 12 Jun 2017 09:21:30 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 13 Jun 2017 08:33:00 +0200
x86/mm: Disable 1GB direct mappings when disabling 2MB mappings
The kmemleak and debug_pagealloc features both disable using huge pages for
direct mappings so they can do cpa() on page level granularity in any context.
However they only do that for 2MB pages, which means 1GB pages can still be
used if the CPU supports it, unless disabled by a boot param, which is
non-obvious. Disable also 1GB pages when disabling 2MB pages.
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vegard Nossum <vegardno@ifi.uio.no>
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/2be70c78-6130-855d-3dfa-d87bd1dd4fda@suse.cz
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/mm/init.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index cbc87ea..9b3f9fa 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -161,16 +161,16 @@ static int page_size_mask;
static void __init probe_page_size_mask(void)
{
-#if !defined(CONFIG_KMEMCHECK)
/*
* For CONFIG_KMEMCHECK or pagealloc debugging, identity mapping will
* use small pages.
* This will simplify cpa(), which otherwise needs to support splitting
* large pages into small in interrupt context, etc.
*/
- if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled())
+ if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled() && !IS_ENABLED(CONFIG_KMEMCHECK))
page_size_mask |= 1 << PG_LEVEL_2M;
-#endif
+ else
+ direct_gbpages = 0;
/* Enable PSE if available */
if (boot_cpu_has(X86_FEATURE_PSE))
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web