[PATCH 2 of 4] paravirt: add hooks for ptep_modify_prot_start/commit

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ingo Molnar <mingo@...>
Cc: LKML <linux-kernel@...>, <x86@...>, xen-devel <xen-devel@...>, Thomas Gleixner <tglx@...>, Hugh Dickins <hugh@...>, Zachary Amsden <zach@...>, kvm-devel <kvm-devel@...>, Virtualization Mailing List <virtualization@...>, Rusty Russell <rusty@...>, Peter Zijlstra <a.p.zijlstra@...>, Linus Torvalds <torvalds@...>
Date: Monday, June 16, 2008 - 7:30 am

This patch adds paravirt-ops hooks in pv_mmu_ops for ptep_modify_prot_start and
ptep_modify_prot_commit.  This allows the hypervisor-specific backends to
implement these in some more efficient way.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/kernel/paravirt.c |    3 +++
 arch/x86/xen/enlighten.c   |    3 +++
 include/asm-x86/paravirt.h |   28 ++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+)

diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -383,6 +383,9 @@
 	.pte_update = paravirt_nop,
 	.pte_update_defer = paravirt_nop,
 
+	.ptep_modify_prot_start = __ptep_modify_prot_start,
+	.ptep_modify_prot_commit = __ptep_modify_prot_commit,
+
 #ifdef CONFIG_HIGHPTE
 	.kmap_atomic_pte = kmap_atomic,
 #endif
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1139,6 +1139,9 @@
 	.set_pte_at = xen_set_pte_at,
 	.set_pmd = xen_set_pmd_hyper,
 
+	.ptep_modify_prot_start = __ptep_modify_prot_start,
+	.ptep_modify_prot_commit = __ptep_modify_prot_commit,
+
 	.pte_val = xen_pte_val,
 	.pte_flags = native_pte_val,
 	.pgd_val = xen_pgd_val,
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
@@ -238,6 +238,11 @@
 			   pte_t *ptep);
 	void (*pte_update_defer)(struct mm_struct *mm,
 				 unsigned long addr, pte_t *ptep);
+
+	pte_t (*ptep_modify_prot_start)(struct mm_struct *mm, unsigned long addr,
+					pte_t *ptep);
+	void (*ptep_modify_prot_commit)(struct mm_struct *mm, unsigned long addr,
+					pte_t *ptep, pte_t pte);
 
 	pteval_t (*pte_val)(pte_t);
 	pteval_t (*pte_flags)(pte_t);
@@ -1040,6 +1045,29 @@
 	return ret;
 }
 
+#define  __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION
+static inline pte_t ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr,
+					   pte_t *ptep)
+{
+	pteval_t ret;
+
+	ret = PVOP_CALL3(pteval_t, pv_mmu_ops.ptep_modify_prot_start,
+			 mm, addr, ptep);
+
+	return (pte_t) { .pte = ret };
+}
+
+static inline void ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
+					   pte_t *ptep, pte_t pte)
+{
+	if (sizeof(pteval_t) > sizeof(long))
+		/* 5 arg words */
+		pv_mmu_ops.ptep_modify_prot_commit(mm, addr, ptep, pte);
+	else
+		PVOP_VCALL4(pv_mmu_ops.ptep_modify_prot_commit,
+			    mm, addr, ptep, pte.pte);
+}
+
 static inline void set_pte(pte_t *ptep, pte_t pte)
 {
 	if (sizeof(pteval_t) > sizeof(long))


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0 of 4] mm+paravirt+xen: add pte read-modify-write ab..., Jeremy Fitzhardinge, (Mon Jun 16, 7:29 am)
[PATCH 2 of 4] paravirt: add hooks for ptep_modify_prot_star..., Jeremy Fitzhardinge, (Mon Jun 16, 7:30 am)
[PATCH 4 of 4] xen: add mechanism to extend existing multica..., Jeremy Fitzhardinge, (Mon Jun 16, 7:30 am)
[PATCH 3 of 4] xen: implement ptep_modify_prot_start/commit, Jeremy Fitzhardinge, (Mon Jun 16, 7:30 am)
[PATCH 1 of 4] mm: add a ptep_modify_prot transaction abstra..., Jeremy Fitzhardinge, (Mon Jun 16, 7:30 am)
Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction ab..., Benjamin Herrenschmidt, (Wed Jun 18, 7:23 pm)
Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction ab..., Jeremy Fitzhardinge, (Wed Jun 18, 7:59 pm)
Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction ab..., Jeremy Fitzhardinge, (Wed Jun 18, 8:15 pm)
Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction ab..., Benjamin Herrenschmidt, (Wed Jun 18, 8:39 pm)
Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction ab..., Jeremy Fitzhardinge, (Thu Jun 19, 1:03 am)
Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction ab..., Benjamin Herrenschmidt, (Thu Jun 19, 3:20 am)
Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction ab..., Jeremy Fitzhardinge, (Thu Jun 19, 1:57 pm)
Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction ab..., Jeremy Fitzhardinge, (Wed Jun 18, 8:37 pm)
Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction ab..., Jeremy Fitzhardinge, (Fri Jun 20, 3:06 pm)
Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction ab..., Jeremy Fitzhardinge, (Fri Jun 20, 4:05 pm)
Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction ab..., Jeremy Fitzhardinge, (Fri Jun 20, 4:16 pm)
Re: [PATCH 1 of 4] mm: add a ptep_modify_prot transaction ab..., Jeremy Fitzhardinge, (Fri Jun 20, 4:22 pm)