All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kmemcheck: don't track pages allocated with interrupts disabled
@ 2008-06-07 14:32 Vegard Nossum
  2008-06-07 17:12 ` Andi Kleen
  0 siblings, 1 reply; 6+ messages in thread
From: Vegard Nossum @ 2008-06-07 14:32 UTC (permalink / raw)
  To: Pekka Enberg, Ingo Molnar; +Cc: Andi Kleen, linux-kernel

Hi,

It seems that I was wrong regarding the set_memory_4k() approach. It seems
to only have worked because we were lucky. We may later reinstate the code
to disable PSE, but this time not unconditionally, perhaps with a config
option or boot-time option.

That a new page needs to be allocated with interrupts disabled is probably
rare enough that we can get away with this without losing too many pages
that could otherwise have been tracked.

Again, this is overall nicer than unconditionally disabling PSE, since
that incurs a much larger overhead in the case where kmemcheck is enabled
in the config but disabled by default. (Ingo, you previously indicated that
it would be nice if kernels could be configured in this way by default.)


Vegard


From: Vegard Nossum <vegardno@ben.ifi.uio.no>
Date: Sat, 7 Jun 2008 16:18:29 +0200
Subject: [PATCH] kmemcheck: don't track pages allocated with interrupts disabled

Because large physical pages need to be split to 4k-sized pages after
the slab page has been allocated, and this needs to flush the page
tables, we cannot track any pages that were allocated while interrupts
were disabled.

This fixes a boot crash that seems to depend on timing to appear.

Signed-off-by: Vegard Nossum <vegardno@ben.ifi.uio.no>
---
 mm/kmemcheck.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/mm/kmemcheck.c b/mm/kmemcheck.c
index 4efdf1e..b337374 100644
--- a/mm/kmemcheck.c
+++ b/mm/kmemcheck.c
@@ -10,6 +10,14 @@ void kmemcheck_alloc_shadow(struct kmem_cache *s, gfp_t flags, int node,
 	int pages;
 	int i;
 
+	/*
+	 * It's sad, but it's true. If interrupts are enabled while making
+	 * this allocation, it means that we can't split the large page
+	 * because it would require flushing the page tables.
+	 */
+	if (irqs_disabled())
+		return;
+
 	pages = 1 << order;
 
 	/*
-- 
1.5.3.1


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

end of thread, other threads:[~2008-06-07 20:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-07 14:32 [PATCH] kmemcheck: don't track pages allocated with interrupts disabled Vegard Nossum
2008-06-07 17:12 ` Andi Kleen
2008-06-07 18:15   ` Vegard Nossum
2008-06-07 19:47     ` Andi Kleen
2008-06-07 20:19       ` Vegard Nossum
2008-06-07 18:18   ` Vegard Nossum

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.