WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 02 of 12] blktap2: add tlb flush properly

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 02 of 12] blktap2: add tlb flush properly
From: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
Date: Fri, 29 Jan 2010 00:59:33 -0000
Delivery-date: Thu, 28 Jan 2010 17:02:00 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1264726771@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1264726771@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.3.1
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1243501466 -3600
# Node ID 0296433ecee6e8897ccaad394d42a2fdffcdc48d
# Parent  5b93bcabe9cc0deaab0f2409dda1f19c1a104141
blktap2: add tlb flush properly.

xen_invlpg() flushes tlb on its cpu, but tlb flush is needed on
all cpus. So replace xen_invlpg() with more proper ones.
Maybe it would be possible to make tlb flush less.
this patch also makes blktap2 compile on ia64 because xen_invlpg()
is x86 specific.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

linux-2.6-pvops:
 * rebase against git-da22857f (port blktap2 from 2.6.18 to tip)
 * rebase against git-fbbc8527 (wean off of use of the BlkBack pageflag)
 * gpl-export flush_tlb_page, flush_tlb_all

Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx>

diff -r 5b93bcabe9cc -r 0296433ecee6 arch/x86/mm/tlb.c
--- a/arch/x86/mm/tlb.c Thu Jan 28 16:53:19 2010 -0800
+++ b/arch/x86/mm/tlb.c Thu May 28 10:04:26 2009 +0100
@@ -282,6 +282,7 @@
 
        preempt_enable();
 }
+EXPORT_SYMBOL_GPL(flush_tlb_page);
 
 void flush_tlb_all(void)
 {
@@ -296,3 +297,4 @@
 
        put_cpu();
 }
+EXPORT_SYMBOL_GPL(flush_tlb_all);
diff -r 5b93bcabe9cc -r 0296433ecee6 drivers/xen/blktap/device.c
--- a/drivers/xen/blktap/device.c       Thu Jan 28 16:53:19 2010 -0800
+++ b/drivers/xen/blktap/device.c       Thu May 28 10:04:26 2009 +0100
@@ -4,6 +4,7 @@
 #include <linux/cdrom.h>
 #include <linux/hdreg.h>
 #include <linux/module.h>
+#include <asm/tlbflush.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_ioctl.h>
@@ -167,7 +168,6 @@
 
        BTDBG("ptep %p -> %012llx\n", ptep, (unsigned long long)pte_val(*pte));
        set_pte(ptep, *pte);
-       __flush_tlb_single(addr);
        return 0;
 }
 
@@ -186,7 +186,6 @@
 
        BTDBG("ptep %p\n", ptep);
        pte_clear(mm, addr, ptep);
-       __flush_tlb_single(addr);
        return 0;
 }
 
@@ -326,6 +325,7 @@
                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);
                        set_phys_to_machine(__pa(kvaddr) >> PAGE_SHIFT,
                                            INVALID_P2M_ENTRY);
                }
@@ -560,7 +560,9 @@
 
        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);
        blktap_map_uaddr(&init_mm, kvaddr, mk_pte(page, PAGE_KERNEL));
+       flush_tlb_kernel_range(kvaddr, kvaddr + PAGE_SIZE);
 
        set_phys_to_machine(__pa(kvaddr) >> PAGE_SHIFT, pte_mfn(pte));
        request->handles[seg].kernel = INVALID_GRANT_HANDLE;

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