Blktap2 patches not in pvops yet ?
Subsystems (5)
Hello Daniel,
It seems that only the hypervisor patches for blktap2 have made it into xen-unstable, but it seems Jeremy hasn't had the time to put the rest in the pvops kernel yet. Do you have a recent set of patches against the current pvops kernel available for testing ?
Signature · 2 lines
Best regards, Sander mailto:[email protected]
PATCH 1/1 blktap2 pvops patches
Hi.
Updates since the last time I posted them:
* Correctly initialize request SG lists.
* Removed init_mm dependency.
Somewhat experimental but I don't see how it could cause trouble.
Open issues:
* -DMEMSHR in tools/blktap2 is broken.
* CONFIG_HIGHPTE fails remapping foreign frame ranges.
PATCH 1/1 Fix x86_32 build after CONFIG_X86_VSYSCALL (c3a1cb06)
# HG changeset patch
# User Daniel Stodden <[email protected]> # Date 1265397134 28800
# Node ID 5a033c651dc03e82c31ec28f304ab799092a533e # Parent 307e7eb9aeec6703359b27546c1d93b59052cf24 Fix x86_32 build after CONFIG_X86_VSYSCALL (c3a1cb06)
arch/x86/include/asm/fixmap.h +2 -0
@@ -189,7 +189,9 @@#ifdef CONFIG_X86_32 case FIX_HOLE ... FIX_VDSO:#else +#ifdef CONFIG_X86_VSYSCALL case VSYSCALL_LAST_PAGE ... VSYSCALL_HPET: +#endif #ifdef CONFIG_PARAVIRT_CLOCK_VSYSCALL case FIX_PVCLOCK_TIME_INFO :#endif
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 blktap2: add tlb flush properly
In reply to Daniel Stoddenxen_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.
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
# HG changeset patch
# User Keir Fraser <[email protected]> # Date 1243501466 -3600
# Node ID b3b159b5e283fd0b6c7fd0317b807512c9e22b50 # Parent 5a033c651dc03e82c31ec28f304ab799092a533e
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.
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
arch/x86/mm/tlb.c +2 -0
@@ -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);
drivers/xen/blktap/device.c +4 -2
@@ -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
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 blktap2: fix compiler warnings
In reply to Daniel Stoddenlinux-2.6-pvops:
* rebase against git-41a06958 (merge into xen/master)
# HG changeset patch
# User Keir Fraser <[email protected]> # Date 1243584997 -3600
# Node ID 05c4915c918213b6f5e144f6631e82f97abc2294 # Parent b3b159b5e283fd0b6c7fd0317b807512c9e22b50
blktap2: fix compiler warnings
linux-2.6-pvops:
* rebase against git-41a06958 (merge into xen/master)
drivers/xen/blktap/sysfs.c +1 -1
@@ -194,7 +194,7 @@ out:blktap_sysfs_exit (tap); -BTDBG ("returning %d\n" , (err ? err : size)); +BTDBG ("returning %zd\n" , (err ? err : size));return (err ? err : size); }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 blktap2: allow to build as module
In reply to Daniel Stodden... and also allow to interact with blkback when that's also built as a module.
linux-2.6-pvops:
* Strip n/a xen_tlb_flush exports
* Fix obj macro naming in Makefile
* Avoid init_mm, remap kernel ranges using tapdisk's mm instead.
* gpl-export zap_page_range
# HG changeset patch
# User Keir Fraser <[email protected]> # Date 1244107954 -3600
# Node ID b2651e8eaa82c3401ccb7e39a879016bf3b42a67 # Parent 05c4915c918213b6f5e144f6631e82f97abc2294
blktap2: allow to build as module
... and also allow to interact with blkback when that's also built as a module.
linux-2.6-pvops:
* Strip n/a xen_tlb_flush exports
* Fix obj macro naming in Makefile
* Avoid init_mm, remap kernel ranges using tapdisk's mm instead.
* gpl-export zap_page_range
drivers/xen/blktap/Makefile +1 -1
@@ -1,3 +1,3 @@ -obj-y := blktap.o +obj-$(CONFIG_XEN_BLKDEV_TAP) := blktap.o blktap-objs := control.o ring.o wait_queue.o device.o request.o sysfs.o
drivers/xen/blktap/device.c +4 -3
@@ -17,7 +17,8 @@#include "blktap.h" -#ifdef CONFIG_XEN_BLKDEV_BACKEND +#if defined(CONFIG_XEN_BLKDEV_BACKEND ) || \ + (defined(CONFIG_XEN_BLKDEV_BACKEND_MODULE ) && defined(MODULE ))#include "../blkback/blkback-pagemap.h" #else struct blkback_pagemap { };
@@ -324,7 +325,7 @@if (request->handles[i].kernel ==INVALID_GRANT_HANDLE ) { kvaddr =request_to_kaddr (request, i); -blktap_umap_uaddr (&init_mm, kvaddr); +blktap_umap_uaddr (tap->ring.vma->vm_mm, kvaddr);flush_tlb_kernel_range (kvaddr, kvaddr +PAGE_SIZE );set_phys_to_machine (__pa (kvaddr) >>PAGE_SHIFT ,INVALID_P2M_ENTRY );
@@ -561,7 +562,7 @@ 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 )); +blktap_map_uaddr (ring->vma->vm_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));
mm/memory.c +1 -0
@@ -1075,6 +1075,7 @@tlb_finish_mmu (tlb, address, end);return end; } +EXPORT_SYMBOL_GPL (zap_page_range);/** * zap_vma_ptes - remove ptes mapping the vma
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 blktap2: reduce TLB flush scope
In reply to Daniel Stoddenc/s 885 added very coarse TLB flushing. Since these flushes always follow single page updates, single page flushes (when available) are sufficient.
To linux-2.6-pvops:
* Stripped arch/i386/mm/hypervisor.c exports
* Stripped xen_invlpg_all(kvaddr) use on CONFIG_X86
# HG changeset patch
# User Keir Fraser <[email protected]> # Date 1244107977 -3600
# Node ID a045aa7c4a77b76dd5be30b0e879087eea57e490 # Parent b2651e8eaa82c3401ccb7e39a879016bf3b42a67
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.
To linux-2.6-pvops:
* Stripped arch/i386/mm/hypervisor.c exports
* Stripped xen_invlpg_all(kvaddr) use on CONFIG_X86
drivers/xen/blktap/device.c +9 -3
@@ -197,6 +197,12 @@ PAGE_SIZE, blktap_umap_uaddr_fn, mm); } +static inline void +flush_tlb_kernel_page (unsigned long kvaddr) +{ +flush_tlb_kernel_range (kvaddr, kvaddr +PAGE_SIZE ); +} +static void blktap_device_end_dequeued_request (struct blktap_device *dev,struct request *req,int error)
@@ -326,7 +332,7 @@if (request->handles[i].kernel ==INVALID_GRANT_HANDLE ) { kvaddr =request_to_kaddr (request, i);blktap_umap_uaddr (tap->ring.vma->vm_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 ); }
@@ -561,9 +567,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); +flush_tlb_page (ring->vma, uvaddr);blktap_map_uaddr (ring->vma->vm_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-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 blktap2: fix blkback/blktap2 interaction
In reply to Daniel Stoddenblkback's page map code needs to be accessible to both blkback and blktap2, irrespective of whether either or both are modules. The most immediate solution is to break it out into a separate, library- like component that doesn't need building if either of the two consumers is configured off, and that gets built as a module if both consumers are modules.
Also fix the dummy implementation of blkback_pagemap_read(), since using BUG() there doesn't compile.
linux-2.6-git:
* adjust XEN_BLKBACK_PAGEMAP dependencies
* rebase against git-fbbc8527 (wean off of use of the BlkBack pageflag)
# HG changeset patch
# User Keir Fraser <[email protected]> # Date 1244108032 -3600
# Node ID 2fd85e9a1e21854264c3d3d593749db42b6fc03f # Parent a045aa7c4a77b76dd5be30b0e879087eea57e490
blktap2: fix blkback/blktap2 interaction
blkback's page map code needs to be accessible to both blkback and blktap2, irrespective of whether either or both are modules. The most immediate solution is to break it out into a separate, library- like component that doesn't need building if either of the two consumers is configured off, and that gets built as a module if both consumers are modules.
Also fix the dummy implementation of blkback_pagemap_read(), since using BUG() there doesn't compile.
linux-2.6-git:
* adjust XEN_BLKBACK_PAGEMAP dependencies
* rebase against git-fbbc8527 (wean off of use of the BlkBack pageflag)
drivers/xen/Kconfig +5 -0
@@ -127,6 +127,11 @@ depends on XEN_PCIDEV_BACKEND +config XEN_BLKBACK_PAGEMAP + tristate + depends on XEN_BLKDEV_BACKEND != n && XEN_BLKDEV_TAP != n + default XEN_BLKDEV_BACKEND || XEN_BLKDEV_TAP + config XENFS tristate "Xen filesystem" depends on XEN
drivers/xen/blkback/Makefile +2 -1
@@ -1,3 +1,4 @@ obj-$(CONFIG_XEN_BLKDEV_BACKEND) := xen-blkback.o +obj-$(CONFIG_XEN_BLKBACK_PAGEMAP) += blkback-pagemap.o -xen-blkback-y := blkback.o xenbus.o interface.o vbd.o blkback-pagemap.o +xen-blkback-y := blkback.o xenbus.o interface.o vbd.o
drivers/xen/blkback/blkback-pagemap.c +6 -1
@@ -1,4 +1,4 @@ -#include "common.h" +#include <linux/module.h> #include "blkback-pagemap.h" static int blkback_pagemap_size;
@@ -22,6 +22,7 @@ blkback_pagemap_size = pages;return 0 ; } +EXPORT_SYMBOL_GPL (blkback_pagemap_init); void blkback_pagemap_set(int idx, struct page *page,
@@ -46,6 +47,7 @@ entry->busid = busid; entry->gref = gref; } +EXPORT_SYMBOL_GPL (blkback_pagemap_set);void blkback_pagemap_clear (struct page *page)
@@ -66,6 +68,7 @@memset (entry,0 ,sizeof (*entry)); } +EXPORT_SYMBOL_GPL (blkback_pagemap_clear);struct blkback_pagemap blkback_pagemap_read (struct page *page)
@@ -88,6 +91,8 @@ }EXPORT_SYMBOL (blkback_pagemap_read); +MODULE_LICENSE ("Dual BSD/GPL" ); +int blkback_pagemap_contains_page (struct page *page) {
drivers/xen/blkback/blkback-pagemap.h +17 -1
@@ -1,6 +1,7 @@#ifndef _BLKBACK_PAGEMAP_H_#define _BLKBACK_PAGEMAP_H_ +#include <linux/mm.h> #include <xen/interface/xen.h> #include <xen/interface/grant_table.h>
@@ -13,8 +14,23 @@grant_ref_t gref; }; +#if defined(CONFIG_XEN_BLKBACK_PAGEMAP ) || defined(CONFIG_XEN_BLKBACK_PAGEMAP_MODULE ) + +int blkback_pagemap_init (int ); +void blkback_pagemap_set (int ,struct page *,domid_t ,busid_t ,grant_ref_t ); +void blkback_pagemap_clear (struct page *);struct blkback_pagemap blkback_pagemap_read (struct page *); -int blkback_pagemap_contains_page (struct page *page); +#else /* CONFIG_XEN_BLKBACK_PAGEMAP */ + +static inline int blkback_pagemap_init (int pages) {return 0 ; } +static inline void blkback_pagemap_set (int idx,struct page *page,domid_t dom, +busid_t bus,grant_ref_t gnt) {} +static inline void blkback_pagemap_clear (struct page *page) {} +#define blkback_pagemap_read (_page) ({ BUG(); (struct blkback_pagemap){0}; }) +static inline int blkback_pagemap_contains_page (struct page *page) {return 0 ; } + +#endif /* CONFIG_XEN_BLKBACK_PAGEMAP */ +#endif
drivers/xen/blkback/common.h +0 -4
@@ -136,8 +136,4 @@int blkback_barrier (struct xenbus_transaction xbt,struct backend_info *be,int state); -int blkback_pagemap_init (int ); -void blkback_pagemap_set (int ,struct page *,domid_t ,busid_t ,grant_ref_t ); -void blkback_pagemap_clear (struct page *); -#endif /* __BLKIF__BACKEND__COMMON_H__ */
drivers/xen/blktap/device.c +0 -7
@@ -17,14 +17,7 @@#include "blktap.h" -#if defined(CONFIG_XEN_BLKDEV_BACKEND ) || \ - (defined(CONFIG_XEN_BLKDEV_BACKEND_MODULE ) && defined(MODULE ))#include "../blkback/blkback-pagemap.h" -#else -struct blkback_pagemap { }; -#define blkback_pagemap_read (page) BUG(); -#define blkback_pagemap_contains_page (page) 0 -#endif #if 0 #define DPRINTK_IOCTL(_f, _a...) printk(KERN_ALERT _f, ## _a)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 blktap2: use blk_rq_map_sg() here too
In reply to Daniel StoddenJust like in blkfront, not doing so can cause the maximum number of segments check to trigger.
linux-2.6-pvops:
* Rebase against git-fbbc8527 (wean off of use of the BlkBack pageflag)
* Scatterlist: fix access macro usage, add initcall to device creation.
# HG changeset patch
# User Keir Fraser <[email protected]> # Date 1244108814 -3600
# Node ID 444a9ed5dfdefb1b7d4a765b7a110e1e74116540 # Parent 2fd85e9a1e21854264c3d3d593749db42b6fc03f
blktap2: use blk_rq_map_sg() here too
Just like in blkfront, not doing so can cause the maximum number of segments check to trigger.
linux-2.6-pvops:
* Rebase against git-fbbc8527 (wean off of use of the BlkBack pageflag)
* Scatterlist: fix access macro usage, add initcall to device creation.
drivers/xen/blktap/blktap.h +2 -0
@@ -4,6 +4,7 @@#include <linux/mm.h> #include <linux/fs.h> #include <linux/cdev.h> +#include <linux/scatterlist.h> #include <xen/blkif.h> #include <xen/grant_table.h>
@@ -173,6 +174,7 @@int pending_cnt;struct blktap_request *pending_requests[MAX_PENDING_REQS ]; +struct scatterlist sg[BLKIF_MAX_SEGMENTS_PER_REQUEST ];wait_queue_head_t wq;struct list_head deferred_queue;
drivers/xen/blktap/control.c +1 -0
@@ -23,6 +23,7 @@init_rwsem (&tap->tap_sem);init_waitqueue_head (&tap->wq);atomic_set (&tap->refcnt,0 ); +sg_init_table (tap->sg,BLKIF_MAX_SEGMENTS_PER_REQUEST ); tap->minor = minor; }
drivers/xen/blktap/device.c +18 -23
80 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 blktap2: remove warnings
In reply to Daniel StoddenThis patch removes the following warnings on ia64.
Quoted 1 line
linux-2.6.18-xen.hg/drivers/xen/blktap2/device.c: In function
'blktap_device_finish_request':
Quoted 1 line
linux-2.6.18-xen.hg/drivers/xen/blktap2/device.c:403: warning:
format '%lld' expects type 'long long int', but argument 7 has type 'uint64_t'
Quoted 1 line
linux-2.6.18-xen.hg/drivers/xen/blktap2/sysfs.c: In function
'blktap_sysfs_debug_device':
Quoted 1 line
linux-2.6.18-xen.hg/drivers/xen/blktap2/sysfs.c:276: warning: format
'%llu' expects type 'long long unsigned int', but argument 4 has type 'uint64_t'
# HG changeset patch
# User Keir Fraser <[email protected]> # Date 1246269466 -3600
# Node ID c995a3160b7e6da90d1ac45c7a558f76384605e2 # Parent 444a9ed5dfdefb1b7d4a765b7a110e1e74116540
blktap2: remove warnings.
This patch removes the following warnings on ia64.
Quoted 1 line
linux-2.6.18-xen.hg/drivers/xen/blktap2/device.c: In function
'blktap_device_finish_request':
Quoted 1 line
linux-2.6.18-xen.hg/drivers/xen/blktap2/device.c:403: warning:
format '%lld' expects type 'long long int', but argument 7 has type 'uint64_t'
Quoted 1 line
linux-2.6.18-xen.hg/drivers/xen/blktap2/sysfs.c: In function
'blktap_sysfs_debug_device':
Quoted 1 line
linux-2.6.18-xen.hg/drivers/xen/blktap2/sysfs.c:276: warning: format
'%llu' expects type 'long long unsigned int', but argument 4 has type 'uint64_t'
drivers/xen/blktap/device.c +2 -1
@@ -400,7 +400,8 @@ ret = res->status ==BLKIF_RSP_OKAY ?0 : -EIO ;BTDBG ("req %p res status %d operation %d/%d id %lld\n" , req, - res->status, res->operation, request->operation, res->id); + res->status, res->operation, request->operation, + (unsigned long long )res->id);switch (request->operation) {case BLKIF_OP_READ :
drivers/xen/blktap/sysfs.c +1 -1
@@ -276,7 +276,7 @@ tmp +=sprintf (tmp,"req %d: id: %llu, usr_idx: %d, " "status: 0x%02x, pendcnt: %d, " "nr_pages: %u, op: %d, time: %lu:%lu\n" , - i, req->id, req->usr_idx, + i, (unsigned long long )req->id, req->usr_idx, req->status,atomic_read (&req->pendcnt), req->nr_pages, req->operation, req->time.tv_sec, req->time.tv_usec);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 blkback: pagemap bug fixes
In reply to Daniel Stodden# HG changeset patch
# User Keir Fraser <[email protected]> # Date 1248080624 -3600
# Node ID e78f3ff3716110b973c22521730d2d4a97814346 # Parent c995a3160b7e6da90d1ac45c7a558f76384605e2
blkback: pagemap bug fixes
drivers/xen/blkback/blkback.c +5 -4
@@ -454,6 +454,11 @@DPRINTK ("invalid buffer -- could not remap it\n" ); map[i].handle =BLKBACK_INVALID_HANDLE ; ret |=1 ; + }else { +blkback_pagemap_set (vaddr_pagenr (pending_req, i), +virt_to_page (vaddr (pending_req, i)), + blkif->domid, req->handle, + req->seg[i].gref); }pending_handle (pending_req, i) = map[i].handle;
@@ -466,10 +471,6 @@ FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT)); seg[i].buf = map[i].dev_bus_addr | (req->seg[i].first_sect <<9 ); -blkback_pagemap_set (vaddr_pagenr (pending_req, i), -virt_to_page (vaddr (pending_req, i)), - blkif->domid, req->handle, - req->seg[i].gref); }if (ret)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 blktap2: properly __init-annotate blktap2 code
In reply to Daniel Stodden# HG changeset patch
# User Keir Fraser <[email protected]> # Date 1260521239 0
# Node ID f9d6e751bd54770b415f5580b788e8c569c34c3c # Parent e78f3ff3716110b973c22521730d2d4a97814346
blktap2: properly __init-annotate blktap2 code
drivers/xen/blktap/blktap.h +1 -0
@@ -4,6 +4,7 @@#include <linux/mm.h> #include <linux/fs.h> #include <linux/cdev.h> +#include <linux/init.h> #include <linux/scatterlist.h> #include <xen/blkif.h> #include <xen/grant_table.h>
drivers/xen/blktap/control.c +1 -1
@@ -206,7 +206,7 @@return err; } -static int +static int __init blktap_control_init (void ) {int err;
drivers/xen/blktap/device.c +1 -1
@@ -1112,7 +1112,7 @@return err; } -int +int __init blktap_device_init (int *maj) {int major;
drivers/xen/blktap/request.c +1 -1
@@ -272,7 +272,7 @@spin_unlock_irqrestore (&pool.lock, flags); } -int +int __init blktap_request_pool_init (void ) {int i, err;
drivers/xen/blktap/ring.c +1 -1
@@ -589,7 +589,7 @@return blktap_sysfs_create (tap); } -int +int __init blktap_ring_init (int *major) {int err;
drivers/xen/blktap/sysfs.c +1 -1
@@ -424,7 +424,7 @@class_destroy (class); } -int +int __init blktap_sysfs_init (void ) {struct class *cls;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 blkback/blktap2: simplify address translations
In reply to Daniel StoddenThere are quite a number of places where e.g. page->va->page translations happen.
Besides yielding smaller code (source and binary), a second goal is to make it easier to determine where virtual addresses of pages allocated through alloc_empty_pages_and_pagevec() are really used (in turn in order to determine whether using highmem pages would be possible there).
linux-2.6-pvops:
* Stripped drivers/xen/gntdev/*
* Stripped drivers/xen/netback/*
# HG changeset patch
# User Keir Fraser <[email protected]> # Date 1260981852 0
# Node ID 7cf2b4299ec1c6ed632ae596368d4c39f28f0479 # Parent f9d6e751bd54770b415f5580b788e8c569c34c3c blkback/blktap2: simplify address translations
There are quite a number of places where e.g. page->va->page translations happen.
Besides yielding smaller code (source and binary), a second goal is to make it easier to determine where virtual addresses of pages allocated through alloc_empty_pages_and_pagevec() are really used (in turn in order to determine whether using highmem pages would be possible there).
linux-2.6-pvops:
* Stripped drivers/xen/gntdev/*
* Stripped drivers/xen/netback/*
drivers/xen/blkback/blkback.c +8 -6
@@ -99,9 +99,11 @@return (req - pending_reqs) *BLKIF_MAX_SEGMENTS_PER_REQUEST + seg; } +#define pending_page (req, seg) pending_pages[vaddr_pagenr(req, seg)] +static inline unsigned long vaddr (pending_req_t *req,int seg) { -unsigned long pfn =page_to_pfn (pending_pages[vaddr_pagenr (req, seg)]); +unsigned long pfn =page_to_pfn (pending_page (req, seg));return (unsigned long )pfn_to_kaddr (pfn); }
@@ -178,7 +180,7 @@ handle =pending_handle (req, i);if (handle ==BLKBACK_INVALID_HANDLE )continue ; -blkback_pagemap_clear (virt_to_page (vaddr (req, i))); +blkback_pagemap_clear (pending_page (req, i));gnttab_set_unmap_op (&unmap[invcount],vaddr (req, i), GNTMAP_host_map, handle);pending_handle (req, i) =BLKBACK_INVALID_HANDLE ;
@@ -456,7 +458,7 @@ ret |=1 ; }else {blkback_pagemap_set (vaddr_pagenr (pending_req, i), -virt_to_page (vaddr (pending_req, i)), +pending_page (pending_req, i), blkif->domid, req->handle, req->seg[i].gref); }
@@ -466,8 +468,8 @@if (ret)continue ; -set_phys_to_machine (__pa (vaddr ( - pending_req, i)) >>PAGE_SHIFT , +set_phys_to_machine ( +page_to_pfn (pending_page (pending_req, i)),FOREIGN_FRAME (map[i].dev_bus_addr >>PAGE_SHIFT )); seg[i].buf = map[i].dev_bus_addr | (req->seg[i].first_sect <<9 );
@@ -498,7 +500,7 @@while ((bio ==NULL ) || (bio_add_page (bio, -virt_to_page (vaddr (pending_req, i)), +pending_page (pending_req, i), seg[i].nsec <<9 , seg[i].buf & ~PAGE_MASK ) ==0 )) {if (bio) {
drivers/xen/blktap/blktap.h +8 -1
@@ -241,6 +241,13 @@int blktap_request_pool_shrink (void );struct blktap_request *blktap_request_allocate (struct blktap *);void blktap_request_free (struct blktap *,struct blktap_request *); -unsigned long request_to_kaddr (struct blktap_request *,int ); +struct page *request_to_page (struct blktap_request *,int ); + +static inline unsigned long +request_to_kaddr (struct blktap_request *req,int seg) +{ +unsigned long pfn =page_to_pfn (request_to_page (req, seg)); +return (unsigned long )pfn_to_kaddr (pfn); +}#endif
drivers/xen/blktap/device.c +14 -16
@@ -315,15 +315,14 @@down_write (&tap->ring.vma->vm_mm->mmap_sem);for (i =0 ; i < request->nr_pages; i++) { + kvaddr =request_to_kaddr (request, i);BTDBG ("request: %p, seg: %d, kvaddr: 0x%08lx, khandle: %u, " "uvaddr: 0x%08lx, uhandle: %u\n" , request, i, -request_to_kaddr (request, i), - request->handles[i].kernel, + kvaddr, request->handles[i].kernel,MMAP_VADDR (tap->ring.user_vstart, usr_idx, i), request->handles[i].user);if (request->handles[i].kernel ==INVALID_GRANT_HANDLE ) { - kvaddr =request_to_kaddr (request, i);blktap_umap_uaddr (tap->ring.vma->vm_mm, kvaddr);flush_tlb_kernel_page (kvaddr); set_phys_to_machine(__pa(kvaddr) >> PAGE_SHIFT,
@@ -450,7 +449,7 @@#ifdef BLKTAP_CHAINED_BLKTAP /* enable chained tap devices */ - tap_page =pfn_to_page (__pa (kvaddr) >>PAGE_SHIFT ); + tap_page =request_to_page (request, seg);set_page_private (tap_page,page_private (page));SetPageBlkback (tap_page);#endif
@@ -480,7 +479,7 @@struct page *page;int i, grant, err, usr_idx;struct blktap_ring *ring; -unsigned long uvaddr, kvaddr, foreign_mfn; +unsigned long uvaddr, foreign_mfn;if (!table->cnt)return 0 ;
@@ -498,7 +497,6 @@continue ; uvaddr =MMAP_VADDR (ring->user_vstart, usr_idx, i); - kvaddr =request_to_kaddr (request, i);if (unlikely (table->grants[grant].status)) {BTERR ("invalid kernel buffer: could not remap it\n" );
@@ -526,18 +524,19 @@if (err)continue ; - page =pfn_to_page (__pa (kvaddr) >>PAGE_SHIFT ); + page =request_to_page (request, i);if (!xen_feature (XENFEAT_auto_translated_physmap)) -set_phys_to_machine (__pa (kvaddr) >>PAGE_SHIFT , +set_phys_to_machine (page_to_pfn (page),FOREIGN_FRAME (foreign_mfn));else if (vm_insert_page (ring->vma, uvaddr, page)) err |=1 ;BTDBG ("pending_req: %p, seg: %d, page: %p, " -"kvaddr: 0x%08lx, khandle: %u, uvaddr: 0x%08lx, " +"kvaddr: 0x%p, khandle: %u, uvaddr: 0x%08lx, " "uhandle: %u\n" , request, i, page, - kvaddr, request->handles[i].kernel, +pfn_to_kaddr (page_to_pfn (page)), + request->handles[i].kernel, uvaddr, request->handles[i].user); }
@@ -585,7 +584,7 @@struct scatterlist *sg;struct blktap_grant_table table;unsigned int fsect, lsect, nr_sects; -unsigned long offset, uvaddr, kvaddr; +unsigned long offset, uvaddr;struct blkif_request blkif_req, *target; err =-1 ;
@@ -641,18 +640,17 @@ } uvaddr =MMAP_VADDR (ring->user_vstart, usr_idx, i); - kvaddr =request_to_kaddr (request, i); offset = (uvaddr - ring->vma->vm_start) >>PAGE_SHIFT ; - page =pfn_to_page (__pa (kvaddr) >>PAGE_SHIFT ); + page =request_to_page (request, i); ring->foreign_map.map[offset] = page;SetPageReserved (page);BTDBG ("mapped uaddr %08lx to page %p pfn 0x%lx\n" , - uvaddr, page,__pa (kvaddr) >>PAGE_SHIFT ); + uvaddr, page,page_to_pfn (page));BTDBG ("offset: 0x%08lx, pending_req: %p, seg: %d, " -"page: %p, kvaddr: 0x%08lx, uvaddr: 0x%08lx\n" , +"page: %p, kvaddr: %p, uvaddr: 0x%08lx\n" , offset, request, i, - page, kvaddr, uvaddr); + page,pfn_to_kaddr (page_to_pfn (page)), uvaddr); request->nr_pages++; }
drivers/xen/blktap/request.c +3 -4
@@ -124,13 +124,12 @@kfree (bucket); } -unsigned long -request_to_kaddr (struct blktap_request *req,int seg) +struct page * +request_to_page (struct blktap_request *req,int seg) {struct blktap_request_handle *handle =blktap_request_to_handle (req);int idx = handle->slot *BLKIF_MAX_SEGMENTS_PER_REQUEST + seg; -unsigned long pfn =page_to_pfn (handle->bucket->foreign_pages[idx]); -return (unsigned long )pfn_to_kaddr (pfn); +return handle->bucket->foreign_pages[idx]; }int
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 blkback: simplify linux-2.6.18-xen.hg-918.71a61b393cdf
In reply to Daniel Stodden# HG changeset patch
# User Daniel Stodden <[email protected]> # Date 1265397144 28800
# Node ID 7d0b5bd0725f0c28105e6729c0b907caf8358c94 # Parent 7cf2b4299ec1c6ed632ae596368d4c39f28f0479
blkback: simplify linux-2.6.18-xen.hg-918.71a61b393cdf
drivers/xen/blkback/blkback.c +6 -10
@@ -456,23 +456,19 @@DPRINTK ("invalid buffer -- could not remap it\n" ); map[i].handle =BLKBACK_INVALID_HANDLE ; ret |=1 ; - }else { -blkback_pagemap_set (vaddr_pagenr (pending_req, i), -pending_page (pending_req, i), - blkif->domid, req->handle, - req->seg[i].gref); +continue ; } -pending_handle (pending_req, i) = map[i].handle; - -if (ret) -continue ; -set_phys_to_machine (page_to_pfn (pending_page (pending_req, i)),FOREIGN_FRAME (map[i].dev_bus_addr >>PAGE_SHIFT )); seg[i].buf = map[i].dev_bus_addr | (req->seg[i].first_sect <<9 ); +blkback_pagemap_set (vaddr_pagenr (pending_req, i), +pending_page (pending_req, i), + blkif->domid, req->handle, + req->seg[i].gref); +pending_handle (pending_req, i) = map[i].handle; }if (ret)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel