After switching from xm to xl i found that all my windows hvm domU can''t boot from iso. domU can''t boot is iso on cifs mount point. If that iso move from cifs to ramdisk - all work''s fine. cifs mount: //cc/public on /var/storage type cifs (rw,relatime,vers=1.0,sec=ntlm,cache=none,unc=\\cc\public,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.25.254,unix,posixpaths,serverino,acl,rsize=1048576,wsize=65536,actimeo=1) xl messages contains: Using file /dev/disk/vbd/21-822 in read-write mode Strip off blktap sub-type prefix to /var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso (drv ''aio'') Using file /var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso in read-only mode qemu: could not open vbd ''/local/domain/0/backend/qdisk/162/5632/mode'' or hard disk image ''/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Ru ssian_w_SP1_MLF_X17-22616_vase.iso'' (drv ''aio'' format ''raw'') domain started with xl create /etc/empty \ -d \ name="21-10824" \ kernel="/usr/lib/xen/boot/hvmloader" \ builder="hvm" \ memory=768 \ vcpus=4 \ vif=["mac=00:16:3e:00:1a:e4,ip=62.76.190.208,type=paravirtualised"] disk=["phy:/dev/disk/vbd/21-822,hda,w", "file:/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso,hdc:cdrom,r", "file:/var/storage/iso/winpe_amd64.iso,hdb,r,devtype=cdrom"] \ device_model="qemu-dm" \ boot="d" \ vnc=1 \ vnclisten="0.0.0.0" \ vncconsole=1 \ viridian=1 \ stdvga=1 \ videoram=16 \ localtime=1 \ vncpasswd="XYhTN4A4OU" \ serial="pty" \ xen_platform_pci=1 \ usbdevice="tablet" \ keymap="en-us" \ on_restart="destroy" \ boot="d"'' -- Vasiliy Tolstov, Clodo.ru e-mail: v.tolstov@selfip.ru jabber: vase@selfip.ru
On Sat, 2013-01-19 at 11:23 +0000, Vasiliy Tolstov wrote:> After switching from xm to xlWhich version of Xen?> i found that all my windows hvm domU > can''t boot from iso. domU can''t boot is iso on cifs mount point. If > that iso move from cifs to ramdisk - all work''s fine. > > cifs mount: > //cc/public on /var/storage type cifs > (rw,relatime,vers=1.0,sec=ntlm,cache=none,unc=\\cc\public,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.25.254,unix,posixpaths,serverino,acl,rsize=1048576,wsize=65536,actimeo=1) > > xl messages contains: > Using file /dev/disk/vbd/21-822 in read-write mode > Strip off blktap sub-type prefix to > /var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso > (drv ''aio'') > Using file /var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso > in read-only mode > qemu: could not open vbd ''/local/domain/0/backend/qdisk/162/5632/mode'' > or hard disk image > ''/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Ru > ssian_w_SP1_MLF_X17-22616_vase.iso'' (drv ''aio'' format ''raw'') > > domain started with xl create /etc/empty \ > -d \ > name="21-10824" \ > kernel="/usr/lib/xen/boot/hvmloader" \ > builder="hvm" \ > memory=768 \ > vcpus=4 \ > vif=["mac=00:16:3e:00:1a:e4,ip=62.76.190.208,type=paravirtualised"] > disk=["phy:/dev/disk/vbd/21-822,hda,w", > "file:/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso,hdc:cdrom,r", > "file:/var/storage/iso/winpe_amd64.iso,hdb,r,devtype=cdrom"] \If you remove the first CD-ROM entry does the second one work? I expect not (they both parse to the same sort of thing) and it is just failing at the first and not even trying the second. Can you read the .iso manually (e.g. using md5sum or od or something) as root on the dom0? (I''m wondering if there is some CIFS equivalent of root_squash) Do you get anything in /var/log/xen/qemu-dm* in addition to the xl logs? One approach to debugging this might be to use device_model_override="/path/to/my-qemu" where my-qemu is a script which runs strace -o /tmp/qemu.strace -fff /usr/lib/xen/bin/qemu-dm $@ The strace might tell you a little bit more about how/why it is failing to open the file. Ian.
Thanks! I found, that now xl tries to open iso with O_DIRECT flag. open("/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso", O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument) write(2, "qemu: could not open vbd ''/local"..., 217) = 217 my xen version is 4.1.3 2013/1/21 Ian Campbell <Ian.Campbell@citrix.com>:> On Sat, 2013-01-19 at 11:23 +0000, Vasiliy Tolstov wrote: >> After switching from xm to xl > > Which version of Xen? > >> i found that all my windows hvm domU >> can''t boot from iso. domU can''t boot is iso on cifs mount point. If >> that iso move from cifs to ramdisk - all work''s fine. >> >> cifs mount: >> //cc/public on /var/storage type cifs >> (rw,relatime,vers=1.0,sec=ntlm,cache=none,unc=\\cc\public,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.25.254,unix,posixpaths,serverino,acl,rsize=1048576,wsize=65536,actimeo=1) >> >> xl messages contains: >> Using file /dev/disk/vbd/21-822 in read-write mode >> Strip off blktap sub-type prefix to >> /var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso >> (drv ''aio'') >> Using file /var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso >> in read-only mode >> qemu: could not open vbd ''/local/domain/0/backend/qdisk/162/5632/mode'' >> or hard disk image >> ''/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Ru >> ssian_w_SP1_MLF_X17-22616_vase.iso'' (drv ''aio'' format ''raw'') >> >> domain started with xl create /etc/empty \ >> -d \ >> name="21-10824" \ >> kernel="/usr/lib/xen/boot/hvmloader" \ >> builder="hvm" \ >> memory=768 \ >> vcpus=4 \ >> vif=["mac=00:16:3e:00:1a:e4,ip=62.76.190.208,type=paravirtualised"] >> disk=["phy:/dev/disk/vbd/21-822,hda,w", >> "file:/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso,hdc:cdrom,r", >> "file:/var/storage/iso/winpe_amd64.iso,hdb,r,devtype=cdrom"] \ > > If you remove the first CD-ROM entry does the second one work? I expect > not (they both parse to the same sort of thing) and it is just failing > at the first and not even trying the second. > > Can you read the .iso manually (e.g. using md5sum or od or something) as > root on the dom0? (I''m wondering if there is some CIFS equivalent of > root_squash) > > Do you get anything in /var/log/xen/qemu-dm* in addition to the xl logs? > > One approach to debugging this might be to use > device_model_override="/path/to/my-qemu" > where my-qemu is a script which runs > strace -o /tmp/qemu.strace -fff /usr/lib/xen/bin/qemu-dm $@ > > The strace might tell you a little bit more about how/why it is failing > to open the file. > > Ian. >-- Vasiliy Tolstov, Clodo.ru e-mail: v.tolstov@selfip.ru jabber: vase@selfip.ru
Please don''t top post. On Tue, 2013-01-22 at 05:38 +0000, Vasiliy Tolstov wrote:> Thanks! > I found, that now xl tries to open iso with O_DIRECT flag. > open("/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso", > O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument) > write(2, "qemu: could not open vbd ''/local"..., 217) = 217I guess CIFS doesn''t support O_DIRECT. It looks like it does have mount -o directio though, worth a try. I''m not sure what options exist to turn this off from the qemu side -- Stefano? I also have a feeling something changed in this regard in 4.2.x> my xen version is 4.1.3 > > > 2013/1/21 Ian Campbell <Ian.Campbell@citrix.com>: > > On Sat, 2013-01-19 at 11:23 +0000, Vasiliy Tolstov wrote: > >> After switching from xm to xl > > > > Which version of Xen? > > > >> i found that all my windows hvm domU > >> can''t boot from iso. domU can''t boot is iso on cifs mount point. If > >> that iso move from cifs to ramdisk - all work''s fine. > >> > >> cifs mount: > >> //cc/public on /var/storage type cifs > >> (rw,relatime,vers=1.0,sec=ntlm,cache=none,unc=\\cc\public,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.25.254,unix,posixpaths,serverino,acl,rsize=1048576,wsize=65536,actimeo=1) > >> > >> xl messages contains: > >> Using file /dev/disk/vbd/21-822 in read-write mode > >> Strip off blktap sub-type prefix to > >> /var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso > >> (drv ''aio'') > >> Using file /var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso > >> in read-only mode > >> qemu: could not open vbd ''/local/domain/0/backend/qdisk/162/5632/mode'' > >> or hard disk image > >> ''/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Ru > >> ssian_w_SP1_MLF_X17-22616_vase.iso'' (drv ''aio'' format ''raw'') > >> > >> domain started with xl create /etc/empty \ > >> -d \ > >> name="21-10824" \ > >> kernel="/usr/lib/xen/boot/hvmloader" \ > >> builder="hvm" \ > >> memory=768 \ > >> vcpus=4 \ > >> vif=["mac=00:16:3e:00:1a:e4,ip=62.76.190.208,type=paravirtualised"] > >> disk=["phy:/dev/disk/vbd/21-822,hda,w", > >> "file:/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso,hdc:cdrom,r", > >> "file:/var/storage/iso/winpe_amd64.iso,hdb,r,devtype=cdrom"] \ > > > > If you remove the first CD-ROM entry does the second one work? I expect > > not (they both parse to the same sort of thing) and it is just failing > > at the first and not even trying the second. > > > > Can you read the .iso manually (e.g. using md5sum or od or something) as > > root on the dom0? (I''m wondering if there is some CIFS equivalent of > > root_squash) > > > > Do you get anything in /var/log/xen/qemu-dm* in addition to the xl logs? > > > > One approach to debugging this might be to use > > device_model_override="/path/to/my-qemu" > > where my-qemu is a script which runs > > strace -o /tmp/qemu.strace -fff /usr/lib/xen/bin/qemu-dm $@ > > > > The strace might tell you a little bit more about how/why it is failing > > to open the file. > > > > Ian. > > > > >
On Tue, 22 Jan 2013, Ian Campbell wrote:> Please don''t top post. > > On Tue, 2013-01-22 at 05:38 +0000, Vasiliy Tolstov wrote: > > Thanks! > > I found, that now xl tries to open iso with O_DIRECT flag. > > open("/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso", > > O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument) > > write(2, "qemu: could not open vbd ''/local"..., 217) = 217xl? I guess you mean QEMU tries to open the ISO with O_DIRECT.> I guess CIFS doesn''t support O_DIRECT. It looks like it does have mount > -o directio though, worth a try. > > I''m not sure what options exist to turn this off from the qemu side -- > Stefano? I also have a feeling something changed in this regard in 4.2.xGiven that you are not passing any device_model_version option to xl, I assume that you are running qemu-xen-traditional (ps should show that a binary called qemu-dm is running). If that is the case, there is currently no way to specify any flags. However the interesting bit is that qemu-xen-traditional opens files corresponding to emulated devices with BDRV_O_CACHE_WB and opens files corresponding to PV interfaces using BDRV_O_NOCACHE (this means O_DIRECT). This means that the failure should be caused by hw/xen_disk.c trying to opening the iso O_DIRECT. Paradoxically the PV inteface for a cdrom drive is usually never used AFAIK. Did the Windows PV drivers start using the PV cdrom interface all of a sudden? In any case I think that the best thing we could do it fall back to write-through (or should it be write-back? It might not be safe..) in case O_DIRECT fails. This is what qemu-xen does in such cases. Try this patch: --- diff --git a/hw/xen_disk.c b/hw/xen_disk.c index 33a5531..d6d71fe 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -659,9 +659,16 @@ static int blk_init(struct XenDevice *xendev) if (blkdev->bs) { if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, bdrv_find_format(blkdev->fileproto)) != 0) { - bdrv_delete(blkdev->bs); - blkdev->bs = NULL; - } + /* try without O_DIRECT */ + xen_be_printf(&blkdev->xendev, 0, "opening %s with O_DIRECT failed, trying write-through.\n", + blkdev->filename); + qflags &= BDRV_O_NOCACHE; + if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, + bdrv_find_format(blkdev->fileproto)) != 0) { + bdrv_delete(blkdev->bs); + blkdev->bs = NULL; + } + } } if (!blkdev->bs) return -1;
Thanks for patch. But it not solve problem: Now i have : domid: 6 Using file /dev/disk/vbd/21-828 in read-write mode Strip off blktap sub-type prefix to (drv ''aio'') Watching /local/domain/0/device-model/6/logdirty/cmd Watching /local/domain/0/device-model/6/command Watching /local/domain/6/cpu char device redirected to /dev/pts/5 qemu_map_cache_init nr_buckets = 10000 size 4194304 Could not open /var/run/tap/qemu-read-6 shared page at pfn feffd buffered io page at pfn feffb Guest uuid = c98c33c8-1891-41ec-96a0-984f3df80def xen be: qdisk-5632: xen be: qdisk-5632: opening with O_DIRECT failed, trying write-through. opening with O_DIRECT failed, trying write-through. populating video RAM at ff000000 mapping video RAM from ff000000 Register xen platform. Done register platform. platform_fixed_ioport: changed ro/rw state of ROM memory area. now is rw state. xs_read(/local/domain/0/device-model/6/xen_extended_power_mgmt): read error medium change watch on `hdc'' (index: 1): aio: I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 Log-dirty: no command yet. I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 vcpu-set: watch node error. I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 xs_read(/local/domain/6/log-throttling): read error qemu: ignoring not-understood drive `/local/domain/6/log-throttling'' medium change watch on `/local/domain/6/log-throttling'' - unknown device, ignored xen be: qdisk-5632: xen be: qdisk-5632: opening with O_DIRECT failed, trying write-through. opening with O_DIRECT failed, trying write-through. log_throttling disabled qemu: ignoring not-understood drive `/local/domain/6/log-throttling'' medium change watch on `/local/domain/6/log-throttling'' - unknown device, ignored vga s->lfb_addr = f0000000 s->lfb_end = f1000000 platform_fixed_ioport: changed ro/rw state of ROM memory area. now is rw state. platform_fixed_ioport: changed ro/rw state of ROM memory area. now is ro state. (XEN) HVM6: VGABios $Id: vgabios.c,v 1.67 2008/01/27 09:44:12 vruppert Exp $ (XEN) HVM6: VBE Bios $Id: vbe.c,v 1.60 2008/03/02 07:47:21 vruppert Exp $ (XEN) HVM6: Bochs BIOS - build: 06/23/99 (XEN) HVM6: $Revision: 1.221 $ $Date: 2008/12/07 17:32:29 $ (XEN) HVM6: Options: apmbios pcibios eltorito PMM (XEN) HVM6: (XEN) HVM6: ata0-0: PCHS=16383/16/63 translation=lba LCHS=1024/255/63 (XEN) HVM6: ata0 master: QEMU HARDDISK ATA-7 Hard-Disk (10246 MBytes) (XEN) HVM6: IDE time out (XEN) HVM6: ata1 master: QEMU DVD-ROM ATAPI-4 CD-Rom/DVD-Rom (XEN) HVM6: IDE time out (XEN) HVM6: (XEN) HVM6: (XEN) HVM6: (XEN) HVM6: Press F12 for boot menu. (XEN) HVM6: (XEN) HVM6: Booting from Hard Disk... (XEN) HVM6: Boot from Hard Disk failed: not a bootable disk (XEN) HVM6: (XEN) HVM6: (XEN) HVM6: No bootable device. (XEN) HVM6: Powering off in 30 seconds. (XEN) hvm.c:1080:d6 All CPUs offline -- powering off. 2013/1/22 Stefano Stabellini <stefano.stabellini@eu.citrix.com>:> On Tue, 22 Jan 2013, Ian Campbell wrote: >> Please don''t top post. >> >> On Tue, 2013-01-22 at 05:38 +0000, Vasiliy Tolstov wrote: >> > Thanks! >> > I found, that now xl tries to open iso with O_DIRECT flag. >> > open("/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso", >> > O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument) >> > write(2, "qemu: could not open vbd ''/local"..., 217) = 217 > > xl? I guess you mean QEMU tries to open the ISO with O_DIRECT. > > >> I guess CIFS doesn''t support O_DIRECT. It looks like it does have mount >> -o directio though, worth a try. >> >> I''m not sure what options exist to turn this off from the qemu side -- >> Stefano? I also have a feeling something changed in this regard in 4.2.x > > Given that you are not passing any device_model_version option to xl, I > assume that you are running qemu-xen-traditional (ps should show that a > binary called qemu-dm is running). > > If that is the case, there is currently no way to specify any flags. > However the interesting bit is that qemu-xen-traditional opens files > corresponding to emulated devices with BDRV_O_CACHE_WB and opens files > corresponding to PV interfaces using BDRV_O_NOCACHE (this means > O_DIRECT). > This means that the failure should be caused by hw/xen_disk.c trying to > opening the iso O_DIRECT. Paradoxically the PV inteface for a cdrom > drive is usually never used AFAIK. > > Did the Windows PV drivers start using the PV cdrom interface all of a > sudden? > > In any case I think that the best thing we could do it fall back to > write-through (or should it be write-back? It might not be safe..) in > case O_DIRECT fails. This is what qemu-xen does in such cases. > > Try this patch: > > --- > > diff --git a/hw/xen_disk.c b/hw/xen_disk.c > index 33a5531..d6d71fe 100644 > --- a/hw/xen_disk.c > +++ b/hw/xen_disk.c > @@ -659,9 +659,16 @@ static int blk_init(struct XenDevice *xendev) > if (blkdev->bs) { > if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, > bdrv_find_format(blkdev->fileproto)) != 0) { > - bdrv_delete(blkdev->bs); > - blkdev->bs = NULL; > - } > + /* try without O_DIRECT */ > + xen_be_printf(&blkdev->xendev, 0, "opening %s with O_DIRECT failed, trying write-through.\n", > + blkdev->filename); > + qflags &= BDRV_O_NOCACHE; > + if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, > + bdrv_find_format(blkdev->fileproto)) != 0) { > + bdrv_delete(blkdev->bs); > + blkdev->bs = NULL; > + } > + } > } > if (!blkdev->bs) > return -1; >-- Vasiliy Tolstov, Clodo.ru e-mail: v.tolstov@selfip.ru jabber: vase@selfip.ru
Strace shows that qemu after O_DIRECT next try with O_DIRECT open("/var/storage/iso/winpe_amd64.iso", O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument) write(2, "xen be: qdisk-832: ", 19) = 19 write(2, "xen be: qdisk-832: ", 19) = 19 write(2, "opening /var/storage/iso/winpe_a"..., 85) = 85 write(2, "opening /var/storage/iso/winpe_a"..., 85) = 85 open("/var/storage/iso/winpe_amd64.iso", O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument) 2013/1/30 Vasiliy Tolstov <v.tolstov@selfip.ru>:> Thanks for patch. But it not solve problem: > Now i have : > domid: 6 > Using file /dev/disk/vbd/21-828 in read-write mode > Strip off blktap sub-type prefix to (drv ''aio'') > Watching /local/domain/0/device-model/6/logdirty/cmd > Watching /local/domain/0/device-model/6/command > Watching /local/domain/6/cpu > char device redirected to /dev/pts/5 > qemu_map_cache_init nr_buckets = 10000 size 4194304 > Could not open /var/run/tap/qemu-read-6 > shared page at pfn feffd > buffered io page at pfn feffb > Guest uuid = c98c33c8-1891-41ec-96a0-984f3df80def > xen be: qdisk-5632: xen be: qdisk-5632: opening with O_DIRECT failed, > trying write-through. > opening with O_DIRECT failed, trying write-through. > populating video RAM at ff000000 > mapping video RAM from ff000000 > Register xen platform. > Done register platform. > platform_fixed_ioport: changed ro/rw state of ROM memory area. now is rw state. > xs_read(/local/domain/0/device-model/6/xen_extended_power_mgmt): read error > medium change watch on `hdc'' (index: 1): aio: > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 > Log-dirty: no command yet. > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 > vcpu-set: watch node error. > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 > xs_read(/local/domain/6/log-throttling): read error > qemu: ignoring not-understood drive `/local/domain/6/log-throttling'' > medium change watch on `/local/domain/6/log-throttling'' - unknown > device, ignored > xen be: qdisk-5632: xen be: qdisk-5632: opening with O_DIRECT failed, > trying write-through. > opening with O_DIRECT failed, trying write-through. > log_throttling disabled > qemu: ignoring not-understood drive `/local/domain/6/log-throttling'' > medium change watch on `/local/domain/6/log-throttling'' - unknown > device, ignored > vga s->lfb_addr = f0000000 s->lfb_end = f1000000 > platform_fixed_ioport: changed ro/rw state of ROM memory area. now is rw state. > platform_fixed_ioport: changed ro/rw state of ROM memory area. now is ro state. > > > (XEN) HVM6: VGABios $Id: vgabios.c,v 1.67 2008/01/27 09:44:12 vruppert Exp $ > (XEN) HVM6: VBE Bios $Id: vbe.c,v 1.60 2008/03/02 07:47:21 vruppert Exp $ > (XEN) HVM6: Bochs BIOS - build: 06/23/99 > (XEN) HVM6: $Revision: 1.221 $ $Date: 2008/12/07 17:32:29 $ > (XEN) HVM6: Options: apmbios pcibios eltorito PMM > (XEN) HVM6: > (XEN) HVM6: ata0-0: PCHS=16383/16/63 translation=lba LCHS=1024/255/63 > (XEN) HVM6: ata0 master: QEMU HARDDISK ATA-7 Hard-Disk (10246 MBytes) > (XEN) HVM6: IDE time out > (XEN) HVM6: ata1 master: QEMU DVD-ROM ATAPI-4 CD-Rom/DVD-Rom > (XEN) HVM6: IDE time out > (XEN) HVM6: > (XEN) HVM6: > (XEN) HVM6: > (XEN) HVM6: Press F12 for boot menu. > (XEN) HVM6: > (XEN) HVM6: Booting from Hard Disk... > (XEN) HVM6: Boot from Hard Disk failed: not a bootable disk > (XEN) HVM6: > (XEN) HVM6: > (XEN) HVM6: No bootable device. > (XEN) HVM6: Powering off in 30 seconds. > (XEN) hvm.c:1080:d6 All CPUs offline -- powering off. > > 2013/1/22 Stefano Stabellini <stefano.stabellini@eu.citrix.com>: >> On Tue, 22 Jan 2013, Ian Campbell wrote: >>> Please don''t top post. >>> >>> On Tue, 2013-01-22 at 05:38 +0000, Vasiliy Tolstov wrote: >>> > Thanks! >>> > I found, that now xl tries to open iso with O_DIRECT flag. >>> > open("/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso", >>> > O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument) >>> > write(2, "qemu: could not open vbd ''/local"..., 217) = 217 >> >> xl? I guess you mean QEMU tries to open the ISO with O_DIRECT. >> >> >>> I guess CIFS doesn''t support O_DIRECT. It looks like it does have mount >>> -o directio though, worth a try. >>> >>> I''m not sure what options exist to turn this off from the qemu side -- >>> Stefano? I also have a feeling something changed in this regard in 4.2.x >> >> Given that you are not passing any device_model_version option to xl, I >> assume that you are running qemu-xen-traditional (ps should show that a >> binary called qemu-dm is running). >> >> If that is the case, there is currently no way to specify any flags. >> However the interesting bit is that qemu-xen-traditional opens files >> corresponding to emulated devices with BDRV_O_CACHE_WB and opens files >> corresponding to PV interfaces using BDRV_O_NOCACHE (this means >> O_DIRECT). >> This means that the failure should be caused by hw/xen_disk.c trying to >> opening the iso O_DIRECT. Paradoxically the PV inteface for a cdrom >> drive is usually never used AFAIK. >> >> Did the Windows PV drivers start using the PV cdrom interface all of a >> sudden? >> >> In any case I think that the best thing we could do it fall back to >> write-through (or should it be write-back? It might not be safe..) in >> case O_DIRECT fails. This is what qemu-xen does in such cases. >> >> Try this patch: >> >> --- >> >> diff --git a/hw/xen_disk.c b/hw/xen_disk.c >> index 33a5531..d6d71fe 100644 >> --- a/hw/xen_disk.c >> +++ b/hw/xen_disk.c >> @@ -659,9 +659,16 @@ static int blk_init(struct XenDevice *xendev) >> if (blkdev->bs) { >> if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, >> bdrv_find_format(blkdev->fileproto)) != 0) { >> - bdrv_delete(blkdev->bs); >> - blkdev->bs = NULL; >> - } >> + /* try without O_DIRECT */ >> + xen_be_printf(&blkdev->xendev, 0, "opening %s with O_DIRECT failed, trying write-through.\n", >> + blkdev->filename); >> + qflags &= BDRV_O_NOCACHE; >> + if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, >> + bdrv_find_format(blkdev->fileproto)) != 0) { >> + bdrv_delete(blkdev->bs); >> + blkdev->bs = NULL; >> + } >> + } >> } >> if (!blkdev->bs) >> return -1; >> > > > > -- > Vasiliy Tolstov, > Clodo.ru > e-mail: v.tolstov@selfip.ru > jabber: vase@selfip.ru-- Vasiliy Tolstov, Clodo.ru e-mail: v.tolstov@selfip.ru jabber: vase@selfip.ru
Sorry that was my stupid mistake. This should work: diff --git a/hw/xen_disk.c b/hw/xen_disk.c index 33a5531..1786db8 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -659,9 +659,16 @@ static int blk_init(struct XenDevice *xendev) if (blkdev->bs) { if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, bdrv_find_format(blkdev->fileproto)) != 0) { - bdrv_delete(blkdev->bs); - blkdev->bs = NULL; - } + /* try without O_DIRECT */ + xen_be_printf(&blkdev->xendev, 0, "opening %s with O_DIRECT failed, trying write-through.\n", + blkdev->filename); + qflags &= ~BDRV_O_NOCACHE; + if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, + bdrv_find_format(blkdev->fileproto)) != 0) { + bdrv_delete(blkdev->bs); + blkdev->bs = NULL; + } + } } if (!blkdev->bs) return -1; On Wed, 30 Jan 2013, Vasiliy Tolstov wrote:> Strace shows that qemu after O_DIRECT next try with O_DIRECT > open("/var/storage/iso/winpe_amd64.iso", O_RDONLY|O_DIRECT) = -1 > EINVAL (Invalid argument) > write(2, "xen be: qdisk-832: ", 19) = 19 > write(2, "xen be: qdisk-832: ", 19) = 19 > write(2, "opening /var/storage/iso/winpe_a"..., 85) = 85 > write(2, "opening /var/storage/iso/winpe_a"..., 85) = 85 > open("/var/storage/iso/winpe_amd64.iso", O_RDONLY|O_DIRECT) = -1 > EINVAL (Invalid argument) > > 2013/1/30 Vasiliy Tolstov <v.tolstov@selfip.ru>: > > Thanks for patch. But it not solve problem: > > Now i have : > > domid: 6 > > Using file /dev/disk/vbd/21-828 in read-write mode > > Strip off blktap sub-type prefix to (drv ''aio'') > > Watching /local/domain/0/device-model/6/logdirty/cmd > > Watching /local/domain/0/device-model/6/command > > Watching /local/domain/6/cpu > > char device redirected to /dev/pts/5 > > qemu_map_cache_init nr_buckets = 10000 size 4194304 > > Could not open /var/run/tap/qemu-read-6 > > shared page at pfn feffd > > buffered io page at pfn feffb > > Guest uuid = c98c33c8-1891-41ec-96a0-984f3df80def > > xen be: qdisk-5632: xen be: qdisk-5632: opening with O_DIRECT failed, > > trying write-through. > > opening with O_DIRECT failed, trying write-through. > > populating video RAM at ff000000 > > mapping video RAM from ff000000 > > Register xen platform. > > Done register platform. > > platform_fixed_ioport: changed ro/rw state of ROM memory area. now is rw state. > > xs_read(/local/domain/0/device-model/6/xen_extended_power_mgmt): read error > > medium change watch on `hdc'' (index: 1): aio: > > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 > > Log-dirty: no command yet. > > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 > > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 > > vcpu-set: watch node error. > > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 > > xs_read(/local/domain/6/log-throttling): read error > > qemu: ignoring not-understood drive `/local/domain/6/log-throttling'' > > medium change watch on `/local/domain/6/log-throttling'' - unknown > > device, ignored > > xen be: qdisk-5632: xen be: qdisk-5632: opening with O_DIRECT failed, > > trying write-through. > > opening with O_DIRECT failed, trying write-through. > > log_throttling disabled > > qemu: ignoring not-understood drive `/local/domain/6/log-throttling'' > > medium change watch on `/local/domain/6/log-throttling'' - unknown > > device, ignored > > vga s->lfb_addr = f0000000 s->lfb_end = f1000000 > > platform_fixed_ioport: changed ro/rw state of ROM memory area. now is rw state. > > platform_fixed_ioport: changed ro/rw state of ROM memory area. now is ro state. > > > > > > (XEN) HVM6: VGABios $Id: vgabios.c,v 1.67 2008/01/27 09:44:12 vruppert Exp $ > > (XEN) HVM6: VBE Bios $Id: vbe.c,v 1.60 2008/03/02 07:47:21 vruppert Exp $ > > (XEN) HVM6: Bochs BIOS - build: 06/23/99 > > (XEN) HVM6: $Revision: 1.221 $ $Date: 2008/12/07 17:32:29 $ > > (XEN) HVM6: Options: apmbios pcibios eltorito PMM > > (XEN) HVM6: > > (XEN) HVM6: ata0-0: PCHS=16383/16/63 translation=lba LCHS=1024/255/63 > > (XEN) HVM6: ata0 master: QEMU HARDDISK ATA-7 Hard-Disk (10246 MBytes) > > (XEN) HVM6: IDE time out > > (XEN) HVM6: ata1 master: QEMU DVD-ROM ATAPI-4 CD-Rom/DVD-Rom > > (XEN) HVM6: IDE time out > > (XEN) HVM6: > > (XEN) HVM6: > > (XEN) HVM6: > > (XEN) HVM6: Press F12 for boot menu. > > (XEN) HVM6: > > (XEN) HVM6: Booting from Hard Disk... > > (XEN) HVM6: Boot from Hard Disk failed: not a bootable disk > > (XEN) HVM6: > > (XEN) HVM6: > > (XEN) HVM6: No bootable device. > > (XEN) HVM6: Powering off in 30 seconds. > > (XEN) hvm.c:1080:d6 All CPUs offline -- powering off. > > > > 2013/1/22 Stefano Stabellini <stefano.stabellini@eu.citrix.com>: > >> On Tue, 22 Jan 2013, Ian Campbell wrote: > >>> Please don''t top post. > >>> > >>> On Tue, 2013-01-22 at 05:38 +0000, Vasiliy Tolstov wrote: > >>> > Thanks! > >>> > I found, that now xl tries to open iso with O_DIRECT flag. > >>> > open("/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso", > >>> > O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument) > >>> > write(2, "qemu: could not open vbd ''/local"..., 217) = 217 > >> > >> xl? I guess you mean QEMU tries to open the ISO with O_DIRECT. > >> > >> > >>> I guess CIFS doesn''t support O_DIRECT. It looks like it does have mount > >>> -o directio though, worth a try. > >>> > >>> I''m not sure what options exist to turn this off from the qemu side -- > >>> Stefano? I also have a feeling something changed in this regard in 4.2.x > >> > >> Given that you are not passing any device_model_version option to xl, I > >> assume that you are running qemu-xen-traditional (ps should show that a > >> binary called qemu-dm is running). > >> > >> If that is the case, there is currently no way to specify any flags. > >> However the interesting bit is that qemu-xen-traditional opens files > >> corresponding to emulated devices with BDRV_O_CACHE_WB and opens files > >> corresponding to PV interfaces using BDRV_O_NOCACHE (this means > >> O_DIRECT). > >> This means that the failure should be caused by hw/xen_disk.c trying to > >> opening the iso O_DIRECT. Paradoxically the PV inteface for a cdrom > >> drive is usually never used AFAIK. > >> > >> Did the Windows PV drivers start using the PV cdrom interface all of a > >> sudden? > >> > >> In any case I think that the best thing we could do it fall back to > >> write-through (or should it be write-back? It might not be safe..) in > >> case O_DIRECT fails. This is what qemu-xen does in such cases. > >> > >> Try this patch: > >> > >> --- > >> > >> diff --git a/hw/xen_disk.c b/hw/xen_disk.c > >> index 33a5531..d6d71fe 100644 > >> --- a/hw/xen_disk.c > >> +++ b/hw/xen_disk.c > >> @@ -659,9 +659,16 @@ static int blk_init(struct XenDevice *xendev) > >> if (blkdev->bs) { > >> if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, > >> bdrv_find_format(blkdev->fileproto)) != 0) { > >> - bdrv_delete(blkdev->bs); > >> - blkdev->bs = NULL; > >> - } > >> + /* try without O_DIRECT */ > >> + xen_be_printf(&blkdev->xendev, 0, "opening %s with O_DIRECT failed, trying write-through.\n", > >> + blkdev->filename); > >> + qflags &= BDRV_O_NOCACHE; > >> + if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, > >> + bdrv_find_format(blkdev->fileproto)) != 0) { > >> + bdrv_delete(blkdev->bs); > >> + blkdev->bs = NULL; > >> + } > >> + } > >> } > >> if (!blkdev->bs) > >> return -1; > >> > > > > > > > > -- > > Vasiliy Tolstov, > > Clodo.ru > > e-mail: v.tolstov@selfip.ru > > jabber: vase@selfip.ru > > > > -- > Vasiliy Tolstov, > Clodo.ru > e-mail: v.tolstov@selfip.ru > jabber: vase@selfip.ru >
Failed again. may be in xenstore.c in this code i need to delete O_DIRECT flag? In strace before i get messages about fallback without O_DIRECT (provided with patch) i get this: write(2, "Using file /var/storage/iso/SW_D"..., 130) = 130 open("/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso", O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument) write(2, "qemu: could not open vbd ''/local"..., 216) = 216 My be in this code i append fallback? if (bdrv_open2(bs, params, flags|BDRV_O_CACHE_WB /* snapshot and write-back */, format) < 0) { fprintf(stderr, "qemu: could not open vbd ''%s'' or hard disk image ''%s'' (drv ''%s'' format ''%s'')\n", buf, params, drv ? drv : "?", format ? format->format_name : "0"); } else { char* snapshot = get_snapshot_name(atoi(e_danger[i])); if (snapshot) { fprintf(stderr, "Using snapshot %s\n", snapshot); ret = bdrv_snapshot_goto(bs, snapshot); switch (ret) { case 0: /* Success */ break; case -ENOTSUP: /* Don''t abort here (could be read-only ISO) */ fprintf(stderr, "Snapshots are not supported for " "this image file format\n"); break; case -ENOENT: fprintf(stderr, "No such snapshot, skipping this " "image file\n"); continue; default: fprintf(stderr, "Could not load snapshot, skipping" " this image file\n"); continue; } } } 2013/1/30 Stefano Stabellini <stefano.stabellini@eu.citrix.com>:> Sorry that was my stupid mistake. > This should work: > > diff --git a/hw/xen_disk.c b/hw/xen_disk.c > index 33a5531..1786db8 100644 > --- a/hw/xen_disk.c > +++ b/hw/xen_disk.c > @@ -659,9 +659,16 @@ static int blk_init(struct XenDevice *xendev) > if (blkdev->bs) { > if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, > bdrv_find_format(blkdev->fileproto)) != 0) { > - bdrv_delete(blkdev->bs); > - blkdev->bs = NULL; > - } > + /* try without O_DIRECT */ > + xen_be_printf(&blkdev->xendev, 0, "opening %s with O_DIRECT failed, trying write-through.\n", > + blkdev->filename); > + qflags &= ~BDRV_O_NOCACHE; > + if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, > + bdrv_find_format(blkdev->fileproto)) != 0) { > + bdrv_delete(blkdev->bs); > + blkdev->bs = NULL; > + } > + } > } > if (!blkdev->bs) > return -1; > > On Wed, 30 Jan 2013, Vasiliy Tolstov wrote: >> Strace shows that qemu after O_DIRECT next try with O_DIRECT >> open("/var/storage/iso/winpe_amd64.iso", O_RDONLY|O_DIRECT) = -1 >> EINVAL (Invalid argument) >> write(2, "xen be: qdisk-832: ", 19) = 19 >> write(2, "xen be: qdisk-832: ", 19) = 19 >> write(2, "opening /var/storage/iso/winpe_a"..., 85) = 85 >> write(2, "opening /var/storage/iso/winpe_a"..., 85) = 85 >> open("/var/storage/iso/winpe_amd64.iso", O_RDONLY|O_DIRECT) = -1 >> EINVAL (Invalid argument) >> >> 2013/1/30 Vasiliy Tolstov <v.tolstov@selfip.ru>: >> > Thanks for patch. But it not solve problem: >> > Now i have : >> > domid: 6 >> > Using file /dev/disk/vbd/21-828 in read-write mode >> > Strip off blktap sub-type prefix to (drv ''aio'') >> > Watching /local/domain/0/device-model/6/logdirty/cmd >> > Watching /local/domain/0/device-model/6/command >> > Watching /local/domain/6/cpu >> > char device redirected to /dev/pts/5 >> > qemu_map_cache_init nr_buckets = 10000 size 4194304 >> > Could not open /var/run/tap/qemu-read-6 >> > shared page at pfn feffd >> > buffered io page at pfn feffb >> > Guest uuid = c98c33c8-1891-41ec-96a0-984f3df80def >> > xen be: qdisk-5632: xen be: qdisk-5632: opening with O_DIRECT failed, >> > trying write-through. >> > opening with O_DIRECT failed, trying write-through. >> > populating video RAM at ff000000 >> > mapping video RAM from ff000000 >> > Register xen platform. >> > Done register platform. >> > platform_fixed_ioport: changed ro/rw state of ROM memory area. now is rw state. >> > xs_read(/local/domain/0/device-model/6/xen_extended_power_mgmt): read error >> > medium change watch on `hdc'' (index: 1): aio: >> > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 >> > Log-dirty: no command yet. >> > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 >> > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 >> > vcpu-set: watch node error. >> > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 >> > xs_read(/local/domain/6/log-throttling): read error >> > qemu: ignoring not-understood drive `/local/domain/6/log-throttling'' >> > medium change watch on `/local/domain/6/log-throttling'' - unknown >> > device, ignored >> > xen be: qdisk-5632: xen be: qdisk-5632: opening with O_DIRECT failed, >> > trying write-through. >> > opening with O_DIRECT failed, trying write-through. >> > log_throttling disabled >> > qemu: ignoring not-understood drive `/local/domain/6/log-throttling'' >> > medium change watch on `/local/domain/6/log-throttling'' - unknown >> > device, ignored >> > vga s->lfb_addr = f0000000 s->lfb_end = f1000000 >> > platform_fixed_ioport: changed ro/rw state of ROM memory area. now is rw state. >> > platform_fixed_ioport: changed ro/rw state of ROM memory area. now is ro state. >> > >> > >> > (XEN) HVM6: VGABios $Id: vgabios.c,v 1.67 2008/01/27 09:44:12 vruppert Exp $ >> > (XEN) HVM6: VBE Bios $Id: vbe.c,v 1.60 2008/03/02 07:47:21 vruppert Exp $ >> > (XEN) HVM6: Bochs BIOS - build: 06/23/99 >> > (XEN) HVM6: $Revision: 1.221 $ $Date: 2008/12/07 17:32:29 $ >> > (XEN) HVM6: Options: apmbios pcibios eltorito PMM >> > (XEN) HVM6: >> > (XEN) HVM6: ata0-0: PCHS=16383/16/63 translation=lba LCHS=1024/255/63 >> > (XEN) HVM6: ata0 master: QEMU HARDDISK ATA-7 Hard-Disk (10246 MBytes) >> > (XEN) HVM6: IDE time out >> > (XEN) HVM6: ata1 master: QEMU DVD-ROM ATAPI-4 CD-Rom/DVD-Rom >> > (XEN) HVM6: IDE time out >> > (XEN) HVM6: >> > (XEN) HVM6: >> > (XEN) HVM6: >> > (XEN) HVM6: Press F12 for boot menu. >> > (XEN) HVM6: >> > (XEN) HVM6: Booting from Hard Disk... >> > (XEN) HVM6: Boot from Hard Disk failed: not a bootable disk >> > (XEN) HVM6: >> > (XEN) HVM6: >> > (XEN) HVM6: No bootable device. >> > (XEN) HVM6: Powering off in 30 seconds. >> > (XEN) hvm.c:1080:d6 All CPUs offline -- powering off. >> > >> > 2013/1/22 Stefano Stabellini <stefano.stabellini@eu.citrix.com>: >> >> On Tue, 22 Jan 2013, Ian Campbell wrote: >> >>> Please don''t top post. >> >>> >> >>> On Tue, 2013-01-22 at 05:38 +0000, Vasiliy Tolstov wrote: >> >>> > Thanks! >> >>> > I found, that now xl tries to open iso with O_DIRECT flag. >> >>> > open("/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso", >> >>> > O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument) >> >>> > write(2, "qemu: could not open vbd ''/local"..., 217) = 217 >> >> >> >> xl? I guess you mean QEMU tries to open the ISO with O_DIRECT. >> >> >> >> >> >>> I guess CIFS doesn''t support O_DIRECT. It looks like it does have mount >> >>> -o directio though, worth a try. >> >>> >> >>> I''m not sure what options exist to turn this off from the qemu side -- >> >>> Stefano? I also have a feeling something changed in this regard in 4.2.x >> >> >> >> Given that you are not passing any device_model_version option to xl, I >> >> assume that you are running qemu-xen-traditional (ps should show that a >> >> binary called qemu-dm is running). >> >> >> >> If that is the case, there is currently no way to specify any flags. >> >> However the interesting bit is that qemu-xen-traditional opens files >> >> corresponding to emulated devices with BDRV_O_CACHE_WB and opens files >> >> corresponding to PV interfaces using BDRV_O_NOCACHE (this means >> >> O_DIRECT). >> >> This means that the failure should be caused by hw/xen_disk.c trying to >> >> opening the iso O_DIRECT. Paradoxically the PV inteface for a cdrom >> >> drive is usually never used AFAIK. >> >> >> >> Did the Windows PV drivers start using the PV cdrom interface all of a >> >> sudden? >> >> >> >> In any case I think that the best thing we could do it fall back to >> >> write-through (or should it be write-back? It might not be safe..) in >> >> case O_DIRECT fails. This is what qemu-xen does in such cases. >> >> >> >> Try this patch: >> >> >> >> --- >> >> >> >> diff --git a/hw/xen_disk.c b/hw/xen_disk.c >> >> index 33a5531..d6d71fe 100644 >> >> --- a/hw/xen_disk.c >> >> +++ b/hw/xen_disk.c >> >> @@ -659,9 +659,16 @@ static int blk_init(struct XenDevice *xendev) >> >> if (blkdev->bs) { >> >> if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, >> >> bdrv_find_format(blkdev->fileproto)) != 0) { >> >> - bdrv_delete(blkdev->bs); >> >> - blkdev->bs = NULL; >> >> - } >> >> + /* try without O_DIRECT */ >> >> + xen_be_printf(&blkdev->xendev, 0, "opening %s with O_DIRECT failed, trying write-through.\n", >> >> + blkdev->filename); >> >> + qflags &= BDRV_O_NOCACHE; >> >> + if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, >> >> + bdrv_find_format(blkdev->fileproto)) != 0) { >> >> + bdrv_delete(blkdev->bs); >> >> + blkdev->bs = NULL; >> >> + } >> >> + } >> >> } >> >> if (!blkdev->bs) >> >> return -1; >> >> >> > >> > >> > >> > -- >> > Vasiliy Tolstov, >> > Clodo.ru >> > e-mail: v.tolstov@selfip.ru >> > jabber: vase@selfip.ru >> >> >> >> -- >> Vasiliy Tolstov, >> Clodo.ru >> e-mail: v.tolstov@selfip.ru >> jabber: vase@selfip.ru >>-- Vasiliy Tolstov, Clodo.ru e-mail: v.tolstov@selfip.ru jabber: vase@selfip.ru
Sorry for the late reply. O_DIRECT is called BDRV_O_NOCACHE in QEMU, we don''t set BDRV_O_NOCACHE in xenstore.c, so I don''t know where the O_DIRECT flag comes from. What version of Xen and QEMU are you using? What is the last commit on your QEMU tree? Posting your QEMU logs after you applied this simple debug patch might help us understand the problem: diff --git a/block-raw-posix.c b/block-raw-posix.c index 795cd5b..ca6bc26 100644 --- a/block-raw-posix.c +++ b/block-raw-posix.c @@ -190,6 +190,7 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags) open_flags |= O_DIRECT; else if (!(flags & BDRV_O_CACHE_WB)) open_flags |= O_DSYNC; + printf("DEBUG flags=%lx open_flags=%lx\n", flags,open_flags); s->type = FTYPE_FILE; On Fri, 1 Feb 2013, Vasiliy Tolstov wrote:> Failed again. > may be in xenstore.c in this code i need to delete O_DIRECT flag? > > In strace before i get messages about fallback without O_DIRECT > (provided with patch) i get this: > > write(2, "Using file /var/storage/iso/SW_D"..., 130) = 130 > open("/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso", > O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument) > write(2, "qemu: could not open vbd ''/local"..., 216) = 216 > > My be in this code i append fallback? > > if (bdrv_open2(bs, params, flags|BDRV_O_CACHE_WB /* > snapshot and write-back */, format) < 0) { > fprintf(stderr, "qemu: could not open vbd ''%s'' or hard > disk image ''%s'' (drv ''%s'' format ''%s'')\n", buf, params, drv ? drv : > "?", format ? format->format_name : "0"); > } else { > char* snapshot = get_snapshot_name(atoi(e_danger[i])); > if (snapshot) { > fprintf(stderr, "Using snapshot %s\n", snapshot); > ret = bdrv_snapshot_goto(bs, snapshot); > switch (ret) { > case 0: > /* Success */ > break; > case -ENOTSUP: > /* Don''t abort here (could be read-only ISO) */ > fprintf(stderr, "Snapshots are not supported for " > "this image file format\n"); > break; > case -ENOENT: > fprintf(stderr, "No such snapshot, skipping this " > "image file\n"); > continue; > default: > fprintf(stderr, "Could not load snapshot, skipping" > " this image file\n"); > continue; > } > } > } > > 2013/1/30 Stefano Stabellini <stefano.stabellini@eu.citrix.com>: > > Sorry that was my stupid mistake. > > This should work: > > > > diff --git a/hw/xen_disk.c b/hw/xen_disk.c > > index 33a5531..1786db8 100644 > > --- a/hw/xen_disk.c > > +++ b/hw/xen_disk.c > > @@ -659,9 +659,16 @@ static int blk_init(struct XenDevice *xendev) > > if (blkdev->bs) { > > if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, > > bdrv_find_format(blkdev->fileproto)) != 0) { > > - bdrv_delete(blkdev->bs); > > - blkdev->bs = NULL; > > - } > > + /* try without O_DIRECT */ > > + xen_be_printf(&blkdev->xendev, 0, "opening %s with O_DIRECT failed, trying write-through.\n", > > + blkdev->filename); > > + qflags &= ~BDRV_O_NOCACHE; > > + if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, > > + bdrv_find_format(blkdev->fileproto)) != 0) { > > + bdrv_delete(blkdev->bs); > > + blkdev->bs = NULL; > > + } > > + } > > } > > if (!blkdev->bs) > > return -1; > > > > On Wed, 30 Jan 2013, Vasiliy Tolstov wrote: > >> Strace shows that qemu after O_DIRECT next try with O_DIRECT > >> open("/var/storage/iso/winpe_amd64.iso", O_RDONLY|O_DIRECT) = -1 > >> EINVAL (Invalid argument) > >> write(2, "xen be: qdisk-832: ", 19) = 19 > >> write(2, "xen be: qdisk-832: ", 19) = 19 > >> write(2, "opening /var/storage/iso/winpe_a"..., 85) = 85 > >> write(2, "opening /var/storage/iso/winpe_a"..., 85) = 85 > >> open("/var/storage/iso/winpe_amd64.iso", O_RDONLY|O_DIRECT) = -1 > >> EINVAL (Invalid argument) > >> > >> 2013/1/30 Vasiliy Tolstov <v.tolstov@selfip.ru>: > >> > Thanks for patch. But it not solve problem: > >> > Now i have : > >> > domid: 6 > >> > Using file /dev/disk/vbd/21-828 in read-write mode > >> > Strip off blktap sub-type prefix to (drv ''aio'') > >> > Watching /local/domain/0/device-model/6/logdirty/cmd > >> > Watching /local/domain/0/device-model/6/command > >> > Watching /local/domain/6/cpu > >> > char device redirected to /dev/pts/5 > >> > qemu_map_cache_init nr_buckets = 10000 size 4194304 > >> > Could not open /var/run/tap/qemu-read-6 > >> > shared page at pfn feffd > >> > buffered io page at pfn feffb > >> > Guest uuid = c98c33c8-1891-41ec-96a0-984f3df80def > >> > xen be: qdisk-5632: xen be: qdisk-5632: opening with O_DIRECT failed, > >> > trying write-through. > >> > opening with O_DIRECT failed, trying write-through. > >> > populating video RAM at ff000000 > >> > mapping video RAM from ff000000 > >> > Register xen platform. > >> > Done register platform. > >> > platform_fixed_ioport: changed ro/rw state of ROM memory area. now is rw state. > >> > xs_read(/local/domain/0/device-model/6/xen_extended_power_mgmt): read error > >> > medium change watch on `hdc'' (index: 1): aio: > >> > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 > >> > Log-dirty: no command yet. > >> > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 > >> > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 > >> > vcpu-set: watch node error. > >> > I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0 > >> > xs_read(/local/domain/6/log-throttling): read error > >> > qemu: ignoring not-understood drive `/local/domain/6/log-throttling'' > >> > medium change watch on `/local/domain/6/log-throttling'' - unknown > >> > device, ignored > >> > xen be: qdisk-5632: xen be: qdisk-5632: opening with O_DIRECT failed, > >> > trying write-through. > >> > opening with O_DIRECT failed, trying write-through. > >> > log_throttling disabled > >> > qemu: ignoring not-understood drive `/local/domain/6/log-throttling'' > >> > medium change watch on `/local/domain/6/log-throttling'' - unknown > >> > device, ignored > >> > vga s->lfb_addr = f0000000 s->lfb_end = f1000000 > >> > platform_fixed_ioport: changed ro/rw state of ROM memory area. now is rw state. > >> > platform_fixed_ioport: changed ro/rw state of ROM memory area. now is ro state. > >> > > >> > > >> > (XEN) HVM6: VGABios $Id: vgabios.c,v 1.67 2008/01/27 09:44:12 vruppert Exp $ > >> > (XEN) HVM6: VBE Bios $Id: vbe.c,v 1.60 2008/03/02 07:47:21 vruppert Exp $ > >> > (XEN) HVM6: Bochs BIOS - build: 06/23/99 > >> > (XEN) HVM6: $Revision: 1.221 $ $Date: 2008/12/07 17:32:29 $ > >> > (XEN) HVM6: Options: apmbios pcibios eltorito PMM > >> > (XEN) HVM6: > >> > (XEN) HVM6: ata0-0: PCHS=16383/16/63 translation=lba LCHS=1024/255/63 > >> > (XEN) HVM6: ata0 master: QEMU HARDDISK ATA-7 Hard-Disk (10246 MBytes) > >> > (XEN) HVM6: IDE time out > >> > (XEN) HVM6: ata1 master: QEMU DVD-ROM ATAPI-4 CD-Rom/DVD-Rom > >> > (XEN) HVM6: IDE time out > >> > (XEN) HVM6: > >> > (XEN) HVM6: > >> > (XEN) HVM6: > >> > (XEN) HVM6: Press F12 for boot menu. > >> > (XEN) HVM6: > >> > (XEN) HVM6: Booting from Hard Disk... > >> > (XEN) HVM6: Boot from Hard Disk failed: not a bootable disk > >> > (XEN) HVM6: > >> > (XEN) HVM6: > >> > (XEN) HVM6: No bootable device. > >> > (XEN) HVM6: Powering off in 30 seconds. > >> > (XEN) hvm.c:1080:d6 All CPUs offline -- powering off. > >> > > >> > 2013/1/22 Stefano Stabellini <stefano.stabellini@eu.citrix.com>: > >> >> On Tue, 22 Jan 2013, Ian Campbell wrote: > >> >>> Please don''t top post. > >> >>> > >> >>> On Tue, 2013-01-22 at 05:38 +0000, Vasiliy Tolstov wrote: > >> >>> > Thanks! > >> >>> > I found, that now xl tries to open iso with O_DIRECT flag. > >> >>> > open("/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso", > >> >>> > O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument) > >> >>> > write(2, "qemu: could not open vbd ''/local"..., 217) = 217 > >> >> > >> >> xl? I guess you mean QEMU tries to open the ISO with O_DIRECT. > >> >> > >> >> > >> >>> I guess CIFS doesn''t support O_DIRECT. It looks like it does have mount > >> >>> -o directio though, worth a try. > >> >>> > >> >>> I''m not sure what options exist to turn this off from the qemu side -- > >> >>> Stefano? I also have a feeling something changed in this regard in 4.2.x > >> >> > >> >> Given that you are not passing any device_model_version option to xl, I > >> >> assume that you are running qemu-xen-traditional (ps should show that a > >> >> binary called qemu-dm is running). > >> >> > >> >> If that is the case, there is currently no way to specify any flags. > >> >> However the interesting bit is that qemu-xen-traditional opens files > >> >> corresponding to emulated devices with BDRV_O_CACHE_WB and opens files > >> >> corresponding to PV interfaces using BDRV_O_NOCACHE (this means > >> >> O_DIRECT). > >> >> This means that the failure should be caused by hw/xen_disk.c trying to > >> >> opening the iso O_DIRECT. Paradoxically the PV inteface for a cdrom > >> >> drive is usually never used AFAIK. > >> >> > >> >> Did the Windows PV drivers start using the PV cdrom interface all of a > >> >> sudden? > >> >> > >> >> In any case I think that the best thing we could do it fall back to > >> >> write-through (or should it be write-back? It might not be safe..) in > >> >> case O_DIRECT fails. This is what qemu-xen does in such cases. > >> >> > >> >> Try this patch: > >> >> > >> >> --- > >> >> > >> >> diff --git a/hw/xen_disk.c b/hw/xen_disk.c > >> >> index 33a5531..d6d71fe 100644 > >> >> --- a/hw/xen_disk.c > >> >> +++ b/hw/xen_disk.c > >> >> @@ -659,9 +659,16 @@ static int blk_init(struct XenDevice *xendev) > >> >> if (blkdev->bs) { > >> >> if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, > >> >> bdrv_find_format(blkdev->fileproto)) != 0) { > >> >> - bdrv_delete(blkdev->bs); > >> >> - blkdev->bs = NULL; > >> >> - } > >> >> + /* try without O_DIRECT */ > >> >> + xen_be_printf(&blkdev->xendev, 0, "opening %s with O_DIRECT failed, trying write-through.\n", > >> >> + blkdev->filename); > >> >> + qflags &= BDRV_O_NOCACHE; > >> >> + if (bdrv_open2(blkdev->bs, blkdev->filename, qflags, > >> >> + bdrv_find_format(blkdev->fileproto)) != 0) { > >> >> + bdrv_delete(blkdev->bs); > >> >> + blkdev->bs = NULL; > >> >> + } > >> >> + } > >> >> } > >> >> if (!blkdev->bs) > >> >> return -1; > >> >> > >> > > >> > > >> > > >> > -- > >> > Vasiliy Tolstov, > >> > Clodo.ru > >> > e-mail: v.tolstov@selfip.ru > >> > jabber: vase@selfip.ru > >> > >> > >> > >> -- > >> Vasiliy Tolstov, > >> Clodo.ru > >> e-mail: v.tolstov@selfip.ru > >> jabber: vase@selfip.ru > >> > > > > -- > Vasiliy Tolstov, > Clodo.ru > e-mail: v.tolstov@selfip.ru > jabber: vase@selfip.ru >