Re: [PATCH] Bugfix for VMI paravirt ops

From: Jeremy Fitzhardinge
Date: Thu Apr 05 2007 - 20:53:24 EST


Zachary Amsden wrote:
> Yes, thought about several solutions, and this seems the best. But it
> requires a new paravirt-op.

Not with the power of multiplexing. Something like this, perhaps?

J

diff -r 5be4a5ff8e6b arch/i386/mm/highmem.c
--- a/arch/i386/mm/highmem.c Thu Apr 05 17:04:04 2007 -0700
+++ b/arch/i386/mm/highmem.c Thu Apr 05 17:50:46 2007 -0700
@@ -42,6 +42,8 @@ void *kmap_atomic_prot(struct page *page

vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
set_pte(kmap_pte-idx, mk_pte(page, prot));
+
+ arch_flush_lazy_mmu_mode();

return (void*) vaddr;
}
diff -r 5be4a5ff8e6b include/asm-generic/pgtable.h
--- a/include/asm-generic/pgtable.h Thu Apr 05 17:04:04 2007 -0700
+++ b/include/asm-generic/pgtable.h Thu Apr 05 17:50:46 2007 -0700
@@ -180,6 +180,7 @@ static inline void ptep_set_wrprotect(st
#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
#define arch_enter_lazy_mmu_mode() do {} while (0)
#define arch_leave_lazy_mmu_mode() do {} while (0)
+#define arch_flush_lazy_mmu_mode() do {} while (0)
#endif

/*
@@ -193,6 +194,7 @@ static inline void ptep_set_wrprotect(st
#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
#define arch_enter_lazy_cpu_mode() do {} while (0)
#define arch_leave_lazy_cpu_mode() do {} while (0)
+#define arch_flush_lazy_cpu_mode() do {} while (0)
#endif

/*
diff -r 5be4a5ff8e6b include/asm-i386/paravirt.h
--- a/include/asm-i386/paravirt.h Thu Apr 05 17:04:04 2007 -0700
+++ b/include/asm-i386/paravirt.h Thu Apr 05 17:50:46 2007 -0700
@@ -27,9 +27,10 @@ struct desc_struct;

/* Lazy mode for batching updates / context switch */
enum paravirt_lazy_mode {
- PARAVIRT_LAZY_NONE = 0,
- PARAVIRT_LAZY_MMU = 1,
- PARAVIRT_LAZY_CPU = 2,
+ PARAVIRT_LAZY_NONE = 0, /* exit lazy mode */
+ PARAVIRT_LAZY_MMU = 1, /* lazy mmu updates */
+ PARAVIRT_LAZY_CPU = 2, /* lazy cpu state updates */
+ PARAVIRT_LAZY_FLUSH = 3, /* flush pending changes, if any */
};

struct paravirt_ops
@@ -1044,6 +1045,10 @@ static inline void arch_leave_lazy_cpu_m
{
PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_NONE);
}
+static inline void arch_flush_lazy_cpu_mode(void)
+{
+ PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_FLUSH);
+}

#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
static inline void arch_enter_lazy_mmu_mode(void)
@@ -1053,6 +1058,10 @@ static inline void arch_leave_lazy_mmu_m
static inline void arch_leave_lazy_mmu_mode(void)
{
PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_NONE);
+}
+static inline void arch_flush_lazy_mmu_mode(void)
+{
+ PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_FLUSH);
}

void _paravirt_nop(void);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/