diff options
author | Andrea Arcangeli <aarcange@redhat.com> | 2011-01-13 18:46:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 20:32:39 -0500 |
commit | 331127f799d1618e2ad978a0d220ed935a7b0ca8 (patch) | |
tree | 8a5d8a647939d13bdbba09379dca08fc9997cd95 | |
parent | 0a47de52db04c5eb346e99a8d038e693689bedca (diff) |
thp: add pmd paravirt ops
Paravirt ops pmd_update/pmd_update_defer/pmd_set_at. Not all might be
necessary (vmware needs pmd_update, Xen needs set_pmd_at, nobody needs
pmd_update_defer), but this is to keep full simmetry with pte paravirt
ops, which looks cleaner and simpler from a common code POV.
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/x86/include/asm/paravirt.h | 25 | ||||
-rw-r--r-- | arch/x86/include/asm/paravirt_types.h | 6 | ||||
-rw-r--r-- | arch/x86/kernel/paravirt.c | 3 |
3 files changed, 34 insertions, 0 deletions
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 7709c12431b8..2071a8b2b32f 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
@@ -435,6 +435,11 @@ static inline void pte_update(struct mm_struct *mm, unsigned long addr, | |||
435 | { | 435 | { |
436 | PVOP_VCALL3(pv_mmu_ops.pte_update, mm, addr, ptep); | 436 | PVOP_VCALL3(pv_mmu_ops.pte_update, mm, addr, ptep); |
437 | } | 437 | } |
438 | static inline void pmd_update(struct mm_struct *mm, unsigned long addr, | ||
439 | pmd_t *pmdp) | ||
440 | { | ||
441 | PVOP_VCALL3(pv_mmu_ops.pmd_update, mm, addr, pmdp); | ||
442 | } | ||
438 | 443 | ||
439 | static inline void pte_update_defer(struct mm_struct *mm, unsigned long addr, | 444 | static inline void pte_update_defer(struct mm_struct *mm, unsigned long addr, |
440 | pte_t *ptep) | 445 | pte_t *ptep) |
@@ -442,6 +447,12 @@ static inline void pte_update_defer(struct mm_struct *mm, unsigned long addr, | |||
442 | PVOP_VCALL3(pv_mmu_ops.pte_update_defer, mm, addr, ptep); | 447 | PVOP_VCALL3(pv_mmu_ops.pte_update_defer, mm, addr, ptep); |
443 | } | 448 | } |
444 | 449 | ||
450 | static inline void pmd_update_defer(struct mm_struct *mm, unsigned long addr, | ||
451 | pmd_t *pmdp) | ||
452 | { | ||
453 | PVOP_VCALL3(pv_mmu_ops.pmd_update_defer, mm, addr, pmdp); | ||
454 | } | ||
455 | |||
445 | static inline pte_t __pte(pteval_t val) | 456 | static inline pte_t __pte(pteval_t val) |
446 | { | 457 | { |
447 | pteval_t ret; | 458 | pteval_t ret; |
@@ -543,6 +554,20 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
543 | PVOP_VCALL4(pv_mmu_ops.set_pte_at, mm, addr, ptep, pte.pte); | 554 | PVOP_VCALL4(pv_mmu_ops.set_pte_at, mm, addr, ptep, pte.pte); |
544 | } | 555 | } |
545 | 556 | ||
557 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
558 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, | ||
559 | pmd_t *pmdp, pmd_t pmd) | ||
560 | { | ||
561 | #if PAGETABLE_LEVELS >= 3 | ||
562 | if (sizeof(pmdval_t) > sizeof(long)) | ||
563 | /* 5 arg words */ | ||
564 | pv_mmu_ops.set_pmd_at(mm, addr, pmdp, pmd); | ||
565 | else | ||
566 | PVOP_VCALL4(pv_mmu_ops.set_pmd_at, mm, addr, pmdp, pmd.pmd); | ||
567 | #endif | ||
568 | } | ||
569 | #endif | ||
570 | |||
546 | static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) | 571 | static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) |
547 | { | 572 | { |
548 | pmdval_t val = native_pmd_val(pmd); | 573 | pmdval_t val = native_pmd_val(pmd); |
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index b82bac975250..82885099c869 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h | |||
@@ -265,10 +265,16 @@ struct pv_mmu_ops { | |||
265 | void (*set_pte_at)(struct mm_struct *mm, unsigned long addr, | 265 | void (*set_pte_at)(struct mm_struct *mm, unsigned long addr, |
266 | pte_t *ptep, pte_t pteval); | 266 | pte_t *ptep, pte_t pteval); |
267 | void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval); | 267 | void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval); |
268 | void (*set_pmd_at)(struct mm_struct *mm, unsigned long addr, | ||
269 | pmd_t *pmdp, pmd_t pmdval); | ||
268 | void (*pte_update)(struct mm_struct *mm, unsigned long addr, | 270 | void (*pte_update)(struct mm_struct *mm, unsigned long addr, |
269 | pte_t *ptep); | 271 | pte_t *ptep); |
270 | void (*pte_update_defer)(struct mm_struct *mm, | 272 | void (*pte_update_defer)(struct mm_struct *mm, |
271 | unsigned long addr, pte_t *ptep); | 273 | unsigned long addr, pte_t *ptep); |
274 | void (*pmd_update)(struct mm_struct *mm, unsigned long addr, | ||
275 | pmd_t *pmdp); | ||
276 | void (*pmd_update_defer)(struct mm_struct *mm, | ||
277 | unsigned long addr, pmd_t *pmdp); | ||
272 | 278 | ||
273 | pte_t (*ptep_modify_prot_start)(struct mm_struct *mm, unsigned long addr, | 279 | pte_t (*ptep_modify_prot_start)(struct mm_struct *mm, unsigned long addr, |
274 | pte_t *ptep); | 280 | pte_t *ptep); |
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index c5b250011fd4..869e1aeeb71b 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -421,8 +421,11 @@ struct pv_mmu_ops pv_mmu_ops = { | |||
421 | .set_pte = native_set_pte, | 421 | .set_pte = native_set_pte, |
422 | .set_pte_at = native_set_pte_at, | 422 | .set_pte_at = native_set_pte_at, |
423 | .set_pmd = native_set_pmd, | 423 | .set_pmd = native_set_pmd, |
424 | .set_pmd_at = native_set_pmd_at, | ||
424 | .pte_update = paravirt_nop, | 425 | .pte_update = paravirt_nop, |
425 | .pte_update_defer = paravirt_nop, | 426 | .pte_update_defer = paravirt_nop, |
427 | .pmd_update = paravirt_nop, | ||
428 | .pmd_update_defer = paravirt_nop, | ||
426 | 429 | ||
427 | .ptep_modify_prot_start = __ptep_modify_prot_start, | 430 | .ptep_modify_prot_start = __ptep_modify_prot_start, |
428 | .ptep_modify_prot_commit = __ptep_modify_prot_commit, | 431 | .ptep_modify_prot_commit = __ptep_modify_prot_commit, |