[Qemu-devel] Help for backport virtio to older kernel 2.6.18
Hi All, It seems that virtio disk driver is included in kernel version started from 2.6.32, but for 2.6.18 (using redhat5 as VM), we have to backport the virtio driver. And I found that there is a link in link below, but cannot be opened. Could you provide help on it? Thanks! http://www.linux-kvm.org/page/Virtio * Backport and instructions can be found in <http://www.kernel.org/pub/scm/virt/kvm/kvm-guest-drivers-linux.git> kvm-guest-drivers-linux.git Best Regards Halsey Pian
Re: [Qemu-devel] [Bug 1434779] [NEW] qemu hangs on live-migration with storage(virtual machine: windows Server 2008 with only one disk )
> -Original Message- > From: qemu-devel-bounces+halsey.pian=gmail@nongnu.org > [mailto:qemu-devel-bounces+halsey.pian=gmail@nongnu.org] > On Behalf Of Stefan Hajnoczi > Sent: 2015年3月23日 21:32 > To: Bug 1434779 > Cc: qemu-devel@nongnu.org > Subject: Re: [Qemu-devel] [Bug 1434779] [NEW] qemu hangs on live-migration > with storage(virtual machine: windows Server 2008 > with only one disk ) > > On Sat, Mar 21, 2015 at 07:44:37AM -, youyunyehe wrote: > > We are using “Windows Server 2008” with qemu-kvm-2.0.1 (linux > > kernel:3.10.0) as a host of a VM. > > Please give the exact qemu-kvm package version and Linux distro name. > The code in qemu.git/master is slightly different so maybe the issue no > longer happens, but it would be worth looking at the exact > source code your qemu-kvm is built from. [Halsey] I also recreated this issue today, qemu hangs at bdrv_rw-co() -> bdrv_prwv_co() -> aio_poll(0 -> qemu_poll_ns() -> ppoll(). I'm just call bdrv_write to write data to qcow2 file. My qemu version is qemu-2.2.0. > I have CCed Jeff Cody, who maintains drive-mirror. > > > Using drive_mirror to do live-migration on the same host for > > different disks Local disk: /sf/data/local/ > > Shared disk(iscsi): /sf/other/local/--- the disk is busy, the IO rate > > is about 30MB/s > > qemu-system-x86_64 -k en-us -m 2048 -smp 2 -vnc :3100 -usbdevice > > tablet -boot c -enable-kvm -drive > > file=/sf/data/local/vm-disk-1.qcow2,if=none,id=drive-ide0,cache=none,a > > io=native -device > > ide-hd,bus=ide.0,unit=0,drive=drive-ide0,id=ide0,bootindex=100 > > > > Step 1: > > Start migration: Drive_mirror -f drive-ide0 > > /sf/other/local/test.qcow2 > > > > Step 2: > > When detect the migration has completed, then send cmd: > > block_job_complete -f drive-ide0 > > > > Step 3: > > send cmd: info status > > What surprised me is that the qemu monitor reports can’t be connected. > > > > Then find bellows: > > The qemu process hangs on the > > mirror_run->bdrv_drain_all->aio_poll->qemu_poll_ns->ppoll (), None > > events were received and poll forever. I don’t know why the aio can’t be > > responsed. This case is hardly to be generated but it really > happens sometimes . I’m looking forward to getting help from you . > > The stack capture snapshot:
Re: [Qemu-devel] Help for backport virtio to older kernel 2.6.18
> -Original Message- > From: Stefan Hajnoczi [mailto:stefa...@gmail.com] > Sent: 2015年3月30日 23:33 > To: Halsey Pian > Cc: qemu-devel@nongnu.org > Subject: Re: [Qemu-devel] Help for backport virtio to older kernel 2.6.18 > > On Mon, Mar 30, 2015 at 04:25:50PM +0800, Halsey Pian wrote: > > It seems that virtio disk driver is included in kernel version started > > from 2.6.32, but for 2.6.18 (using redhat5 as VM), we have to backport the > > virtio driver. And I found that there is a link in link below, > but cannot be opened. Could you provide help on it? > > Red Hat Enterprise Linux 5 guests support virtio devices. You should not > need to compile or backport anything for virtio-net or virtio- > blk. > > Please refer to the official documentation and support channels: > https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Virtualization/index.html > Stefan [Halsey] thanks for your info, Stefan. I would check it. Halsey
Re: [Qemu-devel] Help for backport virtio to older kernel 2.6.18
Best Regards Halsey Pian > -Original Message- > From: Halsey Pian [mailto:halsey.p...@gmail.com] > Sent: 2015年3月31日 19:48 > To: 'Stefan Hajnoczi' > Cc: qemu-devel@nongnu.org; halsey.p...@gmail.com > Subject: RE: [Qemu-devel] Help for backport virtio to older kernel 2.6.18 > > > -Original Message- > > From: Stefan Hajnoczi [mailto:stefa...@gmail.com] > > Sent: 2015年3月30日 23:33 > > To: Halsey Pian > > Cc: qemu-devel@nongnu.org > > Subject: Re: [Qemu-devel] Help for backport virtio to older kernel > > 2.6.18 > > > > On Mon, Mar 30, 2015 at 04:25:50PM +0800, Halsey Pian wrote: > > > It seems that virtio disk driver is included in kernel version > > > started from 2.6.32, but for 2.6.18 (using redhat5 as VM), we have > > > to backport the virtio driver. And I found that there is a link in > link below, > > but cannot be opened. Could you provide help on it? > > > > Red Hat Enterprise Linux 5 guests support virtio devices. You should > > not need to compile or backport anything for virtio-net or > virtio- > > blk. > > > > Please refer to the official documentation and support channels: > > https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux > > /5/html/Virtualization/index.html > > > Stefan > > [Halsey] thanks for your info, Stefan. I would check it. > > Halsey Stefan, Redhat 5 does support virtio block, but for other Linux distributions with kernel < 2.6.25 no virtio support, we also need backport virtio if we want to use it. I checked the link for backport it in KVM website, still cannot be found. Would you have some info for it? Thanks! [Halsey]
[Qemu-devel] qcow2 problem in CentOS
Hi All, QCOW2 feature included in Qemu-2.1.2 version works fine in Fedora, but there is issue in CentOS 6.5/7. We can create a qcow2 img file using qemu-img in CentOS > qemu-img create -f qcow2 test.qcow2 10G Then using qemu-system-x86_64 or virt-manager to install one VM to this file test.qcow2 created above, the disk size is not 10G but only basic about 200K. Are there similar issues in CentOS? Or maybe something I missed. Could you give help on it? Thanks! Best Regards Halsey Pian
[Qemu-devel] [Makefile] Compiling Qemu to dynamic library
Dear All, Recently, I would try to compile qemu to a so in order to call qemu internal functions in my program, I'm trying to do this by steps, 1. Add rules in qemu-2.1.2/ rules.mak %.so: $(call quiet-command,rm -f $@ && $(LINKPROG) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) -fPIC -shared -DBUILD_DSO $(CFLAGS) $($@-cflags) $(LDFLAGS) $(LIBS) -o $@ $^," GEN$(TARGET_DIR)$@") 2. Add target in qemu-2.1.2/Makefile qemu-kvm-obj = vl.o blockdev.o migration.o migration-unix.o qtest.o migration-fd.o ioport.o savevm.o cpus.o qemu-kvm-obj += net/net.o net/queue.o qemu-kvm-obj += ui/console.o qemu-kvm-obj += qom/object.o qemu-kvm-obj += hw/usb/bus.o qemu-kvm-obj += pixman/pixman/pixman-bits-image.o pixman/pixman/pixman-utils.o qemu-kvm-obj += qapi/qapi-visit-core.o libqemu.so : $(block-obj-y) $(util-obj-y) qemu-img.o vmstate.o qemu-file.o $(qemu-kvm-obj) vl.o qapi-event.o migration.o blockdev.o migration-unix.o qtest.o migration-fd.o as you know, the main entrance for final binary qemu-system-x86_64 is located in vl.c, I just want it and qemu-img.o to be included in the so library, so it seems that there are many dependent objects above should have to be included, that would be suffering problem to be fixed below during doing this, There are many platform dependent source code i.e. cpus.c memory.c, how to compile them into so for specific platform? Is there some guidance for building qemu to so? could you give help on this? Thanks a lot! Best Regards Halsey Pian
Re: [Qemu-devel] [Makefile] Compiling Qemu to dynamic library
Hi All, During building this so library, I found that there are many functions with same name in stubs and other source file, for example, There are two implement functions with same name slirp_pollfds_fill in slirp.c and main-loop.c. ./stubs/slirp.c:void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout) ./main-loop.c:slirp_pollfds_fill(gpollfds, &timeout); Do you know when qemustub should be used? libqemustub.a is only used for qemu-img, qemu-nbd, qemu-io, but not for qemu-system-x86_64(and other platform binary)? Thanks! Best Regards Halsey Pian From: Halsey Pian [mailto:halsey.p...@gmail.com] Sent: 2015年1月7日 16:37 To: qemu-devel@nongnu.org Subject: [Qemu-devel] [Makefile] Compiling Qemu to dynamic library Dear All, Recently, I would try to compile qemu to a so in order to call qemu internal functions in my program, I’m trying to do this by steps, 1. Add rules in qemu-2.1.2/ rules.mak %.so: $(call quiet-command,rm -f $@ && $(LINKPROG) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) -fPIC -shared -DBUILD_DSO $(CFLAGS) $($@-cflags) $(LDFLAGS) $(LIBS) -o $@ $^," GEN$(TARGET_DIR)$@") 2. Add target in qemu-2.1.2/Makefile qemu-kvm-obj = vl.o blockdev.o migration.o migration-unix.o qtest.o migration-fd.o ioport.o savevm.o cpus.o qemu-kvm-obj += net/net.o net/queue.o qemu-kvm-obj += ui/console.o qemu-kvm-obj += qom/object.o qemu-kvm-obj += hw/usb/bus.o qemu-kvm-obj += pixman/pixman/pixman-bits-image.o pixman/pixman/pixman-utils.o qemu-kvm-obj += qapi/qapi-visit-core.o libqemu.so : $(block-obj-y) $(util-obj-y) qemu-img.o vmstate.o qemu-file.o $(qemu-kvm-obj) vl.o qapi-event.o migration.o blockdev. o migration-unix.o qtest.o migration-fd.o as you know, the main entrance for final binary qemu-system-x86_64 is located in vl.c, I just want it and qemu-img.o to be included in the so library, so it seems that there are many dependent objects above should have to be included, that would be suffering problem to be fixed below during doing this, There are many platform dependent source code i.e. cpus.c memory.c, how to compile them into so for specific platform? Is there some guidance for building qemu to so? could you give help on this? Thanks a lot! Best Regards Halsey Pian
Re: [Qemu-devel] [Makefile] Compiling Qemu to dynamic library
Hi All, I have a workaround solution to achieve this. I could just get all the object files required by specific platform executable binary by adding some codes in Makefile, and then compile them to the dynamic library. Sorry for reading this mail thread. Please ignore it. Thanks! Best Regards Halsey Pian From: Halsey Pian [mailto:halsey.p...@gmail.com] Sent: 2015年1月8日 12:03 To: qemu-devel@nongnu.org Subject: RE: [Qemu-devel] [Makefile] Compiling Qemu to dynamic library Hi All, During building this so library, I found that there are many functions with same name in stubs and other source file, for example, There are two implement functions with same name slirp_pollfds_fill in slirp.c and main-loop.c. ./stubs/slirp.c:void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout) ./main-loop.c:slirp_pollfds_fill(gpollfds, &timeout); Do you know when qemustub should be used? libqemustub.a is only used for qemu-img, qemu-nbd, qemu-io, but not for qemu-system-x86_64(and other platform binary)? Thanks! Best Regards Halsey Pian From: Halsey Pian [mailto:halsey.p...@gmail.com] Sent: 2015年1月7日 16:37 To: qemu-devel@nongnu.org Subject: [Qemu-devel] [Makefile] Compiling Qemu to dynamic library Dear All, Recently, I would try to compile qemu to a so in order to call qemu internal functions in my program, I’m trying to do this by steps, 1. Add rules in qemu-2.1.2/ rules.mak %.so: $(call quiet-command,rm -f $@ && $(LINKPROG) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) -fPIC -shared -DBUILD_DSO $(CFLAGS) $($@-cflags) $(LDFLAGS) $(LIBS) -o $@ $^," GEN$(TARGET_DIR)$@") 2. Add target in qemu-2.1.2/Makefile qemu-kvm-obj = vl.o blockdev.o migration.o migration-unix.o qtest.o migration-fd.o ioport.o savevm.o cpus.o qemu-kvm-obj += net/net.o net/queue.o qemu-kvm-obj += ui/console.o qemu-kvm-obj += qom/object.o qemu-kvm-obj += hw/usb/bus.o qemu-kvm-obj += pixman/pixman/pixman-bits-image.o pixman/pixman/pixman-utils.o qemu-kvm-obj += qapi/qapi-visit-core.o libqemu.so : $(block-obj-y) $(util-obj-y) qemu-img.o vmstate.o qemu-file.o $(qemu-kvm-obj) vl.o qapi-event.o migration.o blockdev. o migration-unix.o qtest.o migration-fd.o as you know, the main entrance for final binary qemu-system-x86_64 is located in vl.c, I just want it and qemu-img.o to be included in the so library, so it seems that there are many dependent objects above should have to be included, that would be suffering problem to be fixed below during doing this, There are many platform dependent source code i.e. cpus.c memory.c, how to compile them into so for specific platform? Is there some guidance for building qemu to so? could you give help on this? Thanks a lot! Best Regards Halsey Pian
[Qemu-devel] Security for QCOW2 format
Dear All, Nice to know all of you! Recently, I am reading codes of qcow2 format, in order to switch virtualization solution in my project from VMWare to KVM for more specific customization based on customer's requirements. I have one consideration related to qcow2 format in QEMU. As you know, there is all-in-one img file for QCOW2 format even if there is much original data and a number of snapshots, then maybe we would get a huge file, and maybe we cannot use this img if it is broken due to some reason/exception during long term running especially for server application. Is there a solution for this? Or is there a strategy similar to VMWare VMDK format using the structure with parent pointer to manage separate sub vmdk files? Could you give help on it? Many thanks! Best Regards Halsey Pian
[Qemu-devel] Help: Convert HDD to QCOW2 img
Hi All, Recently, I'm writing an interface of wrapper class for QCOW2 in order to manage QCOW2 img files conveniently based on our requirements in my current project , this wrapper includes functions such as QCOW2 creating, read/write and snapshot relatives. Actually, these functions would finally call functions in qemu-img.c, block.c, qcow2.c and others related. With respect to validation of this wrapper, I installed one VM to generate a fedora20.qcow2 file using qemu team's binary qemu-system_x86-64, and use my wrapper to read this file and write to a new QCOW2 file from sector 0 to total sectors the img includes, finally I can boot the VM using my generated QCOW2 img file. Unfortunately, I'm suffering issue below, I connected the fedora20.qcow2 to /dev/nbd0 using support of qemu-nbd and kernel nbd moduel, and fread this block node as file and also write the data to a new QCOW2 file using bdrv_write implemented in block.c starting from sector 0, but this img file doesn't work successfully, error report below when starts up Error: file 'grub2/i386-pc/normal.mod' not found Grub rescue> It seems the partition information is not wrote successfully into the img file, what did I miss? What else should I do except writing the data? Could you give help on it? The reason why I did above is that I want to write a hard disk drive including OS data (and can be started up normally as host) to qcow2 file, and then boot it as VM under qemu kvm support. Any idea or suggestion? Host: Fedora20 VM: Fedora20 Kernel: 3.12.32 QEMU: 2.1.2 Thanks a lot! Best Regards Halsey Pian
[Qemu-devel] [Bug] qemu_coroutine_enter abort and report error "Co-routine re-entered recursively"
Hi All, I have two threads to write two seperate qcow2 files, but after a while, the writing would be aborted in qemu_coroutine_enter, and report error “"Co-routine re-entered recursively” . Qemu should be thread safe, right? It seems that there are some variables is not thread safe? Could you have a chance to look it? Thanks! Call stack: #0 0x75e18989__GI_raise(sig=sig@entry=6) (../nptl/sysdeps/unix/sysv/linux/raise.c:56) #1 0x75e1a098__GI_abort() (abort.c:90) #2 0x7728c034qemu_coroutine_enter(co=0x7fffe0004800, opaque=0x0) (qemu-coroutine.c:117) #3 0x7727df39bdrv_co_io_em_complete(opaque=0x77fd6ae0, ret=0) (block.c:4847) #4 0x77270314thread_pool_completion_bh(opaque=0x7fffe0006ad0) (thread-pool.c:187) #5 0x7726f873 aio_bh_poll(ctx=0x7fffe0001d00) (async.c:82) #6 0x7728340baio_dispatch(ctx=0x7fffe0001d00) (aio-posix.c:137) #7 0x772837b0aio_poll(ctx=0x7fffe0001d00, blocking=true) (aio-posix.c:248) #8 ?? 0x772795a8 in bdrv_prwv_co (bs=0x7fffdc0021c0, offset=12071639552, qiov=0x7fffe67fa590, is_write=true, flags=(unknown: 0)) (block.c:2703) #9 ?? 0x7727966a in bdrv_rw_co (bs=0x7fffdc0021c0, sector_num=23577421, buf=0x7fffe4629250 "\234\b\335Ǽ\254\213q\301\366\315=\005oI\301\245=\373\004+2?H\212\025\035+\262\274C;X\301FaP\324\335\061ҝ&Y\316=\347\335\020\365\003goɿ\214\312S=\v2]\373\363C\311\341\334\r5k\346k\204\332\023\264\315陌\230\203J\222u\214\066", nb_sectors=128, is_write=true, flags=(unknown: 0)) (block.c:2726) #10 0x77279758 bdrv_write(bs=0x7fffdc0021c0, sector_num=23577421, buf=0x7fffe4629250 "\234\b\335Ǽ\254\213q\301\366\315=\005oI\301\245=\373\004+2?H\212\025\035+\262\274C;X\301FaP\324\335\061ҝ&Y\316=\347\335\020\365\003goɿ\214\312S=\v2]\373\363C\311\341\334\r5k\346k\204\332\023\264\315陌\230\203J\222u\214\066", nb_sectors=128) (block.c:2760) Best Regards Halsey Pian
Re: [Qemu-devel] [Bug] qemu_coroutine_enter abort and report error "Co-routine re-entered recursively"
Qemu version: qemu-2.2.0 release Platform: x86_64 From: Halsey Pian [mailto:halsey.p...@gmail.com] Sent: 2015年3月6日 15:04 To: qemu-devel@nongnu.org Cc: halsey.p...@gmail.com Subject: [Qemu-devel][Bug] qemu_coroutine_enter abort and report error "Co-routine re-entered recursively" Hi All, I have two threads to write two seperate qcow2 files, but after a while, the writing would be aborted in qemu_coroutine_enter, and report error “"Co-routine re-entered recursively” . Qemu should be thread safe, right? It seems that there are some variables is not thread safe? Could you have a chance to look it? Thanks! Call stack: #0 0x75e18989__GI_raise(sig=sig@entry=6) (../nptl/sysdeps/unix/sysv/linux/raise.c:56) #1 0x75e1a098__GI_abort() (abort.c:90) #2 0x7728c034qemu_coroutine_enter(co=0x7fffe0004800, opaque=0x0) (qemu-coroutine.c:117) #3 0x7727df39bdrv_co_io_em_complete(opaque=0x77fd6ae0, ret=0) (block.c:4847) #4 0x77270314thread_pool_completion_bh(opaque=0x7fffe0006ad0) (thread-pool.c:187) #5 0x7726f873 aio_bh_poll(ctx=0x7fffe0001d00) (async.c:82) #6 0x7728340baio_dispatch(ctx=0x7fffe0001d00) (aio-posix.c:137) #7 0x772837b0aio_poll(ctx=0x7fffe0001d00, blocking=true) (aio-posix.c:248) #8 ?? 0x772795a8 in bdrv_prwv_co (bs=0x7fffdc0021c0, offset=12071639552, qiov=0x7fffe67fa590, is_write=true, flags=(unknown: 0)) (block.c:2703) #9 ?? 0x7727966a in bdrv_rw_co (bs=0x7fffdc0021c0, sector_num=23577421, buf=0x7fffe4629250 "\234\b\335Ǽ\254\213q\301\366\315=\005oI\301\245=\373\004+2?H\212\025\035+\262\274C;X\301FaP\324\335\061ҝ&Y\316=\347\335\020\365\003goɿ\214\312S=\v2]\373\363C\311\341\334\r5k\346k\204\332\023\264\315陌\230\203J\222u\214\066", nb_sectors=128, is_write=true, flags=(unknown: 0)) (block.c:2726) #10 0x77279758 bdrv_write(bs=0x7fffdc0021c0, sector_num=23577421, buf=0x7fffe4629250 "\234\b\335Ǽ\254\213q\301\366\315=\005oI\301\245=\373\004+2?H\212\025\035+\262\274C;X\301FaP\324\335\061ҝ&Y\316=\347\335\020\365\003goɿ\214\312S=\v2]\373\363C\311\341\334\r5k\346k\204\332\023\264\315陌\230\203J\222u\214\066", nb_sectors=128) (block.c:2760) Best Regards Halsey Pian
Re: [Qemu-devel] [Bug] qemu_coroutine_enter abort and report error "Co-routine re-entered recursively"
> -Original Message- > From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > Bonzini > Sent: 2015年3月6日 17:45 > To: Halsey Pian; qemu-devel@nongnu.org > Subject: Re: [Bug] qemu_coroutine_enter abort and report error "Co-routine > re-entered recursively" > > > > On 06/03/2015 08:03, Halsey Pian wrote: > > I have two threads to write two seperate qcow2 files, but after a > > while, the writing would be aborted in qemu_coroutine_enter, and > > report error “"Co-routine re-entered recursively” . > > > > Qemu should be thread safe, right? It seems that there are some > > variables is not thread safe? Could you have a chance to look it? Thanks! > > QEMU is thread safe but you need to add explicit locking or use separate > event loops in each thread. If you want to write from > separate thread, you need to do one of the following: > > 1) use one AioContext per file, and add an AioContext-based event loop to > each thread (see backends/iothread.c); > > 2) use one AioContext per file, add it (as a GSource) to a GMainContext and > use a GMainLoop-based event loop to each thread; > > 3) use aio_context_acquire and aio_context_release around each blk_* or > bdrv_* call. > > Paolo Hi Paolo, Thanks for your immediate reply. I checked relevant source code, and I'm trying changing AioContext. Would keep changing based on your comments. Thank you! [Halsey]