[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] linux/blktap2: reduce TLB flush scope



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1244107977 -3600
# Node ID f994bfe9b93ba834e1815a307617f35b9e213b40
# Parent  485fe5efa4ff61393101ff151ce9a6e2816dd00f
linux/blktap2: reduce TLB flush scope

c/s 885 added very coarse TLB flushing. Since these flushes always
follow single page updates, single page flushes (when available) are
sufficient.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 arch/i386/mm/hypervisor.c    |    2 ++
 drivers/xen/blktap2/device.c |   16 +++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff -r 485fe5efa4ff -r f994bfe9b93b arch/i386/mm/hypervisor.c
--- a/arch/i386/mm/hypervisor.c Thu Jun 04 10:32:34 2009 +0100
+++ b/arch/i386/mm/hypervisor.c Thu Jun 04 10:32:57 2009 +0100
@@ -142,6 +142,7 @@ void xen_invlpg_all(unsigned long ptr)
        op.arg1.linear_addr = ptr & PAGE_MASK;
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
+EXPORT_SYMBOL_GPL(xen_invlpg_all);
 
 void xen_invlpg_mask(cpumask_t *mask, unsigned long ptr)
 {
@@ -153,6 +154,7 @@ void xen_invlpg_mask(cpumask_t *mask, un
        set_xen_guest_handle(op.arg2.vcpumask, mask->bits);
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
+EXPORT_SYMBOL_GPL(xen_invlpg_mask);
 
 #endif /* CONFIG_SMP */
 
diff -r 485fe5efa4ff -r f994bfe9b93b drivers/xen/blktap2/device.c
--- a/drivers/xen/blktap2/device.c      Thu Jun 04 10:32:34 2009 +0100
+++ b/drivers/xen/blktap2/device.c      Thu Jun 04 10:32:57 2009 +0100
@@ -193,6 +193,16 @@ blktap_umap_uaddr(struct mm_struct *mm, 
                                   PAGE_SIZE, blktap_umap_uaddr_fn, mm);
 }
 
+static inline void
+flush_tlb_kernel_page(unsigned long kvaddr)
+{
+#ifdef CONFIG_X86
+       xen_invlpg_all(kvaddr);
+#else
+       flush_tlb_kernel_range(kvaddr, kvaddr + PAGE_SIZE);
+#endif
+}
+
 static void
 blktap_device_end_dequeued_request(struct blktap_device *dev,
                                   struct request *req, int uptodate)
@@ -322,7 +332,7 @@ blktap_unmap(struct blktap *tap, struct 
                if (request->handles[i].kernel == INVALID_GRANT_HANDLE) {
                        kvaddr = request_to_kaddr(request, i);
                        blktap_umap_uaddr(&init_mm, kvaddr);
-                       flush_tlb_kernel_range(kvaddr, kvaddr + PAGE_SIZE);
+                       flush_tlb_kernel_page(kvaddr);
                        set_phys_to_machine(__pa(kvaddr) >> PAGE_SHIFT,
                                            INVALID_P2M_ENTRY);
                }
@@ -552,9 +562,9 @@ blktap_map(struct blktap *tap,
 
        pte = mk_pte(page, ring->vma->vm_page_prot);
        blktap_map_uaddr(ring->vma->vm_mm, uvaddr, pte_mkwrite(pte));
-       flush_tlb_mm(ring->vma->vm_mm);
+       flush_tlb_page(ring->vma, uvaddr);
        blktap_map_uaddr(&init_mm, kvaddr, mk_pte(page, PAGE_KERNEL));
-       flush_tlb_kernel_range(kvaddr, kvaddr + PAGE_SIZE);
+       flush_tlb_kernel_page(kvaddr);
 
        set_phys_to_machine(__pa(kvaddr) >> PAGE_SHIFT, pte_mfn(pte));
        request->handles[seg].kernel = INVALID_GRANT_HANDLE;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.