Hello, I''m trying to port the blktap2 driver to NetBSD using a pure user-space solution. Since blktap is not included in the kernel, I would like to know where I can find the most up to date version of the code, I''ve seen several repositories that contain blktap2 code, like: http://xenbits.xen.org/linux-2.6.18-xen.hg http://xenbits.xensource.com/gitweb/?p=people/dstodden/blktap.git;a=summary http://xenbits.xensource.com/gitweb/?p=people/dstodden/linux.git;a=summary (I cannot access the tree of this one, I get a 404 error) Whats the best one to fetch to get a current version of the blktap2 code? Thanks, Roger. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Pasi Kärkkäinen
2011-Aug-24 14:15 UTC
Re: [Xen-devel] Most up to date blktap2 kernel driver
On Wed, Aug 24, 2011 at 10:09:10AM +0200, Roger Pau Monné wrote:> Hello, > > I''m trying to port the blktap2 driver to NetBSD using a pure > user-space solution. Since blktap is not included in the kernel, I > would like to know where I can find the most up to date version of the > code, I''ve seen several repositories that contain blktap2 code, like: > > http://xenbits.xen.org/linux-2.6.18-xen.hg > http://xenbits.xensource.com/gitweb/?p=people/dstodden/blktap.git;a=summary > http://xenbits.xensource.com/gitweb/?p=people/dstodden/linux.git;a=summary > (I cannot access the tree of this one, I get a 404 error) > > Whats the best one to fetch to get a current version of the blktap2 code? >I''m not sure which one is the latest but blktap2 can also be found from: Jeremy''s xen.git branch "xen/stable-2.6.32.x" http://git.eu.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=shortlog;h=xen/stable-2.6.32.x and from XenServer/XCP 2.6.32 xenlinux kernel: http://xenbits.xen.org/XCP/linux-2.6.32.pq.hg Daniel (cc) can probably comment.. -- Pasi _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Wed, 2011-08-24 at 15:15 +0100, Pasi Kärkkäinen wrote:> On Wed, Aug 24, 2011 at 10:09:10AM +0200, Roger Pau Monné wrote: > > Hello, > > > > I''m trying to port the blktap2 driver to NetBSD using a pure > > user-space solution.Thanks! This would be awesome to have. We''re interested in taking this same approach for Linux in the future since (as you''ve noticed) blktap is not in the upstream kernel> Since blktap is not included in the kernel, I > > would like to know where I can find the most up to date version of the > > code, I''ve seen several repositories that contain blktap2 code, like: > > > > http://xenbits.xen.org/linux-2.6.18-xen.hg > > http://xenbits.xensource.com/gitweb/?p=people/dstodden/blktap.git;a=summary > > http://xenbits.xensource.com/gitweb/?p=people/dstodden/linux.git;a=summary > > (I cannot access the tree of this one, I get a 404 error) > > > > Whats the best one to fetch to get a current version of the blktap2 code? > > > > I''m not sure which one is the latest but blktap2 can also be found from: > > Jeremy''s xen.git branch "xen/stable-2.6.32.x" > http://git.eu.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=shortlog;h=xen/stable-2.6.32.x > > and from XenServer/XCP 2.6.32 xenlinux kernel: > http://xenbits.xen.org/XCP/linux-2.6.32.pq.hg > > Daniel (cc) can probably comment..FWIW I''d probably lean towards the xen.git one but either is probably a good start. The Xen backend framework in upstream qemu might also be interesting in this context? Does NetBSD have an equivalent of (at least) /dev/xen/gntdev and /dev/xen/evtchn? I think they are a requirement to make this work. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stefano Stabellini
2011-Aug-24 17:58 UTC
Re: [Xen-devel] Most up to date blktap2 kernel driver
On Wed, 24 Aug 2011, Ian Campbell wrote:> The Xen backend framework in upstream qemu might also be interesting in > this context?Give a look at hw/xen_backend.c and hw/xen_disk.c in upstream qemu: they provide the basic infrustructure to run xen backends in userspace and the blkback userspace code.> Does NetBSD have an equivalent of (at least) /dev/xen/gntdev > and /dev/xen/evtchn? I think they are a requirement to make this work.You''ll need a way to receive event channel notifications and a way to map grant references in userspace. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Roger Pau Monné
2011-Aug-25 11:45 UTC
Re: [Xen-devel] Most up to date blktap2 kernel driver
2011/8/24 Stefano Stabellini <stefano.stabellini@eu.citrix.com>:> On Wed, 24 Aug 2011, Ian Campbell wrote: >> The Xen backend framework in upstream qemu might also be interesting in >> this context? > > Give a look at hw/xen_backend.c and hw/xen_disk.c in upstream qemu: they > provide the basic infrustructure to run xen backends in userspace and > the blkback userspace code.This looks interesting, it provides an example of how to interact with grant tables from user space.>> Does NetBSD have an equivalent of (at least) /dev/xen/gntdev >> and /dev/xen/evtchn? I think they are a requirement to make this work. > > You''ll need a way to receive event channel notifications and a way to map > grant references in userspace.NetBSD has a device related to Xen events I think (/dev/xenevt), but hasn''t got any gntdev, I''m not sure if that''s necessary, I saw that hw/xen_block.c uses xc_gnttab functions to interact with grant tables, and they work on NetBSD event though it has no gntdev (but has the necessary hypercall HYPERVISOR_grant_table_op, I still have to figure out how is that called from user space). Regarding kernels, xen.git seems to be missing the blktap2 driver: http://git.eu.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=tree;f=drivers/xen;h=60ce8f2fa68504158843caefdbb8c6f149a37edf;hb=xen/stable-2.6.32.x I only see a blktap folder, and no blktap2. Now I''m reading the code from: http://xenbits.xen.org/hg/linux-2.6.18-xen.hg/file/0b8a9b22b70a/drivers/xen/blktap2 I have a couple of books regarding Xen, the most helpful one being "The Definitive Guide to the Xen Hypervisor" by David Chisnall, it has been very helpful in understanding grant tables, but it doesn''t have any information regarding blktap/blktap2 driver internals, and I cannot find any information apart from the code itself. Is there any book that contains helpful information about the blktap implementation? Thanks, Roger. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Thu, 2011-08-25 at 12:45 +0100, Roger Pau Monné wrote:> Regarding kernels, xen.git seems to be missing the blktap2 driver: > > http://git.eu.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=tree;f=drivers/xen;h=60ce8f2fa68504158843caefdbb8c6f149a37edf;hb=xen/stable-2.6.32.x > > I only see a blktap folder, and no blktap2. Now I''m reading the code from:The contents of drivers/blktap in that tree is the blktap2 kernel side.> http://xenbits.xen.org/hg/linux-2.6.18-xen.hg/file/0b8a9b22b70a/drivers/xen/blktap2 > > I have a couple of books regarding Xen, the most helpful one being > "The Definitive Guide to the Xen Hypervisor" by David Chisnall, it has > been very helpful in understanding grant tables, but it doesn''t have > any information regarding blktap/blktap2 driver internals, and I > cannot find any information apart from the code itself. Is there any > book that contains helpful information about the blktap > implementation?Sorry, not that I know of. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Wed, 2011-08-24 at 09:09 +0100, Roger Pau Monné wrote:> Hello, > > I''m trying to port the blktap2 driver to NetBSD using a pure > user-space solution.I was just wondering about this, is your plan to bolt a block frontend onto the existing tapdisk2 process or are you building a thing using a NetBSD library for doing block devices in userspace (I think you are doing the former but either you or Christoph mentioned that library thing at one point too). The former plan would be awesome since it would make this work useful on all platforms and not just NetBSD. As you''ve no doubt noticed the blktap2 kernel side isn''t (and won''t be) in Linux upstream either. Ian.> Since blktap is not included in the kernel, I > would like to know where I can find the most up to date version of the > code, I''ve seen several repositories that contain blktap2 code, like: > > http://xenbits.xen.org/linux-2.6.18-xen.hg > http://xenbits.xensource.com/gitweb/?p=people/dstodden/blktap.git;a=summary > http://xenbits.xensource.com/gitweb/?p=people/dstodden/linux.git;a=summary > (I cannot access the tree of this one, I get a 404 error) > > Whats the best one to fetch to get a current version of the blktap2 code? > > Thanks, Roger. > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Roger Pau Monné
2011-Sep-22 08:59 UTC
Re: [Xen-devel] Most up to date blktap2 kernel driver
> I was just wondering about this, is your plan to bolt a block frontend > onto the existing tapdisk2 process or are you building a thing using a > NetBSD library for doing block devices in userspace (I think you are > doing the former but either you or Christoph mentioned that library > thing at one point too).Well, my first try was to create a user-space implementation of the block devices found in blktap, so there was no need to change the current blktap tools. This is however not possible right now, because the library for implementing block and char devices as user-space daemons doesn''t support mmap, and there''s no clear way about how to implement this. Correct me if I''m wrong, but the second option would be to directly implement the I/O ring from user-space without using any devices, I haven''t had much time to look into this, but I think this is the best way, because it doesn''t involve the constant context changes that the implementation explained before has. I hope that looking into qemu disk backend file can provide me with some information about how to do this, possibly using libxc?> The former plan would be awesome since it would make this work useful on > all platforms and not just NetBSD. As you''ve no doubt noticed the > blktap2 kernel side isn''t (and won''t be) in Linux upstream either. > > Ian._______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Thu, 2011-09-22 at 09:59 +0100, Roger Pau Monné wrote:> > I was just wondering about this, is your plan to bolt a block frontend > > onto the existing tapdisk2 process or are you building a thing using a > > NetBSD library for doing block devices in userspace (I think you are > > doing the former but either you or Christoph mentioned that library > > thing at one point too). > > Well, my first try was to create a user-space implementation of the > block devices found in blktap, so there was no need to change the > current blktap tools. This is however not possible right now, because > the library for implementing block and char devices as user-space > daemons doesn''t support mmap, and there''s no clear way about how to > implement this.Right. And that would be very OS specific I guess?> Correct me if I''m wrong, but the second option would be to directly > implement the I/O ring from user-space without using any devices,Yes, that is what I was suggesting. I think we generally have consensus that this is the right direction to take blktap.> I haven''t had much time to look into this, but I think this is the best > way, because it doesn''t involve the constant context changes that the > implementation explained before has. I hope that looking into qemu > disk backend file can provide me with some information about how to do > this, possibly using libxc?Using libxc would be better than using the OS provided interfaces directly since it abstracts out the differences between the ioctls/devices on different OSs.> > > The former plan would be awesome since it would make this work useful on > > all platforms and not just NetBSD. As you''ve no doubt noticed the > > blktap2 kernel side isn''t (and won''t be) in Linux upstream either. > > > > Ian._______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stefano Stabellini
2011-Sep-22 11:46 UTC
Re: [Xen-devel] Most up to date blktap2 kernel driver
On Thu, 22 Sep 2011, Roger Pau Monn? wrote:> > I was just wondering about this, is your plan to bolt a block frontend > > onto the existing tapdisk2 process or are you building a thing using a > > NetBSD library for doing block devices in userspace (I think you are > > doing the former but either you or Christoph mentioned that library > > thing at one point too). > > Well, my first try was to create a user-space implementation of the > block devices found in blktap, so there was no need to change the > current blktap tools. This is however not possible right now, because > the library for implementing block and char devices as user-space > daemons doesn''t support mmap, and there''s no clear way about how to > implement this. > > Correct me if I''m wrong, but the second option would be to directly > implement the I/O ring from user-space without using any devices, I > haven''t had much time to look into this, but I think this is the best > way, because it doesn''t involve the constant context changes that the > implementation explained before has. I hope that looking into qemu > disk backend file can provide me with some information about how to do > this, possibly using libxc?Give a look at hw/xen_backend.c and hw/xen_disk.c in upstream qemu, they should give you an idea of what you need. You would still need a way to access the grant table from userspace, that on Linux is provided by the gntdev device, I hope there is something similar in NetBSD. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel