linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86, mm: disable 1GB direct mapping when disabling 2MB mapping
@ 2017-06-09 13:57 Vlastimil Babka
  2017-06-11  7:57 ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Vlastimil Babka @ 2017-06-09 13:57 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H . Peter Anvin
  Cc: x86, linux-mm, linux-kernel, Vegard Nossum, Pekka Enberg,
	Christian Borntraeger, Vlastimil Babka

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-13 10:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-09 13:57 [PATCH] x86, mm: disable 1GB direct mapping when disabling 2MB mapping Vlastimil Babka
2017-06-11  7:57 ` Ingo Molnar
2017-06-12  7:21   ` Vlastimil Babka
2017-06-13 10:02     ` [tip:x86/urgent] x86/mm: Disable 1GB direct mappings when disabling 2MB mappings tip-bot for Vlastimil Babka

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).