CD-ROM size not updated when switching CD-ROM images.
Steps to reproduce:
) Download the first two Slackware-13.1 32-bit CD-ROM ISO images. ) Start KVM with the following command
qemu-system-x86_64 -m 1024M \
-cdrom < full path of 1st install disk > \
-boot d) Hit return when prompted for extra boot parameters.
) Hit return when asked to select a keyboard map.
) Hit return at the login prompt.
) cat /sys/block/sr0/size: this should return 1209360.
) Press Alt-Ctrl-2 to access the monitor
) eject ide1-cd0
) change ide1-cd0 < full path name of 2nd install disk >
) Press Alt-Ctrl-1 to return to the guest.
) dd if=/dev/sr0 of=/dev/null bs=512 skip=1209360 count=3
this should return
3+0 records in
3+0 records out.
instead it returns 0+0....
) cat /sys/block/sr0/size: this still returns 1209360; it should return 1376736.
Oddly, when "mount /dev/sr0 ...." is executed in the guest, ls of the mounted directory shows the correct contents for the 2nd CD.
KVM version is kvm-qemu-0.13.0
Host CPU model name : Intel(R) Core(TM)2 Duo CPU E8600 @ 3.33GHz
Host kernel is 2.6.32.12 Host arch is x86_64
Guest is Slackware 13.1 32-bit Guest kernel version is 2.6.33.4
Start command:
qemu-system-x86_64 -m 1024M \
-cdrom /spare2/slackware-13.1-install-d1.iso \
-boot d
Not affected by -no-kvm-irqchip Not affected by -no-kvm-pit Not affected by -no-kvm
I can test patches.
Built with:
bash-3.2$ ./configure --prefix=/usr/kvm-qemu-0.13.0 --extra-ldflags="-L/usr/X11R7.4/lib"
Install prefix /usr/kvm-qemu-0.13.0 BIOS directory /usr/kvm-qemu-0.13.0/share/qemu binary directory /usr/kvm-qemu-0.13.0/bin config directory /usr/kvm-qemu-0.13.0/etc Manual directory /usr/kvm-qemu-0.13.0/share/man ELF interp prefix /usr/gnemul/qemu-%M Source path /sources/qemu-kvm-0.13.0 C compiler gcc Host C compiler gcc CFLAGS -O2 -g QEMU_CFLAGS -m64 -fstack-protector-all -Wold-style-definition -I. -I$(SRC_PATH) -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing LDFLAGS -Wl,--warn-common -m64 -g -L/usr/X11R7.4/lib make make install install host CPU x86_64 host big endian no target list x86_64-softmmu tcg debug enabled no Mon debug enabled no gprof enabled no sparse enabled no strip binaries yes profiler no static build no -Werror enabled no SDL support yes curses support yes curl support yes check support no mingw32 support no Audio drivers oss Extra audio cards ac97 es1370 sb16 Block whitelist Mixer emulation no VNC TLS support no VNC SASL support yes VNC JPEG support yes VNC PNG support yes VNC thread no xen support no CPU emulation yes brlapi support no bluez support no Documentation yes NPTL support yes GUEST_BASE yes PIE user targets no vde support no IO thread no Linux AIO support no ATTR/XATTR support yes Install blobs yes KVM support yes KVM PIT support yes KVM device assig. yes fdt support no preadv support no fdatasync yes uuid support yes
vhost-net support yes
I code, therefore I am
Quoted 21 lines · Alex Davis
Steps to reproduce:
) Download the first two Slackware-13.1 32-bit CD-ROM ISO images.
) Start KVM with the following command
qemu-system-x86_64 -m 1024M \
-cdrom < full path of 1st install disk > \
-boot d
) Hit return when prompted for extra boot parameters.
) Hit return when asked to select a keyboard map.
) Hit return at the login prompt.
) cat/sys/block/sr0/size: this should return 1209360.
) Press Alt-Ctrl-2 to access the monitor
) eject ide1-cd0
) change ide1-cd0 < full path name of 2nd install disk >
) Press Alt-Ctrl-1 to return to the guest.
) dd if=/dev/sr0 of=/dev/null bs=512 skip=1209360 count=3
this should return
3+0 records in
3+0 records out.
instead it returns 0+0....
) cat/sys/block/sr0/size: this still returns 1209360; it should return 1376736.
Quoted 1 line
Oddly, when "mount
/dev/sr0...." is executed in the guest, ls of the mounted directory shows the correct contents for the 2nd CD.
After changing the CD-ROM, does running "blockdev --rereadpt /dev/sr0" update the size as expected?
You ejected the CD-ROM on the QEMU side, the guest doesn't necessarily know about the medium change. What happens when you use "eject /dev/sr0" inside the guest instead?
I don't know how CD-ROM media change works on real hardware, but that is the behavior that QEMU should be following.
Stefan
I code, therefore I am
Quoted 35 lines · Stefan Hajnoczi
From: Stefan Hajnoczi <[email protected]>
Subject: Re: CD-ROM size not updated when switching CD-ROM images.
To: "Alex Davis" <[email protected]>
Cc: [email protected]
Date: Tuesday, October 19, 2010, 4:31 AMQuoted 2 lines · Alex Davis
Steps to reproduce:
) Download the first two Slackware-13.1 32-bit CD-ROMISO images.
Quoted 3 lines
) Start KVM with the following command
qemu-system-x86_64 -m 1024M \
-cdrom < full path of 1st install disk >\
Quoted 5 lines
-boot d
) Hit return when prompted for extra boot parameters. ) Hit return when asked to select a keyboard map. ) Hit return at the login prompt.
) cat/sys/block/sr0/size: this should return1209360.
Quoted 3 lines
) Press Alt-Ctrl-2 to access the monitor
) eject ide1-cd0
) change ide1-cd0 < full path name of 2nd installdisk >
Quoted 2 lines
) Press Alt-Ctrl-1 to return to the guest.
) dd if=/dev/sr0 of=/dev/null bs=512 skip=1209360count=3
Quoted 5 lines
this should return
3+0 records in
3+0 records out.
instead it returns 0+0....
) cat/sys/block/sr0/size: this still returns 1209360;it should return 1376736.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
Oddly, when "mount
/dev/sr0...." is executed in theguest, ls of the mounted directory shows the correct contents for the 2nd CD.
After changing the CD-ROM, does running "blockdev
--rereadpt/dev/sr0"
update the size as expected?
The install CD does not have the blockdev command.
Quoted 5 lines
You ejected the CD-ROM on the QEMU side, the guest doesn't necessarily
know about the medium change. What happens when you use "eject/dev/sr0" inside the guest instead?
I get a 'no medium found' error from the 'dd..' command. After going into the the monitor, ejecting and reloading the disk, I still get the size of the first disk in the guest.
Quoted 6 lines
I don't know how CD-ROM media change works on real hardware, but that
is the behavior that QEMU should be following.Stefan
Quoted 8 lines · Alex Davis
Quoted 5 lines
You ejected the CD-ROM on the QEMU side, the guest doesn't necessarily
know about the medium change. What happens when you use "eject/dev/sr0" inside the guest instead?I get a 'no medium found' error from the 'dd..' command. After going into the the monitor, ejecting and reloading the disk, I still get the size of the first disk in the guest.
As I recall the old data is coming from the host page cache; it is not seeing the media change. Try dropping the cache in the host on a media change (echo 3 > /proc/sys/vm/drop_caches) or modify qemu to close and reopen the cdrom device.
David
Quoted 14 lines
Quoted 6 lines
I don't know how CD-ROM media change works on real hardware, but that
is the behavior that QEMU should be following.Stefan
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
I code, therefore I am
Quoted 19 lines · David Ahern
From: David Ahern <[email protected]>
Subject: Re: CD-ROM size not updated when switching CD-ROM images.
To: "Alex Davis" <[email protected]>
Cc: "Stefan Hajnoczi" <[email protected]>, [email protected]
Date: Wednesday, October 20, 2010, 12:44 PMQuoted 1 line · Alex Davis
Quoted 1 line
You ejected the CD-ROM on the QEMU side, the guest
doesn't
Quoted 2 lines
Quoted 2 lines
necessarily
know about the medium change. What happenswhen you
Quoted 3 lines
Quoted 2 lines
use "eject
/dev/sr0" inside the guest instead?I get a 'no medium found' error from the 'dd..'
command. After
Quoted 1 line
going into the the monitor, ejecting and reloading the
Quoted 8 lines
disk,
Quoted 1 line
I still get the size of the first disk in the guest.
As I recall the old data is coming from the host page cache; it is not
seeing the media change. Try dropping the cache in the host on a media
change (echo 3 >/proc/sys/vm/drop_caches)
This had no effect.
Quoted 3 lines
or modify
qemu to close and
reopen the cdrom device.
QEMU already does this.
Quoted 20 lines
David
Quoted 2 lines
Quoted 2 lines
I don't know how CD-ROM media change works on
real
Quoted 9 lines
Quoted 4 lines
hardware, but that
is the behavior that QEMU should be following.Stefan
--
To unsubscribe from this list: send the line"unsubscribe kvm" in
Quoted 3 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 30 lines · David Ahern
From: David Ahern <[email protected]>
Subject: Re: CD-ROM size not updated when switching CD-ROM images.
To: "Alex Davis" <[email protected]>
Cc: "Stefan Hajnoczi" <[email protected]>, [email protected]
Date: Wednesday, October 20, 2010, 12:44 PMQuoted 1 line · Alex Davis
Quoted 1 line
You ejected the CD-ROM on the QEMU side, the guest
doesn't
Quoted 2 lines
Quoted 2 lines
necessarily
know about the medium change. What happenswhen you
Quoted 3 lines
Quoted 2 lines
use "eject
/dev/sr0" inside the guest instead?I get a 'no medium found' error from the 'dd..'
command. After
Quoted 1 line
going into the the monitor, ejecting and reloading the
disk,
Quoted 1 line
I still get the size of the first disk in the guest.
As I recall the old data is coming from the host page cache; it is not
seeing the media change. Try dropping the cache in the host on a media
change (echo 3 >/proc/sys/vm/drop_caches) or modify qemu to close and
reopen the cdrom device.
Quoted 1 line
David
I am able to reproduce this problem with just a plain kernel using the ata_piix driver, an initrd that just starts a shell, and plain qemu. When the disk is changed via the monitor, the guest invokes the error- handling code on the next read of the CD-ROM, but the code path doesn't trigger the 'update size' logic. I did an experiment where I placed the line 'sdev->changed = 1' in the sr_open method in sr.c of the guest kernel source, the size was updated, but I will look to see if there's something in qemu that can be changed to make it work properly.
Of course any input from the qemu/kvm developers is appreciated.
I code, therefore I am
Quoted 18 lines
Quoted 3 lines
Quoted 3 lines
I don't know how CD-ROM media change works on
real
Quoted 9 lines
Quoted 4 lines
hardware, but that
is the behavior that QEMU should be following.Stefan
--
To unsubscribe from this list: send the line"unsubscribe kvm" in
Quoted 3 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html