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

[Xen-changelog] [linux-2.6.18-xen] blktap: Small fix to the blktap clear pte hook.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1181034262 -3600
# Node ID 396dfc8423774be703a37d8d86fed37eadbc2eb7
# Parent  45dfe4cfc5ef81f158cbf301a10939ed66dcc483
blktap: Small fix to the blktap clear pte hook.

Fix an offset error in the foreign page map indexing, add support for
auto-translated physmap mode and remove warning message.

This is an update on a patch submitted by Isaku Yamahata 
<yamahata@xxxxxxxxxxxxx>.

Signed-off-by: Geoffrey Lefebvre <geoffrey@xxxxxxxxx>
---
 drivers/xen/blktap/blktap.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff -r 45dfe4cfc5ef -r 396dfc842377 drivers/xen/blktap/blktap.c
--- a/drivers/xen/blktap/blktap.c       Mon Jun 04 14:35:51 2007 +0100
+++ b/drivers/xen/blktap/blktap.c       Tue Jun 05 10:04:22 2007 +0100
@@ -309,7 +309,7 @@ static pte_t blktap_clear_pte(struct vm_
                              unsigned long uvaddr,
                              pte_t *ptep, int is_fullmm)
 {
-       pte_t copy = *ptep;
+       pte_t copy;
        tap_blkif_t *info;
        int offset, seg, usr_idx, pending_idx, mmap_idx;
        unsigned long uvstart = vma->vm_start + (RING_PAGES << PAGE_SHIFT);
@@ -319,20 +319,14 @@ static pte_t blktap_clear_pte(struct vm_
        struct grant_handle_pair *khandle;
        struct gnttab_unmap_grant_ref unmap[2];
        int count = 0;
-       static int print_warning = 1;
-
-       /* Print a warning message once, if the hook gets called. */
-       if (print_warning) {
-               WPRINTK("Clear pte hook called!\n");
-               print_warning = 0;
-       }
 
        /*
         * If the address is before the start of the grant mapped region or
         * if vm_file is NULL (meaning mmap failed and we have nothing to do)
         */
        if (uvaddr < uvstart || vma->vm_file == NULL)
-               return copy;
+               return ptep_get_and_clear_full(vma->vm_mm, uvaddr, 
+                                              ptep, is_fullmm);
 
        info = vma->vm_file->private_data;
        map = vma->vm_private_data;
@@ -352,7 +346,7 @@ static pte_t blktap_clear_pte(struct vm_
        kvaddr = idx_to_kaddr(mmap_idx, pending_idx, seg);
        pg = pfn_to_page(__pa(kvaddr) >> PAGE_SHIFT);
        ClearPageReserved(pg);
-       map[offset] = NULL;
+       map[offset + RING_PAGES] = NULL;
 
        khandle = &pending_handle(mmap_idx, pending_idx, seg);
 
@@ -368,12 +362,19 @@ static pte_t blktap_clear_pte(struct vm_
        if (khandle->user != INVALID_GRANT_HANDLE) {
                BUG_ON(xen_feature(XENFEAT_auto_translated_physmap));
 
+               copy = *ptep;
                gnttab_set_unmap_op(&unmap[count], virt_to_machine(ptep), 
                                    GNTMAP_host_map 
                                    | GNTMAP_application_map 
                                    | GNTMAP_contains_pte,
                                    khandle->user);
                count++;
+       } else {
+               BUG_ON(!xen_feature(XENFEAT_auto_translated_physmap));
+
+               /* USING SHADOW PAGE TABLES. */
+               copy = ptep_get_and_clear_full(vma->vm_mm, uvaddr, ptep,
+                                              is_fullmm);
        }
 
        if (count) {
@@ -979,6 +980,7 @@ static void fast_flush_area(pending_req_
                               MMAP_VADDR(info->user_vstart, u_idx, 0), 
                               req->nr_pages << PAGE_SHIFT, NULL);
                up_write(&info->vma->vm_mm->mmap_sem);
+               return;
        }
 
        mmap_idx = req->mem_idx;

_______________________________________________
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®.