Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 00 of 12] blktap2 on pvops update/merges
Get blktap2 running on pvops. Syncing blktap2/pvops with linux-2.6-xen. This queue merges a bunch of blktap2 related changes from linux-2.6.18 into the pvops tree. fix-git-c3a1cb06-vsyscall.diff # Fix x86_32 build after CONFIG_X86_VSYSCALL (c3a1cb06) linux-2.6.18-xen.hg-885.a4b49dff3387.diff # blktap2: add tlb flush properly. linux-2.6.18-xen.hg-887.85a4c18ad9aa.diff # blktap2: fix compiler warnings linux-2.6.18-xen.hg-892.485fe5efa4ff.diff # blktap2: allow to build as module linux-2.6.18-xen.hg-893.f994bfe9b93b.diff # blktap2: reduce TLB flush scope linux-2.6.18-xen.hg-894.4e5cd2fc45a7.diff # blktap2: fix blkback/blktap2 interaction linux-2.6.18-xen.hg-896.f59c5daed527.diff # blktap2: use blk_rq_map_sg() here too linux-2.6.18-xen.hg-913.b086278a4406.diff # blktap2: remove warnings. linux-2.6.18-xen.hg-918.71a61b393cdf.diff # blkback: pagemap bug fixes linux-2.6.18-xen.hg-960.5e08fff8dc05.diff # blktap2: properly __init-annotate blktap2 code linux-2.6.18-xen.hg-962:0d9c11acc939.diff # blktap2: simplify address translations cleanup-linux-2.6.18-xen.hg-918.diff # blkback: simplify linux-2.6.18-xen.hg-918.71a61b393cdf Different from the filenames listed, results are far from pristine. Where differences matter, comments went into the header. I didn''t test in detail which one are stricly required on pvops. But least the tlb flushing updates apparently were a good idea. These were all done all against xen/master @ 60e0545e _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 01 of 12] Fix x86_32 build after CONFIG_X86_VSYSCALL (c3a1cb06)
# HG changeset patch # User Daniel Stodden <daniel.stodden@citrix.com> # Date 1264726399 28800 # Node ID 5b93bcabe9cc0deaab0f2409dda1f19c1a104141 # Parent 38c7190978b46b9a9dfdcd70ad146b39a6b29c99 Fix x86_32 build after CONFIG_X86_VSYSCALL (c3a1cb06) Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com> diff -r 38c7190978b4 -r 5b93bcabe9cc arch/x86/include/asm/fixmap.h --- a/arch/x86/include/asm/fixmap.h Thu Jan 28 16:53:17 2010 -0800 +++ b/arch/x86/include/asm/fixmap.h Thu Jan 28 16:53:19 2010 -0800 @@ -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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 02 of 12] blktap2: add tlb flush properly
# HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # 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@valinux.co.jp> 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@citrix.com> 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@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 03 of 12] blktap2: fix compiler warnings
# HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1243584997 -3600 # Node ID 4a90fb4644ef8e95cea9e21609b76bd8ce4b4393 # Parent 0296433ecee6e8897ccaad394d42a2fdffcdc48d blktap2: fix compiler warnings Signed-off-by: Jan Beulich <jbeulich@novell.com> linux-2.6-pvops: * rebase against git-41a06958 (merge into xen/master) Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com> diff -r 0296433ecee6 -r 4a90fb4644ef drivers/xen/blktap/sysfs.c --- a/drivers/xen/blktap/sysfs.c Thu May 28 10:04:26 2009 +0100 +++ b/drivers/xen/blktap/sysfs.c Fri May 29 09:16:37 2009 +0100 @@ -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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 04 of 12] blktap2: allow to build as module
# HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1244107954 -3600 # Node ID e6bffb2fc52314d542721c60c65cbb2a7779b4c9 # Parent 4a90fb4644ef8e95cea9e21609b76bd8ce4b4393 blktap2: allow to build as module ... and also allow to interact with blkback when that''s also built as a module. Signed-off-by: Jan Beulich <jbeulich@novell.com> linux-2.6-pvops: * Strip n/a xen_tlb_flush exports * Fix obj macro naming in Makefile * gpl-export init_mm * gpl-export zap_page_range Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com> diff -r 4a90fb4644ef -r e6bffb2fc523 drivers/xen/blktap/Makefile --- a/drivers/xen/blktap/Makefile Fri May 29 09:16:37 2009 +0100 +++ b/drivers/xen/blktap/Makefile Thu Jun 04 10:32:34 2009 +0100 @@ -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 diff -r 4a90fb4644ef -r e6bffb2fc523 drivers/xen/blktap/device.c --- a/drivers/xen/blktap/device.c Fri May 29 09:16:37 2009 +0100 +++ b/drivers/xen/blktap/device.c Thu Jun 04 10:32:34 2009 +0100 @@ -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 { }; diff -r 4a90fb4644ef -r e6bffb2fc523 mm/init-mm.c --- a/mm/init-mm.c Fri May 29 09:16:37 2009 +0100 +++ b/mm/init-mm.c Thu Jun 04 10:32:34 2009 +0100 @@ -4,6 +4,7 @@ #include <linux/spinlock.h> #include <linux/list.h> #include <linux/cpumask.h> +#include <linux/module.h> #include <asm/atomic.h> #include <asm/pgtable.h> @@ -18,3 +19,4 @@ .mmlist = LIST_HEAD_INIT(init_mm.mmlist), .cpu_vm_mask = CPU_MASK_ALL, }; +EXPORT_SYMBOL_GPL(init_mm); diff -r 4a90fb4644ef -r e6bffb2fc523 mm/memory.c --- a/mm/memory.c Fri May 29 09:16:37 2009 +0100 +++ b/mm/memory.c Thu Jun 04 10:32:34 2009 +0100 @@ -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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 05 of 12] blktap2: reduce TLB flush scope
# HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1244107977 -3600 # Node ID 908662be11ba4e0b92f43097caf7625ef84bf6d9 # Parent e6bffb2fc52314d542721c60c65cbb2a7779b4c9 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@novell.com> To linux-2.6-pvops: * Stripped arch/i386/mm/hypervisor.c exports * Stripped xen_invlpg_all(kvaddr) use on CONFIG_X86 Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com> diff -r e6bffb2fc523 -r 908662be11ba drivers/xen/blktap/device.c --- a/drivers/xen/blktap/device.c Thu Jun 04 10:32:34 2009 +0100 +++ b/drivers/xen/blktap/device.c Thu Jun 04 10:32:57 2009 +0100 @@ -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(&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); } @@ -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(&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-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 06 of 12] blktap2: fix blkback/blktap2 interaction
# HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1244108032 -3600 # Node ID d39f82ea033d05bd9cfa4a2fbcfca55f3880498b # Parent 908662be11ba4e0b92f43097caf7625ef84bf6d9 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. Signed-off-by: Jan Beulich <jbeulich@novell.com> linux-2.6-git: * adjust XEN_BLKBACK_PAGEMAP dependencies * rebase against git-fbbc8527 (wean off of use of the BlkBack pageflag) Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com> diff -r 908662be11ba -r d39f82ea033d drivers/xen/Kconfig --- a/drivers/xen/Kconfig Thu Jun 04 10:32:57 2009 +0100 +++ b/drivers/xen/Kconfig Thu Jun 04 10:33:52 2009 +0100 @@ -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 diff -r 908662be11ba -r d39f82ea033d drivers/xen/blkback/Makefile --- a/drivers/xen/blkback/Makefile Thu Jun 04 10:32:57 2009 +0100 +++ b/drivers/xen/blkback/Makefile Thu Jun 04 10:33:52 2009 +0100 @@ -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 diff -r 908662be11ba -r d39f82ea033d drivers/xen/blkback/blkback-pagemap.c --- a/drivers/xen/blkback/blkback-pagemap.c Thu Jun 04 10:32:57 2009 +0100 +++ b/drivers/xen/blkback/blkback-pagemap.c Thu Jun 04 10:33:52 2009 +0100 @@ -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) { diff -r 908662be11ba -r d39f82ea033d drivers/xen/blkback/blkback-pagemap.h --- a/drivers/xen/blkback/blkback-pagemap.h Thu Jun 04 10:32:57 2009 +0100 +++ b/drivers/xen/blkback/blkback-pagemap.h Thu Jun 04 10:33:52 2009 +0100 @@ -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 diff -r 908662be11ba -r d39f82ea033d drivers/xen/blkback/common.h --- a/drivers/xen/blkback/common.h Thu Jun 04 10:32:57 2009 +0100 +++ b/drivers/xen/blkback/common.h Thu Jun 04 10:33:52 2009 +0100 @@ -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__ */ diff -r 908662be11ba -r d39f82ea033d drivers/xen/blktap/device.c --- a/drivers/xen/blktap/device.c Thu Jun 04 10:32:57 2009 +0100 +++ b/drivers/xen/blktap/device.c Thu Jun 04 10:33:52 2009 +0100 @@ -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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 07 of 12] blktap2: use blk_rq_map_sg() here too
# HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1244108814 -3600 # Node ID c5271142c79724bc366b91885737a4c0343c5a19 # Parent d39f82ea033d05bd9cfa4a2fbcfca55f3880498b 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. Signed-off-by: Jan Beulich <jbeulich@novell.com> linux-2.6-pvops: * Rebase against git-fbbc8527 (wean off of use of the BlkBack pageflag) * Fixed scatterlist access. Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com> diff -r d39f82ea033d -r c5271142c797 drivers/xen/blktap/blktap.h --- a/drivers/xen/blktap/blktap.h Thu Jun 04 10:33:52 2009 +0100 +++ b/drivers/xen/blktap/blktap.h Thu Jun 04 10:46:54 2009 +0100 @@ -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; diff -r d39f82ea033d -r c5271142c797 drivers/xen/blktap/device.c --- a/drivers/xen/blktap/device.c Thu Jun 04 10:33:52 2009 +0100 +++ b/drivers/xen/blktap/device.c Thu Jun 04 10:46:54 2009 +0100 @@ -579,10 +579,9 @@ struct request *req) { struct page *page; - struct bio_vec *bvec; - int usr_idx, err; - struct req_iterator iter; + int i, usr_idx, err; struct blktap_ring *ring; + struct scatterlist *sg; struct blktap_grant_table table; unsigned int fsect, lsect, nr_sects; unsigned long offset, uvaddr, kvaddr; @@ -609,42 +608,39 @@ nr_sects = 0; request->nr_pages = 0; - blkif_req.nr_segments = 0; - rq_for_each_segment(bvec, req, iter) { - BUG_ON(blkif_req.nr_segments =- BLKIF_MAX_SEGMENTS_PER_REQUEST); + blkif_req.nr_segments = blk_rq_map_sg(req->q, req, tap->sg); + BUG_ON(blkif_req.nr_segments > BLKIF_MAX_SEGMENTS_PER_REQUEST); + for (i = 0; i < blkif_req.nr_segments; ++i) { + sg = tap->sg + i; + fsect = sg->offset >> 9; + lsect = fsect + (sg->length >> 9) - 1; + nr_sects += sg->length >> 9; - fsect = bvec->bv_offset >> 9; - lsect = fsect + (bvec->bv_len >> 9) - 1; - nr_sects += bvec->bv_len >> 9; - - blkif_req.seg[blkif_req.nr_segments] + blkif_req.seg[i] (struct blkif_request_segment) { .gref = 0, .first_sect = fsect, .last_sect = lsect }; - if (blkback_pagemap_contains_page(bvec->bv_page)) { + if (blkback_pagemap_contains_page(sg_page(sg))) { /* foreign page -- use xen */ if (blktap_prep_foreign(tap, request, &blkif_req, - blkif_req.nr_segments, - bvec->bv_page, + i, + sg_page(sg), &table)) goto out; } else { /* do it the old fashioned way */ blktap_map(tap, request, - blkif_req.nr_segments, - bvec->bv_page); + i, + sg_page(sg)); } - uvaddr = MMAP_VADDR(ring->user_vstart, - usr_idx, blkif_req.nr_segments); - kvaddr = request_to_kaddr(request, - blkif_req.nr_segments); + 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); ring->foreign_map.map[offset] = page; @@ -654,10 +650,9 @@ uvaddr, page, __pa(kvaddr) >> PAGE_SHIFT); BTDBG("offset: 0x%08lx, pending_req: %p, seg: %d, " "page: %p, kvaddr: 0x%08lx, uvaddr: 0x%08lx\n", - offset, request, blkif_req.nr_segments, + offset, request, i, page, kvaddr, uvaddr); - blkif_req.nr_segments++; request->nr_pages++; } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 08 of 12] blktap2: remove warnings
# HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1246269466 -3600 # Node ID 40d2f5a659a72a1d305a9501f5e6afbe78f62d83 # Parent c5271142c79724bc366b91885737a4c0343c5a19 blktap2: remove warnings. This patch removes the following warnings on ia64.> linux-2.6.18-xen.hg/drivers/xen/blktap2/device.c: In function''blktap_device_finish_request'':> 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''> linux-2.6.18-xen.hg/drivers/xen/blktap2/sysfs.c: In function''blktap_sysfs_debug_device'':> 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'' Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> diff -r c5271142c797 -r 40d2f5a659a7 drivers/xen/blktap/device.c --- a/drivers/xen/blktap/device.c Thu Jun 04 10:46:54 2009 +0100 +++ b/drivers/xen/blktap/device.c Mon Jun 29 10:57:46 2009 +0100 @@ -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: diff -r c5271142c797 -r 40d2f5a659a7 drivers/xen/blktap/sysfs.c --- a/drivers/xen/blktap/sysfs.c Thu Jun 04 10:46:54 2009 +0100 +++ b/drivers/xen/blktap/sysfs.c Mon Jun 29 10:57:46 2009 +0100 @@ -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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 09 of 12] blkback: pagemap bug fixes
# HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1248080624 -3600 # Node ID 72b77ff2d5229f9dc14bbaff6fcdec943da59415 # Parent 40d2f5a659a72a1d305a9501f5e6afbe78f62d83 blkback: pagemap bug fixes Signed-off-by: Jake Wires <jake.wires@citrix.com> diff -r 40d2f5a659a7 -r 72b77ff2d522 drivers/xen/blkback/blkback.c --- a/drivers/xen/blkback/blkback.c Mon Jun 29 10:57:46 2009 +0100 +++ b/drivers/xen/blkback/blkback.c Mon Jul 20 10:03:44 2009 +0100 @@ -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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 10 of 12] blktap2: properly __init-annotate blktap2 code
# HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1260521239 0 # Node ID 6b5c16a30bc5e7d771dec05c7cee597b71a695c2 # Parent 72b77ff2d5229f9dc14bbaff6fcdec943da59415 blktap2: properly __init-annotate blktap2 code Signed-off-by: Jan Beulich <jbeulich@novell.com> diff -r 72b77ff2d522 -r 6b5c16a30bc5 drivers/xen/blktap/blktap.h --- a/drivers/xen/blktap/blktap.h Mon Jul 20 10:03:44 2009 +0100 +++ b/drivers/xen/blktap/blktap.h Fri Dec 11 08:47:19 2009 +0000 @@ -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> diff -r 72b77ff2d522 -r 6b5c16a30bc5 drivers/xen/blktap/control.c --- a/drivers/xen/blktap/control.c Mon Jul 20 10:03:44 2009 +0100 +++ b/drivers/xen/blktap/control.c Fri Dec 11 08:47:19 2009 +0000 @@ -205,7 +205,7 @@ return err; } -static int +static int __init blktap_control_init(void) { int err; diff -r 72b77ff2d522 -r 6b5c16a30bc5 drivers/xen/blktap/device.c --- a/drivers/xen/blktap/device.c Mon Jul 20 10:03:44 2009 +0100 +++ b/drivers/xen/blktap/device.c Fri Dec 11 08:47:19 2009 +0000 @@ -1112,7 +1112,7 @@ return err; } -int +int __init blktap_device_init(int *maj) { int major; diff -r 72b77ff2d522 -r 6b5c16a30bc5 drivers/xen/blktap/request.c --- a/drivers/xen/blktap/request.c Mon Jul 20 10:03:44 2009 +0100 +++ b/drivers/xen/blktap/request.c Fri Dec 11 08:47:19 2009 +0000 @@ -272,7 +272,7 @@ spin_unlock_irqrestore(&pool.lock, flags); } -int +int __init blktap_request_pool_init(void) { int i, err; diff -r 72b77ff2d522 -r 6b5c16a30bc5 drivers/xen/blktap/ring.c --- a/drivers/xen/blktap/ring.c Mon Jul 20 10:03:44 2009 +0100 +++ b/drivers/xen/blktap/ring.c Fri Dec 11 08:47:19 2009 +0000 @@ -589,7 +589,7 @@ return blktap_sysfs_create(tap); } -int +int __init blktap_ring_init(int *major) { int err; diff -r 72b77ff2d522 -r 6b5c16a30bc5 drivers/xen/blktap/sysfs.c --- a/drivers/xen/blktap/sysfs.c Mon Jul 20 10:03:44 2009 +0100 +++ b/drivers/xen/blktap/sysfs.c Fri Dec 11 08:47:19 2009 +0000 @@ -424,7 +424,7 @@ class_destroy(class); } -int +int __init blktap_sysfs_init(void) { struct class *cls; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 11 of 12] blkback/blktap2: simplify address translations
# HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1260981852 0 # Node ID 317cdc16a674f4aa4c57b4fdae004ca5fcc24712 # Parent 6b5c16a30bc5e7d771dec05c7cee597b71a695c2 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). Signed-off-by: Jan Beulich <jbeulich@novell.com> linux-2.6-pvops: * Stripped drivers/xen/gntdev/* * Stripped drivers/xen/netback/* Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com> diff -r 6b5c16a30bc5 -r 317cdc16a674 drivers/xen/blkback/blkback.c --- a/drivers/xen/blkback/blkback.c Fri Dec 11 08:47:19 2009 +0000 +++ b/drivers/xen/blkback/blkback.c Wed Dec 16 16:44:12 2009 +0000 @@ -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) { diff -r 6b5c16a30bc5 -r 317cdc16a674 drivers/xen/blktap/blktap.h --- a/drivers/xen/blktap/blktap.h Fri Dec 11 08:47:19 2009 +0000 +++ b/drivers/xen/blktap/blktap.h Wed Dec 16 16:44:12 2009 +0000 @@ -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 diff -r 6b5c16a30bc5 -r 317cdc16a674 drivers/xen/blktap/device.c --- a/drivers/xen/blktap/device.c Fri Dec 11 08:47:19 2009 +0000 +++ b/drivers/xen/blktap/device.c Wed Dec 16 16:44:12 2009 +0000 @@ -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(&init_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++; } diff -r 6b5c16a30bc5 -r 317cdc16a674 drivers/xen/blktap/request.c --- a/drivers/xen/blktap/request.c Fri Dec 11 08:47:19 2009 +0000 +++ b/drivers/xen/blktap/request.c Wed Dec 16 16:44:12 2009 +0000 @@ -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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stodden
2010-Jan-29 00:59 UTC
[Xen-devel] [PATCH 12 of 12] blkback: simplify linux-2.6.18-xen.hg-918.71a61b393cdf
# HG changeset patch # User Daniel Stodden <daniel.stodden@citrix.com> # Date 1264726444 28800 # Node ID 4c1ba88f2fea896770d89e06497bb2695049e173 # Parent 317cdc16a674f4aa4c57b4fdae004ca5fcc24712 blkback: simplify linux-2.6.18-xen.hg-918.71a61b393cdf Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com> diff -r 317cdc16a674 -r 4c1ba88f2fea drivers/xen/blkback/blkback.c --- a/drivers/xen/blkback/blkback.c Wed Dec 16 16:44:12 2009 +0000 +++ b/drivers/xen/blkback/blkback.c Thu Jan 28 16:54:04 2010 -0800 @@ -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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel