public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>, Andi Kleen <ak@suse.de>,
	Jan Beulich <jbeulich@novell.com>,
	Eduardo Pereira Habkost <ehabkost@redhat.com>,
	Ian Campbell <ijc@hellion.org.uk>, H Peter Anvin <hpa@zytor.com>
Subject: [PATCH 03 of 11] x86: add mm parameter to paravirt_alloc_pd
Date: Fri, 25 Jan 2008 13:23:12 -0800	[thread overview]
Message-ID: <c884b4df02dfe6fc8619.1201296192@localhost> (raw)
In-Reply-To: <patchbomb.1201296189@localhost>

Add mm to paravirt_alloc_pd, partly to make it consistent with
paravirt_alloc_pt, and because later changes will make use of it.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
---
 arch/x86/kernel/vmi_32.c     |    2 +-
 arch/x86/mm/init_32.c        |    4 ++--
 arch/x86/mm/pgtable_32.c     |    4 +++-
 include/asm-x86/paravirt.h   |    6 +++---
 include/asm-x86/pgalloc_32.h |    3 +--
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -398,7 +398,7 @@ static void vmi_allocate_pt(struct mm_st
 	vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0);
 }
 
-static void vmi_allocate_pd(u32 pfn)
+static void vmi_allocate_pd(struct mm_struct *mm, u32 pfn)
 {
  	/*
 	 * This call comes in very early, before mem_map is setup.
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -67,7 +67,7 @@ static pmd_t * __init one_md_table_init(
 	if (!(pgd_val(*pgd) & _PAGE_PRESENT)) {
 		pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
 
-		paravirt_alloc_pd(__pa(pmd_table) >> PAGE_SHIFT);
+		paravirt_alloc_pd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT);
 		set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT));
 		pud = pud_offset(pgd, 0);
 		BUG_ON(pmd_table != pmd_offset(pud, 0));
@@ -378,7 +378,7 @@ void __init native_pagetable_setup_start
 
 		pte_clear(NULL, va, pte);
 	}
-	paravirt_alloc_pd(__pa(swapper_pg_dir) >> PAGE_SHIFT);
+	paravirt_alloc_pd(&init_mm, __pa(base) >> PAGE_SHIFT);
 }
 
 void __init native_pagetable_setup_done(pgd_t *base)
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -321,13 +321,15 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
 	if (PTRS_PER_PMD == 1 || !pgd)
 		return pgd;
 
+	mm->pgd = pgd;		/* so that alloc_pd can use it */
+
  	for (i = 0; i < UNSHARED_PTRS_PER_PGD; ++i) {
 		pmd_t *pmd = pmd_cache_alloc(i);
 
 		if (!pmd)
 			goto out_oom;
 
-		paravirt_alloc_pd(__pa(pmd) >> PAGE_SHIFT);
+		paravirt_alloc_pd(mm, __pa(pmd) >> PAGE_SHIFT);
 		set_pgd(&pgd[i], __pgd(1 + __pa(pmd)));
 	}
 	return pgd;
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -221,7 +221,7 @@ struct pv_mmu_ops {
 
 	/* Hooks for allocating/releasing pagetable pages */
 	void (*alloc_pt)(struct mm_struct *mm, u32 pfn);
-	void (*alloc_pd)(u32 pfn);
+	void (*alloc_pd)(struct mm_struct *mm, u32 pfn);
 	void (*alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
 	void (*release_pt)(u32 pfn);
 	void (*release_pd)(u32 pfn);
@@ -903,9 +903,9 @@ static inline void paravirt_release_pt(u
 	PVOP_VCALL1(pv_mmu_ops.release_pt, pfn);
 }
 
-static inline void paravirt_alloc_pd(unsigned pfn)
+static inline void paravirt_alloc_pd(struct mm_struct *mm, unsigned pfn)
 {
-	PVOP_VCALL1(pv_mmu_ops.alloc_pd, pfn);
+	PVOP_VCALL2(pv_mmu_ops.alloc_pd, mm, pfn);
 }
 
 static inline void paravirt_alloc_pd_clone(unsigned pfn, unsigned clonepfn,
diff --git a/include/asm-x86/pgalloc_32.h b/include/asm-x86/pgalloc_32.h
--- a/include/asm-x86/pgalloc_32.h
+++ b/include/asm-x86/pgalloc_32.h
@@ -8,8 +8,7 @@
 #include <asm/paravirt.h>
 #else
 #define paravirt_alloc_pt(mm, pfn) do { } while (0)
-#define paravirt_alloc_pd(pfn) do { } while (0)
-#define paravirt_alloc_pd(pfn) do { } while (0)
+#define paravirt_alloc_pd(mm, pfn) do { } while (0)
 #define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0)
 #define paravirt_release_pt(pfn) do { } while (0)
 #define paravirt_release_pd(pfn) do { } while (0)



  parent reply	other threads:[~2008-01-25 21:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-25 21:23 [PATCH 00 of 11] x86: separate pmd lifetime from pgd Jeremy Fitzhardinge
2008-01-25 21:23 ` [PATCH 01 of 11] xen: fix mismerge in masking pte flags Jeremy Fitzhardinge
2008-01-25 21:23 ` [PATCH 02 of 11] x86: use the same pgd_list for PAE and 64-bit Jeremy Fitzhardinge
2008-01-25 21:23 ` Jeremy Fitzhardinge [this message]
2008-01-25 21:23 ` [PATCH 04 of 11] x86: fix early_ioremap pagetable ops Jeremy Fitzhardinge
2008-01-31 19:01   ` Ian Campbell
2008-01-31 19:52     ` Jeremy Fitzhardinge
2008-01-31 20:37     ` Ingo Molnar
2008-01-31 20:41       ` Jeremy Fitzhardinge
2008-01-25 21:23 ` [PATCH 05 of 11] x86: demacro asm-x86/pgalloc_32.h Jeremy Fitzhardinge
2008-01-25 21:23 ` [PATCH 06 of 11] x86: unify PAE/non-PAE pgd_ctor Jeremy Fitzhardinge
2008-01-25 21:23 ` [PATCH 07 of 11] x86: don't special-case pmd allocations as much Jeremy Fitzhardinge
2008-01-25 21:23 ` [PATCH 08 of 11] xen: deal with pmd being allocated/freed Jeremy Fitzhardinge
2008-01-25 21:23 ` [PATCH 09 of 11] x86: preallocate pmds at pgd creation time Jeremy Fitzhardinge
2008-01-25 21:23 ` [PATCH 10 of 11] x86: allocate and initialize unshared pmds Jeremy Fitzhardinge
2008-01-25 21:23 ` [PATCH 11 of 11] x86: defer cr3 reload when doing pud_clear() Jeremy Fitzhardinge
2008-01-25 21:37   ` H. Peter Anvin
2008-01-25 22:54     ` Jeremy Fitzhardinge
2008-01-25 23:38       ` Keir Fraser
2008-01-25 23:44         ` Jeremy Fitzhardinge
2008-01-26  0:11           ` Ingo Molnar
2008-01-26  0:20             ` H. Peter Anvin
2008-01-26  5:57             ` Andi Kleen
2008-01-26  6:03               ` H. Peter Anvin
2008-01-26  0:10         ` H. Peter Anvin
2008-01-26  0:57           ` Jeremy Fitzhardinge
2008-01-26  1:09             ` H. Peter Anvin
2008-01-28 15:17 ` [PATCH 00 of 11] x86: separate pmd lifetime from pgd Ingo Molnar
2008-01-28 15:39   ` Jeremy Fitzhardinge
2008-01-28 15:41   ` Ingo Molnar
2008-01-28 15:47     ` Ingo Molnar
2008-01-28 16:20     ` Jeremy Fitzhardinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c884b4df02dfe6fc8619.1201296192@localhost \
    --to=jeremy@goop.org \
    --cc=ak@suse.de \
    --cc=ehabkost@redhat.com \
    --cc=hpa@zytor.com \
    --cc=ijc@hellion.org.uk \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox