[kernel] r13240 - in dists/lenny/linux-2.6/debian: . patches/bugfix/x86 patches/series

Dann Frazier dannf at alioth.debian.org
Tue Mar 24 10:46:15 UTC 2009


Author: dannf
Date: Tue Mar 24 10:46:14 2009
New Revision: 13240

Log:
[x86, vmi] Fix missing paravirt_release_pmd in pgd_dtor (Closes: #520677)

Added:
   dists/lenny/linux-2.6/debian/patches/bugfix/x86/paravirt-add-pgd_alloc-free-hooks.patch
   dists/lenny/linux-2.6/debian/patches/bugfix/x86/vmi-add-missing-paravirt_release_pmd.patch
Modified:
   dists/lenny/linux-2.6/debian/changelog
   dists/lenny/linux-2.6/debian/patches/series/14

Modified: dists/lenny/linux-2.6/debian/changelog
==============================================================================
--- dists/lenny/linux-2.6/debian/changelog	(original)
+++ dists/lenny/linux-2.6/debian/changelog	Tue Mar 24 10:46:14 2009
@@ -43,6 +43,7 @@
   * [parisc] Fix the loading of large kernel modules (Closes: #401439)
   * Make the max number of lockd connections configurable and increase
     the default from 80 to the more reasonable 1024 (Closes: #520379)
+  * [x86, vmi] Fix missing paravirt_release_pmd in pgd_dtor (Closes: #520677)
 
   [ Martin Michlmayr ]
   * rt2x00: Fix VGC lower bound initialization. (Closes: #510607)

Added: dists/lenny/linux-2.6/debian/patches/bugfix/x86/paravirt-add-pgd_alloc-free-hooks.patch
==============================================================================
--- (empty file)
+++ dists/lenny/linux-2.6/debian/patches/bugfix/x86/paravirt-add-pgd_alloc-free-hooks.patch	Tue Mar 24 10:46:14 2009
@@ -0,0 +1,157 @@
+commit eba0045ff87bab465d3c80c289f3bf709c1800f5
+Author: Jeremy Fitzhardinge <jeremy at goop.org>
+Date:   Wed Jun 25 00:19:12 2008 -0400
+
+    x86/paravirt: add a pgd_alloc/free hooks
+    
+    Add hooks which are called at pgd_alloc/free time.  The pgd_alloc hook
+    may return an error code, which if non-zero, causes the pgd allocation
+    to be failed.  The hooks may be used to allocate/free auxillary
+    per-pgd information.
+    
+    also fix:
+    
+    > * Ingo Molnar <mingo at elte.hu> wrote:
+    >
+    >  include/asm/pgalloc.h: In function ‘paravirt_pgd_free':
+    >  include/asm/pgalloc.h:14: error: parameter name omitted
+    >  arch/x86/kernel/entry_64.S: In file included from
+    >  arch/x86/kernel/traps_64.c:51:include/asm/pgalloc.h: In function ‘paravirt_pgd_free':
+    >  include/asm/pgalloc.h:14: error: parameter name omitted
+    
+    Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+    Cc: xen-devel <xen-devel at lists.xensource.com>
+    Cc: Stephen Tweedie <sct at redhat.com>
+    Cc: Eduardo Habkost <ehabkost at redhat.com>
+    Cc: Mark McLoughlin <markmc at redhat.com>
+    Signed-off-by: Ingo Molnar <mingo at elte.hu>
+
+Adjusted to apply to Debian's 2.6.26 by dann frazier <dannf at debian.org>
+
+diff -urpN a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
+--- a/arch/x86/kernel/paravirt.c	2009-03-23 21:26:13.000000000 -0600
++++ b/arch/x86/kernel/paravirt.c	2009-03-23 21:33:56.000000000 -0600
+@@ -30,6 +30,7 @@
+ #include <asm/setup.h>
+ #include <asm/arch_hooks.h>
+ #include <asm/time.h>
++#include <asm/pgalloc.h>
+ #include <asm/irq.h>
+ #include <asm/delay.h>
+ #include <asm/fixmap.h>
+@@ -366,6 +367,9 @@ struct pv_mmu_ops pv_mmu_ops = {
+ 	.flush_tlb_single = native_flush_tlb_single,
+ 	.flush_tlb_others = native_flush_tlb_others,
+ 
++	.pgd_alloc = __paravirt_pgd_alloc,
++	.pgd_free = paravirt_nop,
++
+ 	.alloc_pte = paravirt_nop,
+ 	.alloc_pmd = paravirt_nop,
+ 	.alloc_pmd_clone = paravirt_nop,
+diff -urpN a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
+--- a/arch/x86/mm/pgtable.c	2008-07-13 15:51:29.000000000 -0600
++++ b/arch/x86/mm/pgtable.c	2009-03-23 21:33:56.000000000 -0600
+@@ -214,13 +214,15 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
+ 
+ 	/* so that alloc_pmd can use it */
+ 	mm->pgd = pgd;
+-	if (pgd)
++	if (pgd) {
+ 		pgd_ctor(pgd);
+ 
+-	if (pgd && !pgd_prepopulate_pmd(mm, pgd)) {
+-		pgd_dtor(pgd);
+-		free_page((unsigned long)pgd);
+-		pgd = NULL;
++		if (paravirt_pgd_alloc(mm) != 0 ||
++		    !pgd_prepopulate_pmd(mm, pgd)) {
++			pgd_dtor(pgd);
++			free_page((unsigned long)pgd);
++			pgd = NULL;
++		}
+ 	}
+ 
+ 	return pgd;
+@@ -230,6 +232,7 @@ void pgd_free(struct mm_struct *mm, pgd_
+ {
+ 	pgd_mop_up_pmds(mm, pgd);
+ 	pgd_dtor(pgd);
++	paravirt_pgd_free(mm, pgd);
+ 	free_page((unsigned long)pgd);
+ }
+ 
+diff -urpN a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
+--- a/arch/x86/xen/enlighten.c	2009-03-23 21:26:13.000000000 -0600
++++ b/arch/x86/xen/enlighten.c	2009-03-23 21:33:56.000000000 -0600
+@@ -45,6 +45,7 @@
+ #include <asm/pgtable.h>
+ #include <asm/tlbflush.h>
+ #include <asm/reboot.h>
++#include <asm/pgalloc.h>
+ 
+ #include "xen-ops.h"
+ #include "mmu.h"
+@@ -1126,6 +1127,9 @@ static const struct pv_mmu_ops xen_mmu_o
+ 	.pte_update = paravirt_nop,
+ 	.pte_update_defer = paravirt_nop,
+ 
++	.pgd_alloc = __paravirt_pgd_alloc,
++	.pgd_free = paravirt_nop,
++
+ 	.alloc_pte = xen_alloc_pte_init,
+ 	.release_pte = xen_release_pte_init,
+ 	.alloc_pmd = xen_alloc_pte_init,
+diff -urpN a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
+--- a/include/asm-x86/paravirt.h	2009-03-23 21:26:13.000000000 -0600
++++ b/include/asm-x86/paravirt.h	2009-03-23 21:33:56.000000000 -0600
+@@ -219,7 +219,14 @@ struct pv_mmu_ops {
+ 	void (*flush_tlb_others)(const cpumask_t *cpus, struct mm_struct *mm,
+ 				 unsigned long va);
+ 
+-	/* Hooks for allocating/releasing pagetable pages */
++	/* Hooks for allocating and freeing a pagetable top-level */
++	int  (*pgd_alloc)(struct mm_struct *mm);
++	void (*pgd_free)(struct mm_struct *mm, pgd_t *pgd);
++
++	/*
++	 * Hooks for allocating/releasing pagetable pages when they're
++	 * attached to a pagetable
++	 */
+ 	void (*alloc_pte)(struct mm_struct *mm, u32 pfn);
+ 	void (*alloc_pmd)(struct mm_struct *mm, u32 pfn);
+ 	void (*alloc_pmd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
+@@ -918,6 +925,16 @@ static inline void flush_tlb_others(cpum
+ 	PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, &cpumask, mm, va);
+ }
+ 
++static inline int paravirt_pgd_alloc(struct mm_struct *mm)
++{
++	return PVOP_CALL1(int, pv_mmu_ops.pgd_alloc, mm);
++}
++
++static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd)
++{
++	PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd);
++}
++
+ static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned pfn)
+ {
+ 	PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn);
+diff -urpN a/include/asm-x86/pgalloc.h b/include/asm-x86/pgalloc.h
+--- a/include/asm-x86/pgalloc.h	2008-07-13 15:51:29.000000000 -0600
++++ b/include/asm-x86/pgalloc.h	2009-03-23 21:33:56.000000000 -0600
+@@ -5,9 +5,13 @@
+ #include <linux/mm.h>		/* for struct page */
+ #include <linux/pagemap.h>
+ 
++static inline int  __paravirt_pgd_alloc(struct mm_struct *mm) { return 0; }
++
+ #ifdef CONFIG_PARAVIRT
+ #include <asm/paravirt.h>
+ #else
++#define paravirt_pgd_alloc(mm)	__paravirt_pgd_alloc(mm)
++static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd) {}
+ static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn)	{}
+ static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn)	{}
+ static inline void paravirt_alloc_pmd_clone(unsigned long pfn, unsigned long clonepfn,

Added: dists/lenny/linux-2.6/debian/patches/bugfix/x86/vmi-add-missing-paravirt_release_pmd.patch
==============================================================================
--- (empty file)
+++ dists/lenny/linux-2.6/debian/patches/bugfix/x86/vmi-add-missing-paravirt_release_pmd.patch	Tue Mar 24 10:46:14 2009
@@ -0,0 +1,57 @@
+commit 55a8ba4b7f76bebd7e8ce3f74c04b140627a1bad
+Author: Alok Kataria <akataria at vmware.com>
+Date:   Fri Feb 6 10:29:35 2009 -0800
+
+    x86, vmi: put a missing paravirt_release_pmd in pgd_dtor
+    
+    Commit 6194ba6ff6ccf8d5c54c857600843c67aa82c407 ("x86: don't special-case
+    pmd allocations as much") made changes to the way we handle pmd allocations,
+    and while doing that it dropped a call to  paravirt_release_pd on the
+    pgd page from the pgd_dtor code path.
+    
+    As a result of this missing release, the hypervisor is now unaware of the
+    pgd page being freed, and as a result it ends up tracking this page as a
+    page table page.
+    
+    After this the guest may start using the same page for other purposes, and
+    depending on what use the page is put to, it may result in various performance
+    and/or functional issues ( hangs, reboots).
+    
+    Since this release is only required for VMI, I now release the pgd page from
+    the (vmi)_pgd_free hook.
+    
+    Signed-off-by: Alok N Kataria <akataria at vmware.com>
+    Acked-by: Jeremy Fitzhardinge <jeremy at goop.org>
+    Signed-off-by: Ingo Molnar <mingo at elte.hu>
+    Cc: <stable at kernel.org>
+
+Adjusted to apply to Debian's 2.6.26 by dann frazier <dannf at debian.org>
+
+diff -urpN a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
+--- a/arch/x86/kernel/vmi_32.c	2009-03-23 21:26:16.000000000 -0600
++++ b/arch/x86/kernel/vmi_32.c	2009-03-23 21:35:47.000000000 -0600
+@@ -429,6 +429,16 @@ static void vmi_release_pmd(u32 pfn)
+ }
+ 
+ /*
++ * We use the pgd_free hook for releasing the pgd page:
++ */
++static void vmi_pgd_free(struct mm_struct *mm, pgd_t *pgd)
++{
++	unsigned long pfn = __pa(pgd) >> PAGE_SHIFT;
++
++	vmi_ops.release_page(pfn, VMI_PAGE_L2);
++}
++
++/*
+  * Helper macros for MMU update flags.  We can defer updates until a flush
+  * or page invalidation only if the update is to the current address space
+  * (otherwise, there is no flush).  We must check against init_mm, since
+@@ -880,6 +890,7 @@ static inline int __init activate_vmi(vo
+ 	if (vmi_ops.release_page) {
+ 		pv_mmu_ops.release_pte = vmi_release_pte;
+ 		pv_mmu_ops.release_pmd = vmi_release_pmd;
++		pv_mmu_ops.pgd_free = vmi_pgd_free;
+ 	}
+ 
+ 	/* Set linear is needed in all cases */

Modified: dists/lenny/linux-2.6/debian/patches/series/14
==============================================================================
--- dists/lenny/linux-2.6/debian/patches/series/14	(original)
+++ dists/lenny/linux-2.6/debian/patches/series/14	Tue Mar 24 10:46:14 2009
@@ -35,3 +35,5 @@
 + bugfix/all/usb-unusual-devs-update-nokia-6233.patch
 + bugfix/all/cifs-fix-oops-in-cifs_strfromUCS_le.patch
 + bugfix/all/net-kill-skb_truesize_check.patch
++ bugfix/x86/paravirt-add-pgd_alloc-free-hooks.patch
++ bugfix/x86/vmi-add-missing-paravirt_release_pmd.patch



More information about the Kernel-svn-changes mailing list