libxl: switch NetBSD image file handling to Qemu
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/2 libxl: switch NetBSD image file handling to Qemu
This forces libxl to use Qemu when a raw image file is used as a disk backend. NetBSD currently only supports qemu-traditional, so device_model_version="qemu-xen-traditional" has to be added to the config file when using image files.
--- tools/libxl/libxl_netbsd.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
tools/libxl/libxl_netbsd.c +3 -3
@@ -19,10 +19,10 @@int libxl__try_phy_backend (mode_t st_mode) { -if (S_ISREG (st_mode) ||S_ISBLK (st_mode)) -return 1 ; +if (!S_ISBLK (st_mode)) +return 0 ; -return 0 ; +return 1 ; }char *libxl__devid_to_localdev (libxl__gc *gc,int devid)
Signature · 7 lines
1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 2 lines · Roger Pau Monne
This forces libxl to use Qemu when a raw image file is used as a disk backend. NetBSD currently only supports qemu-traditional, so
Wait -- do I grasp correctly that this patch _forces_ NetBSD as a dom0 to handle file-backed I/O requests in a way that includes additional context switches to userspace, and which your previous email said resulted in a 30% reduction in throughput compared to dom0 I/O?
I am assuming there's some reason we want this, rather than handling such requests in-kernel. But what is it?
Thor
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Thor Lancelot Simon
Quoted 2 lines · Roger Pau Monne
This forces libxl to use Qemu when a raw image file is used as a disk backend. NetBSD currently only supports qemu-traditional, so
Wait -- do I grasp correctly that this patch _forces_ NetBSD as a dom0 to handle file-backed I/O requests in a way that includes additional context switches to userspace, and which your previous email said resulted in a 30% reduction in throughput compared to dom0 I/O?
I am assuming there's some reason we want this, rather than handling such requests in-kernel. But what is it?
I should have marked this as "experimental", or something like this. I'm not sure if switching to Qdisk for all image file backends is needed.
Quoted 1 line
From the Xen wiki (http://wiki.xen.org/wiki/Blktap) I've found that:
"loop device had problems with flushing dirty pages (specifically, doing a large number of writes to an NFS-backed image don't result in the OOM killer going berserk)."
I'm not sure if NetBSD is in the same situation, but if I remember correctly (haven't tried that in a long time), trying to use a disk file on a NFS share caused the NetBSD Dom0 kernel to crash. The PR for this issue is: http://gnats.netbsd.org/40726.
If this is solved, and the vnd device is solid in NetBSD we could only use Qdisk when the image format is different than raw (qcow, qcow2, vmdk, vdi...).
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · Roger Pau Monn?
Quoted 3 lines · Thor Lancelot Simon
I am assuming there's some reason we want this, rather than handling such requests in-kernel. But what is it?
I should have marked this as "experimental", or something like this. I'm not sure if switching to Qdisk for all image file backends is needed.
Quoted 1 line
From the Xen wiki (http://wiki.xen.org/wiki/Blktap) I've found that:
Quoted 8 lines
"loop device had problems with flushing dirty pages (specifically, doing a large number of writes to an NFS-backed image don't result in the OOM killer going berserk)."
I'm not sure if NetBSD is in the same situation, but if I remember correctly (haven't tried that in a long time), trying to use a disk file on a NFS share caused the NetBSD Dom0 kernel to crash. The PR for this issue is: http://gnats.netbsd.org/40726.
It seems highly unlikely to me that a problem with the loop device driver on Linux is tremendously relevant to NetBSD.
But, even if there is some problem with vnd backed by NFS, that hardly seems like it would be a good reason to make a change that reduces I/O throughput for the *non* NFS-backed case by at least 20%. Why would one keep disk images for guests, as a general rule, on NFS, rather than simply doing the NFS mounts on the guests themselves, or using a more sensible protocol like iSCSI? I have to assume most folks using files as disks are storing them on local filesystems on the dom0, and wrecking performance for that case to solve a problem with NFS that may or may not be hypothetical seems like a very, very bad trade-off.
Thor
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 22 lines · Thor Lancelot Simon
Quoted 9 lines · Roger Pau Monn?
Quoted 3 lines · Thor Lancelot Simon
I am assuming there's some reason we want this, rather than handling such requests in-kernel. But what is it?
I should have marked this as "experimental", or something like this. I'm not sure if switching to Qdisk for all image file backends is needed.
Quoted 1 line
From the Xen wiki (http://wiki.xen.org/wiki/Blktap) I've found that:
Quoted 8 lines
"loop device had problems with flushing dirty pages (specifically, doing a large number of writes to an NFS-backed image don't result in the OOM killer going berserk)."
I'm not sure if NetBSD is in the same situation, but if I remember correctly (haven't tried that in a long time), trying to use a disk file on a NFS share caused the NetBSD Dom0 kernel to crash. The PR for this issue is: http://gnats.netbsd.org/40726.
It seems highly unlikely to me that a problem with the loop device driver on Linux is tremendously relevant to NetBSD.
Quoted 9 lines
But, even if there is some problem with vnd backed by NFS, that hardly seems like it would be a good reason to make a change that reduces I/O throughput for the *non* NFS-backed case by at least 20%. Why would one keep disk images for guests, as a general rule, on NFS, rather than simply doing the NFS mounts on the guests themselves, or using a more sensible protocol like iSCSI? I have to assume most folks using files as disks are storing them on local filesystems on the dom0, and wrecking performance for that case to solve a problem with NFS that may or may not be hypothetical seems like a very, very bad trade-off.
Quite a lot of people use disk images on NFS, because it's probably the easiest shared storage that allows migration of guests.
Even if disks on NFS was a remote possibility not used by much people I don't think it's acceptable to have a Dom0 crash when you try to create a guest with a disk on NFS, that is by far much more worse than performance degradation in my opinion.
If this is not accepted, I will have to detect image format somewhere and use qemu when the format is different than raw.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 14 lines · Roger Pau Monné
Quoted 12 lines · Thor Lancelot Simon
It seems highly unlikely to me that a problem with the loop device driver on Linux is tremendously relevant to NetBSD.
But, even if there is some problem with vnd backed by NFS, that hardly seems like it would be a good reason to make a change that reduces I/O throughput for the *non* NFS-backed case by at least 20%. Why would one keep disk images for guests, as a general rule, on NFS, rather than simply doing the NFS mounts on the guests themselves, or using a more sensible protocol like iSCSI? I have to assume most folks using files as disks are storing them on local filesystems on the dom0, and wrecking performance for that case to solve a problem with NFS that may or may not be hypothetical seems like a very, very bad trade-off.
Quoted 2 lines
Quite a lot of people use disk images on NFS, because it's probably the easiest shared storage that allows migration of guests.
I agree that this is a case we should be supporting well. We don't support migration yet, but I'd like to see this change in the nearish future.
Quoted 5 lines
Even if disks on NFS was a remote possibility not used by much people I don't think it's acceptable to have a Dom0 crash when you try to create a guest with a disk on NFS, that is by far much more worse than performance degradation in my opinion.
And, of course, a crash is suboptimal. :)
Quoted 3 lines
If this is not accepted, I will have to detect image format somewhere and use qemu when the format is different than raw.
I would definitely like to see some middle-ground compromise that allows us to keep decent performance for local files while still allowing them for NFS.
+j
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 31 lines · Jeff Rizzo
Quoted 14 lines · Roger Pau Monné
Quoted 12 lines · Thor Lancelot Simon
It seems highly unlikely to me that a problem with the loop device driver on Linux is tremendously relevant to NetBSD.
But, even if there is some problem with vnd backed by NFS, that hardly seems like it would be a good reason to make a change that reduces I/O throughput for the *non* NFS-backed case by at least 20%. Why would one keep disk images for guests, as a general rule, on NFS, rather than simply doing the NFS mounts on the guests themselves, or using a more sensible protocol like iSCSI? I have to assume most folks using files as disks are storing them on local filesystems on the dom0, and wrecking performance for that case to solve a problem with NFS that may or may not be hypothetical seems like a very, very bad trade-off.
Quoted 2 lines
Quite a lot of people use disk images on NFS, because it's probably the easiest shared storage that allows migration of guests.
I agree that this is a case we should be supporting well. We don't support migration yet, but I'd like to see this change in the nearish future.
Quoted 5 lines
Even if disks on NFS was a remote possibility not used by much people I don't think it's acceptable to have a Dom0 crash when you try to create a guest with a disk on NFS, that is by far much more worse than performance degradation in my opinion.
And, of course, a crash is suboptimal. :)
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
If this is not accepted, I will have to detect image format somewhere and use qemu when the format is different than raw.
I would definitely like to see some middle-ground compromise that allows us to keep decent performance for local files while still allowing them for NFS.
Well, I think the performance is not that bad, given that we are using qemu-traditional and the Dom0 is not MP. We can archive better performance by fixing qemu-upstream to work with NetBSD and of course getting a MP Dom0.
Quoted 8 lines · Jeff Rizzo
[...]
Quoted 3 lines
If this is not accepted, I will have to detect image format somewhere and use qemu when the format is different than raw.
I would definitely like to see some middle-ground compromise that allows us to keep decent performance for local files while still allowing them for NFS.
using the in-kernel or qemu backend should be configurable. We have a domU configuration file, lets just use it !
Signature · 3 lines
Manuel Bouyer <[email protected]> NetBSD: 26 ans d'experience feront toujours la difference --
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Roger Pau Monné
Well, I think the performance is not that bad, given that we are using qemu-traditional and the Dom0 is not MP. We can archive better performance by fixing qemu-upstream to work with NetBSD and of course getting a MP Dom0.
But it'll still be slower than a in-kernel backend driver.
Signature · 3 lines
Manuel Bouyer <[email protected]> NetBSD: 26 ans d'experience feront toujours la difference --
Quoted 5 lines · Roger Pau Monn?
Well, I think the performance is not that bad, given that we are using qemu-traditional and the Dom0 is not MP. We can archive better performance by fixing qemu-upstream to work with NetBSD and of course getting a MP Dom0.
Why is it a reasonable assumption that adding more CPU resource will make a significant difference to I/O throughput?
Signature · 4 lines
Thor Lancelot Simon [email protected] But as he knew no bad language, he had called him all the names of common objects that he could think of, and had screamed: "You lamp! You towel! You plate!" and so on. --Sigmund Freud
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Thor Lancelot Simon
Quoted 4 lines · Roger Pau Monn?
Well, I think the performance is not that bad, given that we are using qemu-traditional and the Dom0 is not MP. We can archive better performance by fixing qemu-upstream to work with NetBSD and of course getting a MP Dom0.
Why is it a reasonable assumption that adding more CPU resource will make a significant difference to I/O throughput?
throughput might not be affected, but wouldn't additional code execution affect latency?
Signature · 1 line
Aaron J. Grier | "Not your ordinary poofy goof." | [email protected]
Quoted 29 lines · Thor Lancelot Simon
Quoted 7 lines · Roger Pau Monn?
Quoted 2 lines · Thor Lancelot Simon
I am assuming there's some reason we want this, rather than handling such requests in-kernel. But what is it?
I should have marked this as "experimental", or something like this. I'm not sure if switching to Qdisk for all image file backends is needed.
Quoted 1 line
From the Xen wiki (http://wiki.xen.org/wiki/Blktap) I've found that:
Quoted 8 lines
"loop device had problems with flushing dirty pages (specifically, doing a large number of writes to an NFS-backed image don't result in the OOM killer going berserk)."
I'm not sure if NetBSD is in the same situation, but if I remember correctly (haven't tried that in a long time), trying to use a disk file on a NFS share caused the NetBSD Dom0 kernel to crash. The PR for this issue is: http://gnats.netbsd.org/40726.
It seems highly unlikely to me that a problem with the loop device driver on Linux is tremendously relevant to NetBSD.
But, even if there is some problem with vnd backed by NFS, that hardly seems like it would be a good reason to make a change that reduces I/O throughput for the *non* NFS-backed case by at least 20%. Why would one keep disk images for guests, as a general rule, on NFS, rather than simply doing the NFS mounts on the guests themselves, or using a more sensible protocol like iSCSI? I have to assume most folks using files as disks are storing them on local filesystems on the dom0, and wrecking performance for that case to solve a problem with NFS that may or may not be hypothetical seems like a very, very bad trade-off.
Quoted 1 line
Thor
Yeah, I usually don't pipe up, but I strongly dislike being forced to use qemu to read raw disk file instead of being able to use vnd on netbsd dom0.
There was/is? a bug in xentools 4.1 in libxl that prevents using vnd for raw disk file. The problem boils down to libxl not notifying xenbackendd (via xenstored) to call /usr/pkg/etc/xen/scripts/block at the right time such that vnconfig doesn't get called when it's time to shutdown the domU, and hence you end up with a bunch of vnd devices even after the corresponding domU's have been shutdown. I created a patch to fix that: http://mail-index.netbsd.org/port-xen/2012/05/29/msg007252.html Additionally I put in an experimental feature that allows specifying other types of backend aside from phy: or file:, and as long as the /usr/pkg/etc/xen/scripts/block sh script is modified accordingly, the domU will just get the appropriate device in dom0. Then we can use, for example, vnd:, or iscsi: and from the POV of the domU, it's just another 'physical' device that the dom0 manages. I think the way xenbackendd works, in conjunction with xenstored, is pretty flexible and decoupled, at least with xen 3.3 and 4.1; I don't know what the story is for xen 4.2. Was there a rumor of retiring xenbackendd?
I'm also concerned about the trend, which to me is more of putting more and more policy in libxl, as opposed to functionality. I saw this back when I was trying to fix the bug above, hopefully this trend is no longer true. For example, I had the impression (I don't remember the details) that the code that parses the disk configuration to a certain degree decides whether the disk is a block device or a regular file based on the prefix (phy: vs file:), which is not true in netbsd dom0, because the file path is then used to setup a vnd device, which is from libxl's POV is just a block device. Most probably it's born out of the fact that libxl is developed in a mostly linux environment. I do appreciate Roger's effort in improving xen support in netbsd, but hopefully some BSDism would travel back to xen as well.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 30 lines · Toby Karyadi
Quoted 29 lines · Thor Lancelot Simon
Quoted 7 lines · Roger Pau Monn?
Quoted 2 lines · Thor Lancelot Simon
I am assuming there's some reason we want this, rather than handling such requests in-kernel. But what is it?
I should have marked this as "experimental", or something like this. I'm not sure if switching to Qdisk for all image file backends is needed.
Quoted 1 line
From the Xen wiki (http://wiki.xen.org/wiki/Blktap) I've found that:
Quoted 8 lines
"loop device had problems with flushing dirty pages (specifically, doing a large number of writes to an NFS-backed image don't result in the OOM killer going berserk)."
I'm not sure if NetBSD is in the same situation, but if I remember correctly (haven't tried that in a long time), trying to use a disk file on a NFS share caused the NetBSD Dom0 kernel to crash. The PR for this issue is: http://gnats.netbsd.org/40726.
It seems highly unlikely to me that a problem with the loop device driver on Linux is tremendously relevant to NetBSD.
But, even if there is some problem with vnd backed by NFS, that hardly seems like it would be a good reason to make a change that reduces I/O throughput for the *non* NFS-backed case by at least 20%. Why would one keep disk images for guests, as a general rule, on NFS, rather than simply doing the NFS mounts on the guests themselves, or using a more sensible protocol like iSCSI? I have to assume most folks using files as disks are storing them on local filesystems on the dom0, and wrecking performance for that case to solve a problem with NFS that may or may not be hypothetical seems like a very, very bad trade-off.
Quoted 4 lines
Quoted 1 line
Thor
Yeah, I usually don't pipe up, but I strongly dislike being forced to use qemu to read raw disk file instead of being able to use vnd on netbsd dom0.
I'm not a fan of Qemu either, but I don't know an easy way to detect if an image is in a NFS share, or if an image is in qcow, qcow2 or raw. I'm open to a solution that only launches Qemu if image format is different than raw or if the image file is in a NFS share.
Quoted 8 lines
There was/is? a bug in xentools 4.1 in libxl that prevents using vnd for raw disk file. The problem boils down to libxl not notifying xenbackendd (via xenstored) to call
/usr/pkg/etc/xen/scripts/blockat the right time such that vnconfig doesn't get called when it's time to shutdown the domU, and hence you end up with a bunch of vnd devices even after the corresponding domU's have been shutdown. I created a patch to fix that:
http://mail-index.netbsd.org/port-xen/2012/05/29/msg007252.html
Additionally I put in an experimental feature that allows specifying
Quoted 8 lines
other types of backend aside from phy: or file:, and as long as the
/usr/pkg/etc/xen/scripts/blocksh script is modified accordingly, the domU will just get the appropriate device in dom0. Then we can use, for example, vnd:, or iscsi: and from the POV of the domU, it's just another 'physical' device that the dom0 manages. I think the way xenbackendd works, in conjunction with xenstored, is pretty flexible and decoupled, at least with xen 3.3 and 4.1; I don't know what the story is for xen 4.2. Was there a rumor of retiring xenbackendd?
Yes, xenbackendd is deprecated and hotplug scripts are called from libxl directly (that's true for both NetBSD and Linux).
Quoted 4 lines
I'm also concerned about the trend, which to me is more of putting more and more policy in libxl, as opposed to functionality. I saw this back when I was trying to fix the bug above, hopefully this trend is no longer true. For example, I had the impression (I don't remember the
Quoted 8 lines
details) that the code that parses the disk configuration to a certain degree decides whether the disk is a block device or a regular file based on the prefix (phy: vs file:), which is not true in netbsd dom0, because the file path is then used to setup a vnd device, which is from libxl's POV is just a block device. Most probably it's born out of the fact that libxl is developed in a mostly linux environment. I do appreciate Roger's effort in improving xen support in netbsd, but hopefully some BSDism would travel back to xen as well.
Yes, most libxl developers are Linux users, so most of the functionality in libxl is designed with Linux in mind. The only way to change that is to get BSD developers to contribute to libxl and the Xen project in general, if we are not active players in this game, we should not expect that BSD will be taken into account.
As an example, libxl is now working in NetBSD without any external patches, and AFAIK all functionality is working, and Linux developers are very careful to try not to break this compatibility.
Quoted 1 line
From my POV, I think your patches to add new functionality to disk
backends should be rebased against xen-unstable and posted to xen-devel, so that they are added to upstream Xen.
Having a bunch of out-of-tree patches in pkgsrc is not the way to move forward, because we are not able to test NetBSD with latest Xen. Being able to test xen-unstable easily will allow us to find bugs and develop patches before Xen is released, thus keeping this pkgsrc patch queue minimal.
Quoted 4 lines · Roger Pau Monne
This forces libxl to use Qemu when a raw image file is used as a disk backend. NetBSD currently only supports qemu-traditional, so device_model_version="qemu-xen-traditional" has to be added to the config file when using image files.
Why ? This impose a trip to userland, which is expensive. xenbackendd should still call the backend script, right ? Why not let it do its job and map the file to a vnd(4) ?
I don't support this change.
Signature · 3 lines
Manuel Bouyer <[email protected]> NetBSD: 26 ans d'experience feront toujours la difference --
Re: [PATCH 1/2] libxc: add suport for NetBSD gntdev
In reply to a message not in the archiveQuoted 6 lines · Roger Pau Monne
Add OS specific handlers for NetBSD gntdev. The main difference is that NetBSD passes the VA where the grant should be set inside the
IOCTL_GNTDEV_MAP_GRANT_REFioctl, instead of using mmap (this is due to OS constraints).Signed-off-by Roger Pau Monné <[email protected]>
Did the kernel side of this go into NetBSD in the end?
IOW should I apply? (I've just spotted the V2 in my queue, so it would be that one if anything)
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 1/2] libxc: add suport for NetBSD gntdev
Quoted 9 lines · Ian Campbell
Quoted 6 lines · Roger Pau Monne
Add OS specific handlers for NetBSD gntdev. The main difference is that NetBSD passes the VA where the grant should be set inside the
IOCTL_GNTDEV_MAP_GRANT_REFioctl, instead of using mmap (this is due to OS constraints).Signed-off-by Roger Pau Monné <[email protected]>Did the kernel side of this go into NetBSD in the end?
No, the kernel side only worked with PV guests, it failed to map grant refs from HVM guests. Solving this requires quite a lot of changes in the code, which right now I don't have time to perform, so hold on the libxc/libxl changes for now.
Quoted 5 lines
IOW should I apply? (I've just spotted the V2 in my queue, so it would be that one if anything)
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 1/2] libxc: add suport for NetBSD gntdev
Quoted 7 lines · Roger Pau Monne
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Roger Pau Monne
Add OS specific handlers for NetBSD gntdev. The main difference is that NetBSD passes the VA where the grant should be set inside the
IOCTL_GNTDEV_MAP_GRANT_REFioctl, instead of using mmap (this is due to OS constraints).
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Roger Pau Monné <[email protected]>Did the kernel side of this go into NetBSD in the end?
No, the kernel side only worked with PV guests, it failed to map grant refs from HVM guests. Solving this requires quite a lot of changes in the code, which right now I don't have time to perform, so hold on the libxc/libxl changes for now.
Ack, thanks!
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel