virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/10] I386 pgd clone under lock fix.patch
@ 2007-04-10  0:06 Zachary Amsden
  2007-04-10  0:27 ` William Lee Irwin III
  0 siblings, 1 reply; 2+ messages in thread
From: Zachary Amsden @ 2007-04-10  0:06 UTC (permalink / raw)
  To: Andrew Morton, Andi Kleen, Jeremy Fitzhardinge, Rusty Russell,
	Chris Wright, Virtualization Mailing List,
	Linux Kernel Mailing List, Zachary Amsden
  Cc: William Lee Irwin III

Copying of the pgd range must happen under the pgd_lock.  This got broken by
the paravirt changes in the -mm tree.  Badness can result if you copy the pgd
before being added to the list when splitting or rejoining large pages.

Signed-off-by: Zachary Amsden <zach@vmware.com>

diff -r 2247ff2c3fdb arch/i386/mm/pgtable.c
--- a/arch/i386/mm/pgtable.c	Thu Apr 05 17:29:15 2007 -0700
+++ b/arch/i386/mm/pgtable.c	Thu Apr 05 17:40:02 2007 -0700
@@ -241,18 +241,16 @@ void pgd_ctor(void *pgd, struct kmem_cac
 	/* !PAE, no pagetable sharing */
 	memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t));
 
+	spin_lock_irqsave(&pgd_lock, flags);
+
+	/* must happen under lock */
 	clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD,
 			swapper_pg_dir + USER_PTRS_PER_PGD,
 			KERNEL_PGD_PTRS);
-
-	spin_lock_irqsave(&pgd_lock, flags);
-
-	/* must happen under lock */
 	paravirt_alloc_pd_clone(__pa(pgd) >> PAGE_SHIFT,
 				__pa(swapper_pg_dir) >> PAGE_SHIFT,
 				USER_PTRS_PER_PGD,
 				KERNEL_PGD_PTRS);
-
 	pgd_list_add(pgd);
 	spin_unlock_irqrestore(&pgd_lock, flags);
 }

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

* Re: [PATCH 4/10] I386 pgd clone under lock fix.patch
  2007-04-10  0:06 [PATCH 4/10] I386 pgd clone under lock fix.patch Zachary Amsden
@ 2007-04-10  0:27 ` William Lee Irwin III
  0 siblings, 0 replies; 2+ messages in thread
From: William Lee Irwin III @ 2007-04-10  0:27 UTC (permalink / raw)
  To: Zachary Amsden
  Cc: Andrew Morton, Andi Kleen, Chris Wright,
	Virtualization Mailing List, Linux Kernel Mailing List

On Mon, Apr 09, 2007 at 05:06:11PM -0700, Zachary Amsden wrote:
> Copying of the pgd range must happen under the pgd_lock.  This got broken by
> the paravirt changes in the -mm tree.  Badness can result if you copy the pgd
> before being added to the list when splitting or rejoining large pages.
> Signed-off-by: Zachary Amsden <zach@vmware.com>

Sorry my review missed this.

Acked-by: William Irwin <wli@holomorphy.com>


-- wli

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

end of thread, other threads:[~2007-04-10  0:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-10  0:06 [PATCH 4/10] I386 pgd clone under lock fix.patch Zachary Amsden
2007-04-10  0:27 ` William Lee Irwin III

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