[Qemu-devel] [Bug 739785] Re: qemu-i386 user mode on ARMv5 host fails (bash: fork: Invalid argument)
Do you think it will ever get fixed in a reasonable amount of time(or ever) or am I better off just getting an x86 low power board to run x86 binary-only code? -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/739785 Title: qemu-i386 user mode on ARMv5 host fails (bash: fork: Invalid argument) Status in QEMU: New Bug description: Good time of day everybody, I have been trying to make usermode qemu on ARM with plugapps (archlinux) with archlinux i386 chroot to work. 1. I installed arch linux in a virtuabox and created a chroot for it with mkarchroot. Transferred it to my pogo plug into /i386/ 2. I comiled qemu-i386 static and put it into /i386/usr/bin/ ./configure --static --disable-blobs --disable-system --target-list=i386-linux-user make 3. I also compiled linux kernel 2.6.38 with CONFIG_BINFMT_MISC=y and installed it. uname -a Linux Plugbox 2.6.38 #4 PREEMPT Fri Mar 18 22:19:10 CDT 2011 armv5tel Feroceon 88FR131 rev 1 (v5l) Marvell SheevaPlug Reference Board GNU/Linux 4. Added the following options into /etc/rc.local /sbin/modprobe binfmt_misc /bin/mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc echo ':qemu-i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff\xff:/usr/bin/qemu-i386:' >/proc/sys/fs/binfmt_misc/register 5. Also copied ld-linux.so.3 (actually ld-2.13.so because ld- linux.so.3 is a link to that file) from /lib/ to /i386/lib/ 6.Now i chroot into /i386 and I get this: [root@Plugbox i386]# chroot . [II aI hnve ao n@P /]# pacman -Suy bash: fork: Invalid argument 7.I also downloaded linux-user-test-0.3 from qemu website and ran the test: [root@Plugbox linux-user-test-0.3]# make ./qemu-linux-user.sh [qemu-i386] ../qemu-0.14.0/i386-linux-user/qemu-i386 -L ./gnemul/qemu-i386 i386/ls -l dummyfile BUG IN DYNAMIC LINKER ld.so: dl-version.c: 210: _dl_check_map_versions: Assertion `needed != ((void *)0)' failed! make: *** [test] Error 127
[Qemu-devel] [Bug 723871] Re: qemu-kvm-0.14.0 Aborts with -vga qxl
Current patches on F15:- [root@fedora15a SOURCES]# ls -l total 5360 -rw-r--r--. 1 root root4618 Mar 30 01:58 0001-qxl-spice-display-move-pipe-to-ssd.patch -rw-r--r--. 1 root root 10176 Mar 30 01:58 0002-qxl-implement-get_command-in-vga-mode-without-locks.patch -rw-r--r--. 1 root root5073 Mar 30 01:58 0003-qxl-spice-remove-qemu_mutex_-un-lock_iothread-around.patch -rw-r--r--. 1 root root7783 Mar 30 01:58 0004-hw-qxl-render-drop-cursor-locks-replace-with-pipe.patch -rw-r--r--. 1 root root1733 Mar 30 01:58 0005-char-Split-out-tcp-socket-close-code-in-a-separate-f.patch -rw-r--r--. 1 root root 22320 Mar 30 01:58 0006-char-Add-a-QemuChrHandlers-struct-to-initialise-char.patch -rw-r--r--. 1 root root1913 Mar 30 01:58 0007-iohandlers-Add-enable-disable_write_fd_handler-funct.patch -rw-r--r--. 1 root root2182 Mar 30 01:58 0008-char-Add-framework-for-a-write-unblocked-callback.patch -rw-r--r--. 1 root root6678 Mar 30 01:58 0009-char-Update-send_all-to-handle-nonblocking-chardev-w.patch -rw-r--r--. 1 root root2583 Mar 30 01:58 0010-char-Equip-the-unix-tcp-backend-to-handle-nonblockin.patch -rw-r--r--. 1 root root2000 Mar 30 01:58 0011-char-Throttle-when-host-connection-is-down.patch -rw-r--r--. 1 root root1650 Mar 30 01:58 0012-virtio-console-Enable-port-throttling-when-chardev-i.patch -rw-r--r--. 1 root root5036 Mar 30 01:58 0013-spice-qemu-char.c-add-throttling.patch -rw-r--r--. 1 root root2822 Mar 30 01:58 0014-spice-qemu-char.c-remove-intermediate-buffer.patch -rw-r--r--. 1 root root2807 Mar 30 01:58 0015-chardev-Allow-frontends-to-notify-backends-of-guest-.patch -rw-r--r--. 1 root root1592 Mar 30 01:58 0016-virtio-console-notify-backend-of-guest-open-close.patch -rw-r--r--. 1 root root1536 Mar 30 01:58 0017-spice-chardev-listen-to-frontend-guest-open-close.patch -rw-r--r--. 1 root root1784 Mar 30 01:58 0018-spice-qemu-char-Fix-flow-control-in-client-guest-dir.patch -rw-r--r--. 1 root root 40 Mar 30 01:58 80-kvm.rules -rw-r--r--. 1 root root2202 Mar 30 01:58 ksm.init -rw-r--r--. 1 root root 168 Mar 30 01:58 ksm.sysconfig -rw-r--r--. 1 root root3442 Mar 30 01:58 ksmtuned -rw-r--r--. 1 root root 478 Mar 30 01:58 ksmtuned.conf -rw-r--r--. 1 root root1968 Mar 30 01:58 ksmtuned.init -rwxr-xr-x. 1 root root 284 Mar 30 01:58 kvm.modules -rw-r--r--. 1 root root1155 Mar 30 01:58 pc-add-a-Fedora-13-machine-type-for-backward-compat.patch -rw-r--r--. 1 root root1748 Mar 30 01:58 qemu-fix-non-PCI-target-build.patch -rwxr-xr-x. 1 root root3199 Mar 30 01:58 qemu.init -rw-rw-r--. 1 root root 5320696 Feb 24 19:11 qemu-kvm-0.14.0.tar.gz -rw-r--r--. 1 root root1045 Mar 30 01:58 qemu-vhost-fix-dirty-page-handling.patch I believe there is no the one http://patchwork.ozlabs.org/patch/84704/ you have been using -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/723871 Title: qemu-kvm-0.14.0 Aborts with -vga qxl Status in QEMU: Confirmed Status in “qemu-kvm” package in Ubuntu: Fix Released Bug description: Host CPU is Core i7 Q820. KVM is from 2.6.35-gentoo-r5 kernel (x86_64). Host has spice-0.7.2 and spice-protocol-0.7.0. Guest is Windows XP SP3 with qxl driver 0.6.1, virtio-serial 1.1.6 and vdagent 0.6.3. qemu-kvm is started like so: qemu-system-x86_64 -cpu host -enable-kvm -pidfile /home/rick/qemu/hds/wxp.pid -drive file=/home/rick/qemu/hds/wxp.raw,if=virtio,media=disk,aio=native,snapshot=on -m 768 -name WinXP -net nic,model=virtio -net user -localtime -usb -vga qxl -device virtio-serial -chardev spicevmc,name=vdagent,id=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -spice port=1234,disable-ticketing -monitor stdio and crashes with: qemu-system-x86_64: /home/rick/qemu/src/qemu-kvm-0.14.0/qemu-kvm.c:1724: kvm_mutex_unlock: Assertion `!cpu_single_env' failed. Aborted If I use -no-kvm, it works fine. If I use -vga std, it works fine. -enable-kvm and -vga qxl crashes.
[Qemu-devel] [Bug 723871] Re: qemu-kvm-0.14.0 Aborts with -vga qxl
View also http://lists.fedoraproject.org/pipermail/virt/2011-March/002572.html Per Alon Levy :- here is a new patchset, it's basically the old plus first patch of reverting gerd's (cpu_single_env hackage) and last one removing all the locks, after being convinced by hans (cc'ed) and uri that it should work. Tested with rhel qemu-kvm, which should be identical (tm) to fedora qemu-kvm. On account of being too lame to figure out how to add the patches to qemu.spec and doing a scratch build right now.. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/723871 Title: qemu-kvm-0.14.0 Aborts with -vga qxl Status in QEMU: Confirmed Status in “qemu-kvm” package in Ubuntu: Fix Released Bug description: Host CPU is Core i7 Q820. KVM is from 2.6.35-gentoo-r5 kernel (x86_64). Host has spice-0.7.2 and spice-protocol-0.7.0. Guest is Windows XP SP3 with qxl driver 0.6.1, virtio-serial 1.1.6 and vdagent 0.6.3. qemu-kvm is started like so: qemu-system-x86_64 -cpu host -enable-kvm -pidfile /home/rick/qemu/hds/wxp.pid -drive file=/home/rick/qemu/hds/wxp.raw,if=virtio,media=disk,aio=native,snapshot=on -m 768 -name WinXP -net nic,model=virtio -net user -localtime -usb -vga qxl -device virtio-serial -chardev spicevmc,name=vdagent,id=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -spice port=1234,disable-ticketing -monitor stdio and crashes with: qemu-system-x86_64: /home/rick/qemu/src/qemu-kvm-0.14.0/qemu-kvm.c:1724: kvm_mutex_unlock: Assertion `!cpu_single_env' failed. Aborted If I use -no-kvm, it works fine. If I use -vga std, it works fine. -enable-kvm and -vga qxl crashes.
[Qemu-devel] [RESEND][PATCH 3/9] microdrive: qdevify
Switch dscm1 microdrive driver to use qdev infrastructure. --- hw/ide/microdrive.c | 49 +++-- hw/pcmcia.h |2 +- hw/spitz.c |5 - hw/tosa.c |5 - 4 files changed, 48 insertions(+), 13 deletions(-) diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c index 9fbbf0e..7692603 100644 --- a/hw/ide/microdrive.c +++ b/hw/ide/microdrive.c @@ -38,8 +38,8 @@ /* DSCM-1 Microdrive hard disk with CF+ II / PCMCIA interface. */ typedef struct { -IDEBus bus; PCMCIACardState card; +IDEBus bus; uint32_t attr_base; uint32_t io_base; @@ -529,22 +529,51 @@ static int dscm1_detach(void *opaque) return 0; } -PCMCIACardState *dscm1_init(DriveInfo *bdrv) +PCMCIACardState *dscm1_init(PCMCIASocket *socket, DriveInfo *bdrv) +{ +DeviceState *dev; +MicroDriveState *md; + +dev = qdev_create(&socket->qbus, "dscm1"); +qdev_init_nofail(dev); +md = DO_UPCAST(MicroDriveState, card.dev, dev); + +ide_create_drive(&md->bus, 0, bdrv); +md->bus.ifs[0].drive_kind = IDE_CFATA; +md->bus.ifs[0].mdata_size = METADATA_SIZE; +md->bus.ifs[0].mdata_storage = (uint8_t *) qemu_mallocz(METADATA_SIZE); + +return &md->card; +} + +static int dscm1_initfn(PCMCIACardState *state) { -MicroDriveState *md = (MicroDriveState *) qemu_mallocz(sizeof(MicroDriveState)); +MicroDriveState *md; +md = DO_UPCAST(MicroDriveState, card, state); + md->card.state = md; md->card.attach = dscm1_attach; md->card.detach = dscm1_detach; md->card.cis = dscm1_cis; md->card.cis_len = sizeof(dscm1_cis); -ide_init2_with_non_qdev_drives(&md->bus, bdrv, NULL, - qemu_allocate_irqs(md_set_irq, md, 1)[0]); -md->bus.ifs[0].drive_kind = IDE_CFATA; -md->bus.ifs[0].mdata_size = METADATA_SIZE; -md->bus.ifs[0].mdata_storage = (uint8_t *) qemu_mallocz(METADATA_SIZE); +ide_bus_new(&md->bus, &state->dev, 0); +qdev_init_gpio_in(&state->dev, md_set_irq, 1); +ide_init2(&md->bus, qdev_get_gpio_in(&state->dev, 0)); -vmstate_register(NULL, -1, &vmstate_microdrive, md); +return 0; +} -return &md->card; +static PCMCIACardInfo dscm1_info = { +.qdev.name = "dscm1", +.qdev.desc = "QEMU CF MicroDrive emulation", +.init = dscm1_initfn, +.qdev.size = sizeof(MicroDriveState), +.qdev.vmsd = &vmstate_microdrive, +}; + +static void dscm1_register(void) +{ +pcmcia_card_register(&dscm1_info); } +device_init(dscm1_register); diff --git a/hw/pcmcia.h b/hw/pcmcia.h index 561d86c..c6b8100 100644 --- a/hw/pcmcia.h +++ b/hw/pcmcia.h @@ -64,4 +64,4 @@ void pcmcia_card_register(PCMCIACardInfo *info); DeviceState *pxa2xx_pcmcia_init(target_phys_addr_t base, uint8_t id); /* dscm1.c */ -PCMCIACardState *dscm1_init(DriveInfo *bdrv); +PCMCIACardState *dscm1_init(PCMCIASocket *socket, DriveInfo *bdrv); diff --git a/hw/spitz.c b/hw/spitz.c index ce19b5a..51cc08c 100644 --- a/hw/spitz.c +++ b/hw/spitz.c @@ -714,7 +714,10 @@ static void spitz_microdrive_attach(PXA2xxState *cpu, int slot) return; bs = dinfo->bdrv; if (bdrv_is_inserted(bs) && !bdrv_is_removable(bs)) { -md = dscm1_init(dinfo); +md = dscm1_init( +DO_UPCAST(PCMCIASocket, qbus, +qdev_get_child_bus(cpu->pcmcia[slot], "pcmcia")), +dinfo); pxa2xx_pcmcia_attach(cpu->pcmcia[slot], md); } } diff --git a/hw/tosa.c b/hw/tosa.c index 577b59f..f00555b 100644 --- a/hw/tosa.c +++ b/hw/tosa.c @@ -59,7 +59,10 @@ static void tosa_microdrive_attach(PXA2xxState *cpu) return; bs = dinfo->bdrv; if (bdrv_is_inserted(bs) && !bdrv_is_removable(bs)) { -md = dscm1_init(dinfo); +md = dscm1_init( +DO_UPCAST(PCMCIASocket, qbus, +qdev_get_child_bus(cpu->pcmcia[0], "pcmcia")), +dinfo); pxa2xx_pcmcia_attach(cpu->pcmcia[0], md); } } -- 1.7.4.1
[Qemu-devel] [RESEND][PATCH 2/9] PCMCIA: start qdev'ication
Convert PCMCIA bus handling code to use QBus internally. MicroDrive code is still unaffected. Signed-off-by: Dmitry Eremin-Solenikov --- Makefile.objs |3 ++ hw/pcmcia.c| 102 hw/pcmcia.h| 15 +++- hw/pxa2xx_pcmcia.c |2 +- vl.c | 43 -- 5 files changed, 120 insertions(+), 45 deletions(-) create mode 100644 hw/pcmcia.c diff --git a/Makefile.objs b/Makefile.objs index 44ce368..153a148 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -289,6 +289,9 @@ hw-obj-$(CONFIG_REALLY_VIRTFS) += virtio-9p-debug.o hw-obj-$(CONFIG_VIRTFS) += virtio-9p-local.o virtio-9p-xattr.o hw-obj-$(CONFIG_VIRTFS) += virtio-9p-xattr-user.o virtio-9p-posix-acl.o +# PCMCIA +hw-obj-y += pcmcia.o + ## # libdis # NOTE: the disassembler code is only needed for debugging diff --git a/hw/pcmcia.c b/hw/pcmcia.c new file mode 100644 index 000..17a49b6 --- /dev/null +++ b/hw/pcmcia.c @@ -0,0 +1,102 @@ +/* + * QEMU System Emulator + * PCMCIA subsystem + * + * Copyright (c) 2003-2008 Fabrice Bellard + * Copyright (c) 2011 Dmitry Eremin-Solenikov + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#include "hw.h" +#include "pcmcia.h" +#include "monitor.h" + +/***/ +/* PCMCIA/Cardbus */ + +static struct pcmcia_socket_entry_s { +PCMCIASocket *socket; +struct pcmcia_socket_entry_s *next; +} *pcmcia_sockets = 0; + +static BusInfo pcmcia_bus_info = { +.name = "PCMCIA", +.size = sizeof(PCMCIASocket), +}; + +void pcmcia_socket_register(PCMCIASocket *socket, DeviceState *parent) +{ +struct pcmcia_socket_entry_s *entry; + +qbus_create_inplace(&socket->qbus, &pcmcia_bus_info, +parent, "pcmcia"); + +entry = qemu_malloc(sizeof(struct pcmcia_socket_entry_s)); +entry->socket = socket; +entry->next = pcmcia_sockets; +pcmcia_sockets = entry; +} + +void pcmcia_socket_unregister(PCMCIASocket *socket) +{ +struct pcmcia_socket_entry_s *entry, **ptr; + +ptr = &pcmcia_sockets; +for (entry = *ptr; entry; ptr = &entry->next, entry = *ptr) +if (entry->socket == socket) { +*ptr = entry->next; +qemu_free(entry); +} + +qbus_free(&socket->qbus); +} + +void pcmcia_info(Monitor *mon) +{ +struct pcmcia_socket_entry_s *iter; + +if (!pcmcia_sockets) { +monitor_printf(mon, "No PCMCIA sockets\n"); +} + +for (iter = pcmcia_sockets; iter; iter = iter->next) { +monitor_printf(mon, "%s: %s\n", iter->socket->slot_string, + iter->socket->attached ? iter->socket->card_string : + "Empty"); +} +} + +static int pcmcia_device_init(DeviceState *dev, DeviceInfo *info) +{ +PCMCIACardState *state = DO_UPCAST(PCMCIACardState, dev, dev); +PCMCIACardInfo *pinfo = DO_UPCAST(PCMCIACardInfo, qdev, info); +int rc; + +state->info = pinfo; +rc = pinfo->init(state); +return rc; +} + +void pcmcia_card_register(PCMCIACardInfo *info) +{ +info->qdev.init = pcmcia_device_init; +info->qdev.bus_info = &pcmcia_bus_info; +assert(info->qdev.size >= sizeof(PCMCIACardState)); +qdev_register(&info->qdev); +} diff --git a/hw/pcmcia.h b/hw/pcmcia.h index f0b16b8..561d86c 100644 --- a/hw/pcmcia.h +++ b/hw/pcmcia.h @@ -1,19 +1,30 @@ /* PCMCIA/Cardbus */ #include "qemu-common.h" +#include "qdev.h" typedef struct { +BusState qbus; qemu_irq irq; int attached; const char *slot_string; const char *card_string; } PCMCIASocket; -void pcmcia_socket_register(PCMCIASocket *socket); +void pcmcia_socket_register(PCMCIASocket *socket, DeviceState *parent); void pcmcia_socket_unregister(PCMCIASocket *socket); void pcmcia_info(Monitor *mon); +typedef struct PCMCIACardInf
[Qemu-devel] [RESEND][PATCH 1/9] pxa2xx_pcmcia: qdevify
Use qdev insfrastructure for managing PXA PCMCIA devices. PCMCIA bus itself isn't converted to QBus (yet). pxa2xx_pcmcia_init() function is moved to pcmcia.h as it will be used by other cores/devices (like StrongARM). Signed-off-by: Dmitry Eremin-Solenikov --- hw/mainstone.c | 14 + hw/pcmcia.h|3 ++ hw/pxa.h |5 +--- hw/pxa2xx.c|9 +++--- hw/pxa2xx_pcmcia.c | 77 +-- hw/spitz.c | 20 - hw/tosa.c | 12 7 files changed, 91 insertions(+), 49 deletions(-) diff --git a/hw/mainstone.c b/hw/mainstone.c index 4792f0e..11de723 100644 --- a/hw/mainstone.c +++ b/hw/mainstone.c @@ -148,12 +148,14 @@ static void mainstone_common_init(ram_addr_t ram_size, /* MMC/SD host */ pxa2xx_mmci_handlers(cpu->mmc, NULL, qdev_get_gpio_in(mst_irq, MMC_IRQ)); -pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[0], -qdev_get_gpio_in(mst_irq, S0_IRQ), -qdev_get_gpio_in(mst_irq, S0_CD_IRQ)); -pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[1], -qdev_get_gpio_in(mst_irq, S1_IRQ), -qdev_get_gpio_in(mst_irq, S1_CD_IRQ)); +sysbus_connect_irq(sysbus_from_qdev(cpu->pcmcia[0]), 0, +qdev_get_gpio_in(mst_irq, S0_IRQ)); +sysbus_connect_irq(sysbus_from_qdev(cpu->pcmcia[0]), 1, +qdev_get_gpio_in(mst_irq, S0_CD_IRQ)); +sysbus_connect_irq(sysbus_from_qdev(cpu->pcmcia[1]), 0, +qdev_get_gpio_in(mst_irq, S1_IRQ)); +sysbus_connect_irq(sysbus_from_qdev(cpu->pcmcia[1]), 1, +qdev_get_gpio_in(mst_irq, S1_CD_IRQ)); smc91c111_init(&nd_table[0], MST_ETH_PHYS, qdev_get_gpio_in(mst_irq, ETHERNET_IRQ)); diff --git a/hw/pcmcia.h b/hw/pcmcia.h index 50648c9..f0b16b8 100644 --- a/hw/pcmcia.h +++ b/hw/pcmcia.h @@ -47,5 +47,8 @@ struct PCMCIACardState { #define CISTPL_END 0xff/* Tuple End */ #define CISTPL_ENDMARK 0xff +/* pxa2xx_pcmcia.h -- used also for StrongARM */ +DeviceState *pxa2xx_pcmcia_init(target_phys_addr_t base, uint8_t id); + /* dscm1.c */ PCMCIACardState *dscm1_init(DriveInfo *bdrv); diff --git a/hw/pxa.h b/hw/pxa.h index d982f00..25176ef 100644 --- a/hw/pxa.h +++ b/hw/pxa.h @@ -90,11 +90,8 @@ void pxa2xx_mmci_handlers(PXA2xxMMCIState *s, qemu_irq readonly, qemu_irq coverswitch); /* pxa2xx_pcmcia.c */ -typedef struct PXA2xxPCMCIAState PXA2xxPCMCIAState; -PXA2xxPCMCIAState *pxa2xx_pcmcia_init(target_phys_addr_t base); int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card); int pxa2xx_pcmcia_dettach(void *opaque); -void pxa2xx_pcmcia_set_irq_cb(void *opaque, qemu_irq irq, qemu_irq cd_irq); /* pxa2xx_keypad.c */ struct keymap { @@ -126,7 +123,7 @@ typedef struct { SSIBus **ssp; PXA2xxI2CState *i2c[2]; PXA2xxMMCIState *mmc; -PXA2xxPCMCIAState *pcmcia[2]; +DeviceState *pcmcia[2]; PXA2xxI2SState *i2s; PXA2xxFIrState *fir; PXA2xxKeyPadState *kp; diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c index ac5d95d..6ae8c8c 100644 --- a/hw/pxa2xx.c +++ b/hw/pxa2xx.c @@ -13,6 +13,7 @@ #include "pc.h" #include "i2c.h" #include "ssi.h" +#include "pcmcia.h" #include "qemu-char.h" #include "blockdev.h" @@ -2175,8 +2176,8 @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision) qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); } -s->pcmcia[0] = pxa2xx_pcmcia_init(0x2000); -s->pcmcia[1] = pxa2xx_pcmcia_init(0x3000); +s->pcmcia[0] = pxa2xx_pcmcia_init(0x2000, 0); +s->pcmcia[1] = pxa2xx_pcmcia_init(0x3000, 1); sysbus_create_simple("pxa2xx_rtc", 0x4090, qdev_get_gpio_in(s->pic, PXA2XX_PIC_RTCALARM)); @@ -2311,8 +2312,8 @@ PXA2xxState *pxa255_init(unsigned int sdram_size) qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); } -s->pcmcia[0] = pxa2xx_pcmcia_init(0x2000); -s->pcmcia[1] = pxa2xx_pcmcia_init(0x3000); +s->pcmcia[0] = pxa2xx_pcmcia_init(0x2000, 0); +s->pcmcia[1] = pxa2xx_pcmcia_init(0x3000, 1); sysbus_create_simple("pxa2xx_rtc", 0x4090, qdev_get_gpio_in(s->pic, PXA2XX_PIC_RTCALARM)); diff --git a/hw/pxa2xx_pcmcia.c b/hw/pxa2xx_pcmcia.c index 50d4649..3d93829 100644 --- a/hw/pxa2xx_pcmcia.c +++ b/hw/pxa2xx_pcmcia.c @@ -9,15 +9,19 @@ #include "hw.h" #include "pcmcia.h" +#include "sysbus.h" #include "pxa.h" -struct PXA2xxPCMCIAState { +typedef struct PXA2xxPCMCIAState { +SysBusDevice busdev; + +uint8_t id; PCMCIASocket slot; PCMCIACardState *card; qemu_irq irq; qemu_irq cd_irq; -}; +} PXA2xxPCMCIAState; static uint32_t pxa2xx_pcmcia_common_read(void *opaque, target_phys_addr_t offset) @@ -130,39 +134,61 @@ static void pxa2xx_pcmcia_set_irq(void *opaque, int line, int level) qemu_set_irq(s->irq, level)
[Qemu-devel] [RESEND][PATCH 5/9] pcmcia: move attach and detach socket methods to PCMCIASocket
Make attach and detach calls to be automatically called by PCMCIA card instantiation code, rather than calling them by hand from the board code. Signed-off-by: Dmitry Eremin-Solenikov --- hw/pcmcia.c| 45 +++- hw/pcmcia.h|2 + hw/pxa.h |4 --- hw/pxa2xx_pcmcia.c | 73 +++ hw/spitz.c |1 - hw/tosa.c |1 - 6 files changed, 79 insertions(+), 47 deletions(-) diff --git a/hw/pcmcia.c b/hw/pcmcia.c index 17a49b6..d661663 100644 --- a/hw/pcmcia.c +++ b/hw/pcmcia.c @@ -86,16 +86,59 @@ static int pcmcia_device_init(DeviceState *dev, DeviceInfo *info) { PCMCIACardState *state = DO_UPCAST(PCMCIACardState, dev, dev); PCMCIACardInfo *pinfo = DO_UPCAST(PCMCIACardInfo, qdev, info); +PCMCIASocket *socket = DO_UPCAST(PCMCIASocket, qbus, dev->parent_bus); int rc; +if (socket->attached) { +return -1; +} + state->info = pinfo; rc = pinfo->init(state); -return rc; +if (rc) { +return rc; +} + +socket->attached = 1; +state->slot = socket; + +rc = socket->attach(socket, state); +if (rc) { +return rc; +} + +rc = state->info->attach(state); +if (rc) { +socket->detach(socket); +return rc; +} + +return 0; +} + +static int pcmcia_device_exit(DeviceState *dev) +{ +PCMCIACardState *state = DO_UPCAST(PCMCIACardState, dev, dev); +PCMCIASocket *socket = DO_UPCAST(PCMCIASocket, qbus, dev->parent_bus); + +if (!socket->attached) { +return -ENOENT; +} + +state->info->detach(state); +state->slot = NULL; + +socket->detach(socket); + +socket->attached = 0; + +return 0; } void pcmcia_card_register(PCMCIACardInfo *info) { info->qdev.init = pcmcia_device_init; +info->qdev.exit = pcmcia_device_exit; info->qdev.bus_info = &pcmcia_bus_info; assert(info->qdev.size >= sizeof(PCMCIACardState)); qdev_register(&info->qdev); diff --git a/hw/pcmcia.h b/hw/pcmcia.h index 2c012d9..4f90af7 100644 --- a/hw/pcmcia.h +++ b/hw/pcmcia.h @@ -11,6 +11,8 @@ struct PCMCIASocket { int attached; const char *slot_string; const char *card_string; +int (*attach)(PCMCIASocket *socket, PCMCIACardState *card); +int (*detach)(PCMCIASocket *socket); }; void pcmcia_socket_register(PCMCIASocket *socket, DeviceState *parent); diff --git a/hw/pxa.h b/hw/pxa.h index 25176ef..c145029 100644 --- a/hw/pxa.h +++ b/hw/pxa.h @@ -89,10 +89,6 @@ PXA2xxMMCIState *pxa2xx_mmci_init(target_phys_addr_t base, void pxa2xx_mmci_handlers(PXA2xxMMCIState *s, qemu_irq readonly, qemu_irq coverswitch); -/* pxa2xx_pcmcia.c */ -int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card); -int pxa2xx_pcmcia_dettach(void *opaque); - /* pxa2xx_keypad.c */ struct keymap { int column; diff --git a/hw/pxa2xx_pcmcia.c b/hw/pxa2xx_pcmcia.c index ae7d01a..efd4c09 100644 --- a/hw/pxa2xx_pcmcia.c +++ b/hw/pxa2xx_pcmcia.c @@ -150,6 +150,37 @@ DeviceState *pxa2xx_pcmcia_init(target_phys_addr_t base, uint8_t id) return &dev->qdev; } +/* Insert a new card into a slot */ +static int pxa2xx_pcmcia_attach(PCMCIASocket *socket, PCMCIACardState *card) +{ +PXA2xxPCMCIAState *s = container_of(socket, PXA2xxPCMCIAState, slot); + +if (s->cd_irq) { +qemu_irq_raise(s->cd_irq); +} + +s->card = card; + +return 0; +} + +/* Eject card from the slot */ +static int pxa2xx_pcmcia_detach(PCMCIASocket *socket) +{ +PXA2xxPCMCIAState *s = container_of(socket, PXA2xxPCMCIAState, slot); + +s->card = NULL; + +if (s->irq) { +qemu_irq_lower(s->irq); +} +if (s->cd_irq) { +qemu_irq_lower(s->cd_irq); +} + +return 0; +} + static int pxa2xx_pcmcia_initfn(SysBusDevice *dev) { int iomemtype; @@ -186,48 +217,10 @@ static int pxa2xx_pcmcia_initfn(SysBusDevice *dev) snprintf(str, 256, "PXA PC Card Socket %d", s->id); s->slot.slot_string = str; +s->slot.attach = pxa2xx_pcmcia_attach; +s->slot.detach = pxa2xx_pcmcia_detach; s->slot.irq = qemu_allocate_irqs(pxa2xx_pcmcia_set_irq, s, 1)[0]; pcmcia_socket_register(&s->slot, &s->busdev.qdev); -return 0; -} - -/* Insert a new card into a slot */ -int pxa2xx_pcmcia_attach(void *opaque, PCMCIACardState *card) -{ -PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque; -if (s->slot.attached) -return -EEXIST; - -if (s->cd_irq) { -qemu_irq_raise(s->cd_irq); -} - -s->card = card; - -s->slot.attached = 1; -s->card->slot = &s->slot; -s->card->info->attach(s->card); - -return 0; -} - -/* Eject card from the slot */ -int pxa2xx_pcmcia_dettach(void *opaque) -{ -PXA2xxPCMCIAState *s = (PXA2xxPCMCIAState *) opaque; -if (!s->slot.attached) -return -ENOENT; - -s->card->info->detach(s->card); -s->card->slot = NULL; -s->card = NULL; - -s->
[Qemu-devel] [RESEND][PATCH 6/9] pxa: change order of pcmcia devices instantiation, so that the socket 0 will be default
Signed-off-by: Dmitry Eremin-Solenikov --- hw/pxa2xx.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c index 6ae8c8c..dc44864 100644 --- a/hw/pxa2xx.c +++ b/hw/pxa2xx.c @@ -2176,8 +2176,8 @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision) qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); } -s->pcmcia[0] = pxa2xx_pcmcia_init(0x2000, 0); s->pcmcia[1] = pxa2xx_pcmcia_init(0x3000, 1); +s->pcmcia[0] = pxa2xx_pcmcia_init(0x2000, 0); sysbus_create_simple("pxa2xx_rtc", 0x4090, qdev_get_gpio_in(s->pic, PXA2XX_PIC_RTCALARM)); @@ -2312,8 +2312,8 @@ PXA2xxState *pxa255_init(unsigned int sdram_size) qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); } -s->pcmcia[0] = pxa2xx_pcmcia_init(0x2000, 0); s->pcmcia[1] = pxa2xx_pcmcia_init(0x3000, 1); +s->pcmcia[0] = pxa2xx_pcmcia_init(0x2000, 0); sysbus_create_simple("pxa2xx_rtc", 0x4090, qdev_get_gpio_in(s->pic, PXA2XX_PIC_RTCALARM)); -- 1.7.4.1
[Qemu-devel] [RESEND][PATCH 4/9] pcmcia: move all card callbacks to PCMCIACardInfo
Signed-off-by: Dmitry Eremin-Solenikov last commit fixup Signed-off-by: Dmitry Eremin-Solenikov Revert "microdrive fixup" This reverts commit 6a9f969b0626e218ff910d84ed1c9eec285cbcd5. Signed-off-by: Dmitry Eremin-Solenikov --- hw/ide/microdrive.c | 41 - hw/pcmcia.h | 29 +++-- hw/pxa2xx_pcmcia.c | 16 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c index 7692603..c080943 100644 --- a/hw/ide/microdrive.c +++ b/hw/ide/microdrive.c @@ -112,9 +112,9 @@ static void md_reset(MicroDriveState *s) ide_bus_reset(&s->bus); } -static uint8_t md_attr_read(void *opaque, uint32_t at) +static uint8_t md_attr_read(PCMCIACardState *opaque, uint32_t at) { -MicroDriveState *s = opaque; +MicroDriveState *s = DO_UPCAST(MicroDriveState, card, opaque); if (at < s->attr_base) { if (at < s->card.cis_len) return s->card.cis[at]; @@ -145,9 +145,9 @@ static uint8_t md_attr_read(void *opaque, uint32_t at) return 0; } -static void md_attr_write(void *opaque, uint32_t at, uint8_t value) +static void md_attr_write(PCMCIACardState *opaque, uint32_t at, uint8_t value) { -MicroDriveState *s = opaque; +MicroDriveState *s = DO_UPCAST(MicroDriveState, card, opaque); at -= s->attr_base; switch (at) { @@ -176,9 +176,9 @@ static void md_attr_write(void *opaque, uint32_t at, uint8_t value) } } -static uint16_t md_common_read(void *opaque, uint32_t at) +static uint16_t md_common_read(PCMCIACardState *opaque, uint32_t at) { -MicroDriveState *s = opaque; +MicroDriveState *s = DO_UPCAST(MicroDriveState, card, opaque); IDEState *ifs; uint16_t ret; at -= s->io_base; @@ -238,9 +238,9 @@ static uint16_t md_common_read(void *opaque, uint32_t at) return 0; } -static void md_common_write(void *opaque, uint32_t at, uint16_t value) +static void md_common_write(PCMCIACardState *opaque, uint32_t at, uint16_t value) { -MicroDriveState *s = opaque; +MicroDriveState *s = DO_UPCAST(MicroDriveState, card, opaque); at -= s->io_base; switch (s->opt & OPT_MODE) { @@ -502,15 +502,9 @@ static const uint8_t dscm1_cis[0x14a] = { [0x146] = CISTPL_END, /* Tuple End */ }; -static int dscm1_attach(void *opaque) +static int dscm1_attach(PCMCIACardState *opaque) { -MicroDriveState *md = opaque; -md->card.attr_read = md_attr_read; -md->card.attr_write = md_attr_write; -md->card.common_read = md_common_read; -md->card.common_write = md_common_write; -md->card.io_read = md_common_read; -md->card.io_write = md_common_write; +MicroDriveState *md = DO_UPCAST(MicroDriveState, card, opaque); md->attr_base = md->card.cis[0x74] | (md->card.cis[0x76] << 8); md->io_base = 0x0; @@ -522,9 +516,9 @@ static int dscm1_attach(void *opaque) return 0; } -static int dscm1_detach(void *opaque) +static int dscm1_detach(PCMCIACardState *opaque) { -MicroDriveState *md = opaque; +MicroDriveState *md = DO_UPCAST(MicroDriveState, card, opaque); md_reset(md); return 0; } @@ -551,9 +545,6 @@ static int dscm1_initfn(PCMCIACardState *state) MicroDriveState *md; md = DO_UPCAST(MicroDriveState, card, state); -md->card.state = md; -md->card.attach = dscm1_attach; -md->card.detach = dscm1_detach; md->card.cis = dscm1_cis; md->card.cis_len = sizeof(dscm1_cis); @@ -570,6 +561,14 @@ static PCMCIACardInfo dscm1_info = { .init = dscm1_initfn, .qdev.size = sizeof(MicroDriveState), .qdev.vmsd = &vmstate_microdrive, +.attach = dscm1_attach, +.detach = dscm1_detach, +.attr_read = md_attr_read, +.attr_write = md_attr_write, +.common_read= md_common_read, +.common_write = md_common_write, +.io_read= md_common_read, +.io_write = md_common_write, }; static void dscm1_register(void) diff --git a/hw/pcmcia.h b/hw/pcmcia.h index c6b8100..2c012d9 100644 --- a/hw/pcmcia.h +++ b/hw/pcmcia.h @@ -3,13 +3,15 @@ #include "qemu-common.h" #include "qdev.h" -typedef struct { +typedef struct PCMCIASocket PCMCIASocket; + +struct PCMCIASocket { BusState qbus; qemu_irq irq; int attached; const char *slot_string; const char *card_string; -} PCMCIASocket; +}; void pcmcia_socket_register(PCMCIASocket *socket, DeviceState *parent); void pcmcia_socket_unregister(PCMCIASocket *socket); @@ -19,26 +21,25 @@ typedef struct PCMCIACardInfo { DeviceInfo qdev; int (*init)(PCMCIACardState *state); + +int (*attach)(PCMCIACardState *state); +int (*detach)(PCMCIACardState *state); + +/* Only valid if attached */ +uint8_t (*attr_read)(PCMCIACardState *state, uint32_t address); +void (*attr_write)(PCMCIACardS
[Qemu-devel] [RESEND][PATCH 7/9] ide-core: allocate metadata storage for CFATA drives
Currently it's done by hw/ide/microdrive.c To simplify that part, move this initialization to ide core. Signed-off-by: Dmitry Eremin-Solenikov --- hw/ide/core.c |4 hw/ide/internal.h |2 ++ hw/ide/microdrive.c |6 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index f028ddb..16e6f67 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2682,6 +2682,10 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs, return -1; } } +if (s->drive_kind == IDE_CFATA) { +s->mdata_size = CFA_METADATA_SIZE; +s->mdata_storage = qemu_mallocz(CFA_METADATA_SIZE); +} if (serial) { strncpy(s->drive_serial_str, serial, sizeof(s->drive_serial_str)); } else { diff --git a/hw/ide/internal.h b/hw/ide/internal.h index ba7e9a8..769de90 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -364,6 +364,8 @@ typedef struct IDEDMAOps IDEDMAOps; #define SMART_DISABLE 0xd9 #define SMART_STATUS 0xda +#define CFA_METADATA_SIZE 0x20 + typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind; typedef void EndTransferFunc(IDEState *); diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c index c080943..13459a0 100644 --- a/hw/ide/microdrive.c +++ b/hw/ide/microdrive.c @@ -34,8 +34,6 @@ /***/ /* CF-ATA Microdrive */ -#define METADATA_SIZE 0x20 - /* DSCM-1 Microdrive hard disk with CF+ II / PCMCIA interface. */ typedef struct { PCMCIACardState card; @@ -533,9 +531,6 @@ PCMCIACardState *dscm1_init(PCMCIASocket *socket, DriveInfo *bdrv) md = DO_UPCAST(MicroDriveState, card.dev, dev); ide_create_drive(&md->bus, 0, bdrv); -md->bus.ifs[0].drive_kind = IDE_CFATA; -md->bus.ifs[0].mdata_size = METADATA_SIZE; -md->bus.ifs[0].mdata_storage = (uint8_t *) qemu_mallocz(METADATA_SIZE); return &md->card; } @@ -552,6 +547,7 @@ static int dscm1_initfn(PCMCIACardState *state) qdev_init_gpio_in(&state->dev, md_set_irq, 1); ide_init2(&md->bus, qdev_get_gpio_in(&state->dev, 0)); +md->bus.ifs[0].drive_kind = IDE_CFATA; return 0; } -- 1.7.4.1
[Qemu-devel] [RESEND][PATCH 9/9] collie: add support for PCMCIA bus
Signed-off-by: Dmitry Eremin-Solenikov --- hw/collie.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/hw/collie.c b/hw/collie.c index 156404d..89d37f7 100644 --- a/hw/collie.c +++ b/hw/collie.c @@ -14,6 +14,9 @@ #include "flash.h" #include "blockdev.h" +#define COLLIE_GPIO_CF_IRQ (14) +#define COLLIE_GPIO_CF_CD (22) + static struct arm_boot_info collie_binfo = { .loader_start = SA_SDCS0, .ram_size = 0x2000, @@ -47,6 +50,10 @@ static void collie_init(ram_addr_t ram_size, 512, 4, 0x00, 0x00, 0x00, 0x00, 0); sysbus_create_simple("scoop", 0x4080, NULL); +sysbus_connect_irq(sysbus_from_qdev(s->pcmcia[0]), 0, +qdev_get_gpio_in(s->gpio, COLLIE_GPIO_CF_IRQ)); +sysbus_connect_irq(sysbus_from_qdev(s->pcmcia[0]), 1, +qdev_get_gpio_in(s->gpio, COLLIE_GPIO_CF_CD)); collie_binfo.kernel_filename = kernel_filename; collie_binfo.kernel_cmdline = kernel_cmdline; -- 1.7.4.1
[Qemu-devel] [RESEND][PATCH 8/9] strongarm: add PCMCIA support
Add PCMCIA support to StrongARM SoCs reusing PXA devices. Signed-off-by: Dmitry Eremin-Solenikov --- hw/strongarm.c |5 - hw/strongarm.h |1 + 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/hw/strongarm.c b/hw/strongarm.c index de08bdf..dbc253c 100644 --- a/hw/strongarm.c +++ b/hw/strongarm.c @@ -29,6 +29,7 @@ #include "arm-misc.h" #include "sysemu.h" #include "ssi.h" +#include "pcmcia.h" //#define DEBUG @@ -40,7 +41,6 @@ - Implement sleep mode/Wake sources - Implement reset control - Implement memory control regs - - PCMCIA handling - Maybe support MBGNT/MBREQ - DMA channels - GPCLK @@ -1583,6 +1583,9 @@ StrongARMState *sa1110_init(unsigned int sdram_size, const char *rev) qdev_get_gpio_in(s->pic, SA_PIC_SSP), NULL); s->ssp_bus = (SSIBus *)qdev_get_child_bus(s->ssp, "ssi"); +s->pcmcia[1] = pxa2xx_pcmcia_init(0x3000, 1); +s->pcmcia[0] = pxa2xx_pcmcia_init(0x2000, 0); + return s; } diff --git a/hw/strongarm.h b/hw/strongarm.h index a81b110..d1ce538 100644 --- a/hw/strongarm.h +++ b/hw/strongarm.h @@ -57,6 +57,7 @@ typedef struct { DeviceState *ppc; DeviceState *ssp; SSIBus *ssp_bus; +DeviceState *pcmcia[2]; } StrongARMState; StrongARMState *sa1110_init(unsigned int sdram_size, const char *rev); -- 1.7.4.1
Re: [Qemu-devel] virtfs error reporting?
On Monday 25 April 2011 1:01:38 am Rob Landley wrote: > So on the host side I'm trying to do this: > > $ qemu -cpu pentium3 -nographic -no-reboot -kernel bzImage \ > -hda hda.sqf -append 'root=/dev/hda rw init=/sbin/init.sh panic=1 \ > PATH=/bin:/sbin console=ttyS0 HOST=i686 ' -net nic,model=e1000 \ > -net user -virtfs > local,path=../root-filesystem-i686,security_model=mapped,mount_tag=root > > And on the guest side I'm trying to do this: > > mount -t 9p -o ro,trans=virtio,version=9p2000.L root /mnt > > And it's saying: > > mount: mounting root on /mnt failed: No such device > > No idea what I'm doing wrong, "no such device" is not an informative > error message. > > There's no obvious way to get the Linux client to tell me what tags > are available. "What can I mount? Do you see anything?" I've > looked under /proc and /sys for "virtio"... It's entirely possible > I'm missing something in my kernel .config but who knows what? You can get available tags from /sys/devices/virtio-pci/virtio*/mount_tag > > I note that qemu was sitting down and SULKING unless I specified the > security_model (I'm mounting read only, I don't care, but there > doesn't seem to be any way to DO a read-only export). I'm guessing > based on the fact it stopped complaining that it is in fact exporting > something (and thus not upset I gave it a relative path, although giving > it an absolute path made no difference...) > > Any clues? > > Rob M. Mohan Kumar
[Qemu-devel] [Bug 770173] [NEW] /etc/qemu-ifup is not executed
Public bug reported: The following does not work: $ qemu -m 512 -drive file=arch_min.qcow2,if=virtio,boot=on -nographic -net nic,model=virtio -net tap,script=/etc/qemu-ifup warning: could not configure /dev/net/tun: no virtual network emulation However, this works: $ /etc/qemu-ifup tap0 $ kvm -m 512 -drive file=arch_min.qcow2,if=virtio,boot=on -nographic -net nic,model=virtio -net tap,ifname=tap0,script=no,downscript=no $ /etc/qemu-ifdown tap0 Other info: - qemu 0.12.5 - ubuntu 10.10 $ ls -l /etc/qemu-ifup lrwxrwxrwx 1 root root 18 2011-03-26 15:57 /etc/qemu-ifup -> /usr/bin/qemu-ifup* $ cat /etc/qemu-ifup #!/bin/sh #switch=$(/sbin/ip route list | awk '/^default / { print $5 }') #/sbin/ifconfig $1 0.0.0.0 up #/usr/sbin/brctl addif ${switch} $1 set -x switch=br0 if [ -n "$1" ];then /usr/bin/sudo /etc/qemu-ifup-sudo $1 `whoami` exit 0 else echo "Error: no interface specified" exit 1 fi $ cat /etc/qemu-ifup-sudo #!/bin/sh set -x switch=br0 /usr/sbin/tunctl -u $2 -t $1 /usr/bin/sudo /sbin/ip link set $1 up sleep 0.5s /usr/bin/sudo /usr/sbin/brctl addif $switch $1 ** Affects: qemu Importance: Undecided Status: New -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/770173 Title: /etc/qemu-ifup is not executed Status in QEMU: New Bug description: The following does not work: $ qemu -m 512 -drive file=arch_min.qcow2,if=virtio,boot=on -nographic -net nic,model=virtio -net tap,script=/etc/qemu-ifup warning: could not configure /dev/net/tun: no virtual network emulation However, this works: $ /etc/qemu-ifup tap0 $ kvm -m 512 -drive file=arch_min.qcow2,if=virtio,boot=on -nographic -net nic,model=virtio -net tap,ifname=tap0,script=no,downscript=no $ /etc/qemu-ifdown tap0 Other info: - qemu 0.12.5 - ubuntu 10.10 $ ls -l /etc/qemu-ifup lrwxrwxrwx 1 root root 18 2011-03-26 15:57 /etc/qemu-ifup -> /usr/bin/qemu-ifup* $ cat /etc/qemu-ifup #!/bin/sh #switch=$(/sbin/ip route list | awk '/^default / { print $5 }') #/sbin/ifconfig $1 0.0.0.0 up #/usr/sbin/brctl addif ${switch} $1 set -x switch=br0 if [ -n "$1" ];then /usr/bin/sudo /etc/qemu-ifup-sudo $1 `whoami` exit 0 else echo "Error: no interface specified" exit 1 fi $ cat /etc/qemu-ifup-sudo #!/bin/sh set -x switch=br0 /usr/sbin/tunctl -u $2 -t $1 /usr/bin/sudo /sbin/ip link set $1 up sleep 0.5s /usr/bin/sudo /usr/sbin/brctl addif $switch $1
Re: [Qemu-devel] [PATCH] char: Allow devices to use a single multiplexed chardev.
On (Fri) 22 Apr 2011 [21:59:42], Kusanagi Kouichi wrote: > This fixes regression caused by commit > 2d6c1ef40f3678ab47a4d14fb5dadaa486bfcda6 > ("char: Prevent multiple devices opening same chardev"). What's the regression? How do I test it? > Signed-off-by: Kusanagi Kouichi > --- > hw/qdev-properties.c |4 ++-- > qemu-char.c |5 - > qemu-char.h |2 +- > 3 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c > index 1088a26..0eed712 100644 > --- a/hw/qdev-properties.c > +++ b/hw/qdev-properties.c > @@ -354,10 +354,10 @@ static int parse_chr(DeviceState *dev, Property *prop, > const char *str) > if (*ptr == NULL) { > return -ENOENT; > } > -if ((*ptr)->assigned) { > +if ((*ptr)->avail < 1) { > return -EEXIST; > } > -(*ptr)->assigned = 1; > +--(*ptr)->avail; > return 0; > } > > diff --git a/qemu-char.c b/qemu-char.c > index 03858d4..f08f2b8 100644 > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -199,7 +199,7 @@ void qemu_chr_add_handlers(CharDriverState *s, > { > if (!opaque) { > /* chr driver being released. */ > -s->assigned = 0; > +++s->avail; > } Will just checking for handlers (fd_can_read, fd_read, fd_write not NULL) here help instead of this patch? > s->chr_can_read = fd_can_read; > s->chr_read = fd_read; > @@ -2544,7 +2544,10 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts, > snprintf(base->label, len, "%s-base", qemu_opts_id(opts)); > chr = qemu_chr_open_mux(base); > chr->filename = base->filename; > +chr->avail = MAX_MUX; > QTAILQ_INSERT_TAIL(&chardevs, chr, next); > +} else { > +chr->avail = 1; > } > chr->label = qemu_strdup(qemu_opts_id(opts)); > return chr; > diff --git a/qemu-char.h b/qemu-char.h > index fb96eef..ebf3641 100644 > --- a/qemu-char.h > +++ b/qemu-char.h > @@ -70,7 +70,7 @@ struct CharDriverState { > char *label; > char *filename; > int opened; > -int assigned; /* chardev assigned to a device */ > +int avail; > QTAILQ_ENTRY(CharDriverState) next; > }; > > -- > 1.7.4.4 > > Amit
Re: [Qemu-devel] [PATCH v2 1/5] ide: Split atapi.c out
On (Wed) 20 Apr 2011 [13:30:11], Kevin Wolf wrote: > Besides moving code, this patch only fixes some whitespace issues in the moved > code and makes all functions in atapi.c static which can be static. > > Signed-off-by: Kevin Wolf > --- > Makefile.objs |2 +- > hw/ide/atapi.c| 1083 > + > hw/ide/core.c | 1065 +--- > hw/ide/internal.h | 14 +- > 4 files changed, 1098 insertions(+), 1066 deletions(-) > create mode 100644 hw/ide/atapi.c > --- /dev/null > +++ b/hw/ide/atapi.c > @@ -0,0 +1,1083 @@ > +/* > + * QEMU ATAPI Emulatoin typo here. > + * Copyright (c) 2003 Fabrice Bellard > + * Copyright (c) 2006 Openedhand Ltd. Could you also add Copyright (C) 2011 Red Hat Inc. Copyright (C) 2011 Amit Shah > + > +static void lba_to_msf(uint8_t *buf, int lba) > +{ > +lba += 150; > +buf[0] = (lba / 75) / 60; > +buf[1] = (lba / 75) % 60; > +buf[2] = lba % 75; > +} > + > +/* XXX: DVDs that could fit on a CD will be reported as a CD */ This comment belongs to the function below. > +static inline int media_present(IDEState *s) > +{ > +return (s->nb_sectors > 0); > +} > + > +static inline int media_is_dvd(IDEState *s) > +{ > +return (media_present(s) && s->nb_sectors > CD_MAX_SECTORS); > +} > + Amit
[Qemu-devel] [PATCH]fix ambiguity in "-d op_opt"
In Ful-system emulation, when we use "-d op_opt",we can not find the pc of guestinstruction in logfile.However,we can get this in log by using command "-d op". It is funny that when we use "-d op,op_opt",we get pc in both op's log and op_opt's log.It makes the command "-d op_opt" ambiguous. wanghuang:ustc Index: target-cris/translate_v10.c === --- target-cris/translate_v10.c (版本 2) +++ target-cris/translate_v10.c (工作副本) @@ -1150,7 +1150,8 @@ if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) tcg_gen_debug_insn_start(dc->pc); - +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) +tcg_gen_debug_insn_start(dc->pc); /* Load a halfword onto the instruction register. */ dc->ir = lduw_code(dc->pc); Index: target-cris/translate.c === --- target-cris/translate.c (版本 2) +++ target-cris/translate.c (工作副本) @@ -3082,7 +3082,8 @@ if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) tcg_gen_debug_insn_start(dc->pc); - +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) +tcg_gen_debug_insn_start(dc->pc); /* Load a halfword onto the instruction register. */ dc->ir = cris_fetch(dc, dc->pc, 2, 0); Index: target-alpha/translate.c === --- target-alpha/translate.c (版本 2) +++ target-alpha/translate.c (工作副本) @@ -3207,6 +3207,8 @@ if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) { tcg_gen_debug_insn_start(ctx.pc); } +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) +tcg_gen_debug_insn_start(ctx.pc); ctx.pc += 4; ret = translate_one(ctxp, insn); Index: target-sparc/translate.c === --- target-sparc/translate.c (版本 2) +++ target-sparc/translate.c (工作副本) @@ -1873,6 +1873,8 @@ if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) tcg_gen_debug_insn_start(dc->pc); +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) +tcg_gen_debug_insn_start(dc->pc); insn = ldl_code(dc->pc); opc = GET_FIELD(insn, 0, 1); Index: target-ppc/translate.c === --- target-ppc/translate.c (版本 2) +++ target-ppc/translate.c (工作副本) @@ -9036,6 +9036,8 @@ opc3(ctx.opcode), little_endian ? "little" : "big"); if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) tcg_gen_debug_insn_start(ctx.nip); +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) +tcg_gen_debug_insn_start(ctx.nip); ctx.nip += 4; table = env->opcodes; num_insns++; Index: target-mips/translate.c === --- target-mips/translate.c (版本 2) +++ target-mips/translate.c (工作副本) @@ -11631,7 +11631,8 @@ if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) tcg_gen_debug_insn_start(ctx->pc); - +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) +tcg_gen_debug_insn_start(ctx->pc); op = MASK_OP_MAJOR(ctx->opcode); rs = (ctx->opcode >> 21) & 0x1f; rt = (ctx->opcode >> 16) & 0x1f; Index: target-arm/translate.c === --- target-arm/translate.c (版本 2) +++ target-arm/translate.c (工作副本) @@ -9204,6 +9204,8 @@ if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) { tcg_gen_debug_insn_start(dc->pc); } +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) +tcg_gen_debug_insn_start(dc->pc); if (dc->thumb) { disas_thumb_insn(env, dc); Index: target-microblaze/translate.c === --- target-microblaze/translate.c (版本 2) +++ target-microblaze/translate.c (工作副本) @@ -1510,7 +1510,8 @@ if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) tcg_gen_debug_insn_start(dc->pc); - +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) +tcg_gen_debug_insn_start(dc->pc); dc->ir = ir = ldl_code(dc->pc); LOG_DIS("%8.8x\t", dc->ir); Index: target-i386/translate.c === --- target-i386/translate.c (版本 2) +++ target-i386/translate.c (工作副本) @@ -4070,6 +4070,8 @@ if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) tcg_gen_debug_insn_start(pc_start); +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) +tcg_gen_debug_insn_start(pc_start); s->pc = pc_start; prefixes = 0; aflag = s->code32;
Re: [Qemu-devel] [PATCH v2 3/5] ide/atapi: Use table instead of switch for commands
On (Wed) 20 Apr 2011 [13:30:13], Kevin Wolf wrote: > Signed-off-by: Kevin Wolf > --- > hw/ide/atapi.c | 115 +++ > 1 files changed, 48 insertions(+), 67 deletions(-) > > diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c > index d161bf7..d0bf7fd 100644 > --- a/hw/ide/atapi.c > +++ b/hw/ide/atapi.c > @@ -533,10 +533,11 @@ static unsigned int event_status_media(IDEState *s, > return 8; /* We wrote to 4 extra bytes from the header */ > } > > -static void handle_get_event_status_notification(IDEState *s, > - uint8_t *buf, > - const uint8_t *packet) > +static void cmd_get_event_status_notification(IDEState *s, > + uint8_t *buf) > { > +const uint8_t *packet = buf; > + Exploiting packet == buf. But do we want to go away from that? Amit
[Qemu-devel] [Bug 770173] Re: /etc/qemu-ifup is not executed
This is not how tap networking works. You have to either pre-configure the tap device before starting qemu, or grant the user ability to create tap devices. Qemu have to open (or create) the tap device BEFORE invoking the script, and if fails to do so due to insufficient privileges, hence the script does not run. This is not a bug. ** Changed in: qemu Status: New => Invalid -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/770173 Title: /etc/qemu-ifup is not executed Status in QEMU: Invalid Bug description: The following does not work: $ qemu -m 512 -drive file=arch_min.qcow2,if=virtio,boot=on -nographic -net nic,model=virtio -net tap,script=/etc/qemu-ifup warning: could not configure /dev/net/tun: no virtual network emulation However, this works: $ /etc/qemu-ifup tap0 $ kvm -m 512 -drive file=arch_min.qcow2,if=virtio,boot=on -nographic -net nic,model=virtio -net tap,ifname=tap0,script=no,downscript=no $ /etc/qemu-ifdown tap0 Other info: - qemu 0.12.5 - ubuntu 10.10 $ ls -l /etc/qemu-ifup lrwxrwxrwx 1 root root 18 2011-03-26 15:57 /etc/qemu-ifup -> /usr/bin/qemu-ifup* $ cat /etc/qemu-ifup #!/bin/sh #switch=$(/sbin/ip route list | awk '/^default / { print $5 }') #/sbin/ifconfig $1 0.0.0.0 up #/usr/sbin/brctl addif ${switch} $1 set -x switch=br0 if [ -n "$1" ];then /usr/bin/sudo /etc/qemu-ifup-sudo $1 `whoami` exit 0 else echo "Error: no interface specified" exit 1 fi $ cat /etc/qemu-ifup-sudo #!/bin/sh set -x switch=br0 /usr/sbin/tunctl -u $2 -t $1 /usr/bin/sudo /sbin/ip link set $1 up sleep 0.5s /usr/bin/sudo /usr/sbin/brctl addif $switch $1
Re: [Qemu-devel] [PATCH v2 5/5] ide/atapi: Introduce CHECK_READY flag for commands
On (Wed) 20 Apr 2011 [13:30:15], Kevin Wolf wrote: > Some commands are supposed to report a Not Ready Conmdition (i.e. they require typo in Condition Amit
Re: [Qemu-devel] [PATCH 0/3] spicevmc -> chardev: restore guest open / close (v2)
On (Thu) 24 Mar 2011 [11:12:01], Hans de Goede wrote: > Hi All, > > When we moved from the spicevmc device (which directly implemented a virtio > serial port) to doing spicevmc as a chardev backend we lost the notification > of the guest opening / closing the port to spice server. This causes the > server to not fall back to server mouse mode when the agent inside the > guest stops / dies (for what ever reason). Which causes the mouse to > stop working in this scenario. This patch set fixes this regression. > > Changes since v1: > -Replace "return qemu_chr_guest_open(vcon->chr);" with just > "qemu_chr_guest_open(vcon->chr);", since this is a void func. idem for close. I've picked this up in the virtio-serial branch; will do a pull request shortly. Amit
Re: [Qemu-devel] [PATCH v2 10/11] trace-state: [stderr] add support for dynamically enabling/disabling events
Stefan Hajnoczi writes: > On Sun, Apr 24, 2011 at 7:24 AM, Paolo Bonzini wrote: >> On 04/23/2011 04:31 PM, Stefan Hajnoczi wrote: >>> >>> For tracing use cases that require performance or runtime >>> enabling/disabling trace events, just use the simple, ust, or dtrace >>> backends. >> >> Having -trace events for the stderr backend would still be nice. > That should be doable without ifdefing and duplicating simpletrace. > The tracer and monitor command parts of simpletrace need to be > separated from common TraceEvent and tracetool generation, which can > be reused by stderr. That's exactly what I thought, but I tried to preserve as much as possible the original patch that was sent to me. But in any case, I'm still not sure if stderr should have programatic tracing state controls. Lluis -- "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth
[Qemu-devel] [PATCH 05/18] vl.c: add deleted flag for deleting the handler.
From: Yoshiaki Tamura Make deleting handlers robust against deletion of any elements in a handler by using a deleted flag like in file descriptors. Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- vl.c | 15 ++- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/vl.c b/vl.c index 68c3b53..a18792d 100644 --- a/vl.c +++ b/vl.c @@ -1096,6 +1096,7 @@ static void nographic_update(void *opaque) struct vm_change_state_entry { VMChangeStateHandler *cb; void *opaque; +int deleted; QLIST_ENTRY (vm_change_state_entry) entries; }; @@ -1116,18 +1117,22 @@ VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, void qemu_del_vm_change_state_handler(VMChangeStateEntry *e) { -QLIST_REMOVE (e, entries); -qemu_free (e); +e->deleted = 1; } void vm_state_notify(int running, int reason) { -VMChangeStateEntry *e; +VMChangeStateEntry *e, *ne; trace_vm_state_notify(running, reason); -for (e = vm_change_state_head.lh_first; e; e = e->entries.le_next) { -e->cb(e->opaque, running, reason); +QLIST_FOREACH_SAFE(e, &vm_change_state_head, entries, ne) { +if (e->deleted) { +QLIST_REMOVE(e, entries); +qemu_free(e); +} else { +e->cb(e->opaque, running, reason); +} } } -- 1.7.0.2
[Qemu-devel] [PATCH 08/18] savevm: introduce util functions to control ft_trans_file from savevm layer.
From: Yoshiaki Tamura To utilize ft_trans_file function, savevm needs interfaces to be exported. Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- hw/hw.h |5 ++ savevm.c | 150 ++ 2 files changed, 155 insertions(+), 0 deletions(-) diff --git a/hw/hw.h b/hw/hw.h index f90ff15..2d4d595 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -51,6 +51,7 @@ QEMUFile *qemu_fopen_ops(void *opaque, QEMUFilePutBufferFunc *put_buffer, QEMUFile *qemu_fopen(const char *filename, const char *mode); QEMUFile *qemu_fdopen(int fd, const char *mode); QEMUFile *qemu_fopen_socket(int fd); +QEMUFile *qemu_fopen_ft_trans(int s_fd, int c_fd); QEMUFile *qemu_popen(FILE *popen_file, const char *mode); QEMUFile *qemu_popen_cmd(const char *command, const char *mode); int qemu_stdio_fd(QEMUFile *f); @@ -60,6 +61,9 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size); void qemu_put_byte(QEMUFile *f, int v); void *qemu_realloc_buffer(QEMUFile *f, int size); void qemu_clear_buffer(QEMUFile *f); +int qemu_ft_trans_begin(QEMUFile *f); +int qemu_ft_trans_commit(QEMUFile *f); +int qemu_ft_trans_cancel(QEMUFile *f); static inline void qemu_put_ubyte(QEMUFile *f, unsigned int v) { @@ -94,6 +98,7 @@ void qemu_file_set_error(QEMUFile *f); * halted due to rate limiting or EAGAIN errors occur as it can be used to * resume output. */ void qemu_file_put_notify(QEMUFile *f); +void qemu_file_get_notify(void *opaque); static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv) { diff --git a/savevm.c b/savevm.c index d017760..5b57e94 100644 --- a/savevm.c +++ b/savevm.c @@ -83,6 +83,7 @@ #include "qemu_socket.h" #include "qemu-queue.h" #include "cpus.h" +#include "ft_trans_file.h" #define SELF_ANNOUNCE_ROUNDS 5 @@ -190,6 +191,13 @@ typedef struct QEMUFileSocket QEMUFile *file; } QEMUFileSocket; +typedef struct QEMUFileSocketTrans +{ +int fd; +QEMUFileSocket *s; +VMChangeStateEntry *e; +} QEMUFileSocketTrans; + static int socket_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size) { QEMUFileSocket *s = opaque; @@ -205,6 +213,22 @@ static int socket_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size) return len; } +static ssize_t socket_put_buffer(void *opaque, const void *buf, size_t size) +{ +QEMUFileSocket *s = opaque; +ssize_t len; + +do { +len = send(s->fd, (void *)buf, size, 0); +} while (len == -1 && socket_error() == EINTR); + +if (len == -1) { +len = -socket_error(); +} + +return len; +} + static int socket_close(void *opaque) { QEMUFileSocket *s = opaque; @@ -212,6 +236,71 @@ static int socket_close(void *opaque) return 0; } +static int socket_trans_get_buffer(void *opaque, uint8_t *buf, int64_t pos, size_t size) +{ +QEMUFileSocketTrans *t = opaque; +QEMUFileSocket *s = t->s; +ssize_t len; + +len = socket_get_buffer(s, buf, pos, size); + +return len; +} + +static ssize_t socket_trans_put_buffer(void *opaque, const void *buf, size_t size) +{ +QEMUFileSocketTrans *t = opaque; + +return socket_put_buffer(t->s, buf, size); +} + +static int qemu_loadvm_state_no_header(QEMUFile *f); + +static int socket_trans_get_ready(void *opaque) +{ +QEMUFileSocketTrans *t = opaque; +QEMUFileSocket *s = t->s; +QEMUFile *f = s->file; +int ret = 0; + +ret = qemu_loadvm_state_no_header(f); +if (ret < 0) { +fprintf(stderr, +"socket_trans_get_ready: error while loading vmstate\n"); +} + +return ret; +} + +static int socket_trans_close(void *opaque) +{ +QEMUFileSocketTrans *t = opaque; +QEMUFileSocket *s = t->s; + +qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); +qemu_set_fd_handler2(t->fd, NULL, NULL, NULL, NULL); +qemu_del_vm_change_state_handler(t->e); +close(s->fd); +close(t->fd); +qemu_free(s); +qemu_free(t); + +return 0; +} + +static void socket_trans_resume(void *opaque, int running, int reason) +{ +QEMUFileSocketTrans *t = opaque; +QEMUFileSocket *s = t->s; + +if (!running) { +return; +} + +qemu_announce_self(); +qemu_fclose(s->file); +} + static int stdio_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, int size) { QEMUFileStdio *s = opaque; @@ -334,6 +423,26 @@ QEMUFile *qemu_fopen_socket(int fd) return s->file; } +QEMUFile *qemu_fopen_ft_trans(int s_fd, int c_fd) +{ +QEMUFileSocketTrans *t = qemu_mallocz(sizeof(QEMUFileSocketTrans)); +QEMUFileSocket *s = qemu_mallocz(sizeof(QEMUFileSocket)); + +t->s = s; +t->fd = s_fd; +t->e = qemu_add_vm_change_state_handler(socket_trans_resume, t); + +s->fd = c_fd; +s->file = qemu_fopen_ops_ft_trans(t, socket_trans_put_buffer, + socket_trans_get_buffer, NULL, + socket_trans_get_ready, +
[Qemu-devel] [PATCH 11/18] ioport: insert event_tap_ioport() to ioport_write().
From: Yoshiaki Tamura Record ioport event to replay it upon failover. Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- ioport.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/ioport.c b/ioport.c index 2e971fa..f485bab 100644 --- a/ioport.c +++ b/ioport.c @@ -27,6 +27,7 @@ #include "ioport.h" #include "trace.h" +#include "event-tap.h" /***/ /* IO Port */ @@ -76,6 +77,7 @@ static void ioport_write(int index, uint32_t address, uint32_t data) default_ioport_writel }; IOPortWriteFunc *func = ioport_write_table[index][address]; +event_tap_ioport(index, address, data); if (!func) func = default_func[index]; func(ioport_opaque[address], address, data); -- 1.7.0.2
[Qemu-devel] [PATCH 03/18] Introduce qemu_loadvm_state_no_header() and make qemu_loadvm_state() a wrapper.
From: Yoshiaki Tamura Introduce qemu_loadvm_state_no_header() so that it can be called iteratively without reading the header, and qemu_loadvm_state() becomes a wrapper of it. Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- savevm.c | 45 +++-- 1 files changed, 27 insertions(+), 18 deletions(-) diff --git a/savevm.c b/savevm.c index 9cf0258..d017760 100644 --- a/savevm.c +++ b/savevm.c @@ -1744,30 +1744,14 @@ typedef struct LoadStateEntry { int version_id; } LoadStateEntry; -int qemu_loadvm_state(QEMUFile *f) +static int qemu_loadvm_state_no_header(QEMUFile *f) { QLIST_HEAD(, LoadStateEntry) loadvm_handlers = QLIST_HEAD_INITIALIZER(loadvm_handlers); LoadStateEntry *le, *new_le; uint8_t section_type; -unsigned int v; -int ret; - -if (qemu_savevm_state_blocked(default_mon)) { -return -EINVAL; -} - -v = qemu_get_be32(f); -if (v != QEMU_VM_FILE_MAGIC) -return -EINVAL; -v = qemu_get_be32(f); -if (v == QEMU_VM_FILE_VERSION_COMPAT) { -fprintf(stderr, "SaveVM v2 format is obsolete and don't work anymore\n"); -return -ENOTSUP; -} -if (v != QEMU_VM_FILE_VERSION) -return -ENOTSUP; +int ret; while ((section_type = qemu_get_byte(f)) != QEMU_VM_EOF) { uint32_t instance_id, version_id, section_id; @@ -1862,6 +1846,31 @@ out: return ret; } +int qemu_loadvm_state(QEMUFile *f) +{ +unsigned int v; + +if (qemu_savevm_state_blocked(default_mon)) { +return -EINVAL; +} + +v = qemu_get_be32(f); +if (v != QEMU_VM_FILE_MAGIC) { +return -EINVAL; +} + +v = qemu_get_be32(f); +if (v == QEMU_VM_FILE_VERSION_COMPAT) { +fprintf(stderr, "SaveVM v2 format is obsolete and don't work anymore\n"); +return -ENOTSUP; +} +if (v != QEMU_VM_FILE_VERSION) { +return -ENOTSUP; +} + +return qemu_loadvm_state_no_header(f); +} + static int bdrv_snapshot_find(BlockDriverState *bs, QEMUSnapshotInfo *sn_info, const char *name) { -- 1.7.0.2
[Qemu-devel] [PATCH 15/18] savevm: introduce qemu_savevm_trans_{begin, commit}.
From: Yoshiaki Tamura Introduce qemu_savevm_trans_{begin,commit} to send the memory and device info together, while avoiding cancelling memory state tracking. This patch also abstracts common code between qemu_savevm_state_{begin,iterate,commit}. Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- savevm.c | 157 +++--- sysemu.h |2 + 2 files changed, 101 insertions(+), 58 deletions(-) diff --git a/savevm.c b/savevm.c index 5b57e94..dfbdc6c 100644 --- a/savevm.c +++ b/savevm.c @@ -1630,29 +1630,68 @@ bool qemu_savevm_state_blocked(Monitor *mon) return false; } -int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable, -int shared) +/* + * section: header to write + * inc: if true, forces to pass SECTION_PART instead of SECTION_START + * pause: if true, breaks the loop when live handler returned 0 + */ +static int qemu_savevm_state_live(Monitor *mon, QEMUFile *f, int section, + bool inc, bool pause) { SaveStateEntry *se; +int skip = 0, ret; QTAILQ_FOREACH(se, &savevm_handlers, entry) { -if(se->set_params == NULL) { +int len, stage; + +if (se->save_live_state == NULL) { continue; - } - se->set_params(blk_enable, shared, se->opaque); +} + +/* Section type */ +qemu_put_byte(f, section); +qemu_put_be32(f, se->section_id); + +if (section == QEMU_VM_SECTION_START) { +/* ID string */ +len = strlen(se->idstr); +qemu_put_byte(f, len); +qemu_put_buffer(f, (uint8_t *)se->idstr, len); + +qemu_put_be32(f, se->instance_id); +qemu_put_be32(f, se->version_id); + +stage = inc ? QEMU_VM_SECTION_PART : QEMU_VM_SECTION_START; +} else { +assert(inc); +stage = section; +} + +ret = se->save_live_state(mon, f, stage, se->opaque); +if (!ret) { +skip++; +if (pause) { +break; +} +} } - -qemu_put_be32(f, QEMU_VM_FILE_MAGIC); -qemu_put_be32(f, QEMU_VM_FILE_VERSION); + +return skip; +} + +static void qemu_savevm_state_full(QEMUFile *f) +{ +SaveStateEntry *se; QTAILQ_FOREACH(se, &savevm_handlers, entry) { int len; -if (se->save_live_state == NULL) +if (se->save_state == NULL && se->vmsd == NULL) { continue; +} /* Section type */ -qemu_put_byte(f, QEMU_VM_SECTION_START); +qemu_put_byte(f, QEMU_VM_SECTION_FULL); qemu_put_be32(f, se->section_id); /* ID string */ @@ -1663,9 +1702,29 @@ int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable, qemu_put_be32(f, se->instance_id); qemu_put_be32(f, se->version_id); -se->save_live_state(mon, f, QEMU_VM_SECTION_START, se->opaque); +vmstate_save(f, se); +} + +qemu_put_byte(f, QEMU_VM_EOF); +} + +int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable, +int shared) +{ +SaveStateEntry *se; + +QTAILQ_FOREACH(se, &savevm_handlers, entry) { +if (se->set_params == NULL) { +continue; +} +se->set_params(blk_enable, shared, se->opaque); } +qemu_put_be32(f, QEMU_VM_FILE_MAGIC); +qemu_put_be32(f, QEMU_VM_FILE_VERSION); + +qemu_savevm_state_live(mon, f, QEMU_VM_SECTION_START, 0, 0); + if (qemu_file_has_error(f)) { qemu_savevm_state_cancel(mon, f); return -EIO; @@ -1676,29 +1735,16 @@ int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable, int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f) { -SaveStateEntry *se; int ret = 1; -QTAILQ_FOREACH(se, &savevm_handlers, entry) { -if (se->save_live_state == NULL) -continue; - -/* Section type */ -qemu_put_byte(f, QEMU_VM_SECTION_PART); -qemu_put_be32(f, se->section_id); - -ret = se->save_live_state(mon, f, QEMU_VM_SECTION_PART, se->opaque); -if (!ret) { -/* Do not proceed to the next vmstate before this one reported - completion of the current stage. This serializes the migration - and reduces the probability that a faster changing state is - synchronized over and over again. */ -break; -} -} - -if (ret) +/* Do not proceed to the next vmstate before this one reported + completion of the current stage. This serializes the migration + and reduces the probability that a faster changing state is + synchronized over and over again. */ +ret = qemu_savevm_state_live(mon, f, QEMU_VM_SECTION_PART, 1, 1); +if (!ret) { return 1; +} if (qemu_file_has_error(f)) { qemu_savevm_state_ca
[Qemu-devel] [PATCH 13/18] net: insert event-tap to qemu_send_packet() and qemu_sendv_packet_async().
From: Yoshiaki Tamura event-tap function is called only when it is on. Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- net.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/net.c b/net.c index 4f777c3..8bcc504 100644 --- a/net.c +++ b/net.c @@ -36,6 +36,7 @@ #include "qemu_socket.h" #include "hw/qdev.h" #include "iov.h" +#include "event-tap.h" static QTAILQ_HEAD(, VLANState) vlans; static QTAILQ_HEAD(, VLANClientState) non_vlan_clients; @@ -518,6 +519,10 @@ ssize_t qemu_send_packet_async(VLANClientState *sender, void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size) { +if (event_tap_is_on()) { +return event_tap_send_packet(vc, buf, size); +} + qemu_send_packet_async(vc, buf, size, NULL); } @@ -599,6 +604,10 @@ ssize_t qemu_sendv_packet_async(VLANClientState *sender, { NetQueue *queue; +if (event_tap_is_on()) { +return event_tap_sendv_packet_async(sender, iov, iovcnt, sent_cb); +} + if (sender->link_down || (!sender->peer && !sender->vlan)) { return iov_size(iov, iovcnt); } -- 1.7.0.2
[Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.14
Hi, This patch series is a revised version of Kemari for KVM. The current code is based on qemu.git ec52b8753a372de30b22d9b4765a799db612. The changes from v0.2.13 -> v0.2.14 are: - rebased to latest. - correct patch[07], [09] author. The changes from v0.2.12 -> v0.2.13 are: - replaced qemu_get_timer() with qemu_get_timer_ns() - check check s->file before calling qemu_ft_trans_cancel() - avoid virtio-net assert upon calling event_tap_unregister() The changes from v0.2.11 -> v0.2.12 are: - fix vm_state_notify() to use QLIST_FOREACH_SAFE (Juan) - introduce qemu_loadvm_state_no_header() and refactored qemu_loadvm_state() to call it after checking headers (Juan) The changes from v0.2.10 -> v0.2.11 are: - rebased to 0.14 - upon unregistering event-tap, set event_tap_state after event_tap_flush - modify commit log of 02/18 that it won't make existing migration bi-directional. The changes from v0.2.9 -> v0.2.10 are: - change migrate format to kemari::: (Paolo) The changes from v0.2.8 -> v0.2.9 are: - abstract common code between qemu_savevm_{state,trans}_* (Paolo) - change incoming format to kemari::: (Paolo) The changes from v0.2.7 -> v0.2.8 are: - fixed calling wrong cb in event-tap - add missing qemu_aio_release in event-tap The changes from v0.2.6 -> v0.2.7 are: - add AIOCB, AIOPool and cancel functions (Kevin) - insert event-tap for bdrv_flush (Kevin) - add error handing when calling bdrv functions (Kevin) - fix usage of qemu_aio_flush and bdrv_flush (Kevin) - use bs in AIOCB on the primary (Kevin) - reorder event-tap functions to gather with block/net (Kevin) - fix checking bs->device_name (Kevin) The changes from v0.2.5 -> v0.2.6 are: - use qemu_{put,get}_be32() to save/load niov in event-tap The changes from v0.2.4 -> v0.2.5 are: - fixed braces and trailing spaces by using Blue's checkpatch.pl (Blue) - event-tap: don't try to send blk_req if it's a bdrv_aio_flush event The changes from v0.2.3 -> v0.2.4 are: - call vm_start() before event_tap_flush_one() to avoid failure in virtio-net assertion - add vm_change_state_handler to turn off ft_mode - use qemu_iovec functions in event-tap - remove duplicated code in migration - remove unnecessary new line for error_report in ft_trans_file The changes from v0.2.2 -> v0.2.3 are: - queue async net requests without copying (MST) -- if not async, contents of the packets are sent to the secondary - better description for option -k (MST) - fix memory transfer failure - fix ft transaction initiation failure The changes from v0.2.1 -> v0.2.2 are: - decrement last_avaid_idx with inuse before saving (MST) - remove qemu_aio_flush() and bdrv_flush_all() in migrate_ft_trans_commit() The changes from v0.2 -> v0.2.1 are: - Move event-tap to net/block layer and use stubs (Blue, Paul, MST, Kevin) - Tap bdrv_aio_flush (Marcelo) - Remove multiwrite interface in event-tap (Stefan) - Fix event-tap to use pio/mmio to replay both net/block (Stefan) - Improve error handling in event-tap (Stefan) - Fix leak in event-tap (Stefan) - Revise virtio last_avail_idx manipulation (MST) - Clean up migration.c hook (Marcelo) - Make deleting change state handler robust (Isaku, Anthony) The changes from v0.1.1 -> v0.2 are: - Introduce a queue in event-tap to make VM sync live. - Change transaction receiver to a state machine for async receiving. - Replace net/block layer functions with event-tap proxy functions. - Remove dirty bitmap optimization for now. - convert DPRINTF() in ft_trans_file to trace functions. - convert fprintf() in ft_trans_file to error_report(). - improved error handling in ft_trans_file. - add a tmp pointer to qemu_del_vm_change_state_handler. The changes from v0.1 -> v0.1.1 are: - events are tapped in net/block layer instead of device emulation layer. - Introduce a new option for -incoming to accept FT transaction. - Removed writev() support to QEMUFile and FdMigrationState for now. I would post this work in a different series. - Modified virtio-blk save/load handler to send inuse variable to correctly replay. - Removed configure --enable-ft-mode. - Removed unnecessary check for qemu_realloc(). The first 6 patches modify several functions of qemu to prepare introducing Kemari specific components. The next 6 patches are the components of Kemari. They introduce event-tap and the FT transaction protocol file based on buffered file. The design document of FT transaction protocol can be found at, http://wiki.qemu.org/images/b/b1/Kemari_sender_receiver_0.5a.pdf Then the following 2 patches modifies net/block layer functions with event-tap functions. Please note that if Kemari is off, event-tap will just passthrough, and there is most no intrusion to exisiting functions including normal live migration. Finally, the migration layer are modified to support Kemari in the last 4 patches. Again, there shouldn't be any affection if a user doesn't specify Kemari specific options. The transaction is now async on both sender and receiver si
[Qemu-devel] [PATCH 18/18] Introduce "kemari:" to enable FT migration mode (Kemari).
From: Yoshiaki Tamura When "kemari:" is set in front of URI of migrate command, it will turn on ft_mode to start FT migration mode (Kemari). On the receiver side, the option looks like, -incoming kemari::: Signed-off-by: Yoshiaki Tamura Acked-by: Paolo Bonzini Signed-off-by: OHMURA Kei --- hmp-commands.hx |4 +++- migration.c | 12 qmp-commands.hx |4 +++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 834e6a8..4cd7bfa 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -760,7 +760,9 @@ ETEXI "\n\t\t\t -b for migration without shared storage with" " full copy of disk\n\t\t\t -i for migration without " "shared storage with incremental copy of disk " - "(base image shared between src and destination)", + "(base image shared between src and destination)" + "\n\t\t\t put \"kemari:\" in front of URI to enable " + "Fault Tolerance mode (Kemari protocol)", .user_print = monitor_user_noop, .mhandler.cmd_new = do_migrate, }, diff --git a/migration.c b/migration.c index d536df0..5017dea 100644 --- a/migration.c +++ b/migration.c @@ -48,6 +48,12 @@ int qemu_start_incoming_migration(const char *uri) const char *p; int ret; +/* check ft_mode (Kemari protocol) */ +if (strstart(uri, "kemari:", &p)) { +ft_mode = FT_INIT; +uri = p; +} + if (strstart(uri, "tcp:", &p)) ret = tcp_start_incoming_migration(p); #if !defined(WIN32) @@ -99,6 +105,12 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) return -1; } +/* check ft_mode (Kemari protocol) */ +if (strstart(uri, "kemari:", &p)) { +ft_mode = FT_INIT; +uri = p; +} + if (strstart(uri, "tcp:", &p)) { s = tcp_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); diff --git a/qmp-commands.hx b/qmp-commands.hx index fbd98ee..71e4f0e 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -437,7 +437,9 @@ EQMP "\n\t\t\t -b for migration without shared storage with" " full copy of disk\n\t\t\t -i for migration without " "shared storage with incremental copy of disk " - "(base image shared between src and destination)", + "(base image shared between src and destination)" + "\n\t\t\t put \"kemari:\" in front of URI to enable " + "Fault Tolerance mode (Kemari protocol)", .user_print = monitor_user_noop, .mhandler.cmd_new = do_migrate, }, -- 1.7.0.2
[Qemu-devel] [PATCH 06/18] virtio: decrement last_avail_idx with inuse before saving.
From: Yoshiaki Tamura For regular migration inuse == 0 always as requests are flushed before save. However, event-tap log when enabled introduces an extra queue for requests which is not being flushed, thus the last inuse requests are left in the event-tap queue. Move the last_avail_idx value sent to the remote back to make it repeat the last inuse requests. Signed-off-by: Michael S. Tsirkin Signed-off-by: Yoshiaki Tamura --- hw/virtio.c | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index 6e8814c..d342e25 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -672,12 +672,20 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f) qemu_put_be32(f, i); for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) { +/* For regular migration inuse == 0 always as + * requests are flushed before save. However, + * event-tap log when enabled introduces an extra + * queue for requests which is not being flushed, + * thus the last inuse requests are left in the event-tap queue. + * Move the last_avail_idx value sent to the remote back + * to make it repeat the last inuse requests. */ +uint16_t last_avail = vdev->vq[i].last_avail_idx - vdev->vq[i].inuse; if (vdev->vq[i].vring.num == 0) break; qemu_put_be32(f, vdev->vq[i].vring.num); qemu_put_be64(f, vdev->vq[i].pa); -qemu_put_be16s(f, &vdev->vq[i].last_avail_idx); +qemu_put_be16s(f, &last_avail); if (vdev->binding->save_queue) vdev->binding->save_queue(vdev->binding_opaque, i, f); } -- 1.7.0.2
[Qemu-devel] [PATCH 10/18] Call init handler of event-tap at main() in vl.c.
From: Yoshiaki Tamura Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- vl.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/vl.c b/vl.c index a18792d..2dbda4d 100644 --- a/vl.c +++ b/vl.c @@ -160,6 +160,7 @@ int main(int argc, char **argv) #include "qemu-queue.h" #include "cpus.h" #include "arch_init.h" +#include "event-tap.h" #include "ui/qemu-spice.h" @@ -2974,6 +2975,8 @@ int main(int argc, char **argv, char **envp) blk_mig_init(); +event_tap_init(); + /* open the virtual block devices */ if (snapshot) qemu_opts_foreach(qemu_find_opts("drive"), drive_enable_snapshot, NULL, 0); -- 1.7.0.2
[Qemu-devel] [PATCH 17/18] migration-tcp: modify tcp_accept_incoming_migration() to handle ft_mode, and add a hack not to close fd when ft_mode is enabled.
From: Yoshiaki Tamura When ft_mode is set in the header, tcp_accept_incoming_migration() sets ft_trans_incoming() as a callback, and call qemu_file_get_notify() to receive FT transaction iteratively. We also need a hack no to close fd before moving to ft_transaction mode, so that we can reuse the fd for it. vm_change_state_handler is added to turn off ft_mode when cont is pressed. Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- migration-tcp.c | 68 ++- 1 files changed, 67 insertions(+), 1 deletions(-) diff --git a/migration-tcp.c b/migration-tcp.c index bb67d53..1eeac2b 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -17,6 +17,9 @@ #include "qemu-char.h" #include "buffered_file.h" #include "block.h" +#include "sysemu.h" +#include "ft_trans_file.h" +#include "event-tap.h" //#define DEBUG_MIGRATION_TCP @@ -28,6 +31,8 @@ do { } while (0) #endif +static VMChangeStateEntry *vmstate; + static int socket_errno(FdMigrationState *s) { return socket_error(); @@ -55,7 +60,8 @@ static int socket_read(FdMigrationState *s, const void * buf, size_t size) static int tcp_close(FdMigrationState *s) { DPRINTF("tcp_close\n"); -if (s->fd != -1) { +/* FIX ME: accessing ft_mode here isn't clean */ +if (s->fd != -1 && ft_mode != FT_INIT) { close(s->fd); s->fd = -1; } @@ -149,6 +155,36 @@ MigrationState *tcp_start_outgoing_migration(Monitor *mon, return &s->mig_state; } +static void ft_trans_incoming(void *opaque) +{ +QEMUFile *f = opaque; + +qemu_file_get_notify(f); +if (qemu_file_has_error(f)) { +ft_mode = FT_ERROR; +qemu_fclose(f); +} +} + +static void ft_trans_reset(void *opaque, int running, int reason) +{ +QEMUFile *f = opaque; + +if (running) { +if (ft_mode != FT_ERROR) { +qemu_fclose(f); +} +ft_mode = FT_OFF; +qemu_del_vm_change_state_handler(vmstate); +} +} + +static void ft_trans_schedule_replay(QEMUFile *f) +{ +event_tap_schedule_replay(); +vmstate = qemu_add_vm_change_state_handler(ft_trans_reset, f); +} + static void tcp_accept_incoming_migration(void *opaque) { struct sockaddr_in addr; @@ -174,8 +210,38 @@ static void tcp_accept_incoming_migration(void *opaque) goto out; } +if (ft_mode == FT_INIT) { +autostart = 0; +} + process_incoming_migration(f); + +if (ft_mode == FT_INIT) { +int ret; + +socket_set_nodelay(c); + +f = qemu_fopen_ft_trans(s, c); +if (f == NULL) { +fprintf(stderr, "could not qemu_fopen_ft_trans\n"); +goto out; +} + +/* need to wait sender to setup */ +ret = qemu_ft_trans_begin(f); +if (ret < 0) { +goto out; +} + +qemu_set_fd_handler2(c, NULL, ft_trans_incoming, NULL, f); +ft_trans_schedule_replay(f); +ft_mode = FT_TRANSACTION_RECV; + +return; +} + qemu_fclose(f); + out: close(c); out2: -- 1.7.0.2
[Qemu-devel] [PATCH 04/18] qemu-char: export socket_set_nodelay().
From: Yoshiaki Tamura Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- qemu-char.c |2 +- qemu_socket.h |1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 03858d4..fef33b0 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2115,7 +2115,7 @@ static void tcp_chr_telnet_init(int fd) send(fd, (char *)buf, 3, 0); } -static void socket_set_nodelay(int fd) +void socket_set_nodelay(int fd) { int val = 1; setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); diff --git a/qemu_socket.h b/qemu_socket.h index 180e4db..a05e1e5 100644 --- a/qemu_socket.h +++ b/qemu_socket.h @@ -36,6 +36,7 @@ int inet_aton(const char *cp, struct in_addr *ia); int qemu_socket(int domain, int type, int protocol); int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen); void socket_set_nonblock(int fd); +void socket_set_nodelay(int fd); int send_all(int fd, const void *buf, int len1); /* New, ipv6-ready socket helper functions, see qemu-sockets.c */ -- 1.7.0.2
[Qemu-devel] [PATCH 02/18] Introduce read() to FdMigrationState.
From: Yoshiaki Tamura Currently FdMigrationState doesn't support read(), and this patch introduces it to get response from the other side. Note that this won't change the existing migration protocol to be bi-directional. Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- migration-tcp.c | 15 +++ migration.c | 13 + migration.h |3 +++ 3 files changed, 31 insertions(+), 0 deletions(-) diff --git a/migration-tcp.c b/migration-tcp.c index d3d80c9..bb67d53 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -38,6 +38,20 @@ static int socket_write(FdMigrationState *s, const void * buf, size_t size) return send(s->fd, buf, size, 0); } +static int socket_read(FdMigrationState *s, const void * buf, size_t size) +{ +ssize_t len; + +do { +len = recv(s->fd, (void *)buf, size, 0); +} while (len == -1 && socket_error() == EINTR); +if (len == -1) { +len = -socket_error(); +} + +return len; +} + static int tcp_close(FdMigrationState *s) { DPRINTF("tcp_close\n"); @@ -93,6 +107,7 @@ MigrationState *tcp_start_outgoing_migration(Monitor *mon, s->get_error = socket_errno; s->write = socket_write; +s->read = socket_read; s->close = tcp_close; s->mig_state.cancel = migrate_fd_cancel; s->mig_state.get_status = migrate_fd_get_status; diff --git a/migration.c b/migration.c index af3a1f2..302b8fe 100644 --- a/migration.c +++ b/migration.c @@ -340,6 +340,19 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size) return ret; } +int migrate_fd_get_buffer(void *opaque, uint8_t *data, int64_t pos, size_t size) +{ +FdMigrationState *s = opaque; +int ret; + +ret = s->read(s, data, size); +if (ret == -1) { +ret = -(s->get_error(s)); +} + +return ret; +} + void migrate_fd_connect(FdMigrationState *s) { int ret; diff --git a/migration.h b/migration.h index 050c56c..6a76f77 100644 --- a/migration.h +++ b/migration.h @@ -48,6 +48,7 @@ struct FdMigrationState int (*get_error)(struct FdMigrationState*); int (*close)(struct FdMigrationState*); int (*write)(struct FdMigrationState*, const void *, size_t); +int (*read)(struct FdMigrationState *, const void *, size_t); void *opaque; }; @@ -116,6 +117,8 @@ void migrate_fd_put_notify(void *opaque); ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size); +int migrate_fd_get_buffer(void *opaque, uint8_t *data, int64_t pos, size_t size); + void migrate_fd_connect(FdMigrationState *s); void migrate_fd_put_ready(void *opaque); -- 1.7.0.2
[Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
From: Yoshiaki Tamura Record mmio write event to replay it upon failover. Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- exec.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/exec.c b/exec.c index c3dc68a..3c3cece 100644 --- a/exec.c +++ b/exec.c @@ -33,6 +33,7 @@ #include "osdep.h" #include "kvm.h" #include "qemu-timer.h" +#include "event-tap.h" #if defined(CONFIG_USER_ONLY) #include #include @@ -3736,6 +3737,9 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); if (p) addr1 = (addr & ~TARGET_PAGE_MASK) + p->region_offset; + +event_tap_mmio(addr, buf, len); + /* XXX: could force cpu_single_env to NULL to avoid potential bugs */ if (l >= 4 && ((addr1 & 3) == 0)) { -- 1.7.0.2
[Qemu-devel] [PATCH 14/18] block: insert event-tap to bdrv_aio_writev(), bdrv_aio_flush() and bdrv_flush().
From: Yoshiaki Tamura event-tap function is called only when it is on, and requests were sent from device emulators. Signed-off-by: Yoshiaki Tamura Acked-by: Kevin Wolf Signed-off-by: OHMURA Kei --- block.c | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/block.c b/block.c index f731c7a..9e6b610 100644 --- a/block.c +++ b/block.c @@ -28,6 +28,7 @@ #include "block_int.h" #include "module.h" #include "qemu-objects.h" +#include "event-tap.h" #ifdef CONFIG_BSD #include @@ -1591,6 +1592,10 @@ int bdrv_flush(BlockDriverState *bs) } if (bs->drv && bs->drv->bdrv_flush) { +if (*bs->device_name && event_tap_is_on()) { +event_tap_bdrv_flush(); +} + return bs->drv->bdrv_flush(bs); } @@ -2226,6 +2231,11 @@ BlockDriverAIOCB *bdrv_aio_writev(BlockDriverState *bs, int64_t sector_num, if (bdrv_check_request(bs, sector_num, nb_sectors)) return NULL; +if (*bs->device_name && event_tap_is_on()) { +return event_tap_bdrv_aio_writev(bs, sector_num, qiov, nb_sectors, + cb, opaque); +} + if (bs->dirty_bitmap) { blk_cb_data = blk_dirty_cb_alloc(bs, sector_num, nb_sectors, cb, opaque); @@ -2499,6 +2509,11 @@ BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, if (!drv) return NULL; + +if (*bs->device_name && event_tap_is_on()) { +return event_tap_bdrv_aio_flush(bs, cb, opaque); +} + return drv->bdrv_aio_flush(bs, cb, opaque); } -- 1.7.0.2
[Qemu-devel] [PATCH 16/18] migration: introduce migrate_ft_trans_{put, get}_ready(), and modify migrate_fd_put_ready() when ft_mode is on.
From: Yoshiaki Tamura Introduce migrate_ft_trans_put_ready() which kicks the FT transaction cycle. When ft_mode is on, migrate_fd_put_ready() would open ft_trans_file and turn on event_tap. To end or cancel FT transaction, ft_mode and event_tap is turned off. migrate_ft_trans_get_ready() is called to receive ack from the receiver. Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- migration.c | 266 ++- 1 files changed, 265 insertions(+), 1 deletions(-) diff --git a/migration.c b/migration.c index 1c2d956..d536df0 100644 --- a/migration.c +++ b/migration.c @@ -21,6 +21,7 @@ #include "qemu_socket.h" #include "block-migration.h" #include "qemu-objects.h" +#include "event-tap.h" //#define DEBUG_MIGRATION @@ -283,6 +284,17 @@ void migrate_fd_error(FdMigrationState *s) migrate_fd_cleanup(s); } +static void migrate_ft_trans_error(FdMigrationState *s) +{ +ft_mode = FT_ERROR; +qemu_savevm_state_cancel(s->mon, s->file); +migrate_fd_error(s); +/* we need to set vm running to avoid assert in virtio-net */ +vm_start(); +event_tap_unregister(); +vm_stop(0); +} + int migrate_fd_cleanup(FdMigrationState *s) { int ret = 0; @@ -318,6 +330,17 @@ void migrate_fd_put_notify(void *opaque) qemu_file_put_notify(s->file); } +static void migrate_fd_get_notify(void *opaque) +{ +FdMigrationState *s = opaque; + +qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); +qemu_file_get_notify(s->file); +if (qemu_file_has_error(s->file)) { +migrate_ft_trans_error(s); +} +} + ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size) { FdMigrationState *s = opaque; @@ -353,6 +376,10 @@ int migrate_fd_get_buffer(void *opaque, uint8_t *data, int64_t pos, size_t size) ret = -(s->get_error(s)); } +if (ret == -EAGAIN) { +qemu_set_fd_handler2(s->fd, NULL, migrate_fd_get_notify, NULL, s); +} + return ret; } @@ -379,6 +406,230 @@ void migrate_fd_connect(FdMigrationState *s) migrate_fd_put_ready(s); } +static int migrate_ft_trans_commit(void *opaque) +{ +FdMigrationState *s = opaque; +int ret = -1; + +if (ft_mode != FT_TRANSACTION_COMMIT && ft_mode != FT_TRANSACTION_ATOMIC) { +fprintf(stderr, +"migrate_ft_trans_commit: invalid ft_mode %d\n", ft_mode); +goto out; +} + +do { +if (ft_mode == FT_TRANSACTION_ATOMIC) { +if (qemu_ft_trans_begin(s->file) < 0) { +fprintf(stderr, "qemu_ft_trans_begin failed\n"); +goto out; +} + +ret = qemu_savevm_trans_begin(s->mon, s->file, 0); +if (ret < 0) { +fprintf(stderr, "qemu_savevm_trans_begin failed\n"); +goto out; +} + +ft_mode = FT_TRANSACTION_COMMIT; +if (ret) { +/* don't proceed until if fd isn't ready */ +goto out; +} +} + +/* make the VM state consistent by flushing outstanding events */ +vm_stop(0); + +/* send at full speed */ +qemu_file_set_rate_limit(s->file, 0); + +ret = qemu_savevm_trans_complete(s->mon, s->file); +if (ret < 0) { +fprintf(stderr, "qemu_savevm_trans_complete failed\n"); +goto out; +} + +ret = qemu_ft_trans_commit(s->file); +if (ret < 0) { +fprintf(stderr, "qemu_ft_trans_commit failed\n"); +goto out; +} + +if (ret) { +ft_mode = FT_TRANSACTION_RECV; +ret = 1; +goto out; +} + +/* flush and check if events are remaining */ +vm_start(); +ret = event_tap_flush_one(); +if (ret < 0) { +fprintf(stderr, "event_tap_flush_one failed\n"); +goto out; +} + +ft_mode = ret ? FT_TRANSACTION_BEGIN : FT_TRANSACTION_ATOMIC; +} while (ft_mode != FT_TRANSACTION_BEGIN); + +vm_start(); +ret = 0; + +out: +return ret; +} + +static int migrate_ft_trans_get_ready(void *opaque) +{ +FdMigrationState *s = opaque; +int ret = -1; + +if (ft_mode != FT_TRANSACTION_RECV) { +fprintf(stderr, +"migrate_ft_trans_get_ready: invalid ft_mode %d\n", ft_mode); +goto error_out; +} + +/* flush and check if events are remaining */ +vm_start(); +ret = event_tap_flush_one(); +if (ret < 0) { +fprintf(stderr, "event_tap_flush_one failed\n"); +goto error_out; +} + +if (ret) { +ft_mode = FT_TRANSACTION_BEGIN; +} else { +ft_mode = FT_TRANSACTION_ATOMIC; + +ret = migrate_ft_trans_commit(s); +if (ret < 0) { +goto error_out; +} +if (ret) { +goto out; +} +} + +vm_start(); +ret = 0; +goto out; + +error_out: +migr
[Qemu-devel] [PATCH 07/18] Introduce fault tolerant VM transaction QEMUFile and ft_mode.
This code implements VM transaction protocol. Like buffered_file, it sits between savevm and migration layer. With this architecture, VM transaction protocol is implemented mostly independent from other existing code. Signed-off-by: OHMURA Kei Signed-off-by: Yoshiaki Tamura --- Makefile.objs |1 + ft_trans_file.c | 624 +++ ft_trans_file.h | 72 +++ migration.c |3 + trace-events| 15 ++ 5 files changed, 715 insertions(+), 0 deletions(-) create mode 100644 ft_trans_file.c create mode 100644 ft_trans_file.h diff --git a/Makefile.objs b/Makefile.objs index 44ce368..75e7c79 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -101,6 +101,7 @@ common-obj-y += qdev.o qdev-properties.o common-obj-y += block-migration.o iohandler.o common-obj-y += pflib.o common-obj-y += bitmap.o bitops.o +common-obj-y += ft_trans_file.o common-obj-$(CONFIG_BRLAPI) += baum.o common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o diff --git a/ft_trans_file.c b/ft_trans_file.c new file mode 100644 index 000..2b42b95 --- /dev/null +++ b/ft_trans_file.c @@ -0,0 +1,624 @@ +/* + * Fault tolerant VM transaction QEMUFile + * + * Copyright (c) 2010 Nippon Telegraph and Telephone Corporation. + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * This source code is based on buffered_file.c. + * Copyright IBM, Corp. 2008 + * Authors: + * Anthony Liguori + */ + +#include "qemu-common.h" +#include "qemu-error.h" +#include "hw/hw.h" +#include "qemu-timer.h" +#include "sysemu.h" +#include "qemu-char.h" +#include "trace.h" +#include "ft_trans_file.h" + +typedef struct FtTransHdr +{ +uint16_t cmd; +uint16_t id; +uint32_t seq; +uint32_t payload_len; +} FtTransHdr; + +typedef struct QEMUFileFtTrans +{ +FtTransPutBufferFunc *put_buffer; +FtTransGetBufferFunc *get_buffer; +FtTransPutReadyFunc *put_ready; +FtTransGetReadyFunc *get_ready; +FtTransWaitForUnfreezeFunc *wait_for_unfreeze; +FtTransCloseFunc *close; +void *opaque; +QEMUFile *file; + +enum QEMU_VM_TRANSACTION_STATE state; +uint32_t seq; +uint16_t id; + +int has_error; + +bool freeze_output; +bool freeze_input; +bool rate_limit; +bool is_sender; +bool is_payload; + +uint8_t *buf; +size_t buf_max_size; +size_t put_offset; +size_t get_offset; + +FtTransHdr header; +size_t header_offset; +} QEMUFileFtTrans; + +#define IO_BUF_SIZE 32768 + +static void ft_trans_append(QEMUFileFtTrans *s, +const uint8_t *buf, size_t size) +{ +if (size > (s->buf_max_size - s->put_offset)) { +trace_ft_trans_realloc(s->buf_max_size, size + 1024); +s->buf_max_size += size + 1024; +s->buf = qemu_realloc(s->buf, s->buf_max_size); +} + +trace_ft_trans_append(size); +memcpy(s->buf + s->put_offset, buf, size); +s->put_offset += size; +} + +static void ft_trans_flush(QEMUFileFtTrans *s) +{ +size_t offset = 0; + +if (s->has_error) { +error_report("flush when error %d, bailing", s->has_error); +return; +} + +while (offset < s->put_offset) { +ssize_t ret; + +ret = s->put_buffer(s->opaque, s->buf + offset, s->put_offset - offset); +if (ret == -EAGAIN) { +break; +} + +if (ret <= 0) { +error_report("error flushing data, %s", strerror(errno)); +s->has_error = FT_TRANS_ERR_FLUSH; +break; +} else { +offset += ret; +} +} + +trace_ft_trans_flush(offset, s->put_offset); +memmove(s->buf, s->buf + offset, s->put_offset - offset); +s->put_offset -= offset; +s->freeze_output = !!s->put_offset; +} + +static ssize_t ft_trans_put(void *opaque, void *buf, int size) +{ +QEMUFileFtTrans *s = opaque; +size_t offset = 0; +ssize_t len; + +/* flush buffered data before putting next */ +if (s->put_offset) { +ft_trans_flush(s); +} + +while (!s->freeze_output && offset < size) { +len = s->put_buffer(s->opaque, (uint8_t *)buf + offset, size - offset); + +if (len == -EAGAIN) { +trace_ft_trans_freeze_output(); +s->freeze_output = 1; +break; +} + +if (len <= 0) { +error_report("putting data failed, %s", strerror(errno)); +s->has_error = 1; +offset = -EINVAL; +break; +} + +offset += len; +} + +if (s->freeze_output) { +ft_trans_append(s, buf + offset, size - offset); +offset = size; +} + +return offset; +} + +static int ft_trans_send_header(QEMUFileFtTrans *s, +enum QEMU_VM_TRANSACTION_STATE state, +uint32_t payload_len) +{ +int ret; +FtTransHd
[Qemu-devel] [PATCH 01/18] Make QEMUFile buf expandable, and introduce qemu_realloc_buffer() and qemu_clear_buffer().
From: Yoshiaki Tamura Currently buf size is fixed at 32KB. It would be useful if it could be flexible. Signed-off-by: Yoshiaki Tamura Signed-off-by: OHMURA Kei --- hw/hw.h |2 ++ savevm.c | 20 +++- 2 files changed, 21 insertions(+), 1 deletions(-) diff --git a/hw/hw.h b/hw/hw.h index 1b09039..f90ff15 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -58,6 +58,8 @@ void qemu_fflush(QEMUFile *f); int qemu_fclose(QEMUFile *f); void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size); void qemu_put_byte(QEMUFile *f, int v); +void *qemu_realloc_buffer(QEMUFile *f, int size); +void qemu_clear_buffer(QEMUFile *f); static inline void qemu_put_ubyte(QEMUFile *f, unsigned int v) { diff --git a/savevm.c b/savevm.c index f4ff1a1..9cf0258 100644 --- a/savevm.c +++ b/savevm.c @@ -172,7 +172,8 @@ struct QEMUFile { when reading */ int buf_index; int buf_size; /* 0 when writing */ -uint8_t buf[IO_BUF_SIZE]; +int buf_max_size; +uint8_t *buf; int has_error; }; @@ -423,6 +424,9 @@ QEMUFile *qemu_fopen_ops(void *opaque, QEMUFilePutBufferFunc *put_buffer, f->get_rate_limit = get_rate_limit; f->is_write = 0; +f->buf_max_size = IO_BUF_SIZE; +f->buf = qemu_malloc(sizeof(uint8_t) * f->buf_max_size); + return f; } @@ -453,6 +457,19 @@ void qemu_fflush(QEMUFile *f) } } +void *qemu_realloc_buffer(QEMUFile *f, int size) +{ +f->buf_max_size = size; +f->buf = qemu_realloc(f->buf, f->buf_max_size); + +return f->buf; +} + +void qemu_clear_buffer(QEMUFile *f) +{ +f->buf_size = f->buf_index = f->buf_offset = 0; +} + static void qemu_fill_buffer(QEMUFile *f) { int len; @@ -478,6 +495,7 @@ int qemu_fclose(QEMUFile *f) qemu_fflush(f); if (f->close) ret = f->close(f->opaque); +qemu_free(f->buf); qemu_free(f); return ret; } -- 1.7.0.2
[Qemu-devel] [PATCH 09/18] Introduce event-tap.
event-tap controls when to start FT transaction, and provides proxy functions to called from net/block devices. While FT transaction, it queues up net/block requests, and flush them when the transaction gets completed. Signed-off-by: OHMURA Kei Signed-off-by: Yoshiaki Tamura --- Makefile.target |1 + event-tap.c | 940 +++ event-tap.h | 44 +++ qemu-tool.c | 28 ++ trace-events| 10 + 5 files changed, 1023 insertions(+), 0 deletions(-) create mode 100644 event-tap.c create mode 100644 event-tap.h diff --git a/Makefile.target b/Makefile.target index 0e0ef36..e489df4 100644 --- a/Makefile.target +++ b/Makefile.target @@ -199,6 +199,7 @@ obj-y += rwhandler.o obj-$(CONFIG_KVM) += kvm.o kvm-all.o obj-$(CONFIG_NO_KVM) += kvm-stub.o LIBS+=-lz +obj-y += event-tap.o QEMU_CFLAGS += $(VNC_TLS_CFLAGS) QEMU_CFLAGS += $(VNC_SASL_CFLAGS) diff --git a/event-tap.c b/event-tap.c new file mode 100644 index 000..95c147a --- /dev/null +++ b/event-tap.c @@ -0,0 +1,940 @@ +/* + * Event Tap functions for QEMU + * + * Copyright (c) 2010 Nippon Telegraph and Telephone Corporation. + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + */ + +#include "qemu-common.h" +#include "qemu-error.h" +#include "block.h" +#include "block_int.h" +#include "ioport.h" +#include "osdep.h" +#include "sysemu.h" +#include "hw/hw.h" +#include "net.h" +#include "event-tap.h" +#include "trace.h" + +enum EVENT_TAP_STATE { +EVENT_TAP_OFF, +EVENT_TAP_ON, +EVENT_TAP_SUSPEND, +EVENT_TAP_FLUSH, +EVENT_TAP_LOAD, +EVENT_TAP_REPLAY, +}; + +static enum EVENT_TAP_STATE event_tap_state = EVENT_TAP_OFF; + +typedef struct EventTapIOport { +uint32_t address; +uint32_t data; +int index; +} EventTapIOport; + +#define MMIO_BUF_SIZE 8 + +typedef struct EventTapMMIO { +uint64_t address; +uint8_t buf[MMIO_BUF_SIZE]; +int len; +} EventTapMMIO; + +typedef struct EventTapNetReq { +char *device_name; +int iovcnt; +int vlan_id; +bool vlan_needed; +bool async; +struct iovec *iov; +NetPacketSent *sent_cb; +} EventTapNetReq; + +#define MAX_BLOCK_REQUEST 32 + +typedef struct EventTapAIOCB EventTapAIOCB; + +typedef struct EventTapBlkReq { +char *device_name; +int num_reqs; +int num_cbs; +bool is_flush; +BlockRequest reqs[MAX_BLOCK_REQUEST]; +EventTapAIOCB *acb[MAX_BLOCK_REQUEST]; +} EventTapBlkReq; + +#define EVENT_TAP_IOPORT (1 << 0) +#define EVENT_TAP_MMIO (1 << 1) +#define EVENT_TAP_NET(1 << 2) +#define EVENT_TAP_BLK(1 << 3) + +#define EVENT_TAP_TYPE_MASK (EVENT_TAP_NET - 1) + +typedef struct EventTapLog { +int mode; +union { +EventTapIOport ioport; +EventTapMMIO mmio; +}; +union { +EventTapNetReq net_req; +EventTapBlkReq blk_req; +}; +QTAILQ_ENTRY(EventTapLog) node; +} EventTapLog; + +struct EventTapAIOCB { +BlockDriverAIOCB common; +BlockDriverAIOCB *acb; +bool is_canceled; +}; + +static EventTapLog *last_event_tap; + +static QTAILQ_HEAD(, EventTapLog) event_list; +static QTAILQ_HEAD(, EventTapLog) event_pool; + +static int (*event_tap_cb)(void); +static QEMUBH *event_tap_bh; +static VMChangeStateEntry *vmstate; + +static void event_tap_bh_cb(void *p) +{ +if (event_tap_cb) { +event_tap_cb(); +} + +qemu_bh_delete(event_tap_bh); +event_tap_bh = NULL; +} + +static void event_tap_schedule_bh(void) +{ +trace_event_tap_ignore_bh(!!event_tap_bh); + +/* if bh is already set, we ignore it for now */ +if (event_tap_bh) { +return; +} + +event_tap_bh = qemu_bh_new(event_tap_bh_cb, NULL); +qemu_bh_schedule(event_tap_bh); + +return; +} + +static void *event_tap_alloc_log(void) +{ +EventTapLog *log; + +if (QTAILQ_EMPTY(&event_pool)) { +log = qemu_mallocz(sizeof(EventTapLog)); +} else { +log = QTAILQ_FIRST(&event_pool); +QTAILQ_REMOVE(&event_pool, log, node); +} + +return log; +} + +static void event_tap_free_net_req(EventTapNetReq *net_req); +static void event_tap_free_blk_req(EventTapBlkReq *blk_req); + +static void event_tap_free_log(EventTapLog *log) +{ +int mode = log->mode & ~EVENT_TAP_TYPE_MASK; + +if (mode == EVENT_TAP_NET) { +event_tap_free_net_req(&log->net_req); +} else if (mode == EVENT_TAP_BLK) { +event_tap_free_blk_req(&log->blk_req); +} + +log->mode = 0; + +/* return the log to event_pool */ +QTAILQ_INSERT_HEAD(&event_pool, log, node); +} + +static void event_tap_free_pool(void) +{ +EventTapLog *log, *next; + +QTAILQ_FOREACH_SAFE(log, &event_pool, node, next) { +QTAILQ_REMOVE(&event_pool, log, node); +qemu_free(log); +} +} + +static void event_tap_free_net_req(EventTapNetReq *net_req) +{ +int i; + +if (!net_req->async) { +for (i = 0; i <
Re: [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
On 2011-04-25 13:00, OHMURA Kei wrote: > From: Yoshiaki Tamura > > Record mmio write event to replay it upon failover. > > Signed-off-by: Yoshiaki Tamura > Signed-off-by: OHMURA Kei > --- > exec.c |4 > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/exec.c b/exec.c > index c3dc68a..3c3cece 100644 > --- a/exec.c > +++ b/exec.c > @@ -33,6 +33,7 @@ > #include "osdep.h" > #include "kvm.h" > #include "qemu-timer.h" > +#include "event-tap.h" > #if defined(CONFIG_USER_ONLY) > #include > #include > @@ -3736,6 +3737,9 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, > uint8_t *buf, > io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); > if (p) > addr1 = (addr & ~TARGET_PAGE_MASK) + p->region_offset; > + > +event_tap_mmio(addr, buf, len); > + You know that this is incomplete? A few devices are calling st*_phys directly, specifically virtio. What kind of mmio should be traced here, device or CPU originated? Or both? Jan signature.asc Description: OpenPGP digital signature
Re: [Qemu-devel] [PATCH 1/2] Support for MIPS64 user mode emulation
please see inline comments highlighted in red color. On Wed, Apr 13, 2011 at 2:32 AM, Aurelien Jarno wrote: > [I don't know very well linux-user, it would be nice to Cc: Riku Voipio, > the linux-user maintainer for the next version.] > > On Sat, Apr 09, 2011 at 04:02:31PM +0500, Khansa Butt wrote: > > From e96e20e50cada1c9e1b65de5925281cdd5659746 Mon Sep 17 00:00:00 2001 > > From: Ehsan-ul-Haq & Khansa Butt > > Date: Sat, 9 Apr 2011 10:51:22 +0500 > > Subject: [PATCH 1/2] Support for MIPS64 user mode emulation > > > > > > Signed-off-by: Ehsan-ul-Haq, Abdul Qadeer, Abdul Waheed, Khansa Butt < > > kha...@kics.edu.pk> > > --- > > configure |1 + > > default-configs/mips64-linux-user.mak |1 + > > linux-user/elfload.c |2 +- > > linux-user/main.c | 29 > +++-- > > linux-user/mips64/syscall.h |3 +++ > > linux-user/signal.c |3 ++- > > target-mips/translate.c |1 + > > 7 files changed, 36 insertions(+), 4 deletions(-) > > create mode 100644 default-configs/mips64-linux-user.mak > > > > diff --git a/configure b/configure > > index ae97e11..d1f7867 100755 > > --- a/configure > > +++ b/configure > > @@ -1039,6 +1039,7 @@ m68k-linux-user \ > > microblaze-linux-user \ > > microblazeel-linux-user \ > > mips-linux-user \ > > +mips64-linux-user \ > > mipsel-linux-user \ > > ppc-linux-user \ > > ppc64-linux-user \ > > diff --git a/default-configs/mips64-linux-user.mak > > b/default-configs/mips64-linux-user.mak > > new file mode 100644 > > index 000..1598bfc > > --- /dev/null > > +++ b/default-configs/mips64-linux-user.mak > > @@ -0,0 +1 @@ > > +# Default configuration for mips64-linux-user > > diff --git a/linux-user/elfload.c b/linux-user/elfload.c > > index fe5410e..2832a33 100644 > > --- a/linux-user/elfload.c > > +++ b/linux-user/elfload.c > > @@ -1384,7 +1384,7 @@ static void load_elf_image(const char *image_name, > int > > image_fd, > > vaddr_po = TARGET_ELF_PAGEOFFSET(vaddr); > > vaddr_ps = TARGET_ELF_PAGESTART(vaddr); > > > > -error = target_mmap(vaddr_ps, eppnt->p_filesz + vaddr_po, > > +error = target_mmap(vaddr_ps, eppnt->p_memsz + vaddr_po, > > What is the goal of this change? If the mmapped aread is bigger than the > file size rounded up to te page size, it will cause a SIGBUS. > > > elf_prot, MAP_PRIVATE | MAP_FIXED, > > image_fd, eppnt->p_offset - vaddr_po); > > if (error == -1) { > > diff --git a/linux-user/main.c b/linux-user/main.c > > index e651bfd..a7f4955 100644 > > --- a/linux-user/main.c > > +++ b/linux-user/main.c > > @@ -1937,6 +1937,14 @@ static int do_store_exclusive(CPUMIPSState *env) > > int d; > > > > addr = env->lladdr; > > +#if defined(TARGET_MIPS64) > > +/* For MIPS64 on 32 bit host there is a need to make > > +* the page accessible to which the above 'addr' is belonged */ > > +#if HOST_LONG_BITS == 32 > > +int flag = PAGE_VALID | PAGE_READ | PAGE_WRITE | PAGE_WRITE_ORG; > > +page_set_flags(addr, addr + 4096, flag); > > +#endif > > +#endif > > I don't really see the reason why this should be done that way. Are you > trying to run MIPS32 binaries compiled for 8kB page size? > this change is needed when we run MIPS64 ELF on 32 bit x86 host. MIPS64 ELF contains 36 bit address. load_elf_image() at /home/khansa/testpatch/qemu/linux-user/elfload.c: QEMU contains these lines /* Round addresses to page boundaries. */ loaddr &= qemu_host_page_mask; hiaddr = HOST_PAGE_ALIGN(hiaddr); when QEMU run on 32 bit x86 the above two variables are rounded to 32 bit value while these should be 36 bits as these come from MIPS64 ELF.and then for these rounded address l1_map is initialized in page_find_alloc(). in case of SCD(store condition double ) instruction of MIPS64r2 when we have to check load linked address its again 36 bit so it will make an index(addr >> TARGET_PAGE_BITS) for which l1_map is no valid entry, returning 0 value and we got segmentation fault. this is the reason we did following changes in main.c do_store_exclusive() +#if HOST_LONG_BITS == 32 > +int flag = PAGE_VALID | PAGE_READ | PAGE_WRITE | PAGE_WRITE_ORG; > +page_set_flags(addr, addr + 4096, flag); > +#endif Please give comments on this > > > page_addr = addr & TARGET_PAGE_MASK; > > start_exclusive(); > > mmap_lock(); > > @@ -1978,7 +1986,8 @@ static int do_store_exclusive(CPUMIPSState *env) > > void cpu_loop(CPUMIPSState *env) > > { > > target_siginfo_t info; > > -int trapnr, ret; > > +int trapnr; > > +abi_long ret; > > unsigned int syscall_num; > > > > for(;;) { > > @@ -1987,7 +1996,11 @@ void cpu_loop(CPUMIPSState *env) > > cpu_exec_end(env); > > switch(trapnr) { > > case EXCP_SYSCALL: > > +#if d
Re: [Qemu-devel] [RFC][PATCH v2 15/17] guest agent: qemu-ga daemon
On Fri, 2011-04-22 at 13:51 +0200, Jes Sorensen wrote: > > What kind of coding error does splitting this out aim to prevent? > > missing break; / return; statements? Because I dont see how it > achieves > > that... > > Hiding things you miss when reading the code, it's a classic for > people > to do if(foo) bleh(); on the same line, and whoever reads the code > will > expect the action on the next line, especially if foo is a long > complex > statement. > > It's one of these 'just don't do it, it bites you in the end' things. Meh. I dont see it that way... Sure, if it was one line out of 20 written that way, it would be weird, but as is, its just part of a block of identical lines. I dont really see a parallel with the if() statement either since the condition in the switch() case isnt on the same line as such. I must admit that I only write one-liner if statements if the condition is short though. -Ian
Re: [Qemu-devel] [PATCH] net: add drop_packets parameter to -net nic
2011/4/25 Nguyễn Thái Ngọc Duy : > Dropping packets is sometimes perferred behavior. Add drop_packets > parameter to NICConf struct and let nic simulation decide how to use > it. > > Only e1000 supports this for now. > > Signed-off-by: Nguyễn Thái Ngọc Duy > --- > Documentation is missing, but I'm not even sure if there's any other > user who finds this useful. Can you explain why you are adding this? You are trying to bypass the send queue and drop packets instead? Stefan
Re: [Qemu-devel] [PATCH] net: add drop_packets parameter to -net nic
On 04/25/2011 08:40 AM, Stefan Hajnoczi wrote: 2011/4/25 Nguyễn Thái Ngọc Duy: Dropping packets is sometimes perferred behavior. Add drop_packets parameter to NICConf struct and let nic simulation decide how to use it. Only e1000 supports this for now. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation is missing, but I'm not even sure if there's any other user who finds this useful. Can you explain why you are adding this? You are trying to bypass the send queue and drop packets instead? And some performance results always help with this sort of thing. Regards, Anthony Liguori Stefan
Re: [Qemu-devel] [PATCH] net: add drop_packets parameter to -net nic
2011/4/25 Stefan Hajnoczi : > 2011/4/25 Nguyễn Thái Ngọc Duy : >> Dropping packets is sometimes perferred behavior. Add drop_packets >> parameter to NICConf struct and let nic simulation decide how to use >> it. >> >> Only e1000 supports this for now. >> >> Signed-off-by: Nguyễn Thái Ngọc Duy >> --- >> Documentation is missing, but I'm not even sure if there's any other >> user who finds this useful. > > Can you explain why you are adding this? You are trying to bypass the > send queue and drop packets instead? Yes. I have a driver that does connection hand shaking at ethernet level. If anything goes wrong, it disables rx and after a while a new session will be started from higher level. The other end has a timer and keeps sending data until it times out. If this end does not respond properly until the timer is timed out, the other end starts sending "connection request" packets periodically for a new session. When this end enables rx again, in real world it would receive a fresh req packet and send ack. Because of queuing, it receives packets from old session and sends out a series of nack because it expects req packet. Depends on how long rx is disabled until a new session is started, the driver will have to process all queued (invalid) packets and delay session establishment some more. I think dropping packets will improve this situation. But again, this driver is peculiar. I don't think there are many drivers that do dialog-style like this. -- Duy
Re: [Qemu-devel] [Bug 723871] Re: qemu-kvm-0.14.0 Aborts with -vga qxl
Quoting Boris Derzhavets (723...@bugs.launchpad.net): > View also > > http://lists.fedoraproject.org/pipermail/virt/2011-March/002572.html Thanks, this should be added to the qemu-kvm-spice package then. Note that this patch is not yet upstream, but should be going in through the spice tree at some point. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/723871 Title: qemu-kvm-0.14.0 Aborts with -vga qxl Status in QEMU: Confirmed Status in “qemu-kvm” package in Ubuntu: Fix Released Bug description: Host CPU is Core i7 Q820. KVM is from 2.6.35-gentoo-r5 kernel (x86_64). Host has spice-0.7.2 and spice-protocol-0.7.0. Guest is Windows XP SP3 with qxl driver 0.6.1, virtio-serial 1.1.6 and vdagent 0.6.3. qemu-kvm is started like so: qemu-system-x86_64 -cpu host -enable-kvm -pidfile /home/rick/qemu/hds/wxp.pid -drive file=/home/rick/qemu/hds/wxp.raw,if=virtio,media=disk,aio=native,snapshot=on -m 768 -name WinXP -net nic,model=virtio -net user -localtime -usb -vga qxl -device virtio-serial -chardev spicevmc,name=vdagent,id=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -spice port=1234,disable-ticketing -monitor stdio and crashes with: qemu-system-x86_64: /home/rick/qemu/src/qemu-kvm-0.14.0/qemu-kvm.c:1724: kvm_mutex_unlock: Assertion `!cpu_single_env' failed. Aborted If I use -no-kvm, it works fine. If I use -vga std, it works fine. -enable-kvm and -vga qxl crashes.
Re: [Qemu-devel] [PATCH 2/2 V7] qemu, qmp: add inject-nmi qmp command
On Wed, 20 Apr 2011 09:53:56 +0800 Lai Jiangshan wrote: > On 04/04/2011 09:09 PM, Anthony Liguori wrote: > > On 04/04/2011 07:19 AM, Markus Armbruster wrote: > >> [Note cc: Anthony] > >> > >> "Daniel P. Berrange" writes: > >> > >>> On Mon, Mar 07, 2011 at 05:46:28PM +0800, Lai Jiangshan wrote: > From: Lai Jiangshan > Date: Mon, 7 Mar 2011 17:05:15 +0800 > Subject: [PATCH 2/2] qemu,qmp: add inject-nmi qmp command > > inject-nmi command injects an NMI on all CPUs of guest. > It is only supported for x86 guest currently, it will > returns "Unsupported" error for non-x86 guest. > > --- > hmp-commands.hx |2 +- > monitor.c | 18 +- > qmp-commands.hx | 29 + > 3 files changed, 47 insertions(+), 2 deletions(-) > >>> Does anyone have any feedback on this addition, or are all new > >>> QMP patch proposals blocked pending Anthony's QAPI work ? > >> That would be bad. Anthony, what's holding this back? > > > > It doesn't pass checkpath.pl. > > > > But I'd also expect this to come through Luiz's QMP tree. > > > > Regards, > > > > Anthony Liguori > > > > Hi, Anthony, > > I cannot find checkpath.pl in the source tree. It's ./scripts/checkpatch.pl > And how/where to write errors descriptions? Is the following description > suitable? > > ## > # @inject-nmi: > # > # Inject an NMI on the guest. > # > # Returns: Nothing on success. > # If the guest(non-x86) does not support NMI injection, Unsupported > # > # Since: 0.15.0 > ## > { 'command': 'inject-nmi' } > > > Thanks, > Lai >
Re: [Qemu-devel] [PATCH] char: Allow devices to use a single multiplexed chardev.
On 2011-04-25 15:27:20 +0530, Amit Shah wrote: > On (Fri) 22 Apr 2011 [21:59:42], Kusanagi Kouichi wrote: > > This fixes regression caused by commit > > 2d6c1ef40f3678ab47a4d14fb5dadaa486bfcda6 > > ("char: Prevent multiple devices opening same chardev"). > > What's the regression? How do I test it? > -nodefaults -nographic -chardev stdio,id=stdio,mux=on,signal=off -mon stdio -device virtio-serial-pci -device virtconsole,chardev=stdio -device isa-serial,chardev=stdio fails with qemu-system-x86_64: -device isa-serial,chardev=stdio: Property 'isa-serial.chardev' can't take value 'stdio', it's in use Is this intended? > > Signed-off-by: Kusanagi Kouichi > > --- > > hw/qdev-properties.c |4 ++-- > > qemu-char.c |5 - > > qemu-char.h |2 +- > > 3 files changed, 7 insertions(+), 4 deletions(-) > > > > diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c > > index 1088a26..0eed712 100644 > > --- a/hw/qdev-properties.c > > +++ b/hw/qdev-properties.c > > @@ -354,10 +354,10 @@ static int parse_chr(DeviceState *dev, Property > > *prop, const char *str) > > if (*ptr == NULL) { > > return -ENOENT; > > } > > -if ((*ptr)->assigned) { > > +if ((*ptr)->avail < 1) { > > return -EEXIST; > > } > > -(*ptr)->assigned = 1; > > +--(*ptr)->avail; > > return 0; > > } > > > > diff --git a/qemu-char.c b/qemu-char.c > > index 03858d4..f08f2b8 100644 > > --- a/qemu-char.c > > +++ b/qemu-char.c > > @@ -199,7 +199,7 @@ void qemu_chr_add_handlers(CharDriverState *s, > > { > > if (!opaque) { > > /* chr driver being released. */ > > -s->assigned = 0; > > +++s->avail; > > } > > Will just checking for handlers (fd_can_read, fd_read, fd_write not > NULL) here help instead of this patch? > That doesn't help. > > s->chr_can_read = fd_can_read; > > s->chr_read = fd_read; > > @@ -2544,7 +2544,10 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts, > > snprintf(base->label, len, "%s-base", qemu_opts_id(opts)); > > chr = qemu_chr_open_mux(base); > > chr->filename = base->filename; > > +chr->avail = MAX_MUX; > > QTAILQ_INSERT_TAIL(&chardevs, chr, next); > > +} else { > > +chr->avail = 1; > > } > > chr->label = qemu_strdup(qemu_opts_id(opts)); > > return chr; > > diff --git a/qemu-char.h b/qemu-char.h > > index fb96eef..ebf3641 100644 > > --- a/qemu-char.h > > +++ b/qemu-char.h > > @@ -70,7 +70,7 @@ struct CharDriverState { > > char *label; > > char *filename; > > int opened; > > -int assigned; /* chardev assigned to a device */ > > +int avail; > > QTAILQ_ENTRY(CharDriverState) next; > > }; > > > > -- > > 1.7.4.4 > > > > > > Amit
Re: [Qemu-devel] [PATCH] virtio-serial: Fix endianness bug in the config space
David Gibson wrote: > From: Alexey Kardashevskiy > > The virtio serial specification requres that the values in the config > space are encoded in native endian of the guest. > The qemu virtio-serial code did not do conversion to the guest endian > format what caused problems when host and guest use different format. > > This patch corrects the qemu side, correctly doing host-native <-> > guest-native conversions when accessing the config space. This won't > break any setups that aren't already broken, and fixes the case > of different host and guest endianness. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: Juan Quintela It dont' make any change when guest & host has the same endianess. Later, Juan.
[Qemu-devel] pSeries build breakage
Hello, Building QEMU HEAD (347ac8e35661eff1c2b5ec74d11ee152f2a61856 target- i386: switch to softfloat) on OSX/ppc64 results in: [...] LINK arm-softmmu/qemu-system-arm make: *** pc-bios/spapr-rtas: No such file or directory. Stop. make: *** [romsubdir-spapr-rtas] Error 2 Could this be a VPATH issue? The source pc-bios dir does have such a directory but not the build dir. Regards, Andreas
[Qemu-devel] [Bug 770173] Re: /etc/qemu-ifup is not executed
That's not what is written in documentation. http://www.linux- kvm.org/page/Networking) makes clear that /etc/qemu-ifup is executed by qemu to create a tap interface. My script /etc/qemu-ifup-sudo is based on the doc's one and my user has the ability to create tap devices using sudo. In fact, a device is created in the first post if the script is called manually. If the bug is in the documentation and we must create tap devices before calling qemu, where is the best place to discover the first non-existent tapX device and create it? -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/770173 Title: /etc/qemu-ifup is not executed Status in QEMU: Invalid Bug description: The following does not work: $ qemu -m 512 -drive file=arch_min.qcow2,if=virtio,boot=on -nographic -net nic,model=virtio -net tap,script=/etc/qemu-ifup warning: could not configure /dev/net/tun: no virtual network emulation However, this works: $ /etc/qemu-ifup tap0 $ kvm -m 512 -drive file=arch_min.qcow2,if=virtio,boot=on -nographic -net nic,model=virtio -net tap,ifname=tap0,script=no,downscript=no $ /etc/qemu-ifdown tap0 Other info: - qemu 0.12.5 - ubuntu 10.10 $ ls -l /etc/qemu-ifup lrwxrwxrwx 1 root root 18 2011-03-26 15:57 /etc/qemu-ifup -> /usr/bin/qemu-ifup* $ cat /etc/qemu-ifup #!/bin/sh #switch=$(/sbin/ip route list | awk '/^default / { print $5 }') #/sbin/ifconfig $1 0.0.0.0 up #/usr/sbin/brctl addif ${switch} $1 set -x switch=br0 if [ -n "$1" ];then /usr/bin/sudo /etc/qemu-ifup-sudo $1 `whoami` exit 0 else echo "Error: no interface specified" exit 1 fi $ cat /etc/qemu-ifup-sudo #!/bin/sh set -x switch=br0 /usr/sbin/tunctl -u $2 -t $1 /usr/bin/sudo /sbin/ip link set $1 up sleep 0.5s /usr/bin/sudo /usr/sbin/brctl addif $switch $1
Re: [Qemu-devel] [RFC PATCH 0/3 V8] QAPI: add inject-nmi qmp command
On 04/20/2011 01:19 AM, Lai Jiangshan wrote: These patches are applied for "http://repo.or.cz/r/qemu/aliguori.git glib". These patches add QAPI inject-nmi. They are passed checkpatch.pl and the build. But the result qemu executable file is not tested, because the result qemu of "http://repo.or.cz/r/qemu/aliguori.git glib" can't work in my box. What issues are you seeing using the binary from the glib tree? AFAIK that tree should be functional, except potentially with TCG. I've only been using it with KVM and --enable-io-thread though so don't know for sure. Lai Jiangshan (3): QError: Introduce QERR_UNSUPPORTED qapi,nmi: add inject-nmi qmp command qapi-hmp: Convert HMP nmi to use QMP hmp-commands.hx | 18 -- hmp.c| 12 hmp.h|1 + monitor.c| 14 -- qapi-schema.json | 12 qerror.c |4 qerror.h |3 +++ qmp.c| 17 + 8 files changed, 57 insertions(+), 24 deletions(-)
[Qemu-devel] [PATCH] Fix bug with virtio-9p fsync
v9fs_fsync and possibly others break when asked to operate on a directory. It does not check fid_type to see if it is operating on a directory and therefore accesses the wrong element of the fs union. This error can result in guest applications failing (in my case it was dpkg). This patch fixes the issue, although there may be other, similar bugs in virtio-9p. --- hw/virtio-9p.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c index 7e29535..09fb5da 100644 --- a/hw/virtio-9p.c +++ b/hw/virtio-9p.c @@ -1875,7 +1875,10 @@ static void v9fs_fsync(V9fsState *s, V9fsPDU *pdu) v9fs_post_do_fsync(s, pdu, err); return; } -err = v9fs_do_fsync(s, fidp->fs.fd, datasync); +if (fidp->fid_type == P9_FID_DIR) +err = v9fs_do_fsync(s, dirfd(fidp->fs.dir), datasync); +else +err = v9fs_do_fsync(s, fidp->fs.fd, datasync); v9fs_post_do_fsync(s, pdu, err); } -- 1.7.0.4
[Qemu-devel] [Bug 770173] Re: /etc/qemu-ifup is not executed
/etc/qemu-ifup is read if qemu is launched with sudo (in spite of errors like "TUNSETIFF: Device or resource busy", it works). Shouldn't qemu execute it when run by a normal user with enough privileges? -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/770173 Title: /etc/qemu-ifup is not executed Status in QEMU: Invalid Bug description: The following does not work: $ qemu -m 512 -drive file=arch_min.qcow2,if=virtio,boot=on -nographic -net nic,model=virtio -net tap,script=/etc/qemu-ifup warning: could not configure /dev/net/tun: no virtual network emulation However, this works: $ /etc/qemu-ifup tap0 $ kvm -m 512 -drive file=arch_min.qcow2,if=virtio,boot=on -nographic -net nic,model=virtio -net tap,ifname=tap0,script=no,downscript=no $ /etc/qemu-ifdown tap0 Other info: - qemu 0.12.5 - ubuntu 10.10 $ ls -l /etc/qemu-ifup lrwxrwxrwx 1 root root 18 2011-03-26 15:57 /etc/qemu-ifup -> /usr/bin/qemu-ifup* $ cat /etc/qemu-ifup #!/bin/sh #switch=$(/sbin/ip route list | awk '/^default / { print $5 }') #/sbin/ifconfig $1 0.0.0.0 up #/usr/sbin/brctl addif ${switch} $1 set -x switch=br0 if [ -n "$1" ];then /usr/bin/sudo /etc/qemu-ifup-sudo $1 `whoami` exit 0 else echo "Error: no interface specified" exit 1 fi $ cat /etc/qemu-ifup-sudo #!/bin/sh set -x switch=br0 /usr/sbin/tunctl -u $2 -t $1 /usr/bin/sudo /sbin/ip link set $1 up sleep 0.5s /usr/bin/sudo /usr/sbin/brctl addif $switch $1
Re: [Qemu-devel] [PATCH v2 10/11] trace-state: [stderr] add support for dynamically enabling/disabling events
On 04/25/2011 12:27 PM, Lluís wrote: But in any case, I'm still not sure if stderr should have programatic tracing state controls. Yes, please, stderr is even more useful than simple when you're using it under gdb. Paolo
Re: [Qemu-devel] [PATCH v2 0/3] io-thread optimizations
On Thu, Apr 14, 2011 at 09:14:35AM +0200, Jan Kiszka wrote: > On 2011-04-13 22:16, Aurelien Jarno wrote: > > On Mon, Apr 11, 2011 at 10:27:41PM +0200, Jan Kiszka wrote: > >> These patches were posted before. They bring down the overhead of the > >> io-thread mode for TCG here, specifically when emulating SMP. > >> > >> The major change in this version, besides rebasing, is the exclusion of > >> KVM from the main loop polling optimization. > >> > >> > >> > >> Jan Kiszka (3): > >> Do not drop global mutex for polled main loop runs > >> Poll main loop after I/O events were received > >> Do not kick vcpus in TCG mode > >> > >> cpus.c |2 +- > >> sysemu.h |2 +- > >> vl.c | 22 -- > >> 3 files changed, 18 insertions(+), 8 deletions(-) > >> > > > > Thanks for working on improving the io-thread with TCG. Your patches > > make sense, but they don't seems to fix the slowdown observed when > > enabling the io-thread. Well maybe they were not supposed to. This is > > for example the results of netperf between guest and host using virtio: > > > > no io-thread122 MB/s > > io-thread97 MB/s > > io-thread + patches 98 MB/s > > > > Can you capture ftraces of io-thread enabled & disabled runs? They just > need to cover a hand full of frames. > >From what I have been able to get from the ftraces documentation, it's possible multiple tracers. Which tracers would you like to use there? The best would be a set of command lines to run. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
Re: [Qemu-devel] [PATCH] doc: fix slirp description
On Sun, Apr 24, 2011 at 05:19:56PM +1000, Brad Hards wrote: > net/slirp.c says: > /* default settings according to historic slirp */ > struct in_addr net = { .s_addr = htonl(0x0a000200) }; /* 10.0.2.0 */ > struct in_addr mask = { .s_addr = htonl(0xff00) }; /* 255.255.255.0 */ > struct in_addr host = { .s_addr = htonl(0x0a000202) }; /* 10.0.2.2 */ > struct in_addr dhcp = { .s_addr = htonl(0x0a00020f) }; /* 10.0.2.15 */ > struct in_addr dns = { .s_addr = htonl(0x0a000203) }; /* 10.0.2.3 */ > > Which I think is not what the documentation says. > > Signed-off-by: Brad Hards > --- > qemu-options.hx |4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) Thanks, applied. > diff --git a/qemu-options.hx b/qemu-options.hx > index 677c550..489df10 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -1152,7 +1152,7 @@ Assign symbolic name for use in monitor commands. > @item net=@var{addr}[/@var{mask}] > Set IP network address the guest will see. Optionally specify the netmask, > either in the form a.b.c.d or as number of valid top-most bits. Default is > -10.0.2.0/8. > +10.0.2.0/24. > > @item host=@var{addr} > Specify the guest-visible address of the host. Default is the 2nd IP in the > @@ -1168,7 +1168,7 @@ Specifies the client hostname reported by the builtin > DHCP server. > > @item dhcpstart=@var{addr} > Specify the first of the 16 IPs the built-in DHCP server can assign. Default > -is the 16th to 31st IP in the guest network, i.e. x.x.x.16 to x.x.x.31. > +is the 15th to 31st IP in the guest network, i.e. x.x.x.15 to x.x.x.31. > > @item dns=@var{addr} > Specify the guest-visible address of the virtual nameserver. The address must > -- > 1.7.1 > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
Re: [Qemu-devel] [PATCH] target-arm: Minimal implementation of performance counters
On Thu, Apr 21, 2011 at 05:01:48PM +0100, Peter Maydell wrote: > Newer Linux kernels assume the existence of the performance counter > cp15 registers. Provide a minimal implementation of these registers. > We support no events. This should be compliant with the ARM ARM, > except that we don't implement the cycle counter. > > Signed-off-by: Peter Maydell > --- > This is the last fix required to be able to boot a stock Linaro > versatile express image on upstream QEMU... > > target-arm/cpu.h |8 ++- > target-arm/helper.c| 159 > > target-arm/machine.c | 12 > target-arm/translate.c | 20 ++- > 4 files changed, 183 insertions(+), 16 deletions(-) > > diff --git a/target-arm/cpu.h b/target-arm/cpu.h > index d5af644..b8e7419 100644 > --- a/target-arm/cpu.h > +++ b/target-arm/cpu.h > @@ -129,6 +129,12 @@ typedef struct CPUARMState { > uint32_t c7_par; /* Translation result. */ > uint32_t c9_insn; /* Cache lockdown registers. */ > uint32_t c9_data; > +uint32_t c9_pmcr; /* performance monitor control register */ > +uint32_t c9_pmcnten; /* perf monitor counter enables */ > +uint32_t c9_pmovsr; /* perf monitor overflow status */ > +uint32_t c9_pmxevtyper; /* perf monitor event type */ > +uint32_t c9_pmuserenr; /* perf monitor user enable */ > +uint32_t c9_pminten; /* perf monitor interrupt enables */ > uint32_t c13_fcse; /* FCSE PID. */ > uint32_t c13_context; /* Context ID. */ > uint32_t c13_tls1; /* User RW Thread register. */ > @@ -434,7 +440,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum, > #define cpu_signal_handler cpu_arm_signal_handler > #define cpu_list arm_cpu_list > > -#define CPU_SAVE_VERSION 3 > +#define CPU_SAVE_VERSION 4 > > /* MMU modes definitions */ > #define MMU_MODE0_SUFFIX _kernel > diff --git a/target-arm/helper.c b/target-arm/helper.c > index 62ae72e..b051b8c 100644 > --- a/target-arm/helper.c > +++ b/target-arm/helper.c > @@ -270,6 +270,10 @@ void cpu_reset(CPUARMState *env) > } > env->vfp.xregs[ARM_VFP_FPEXC] = 0; > env->cp15.c2_base_mask = 0xc000u; > +/* v7 performance monitor control register: same implementor > + * field as main ID register, and we implement no event counters. > + */ > +env->cp15.c9_pmcr = (id & 0xff00); > #endif > set_flush_to_zero(1, &env->vfp.standard_fp_status); > set_flush_inputs_to_zero(1, &env->vfp.standard_fp_status); > @@ -1587,6 +1591,81 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, > uint32_t val) > case 1: /* TCM memory region registers. */ > /* Not implemented. */ > goto bad_reg; > +case 12: /* Performance monitor control */ > +/* Performance monitors are implementation defined in v7, > + * but with an ARM recommended set of registers, which we > + * follow (although we don't actually implement any counters) > + */ > +if (!arm_feature(env, ARM_FEATURE_V7)) { > +goto bad_reg; > +} > +switch (op2) { > +case 0: /* performance monitor control register */ > +/* only the DP, X, D and E bits are writable */ > +env->cp15.c9_pmcr &= ~0x39; > +env->cp15.c9_pmcr |= (val & 0x39); > +break; > +case 1: /* Count enable set register */ > +val &= (1 << 31); > +env->cp15.c9_pmcnten |= val; > +break; > +case 2: /* Count enable clear */ > +val &= (1 << 31); > +env->cp15.c9_pmcnten &= ~val; > +break; > +case 3: /* Overflow flag status */ > +env->cp15.c9_pmovsr &= ~val; > +break; > +case 4: /* Software increment */ > +/* RAZ/WI since we don't implement the software-count event > */ > +break; > +case 5: /* Event counter selection register */ > +/* Since we don't implement any events, writing to this > register > + * is actually UNPREDICTABLE. So we choose to RAZ/WI. > + */ > +break; > +default: > +goto bad_reg; > +} > +break; > +case 13: /* Performance counters */ > +if (!arm_feature(env, ARM_FEATURE_V7)) { > +goto bad_reg; > +} > +switch (op2) { > +case 0: /* Cycle count register: not implemented, so RAZ/WI */ > +break; > +case 1: /* Event type select */ > +env->cp15.c9_pmxevtyper = val & 0xff; > +break; > +case 2: /* Event count register */ > +/* Unimplemented (we have no events), RAZ/WI */ > +br
Re: [Qemu-devel] [RFC][PATCH] configure: target dependent linking
On Thu, Apr 14, 2011 at 11:14:58PM +0200, Michael Walle wrote: > This patch is the first attempt to make configure more intelligent with > regard to how it links to libraries. It divides the softmmu libraries into > two lists, a general one and a list which depends on the target > architecture. > > --- > configure | 12 +--- > 1 files changed, 9 insertions(+), 3 deletions(-) This looks fine to me. Reviewed-by: Aurelien Jarno > diff --git a/configure b/configure > index da2da04..9825b12 100755 > --- a/configure > +++ b/configure > @@ -1946,11 +1946,11 @@ int main(void) { return 0; } > EOF >if compile_prog "" "$fdt_libs" ; then > fdt=yes > -libs_softmmu="$fdt_libs $libs_softmmu" >else > if test "$fdt" = "yes" ; then >feature_not_found "fdt" > fi > +fdt_libs= > fdt=no >fi > fi > @@ -1967,11 +1967,11 @@ int main(void) { GL_VERSION; return 0; } > EOF >if compile_prog "" "-lGL" ; then > opengl=yes > - libs_softmmu="$opengl_libs $libs_softmmu" >else > if test "$opengl" = "yes" ; then >feature_not_found "opengl" > fi > +opengl_libs= > opengl=no >fi > fi > @@ -3071,6 +3071,7 @@ target_short_alignment=2 > target_int_alignment=4 > target_long_alignment=4 > target_llong_alignment=8 > +target_libs_softmmu= > > TARGET_ARCH="$target_arch2" > TARGET_BASE_ARCH="" > @@ -3104,6 +3105,7 @@ case "$target_arch2" in >;; >lm32) > target_phys_bits=32 > +target_libs_softmmu="$opengl_libs" >;; >m68k) > bflt="yes" > @@ -3142,6 +3144,7 @@ case "$target_arch2" in > gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml > power-spe.xml" > target_phys_bits=32 > target_nptl="yes" > +target_libs_softmmu="$fdt_libs" >;; >ppcemb) > TARGET_BASE_ARCH=ppc > @@ -3149,6 +3152,7 @@ case "$target_arch2" in > gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml > power-spe.xml" > target_phys_bits=64 > target_nptl="yes" > +target_libs_softmmu="$fdt_libs" >;; >ppc64) > TARGET_BASE_ARCH=ppc > @@ -3156,6 +3160,7 @@ case "$target_arch2" in > gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml > power-spe.xml" > target_phys_bits=64 > target_long_alignment=8 > +target_libs_softmmu="$fdt_libs" >;; >ppc64abi32) > TARGET_ARCH=ppc64 > @@ -3164,6 +3169,7 @@ case "$target_arch2" in > echo "TARGET_ABI32=y" >> $config_target_mak > gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml > power-spe.xml" > target_phys_bits=64 > +target_libs_softmmu="$fdt_libs" >;; >sh4|sh4eb) > TARGET_ARCH=sh4 > @@ -3249,7 +3255,7 @@ fi > if test "$target_softmmu" = "yes" ; then >echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak >echo "CONFIG_SOFTMMU=y" >> $config_target_mak > - echo "LIBS+=$libs_softmmu" >> $config_target_mak > + echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak >echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak >echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak > fi > -- > 1.7.2.3 > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
Re: [Qemu-devel] [PATCH] linux-user/arm/nwfpe: rename REG_PC to ARM_REG_PC
On Wed, Apr 20, 2011 at 11:19:15AM +0100, Peter Maydell wrote: > The REG_PC constant used in the ARM nwfpe code is fine in the kernel > but when used in qemu can clash with a definition in the host system > include files (in particular on Ubuntu Lucid SPARC, including signal.h > will define a REG_PC). Rename the constant to avoid this issue. > > Signed-off-by: Peter Maydell > --- > linux-user/arm/nwfpe/fpa11.c |2 +- > linux-user/arm/nwfpe/fpa11.h |2 +- > linux-user/arm/nwfpe/fpa11_cpdt.c |8 > 3 files changed, 6 insertions(+), 6 deletions(-) Thanks, applied. > diff --git a/linux-user/arm/nwfpe/fpa11.c b/linux-user/arm/nwfpe/fpa11.c > index 0a87c43..eebd93f 100644 > --- a/linux-user/arm/nwfpe/fpa11.c > +++ b/linux-user/arm/nwfpe/fpa11.c > @@ -144,7 +144,7 @@ unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, > CPUARMState* qregs) > > #if 0 >fprintf(stderr,"emulating FP insn 0x%08x, PC=0x%08x\n", > - opcode, qregs[REG_PC]); > + opcode, qregs[ARM_REG_PC]); > #endif >fpa11 = GET_FPA11(); > > diff --git a/linux-user/arm/nwfpe/fpa11.h b/linux-user/arm/nwfpe/fpa11.h > index f17647b..002b3cb 100644 > --- a/linux-user/arm/nwfpe/fpa11.h > +++ b/linux-user/arm/nwfpe/fpa11.h > @@ -111,7 +111,7 @@ static inline void writeConditionCodes(unsigned int x) > cpsr_write(user_registers,x,CPSR_NZCV); > } > > -#define REG_PC 15 > +#define ARM_REG_PC 15 > > unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* > qregs); > > diff --git a/linux-user/arm/nwfpe/fpa11_cpdt.c > b/linux-user/arm/nwfpe/fpa11_cpdt.c > index b12e27d..3e7a938 100644 > --- a/linux-user/arm/nwfpe/fpa11_cpdt.c > +++ b/linux-user/arm/nwfpe/fpa11_cpdt.c > @@ -220,7 +220,7 @@ static unsigned int PerformLDF(const unsigned int opcode) > //printk("PerformLDF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode)); > > pBase = readRegister(getRn(opcode)); > - if (REG_PC == getRn(opcode)) > + if (ARM_REG_PC == getRn(opcode)) > { > pBase += 8; > write_back = 0; > @@ -256,7 +256,7 @@ static unsigned int PerformSTF(const unsigned int opcode) > SetRoundingMode(ROUND_TO_NEAREST); > > pBase = readRegister(getRn(opcode)); > - if (REG_PC == getRn(opcode)) > + if (ARM_REG_PC == getRn(opcode)) > { > pBase += 8; > write_back = 0; > @@ -289,7 +289,7 @@ static unsigned int PerformLFM(const unsigned int opcode) > target_ulong pBase, pAddress, pFinal; > > pBase = readRegister(getRn(opcode)); > - if (REG_PC == getRn(opcode)) > + if (ARM_REG_PC == getRn(opcode)) > { > pBase += 8; > write_back = 0; > @@ -322,7 +322,7 @@ static unsigned int PerformSFM(const unsigned int opcode) > target_ulong pBase, pAddress, pFinal; > > pBase = readRegister(getRn(opcode)); > - if (REG_PC == getRn(opcode)) > + if (ARM_REG_PC == getRn(opcode)) > { > pBase += 8; > write_back = 0; > -- > 1.7.1 > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
Re: [Qemu-devel] [PATCH 1/3] rtl8139: use TARGET_FMT_plx in debug messages
On Wed, Apr 20, 2011 at 07:39:00PM -0400, Benjamin Poirier wrote: > Prevents a compilation failure when DEBUG_RTL8139 is defined: > > CClibhw32/rtl8139.o > cc1: warnings being treated as errors > hw/rtl8139.c: In function ‘rtl8139_cplus_transmit_one’: > hw/rtl8139.c:1960: error: format ‘%8lx’ expects type ‘long unsigned int’, but > argument 5 has type ‘target_phys_addr_t’ > make[1]: *** [rtl8139.o] Error 1 > > Signed-off-by: Benjamin Poirier > Cc: Igor V. Kovalenko > --- > hw/rtl8139.c | 15 +-- > 1 files changed, 9 insertions(+), 6 deletions(-) Thanks, all applied. > diff --git a/hw/rtl8139.c b/hw/rtl8139.c > index d545933..9a759e7 100644 > --- a/hw/rtl8139.c > +++ b/hw/rtl8139.c > @@ -978,8 +978,9 @@ static ssize_t rtl8139_do_receive(VLANClientState *nc, > const uint8_t *buf, size_ > cplus_rx_ring_desc = rtl8139_addr64(s->RxRingAddrLO, > s->RxRingAddrHI); > cplus_rx_ring_desc += 16 * descriptor; > > -DEBUG_PRINT(("RTL8139: +++ C+ mode reading RX descriptor %d from > host memory at %08x %08x = %016" PRIx64 "\n", > - descriptor, s->RxRingAddrHI, s->RxRingAddrLO, > (uint64_t)cplus_rx_ring_desc)); > +DEBUG_PRINT(("RTL8139: +++ C+ mode reading RX descriptor %d from " > +"host memory at %08x %08x = " TARGET_FMT_plx "\n", > descriptor, > +s->RxRingAddrHI, s->RxRingAddrLO, cplus_rx_ring_desc)); > > uint32_t val, rxdw0,rxdw1,rxbufLO,rxbufHI; > > @@ -1957,8 +1958,9 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s) > /* Normal priority ring */ > cplus_tx_ring_desc += 16 * descriptor; > > -DEBUG_PRINT(("RTL8139: +++ C+ mode reading TX descriptor %d from host > memory at %08x0x%08x = 0x%8lx\n", > - descriptor, s->TxAddr[1], s->TxAddr[0], cplus_tx_ring_desc)); > +DEBUG_PRINT(("RTL8139: +++ C+ mode reading TX descriptor %d from host " > +"memory at %08x0x%08x = 0x" TARGET_FMT_plx "\n", descriptor, > +s->TxAddr[1], s->TxAddr[0], cplus_tx_ring_desc)); > > uint32_t val, txdw0,txdw1,txbufLO,txbufHI; > > @@ -2069,8 +2071,9 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s) > > /* append more data to the packet */ > > -DEBUG_PRINT(("RTL8139: +++ C+ mode transmit reading %d bytes from host > memory at %016" PRIx64 " to offset %d\n", > - txsize, (uint64_t)tx_addr, s->cplus_txbuffer_offset)); > +DEBUG_PRINT(("RTL8139: +++ C+ mode transmit reading %d bytes from host " > +"memory at " TARGET_FMT_plx " to offset %d\n", txsize, tx_addr, > +s->cplus_txbuffer_offset)); > > cpu_physical_memory_read(tx_addr, s->cplus_txbuffer + > s->cplus_txbuffer_offset, txsize); > s->cplus_txbuffer_offset += txsize; > -- > 1.7.4.1 > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
Re: [Qemu-devel] [PATCH]fix ambiguity in "-d op_opt"
On Mon, Apr 25, 2011 at 05:41:24PM +0800, qemu_wanghuang wrote: > In Ful-system emulation, when we use "-d op_opt",we can not find the pc of > guestinstruction in logfile.However,we can get this in log by using command > "-d op". It is funny that when we use "-d op,op_opt",we get pc in both op's > log and op_opt's log.It makes the command "-d op_opt" ambiguous. Please add a Signed-off-by: line to your patch. > wanghuang:ustc > > Index: target-cris/translate_v10.c > === > --- target-cris/translate_v10.c (版本 2) > +++ target-cris/translate_v10.c (工作副本) > @@ -1150,7 +1150,8 @@ > > if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) > tcg_gen_debug_insn_start(dc->pc); > - > +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) > +tcg_gen_debug_insn_start(dc->pc); Instead of adding some more code doing the same, you should use something like: qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT) > /* Load a halfword onto the instruction register. */ > dc->ir = lduw_code(dc->pc); > > Index: target-cris/translate.c > === > --- target-cris/translate.c (版本 2) > +++ target-cris/translate.c (工作副本) > @@ -3082,7 +3082,8 @@ > > if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) >tcg_gen_debug_insn_start(dc->pc); > - > +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) > +tcg_gen_debug_insn_start(dc->pc); > /* Load a halfword onto the instruction register. */ > dc->ir = cris_fetch(dc, dc->pc, 2, 0); > > Index: target-alpha/translate.c > === > --- target-alpha/translate.c (版本 2) > +++ target-alpha/translate.c (工作副本) > @@ -3207,6 +3207,8 @@ > if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) { > tcg_gen_debug_insn_start(ctx.pc); > } > +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) > +tcg_gen_debug_insn_start(ctx.pc); > > ctx.pc += 4; > ret = translate_one(ctxp, insn); > Index: target-sparc/translate.c > === > --- target-sparc/translate.c (版本 2) > +++ target-sparc/translate.c (工作副本) > @@ -1873,6 +1873,8 @@ > > if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) > tcg_gen_debug_insn_start(dc->pc); > +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) > +tcg_gen_debug_insn_start(dc->pc); > insn = ldl_code(dc->pc); > opc = GET_FIELD(insn, 0, 1); > > Index: target-ppc/translate.c > === > --- target-ppc/translate.c (版本 2) > +++ target-ppc/translate.c (工作副本) > @@ -9036,6 +9036,8 @@ > opc3(ctx.opcode), little_endian ? "little" : "big"); > if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) > tcg_gen_debug_insn_start(ctx.nip); > +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) > +tcg_gen_debug_insn_start(ctx.nip); > ctx.nip += 4; > table = env->opcodes; > num_insns++; > Index: target-mips/translate.c > === > --- target-mips/translate.c (版本 2) > +++ target-mips/translate.c (工作副本) > @@ -11631,7 +11631,8 @@ > > if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) > tcg_gen_debug_insn_start(ctx->pc); > - > +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) > +tcg_gen_debug_insn_start(ctx->pc); > op = MASK_OP_MAJOR(ctx->opcode); > rs = (ctx->opcode >> 21) & 0x1f; > rt = (ctx->opcode >> 16) & 0x1f; > Index: target-arm/translate.c > === > --- target-arm/translate.c (版本 2) > +++ target-arm/translate.c (工作副本) > @@ -9204,6 +9204,8 @@ > if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) { > tcg_gen_debug_insn_start(dc->pc); > } > +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) > +tcg_gen_debug_insn_start(dc->pc); > > if (dc->thumb) { > disas_thumb_insn(env, dc); > Index: target-microblaze/translate.c > === > --- target-microblaze/translate.c (版本 2) > +++ target-microblaze/translate.c (工作副本) > @@ -1510,7 +1510,8 @@ > > if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) > tcg_gen_debug_insn_start(dc->pc); > - > +else if(unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) > +tcg_gen_debug_insn_start(dc->pc); > dc->ir = ir = ldl_code(dc->pc); > LOG_DIS("%8.8x\t", dc->ir); > > Index: target-i386/translate.c > === > --- target-i386/translate.c (版本 2) > +++ target-i386/translate.c (工作副本) > @@ -4070,6 +4070,8 @@ > > if
Re: [Qemu-devel] virtfs error reporting?
On Sun, Apr 24, 2011 at 2:31 PM, Rob Landley wrote: > So on the host side I'm trying to do this: > > $ qemu -cpu pentium3 -nographic -no-reboot -kernel bzImage \ > -hda hda.sqf -append 'root=/dev/hda rw init=/sbin/init.sh panic=1 \ > PATH=/bin:/sbin console=ttyS0 HOST=i686 ' -net nic,model=e1000 \ > -net user -virtfs > local,path=../root-filesystem-i686,security_model=mapped,mount_tag=root > > And on the guest side I'm trying to do this: > > mount -t 9p -o ro,trans=virtio,version=9p2000.L root /mnt > > And it's saying: > > mount: mounting root on /mnt failed: No such device > Not that I expect this to be the problem (or if it is, I'm not sure of a good reason for it) -- but are you sure this isn't a different case of the same problem you had with a TCP server? In other words, put the root /mnt before the -o: mount -t 9p root /mnt -o ro,trans=virtio,version=9p2000.L -eric
Re: [Qemu-devel] [PATCH 0/2] target-arm: Handle UNDEF cases for Neon load/stores
On Mon, Apr 18, 2011 at 07:07:10PM +0100, Peter Maydell wrote: > These two simple patches make qemu correctly UNDEF where required in the > Neon load/store space. We also catch and UNDEF on an UNPREDICTABLE rather > than indexing off the end of the register file. > > Tested in the usual way with random instruction sequences. > > Peter Maydell (2): > target-arm: Handle UNDEFs for Neon single element load/stores > target-arm: Handle UNDEF cases for Neon VLD/VST multiple-structures > > target-arm/translate.c | 49 > > 1 files changed, 49 insertions(+), 0 deletions(-) > Thanks, both applied. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
Re: [Qemu-devel] tcg/tcg.c:1892: tcg fatal error
On Fri, Apr 22, 2011 at 06:14:06PM +0400, Igor Kovalenko wrote: > On Fri, Apr 22, 2011 at 2:39 AM, Laurent Desnogues > wrote: > > On Thu, Apr 21, 2011 at 9:45 PM, Igor Kovalenko > > wrote: > >> On Thu, Apr 21, 2011 at 7:44 PM, Laurent Desnogues > >> wrote: > >>> On Thu, Apr 21, 2011 at 4:57 PM, Artyom Tarasenko > >>> wrote: > On Tue, Apr 12, 2011 at 4:14 AM, Igor Kovalenko > wrote: > >>> Do you have public test case? > >>> It is possible to code this delay slot write test but real issue may > >>> be corruption elsewhere. > > The test case is trivial: it's just the two instructions, branch and > wrpr. > > > In theory there could be multiple issues including compiler induced > > ones. > > I'd prefer to see some kind of reproducible testcase. > > Ok, attached a 40 byte long test (the first 32 bytes are not used and > needed only because the bios entry point is 0x20). > > $ git pull && make && sparc64-softmmu/qemu-system-sparc64 -bios > test-wrpr.bin -nographic > Already up-to-date. > make[1]: Nothing to be done for `all'. > /mnt/terra/projects/vanilla/qemu/tcg/tcg.c:1892: tcg fatal error > Aborted > >>> > >>> The problem seems to be that wrpr is using a non-local > >>> TCG tmp (cpu_tmp0). > >> > >> Just tried the test case with write to %pil - seems like write itself is > >> OK. > >> The issue appears to be with save_state() call since adding save_state > >> to %pil case provokes the same tcg abort. > > > > The problem is that cpu_tmp0, not being a local tmp, doesn't > > need to be saved across helper calls. This results in the > > TCG "optimizer" getting rid of it even though it's later used. > > Look at the log and you'll see what I mean :-) > > I'm not very comfortable with tcg yet. Would it be possible to teach > optimizer working with delay slots? Or do I look in the wrong place. > The problem is not on the TCG side, but on the target-sparc/translate.c side: |case 0x32: /* wrwim, V9 wrpr */ | { | if (!supervisor(dc)) | goto priv_insn; | tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); | #ifdef TARGET_SPARC64 Here cpu_tmp0 is loaded. cpu_tmp0 is a TCG temp, which means it is not saved across TCG branches. [...] | case 6: // pstate | save_state(dc, cpu_cond); | gen_helper_wrpstate(cpu_tmp0); | dc->npc = DYNAMIC_PC; | break; save_state() calls save_npc(), which in turns might call gen_generic_branch(): | static inline void gen_generic_branch(target_ulong npc1, target_ulong npc2, | TCGv r_cond) | { | int l1, l2; | | l1 = gen_new_label(); | l2 = gen_new_label(); | | tcg_gen_brcondi_tl(TCG_COND_EQ, r_cond, 0, l1); | | tcg_gen_movi_tl(cpu_npc, npc1); | tcg_gen_br(l2); | | gen_set_label(l1); | tcg_gen_movi_tl(cpu_npc, npc2); | gen_set_label(l2); | } And here is the TCG branch, which drop the TCG temp cpu_temp0. The solution is either to rewrite gen_generic_branch() without TCG branches, or to use a TCG temp local instead of a TCG temp. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
Re: [Qemu-devel] [RFC][PATCH] configure: target dependent linking
Am Montag 25 April 2011, 22:04:58 schrieb Aurelien Jarno: > On Thu, Apr 14, 2011 at 11:14:58PM +0200, Michael Walle wrote: > > This patch is the first attempt to make configure more intelligent with > > regard to how it links to libraries. It divides the softmmu libraries > > into two lists, a general one and a list which depends on the target > > architecture. > > > > --- > > > > configure | 12 +--- > > 1 files changed, 9 insertions(+), 3 deletions(-) > > This looks fine to me. > > Reviewed-by: Aurelien Jarno Ok, the next question is, what libs are target dependent. Or should we just start with lm32 (opengl) and ppc? @alex: could you comment on the libs, which are only used for ppc, only fdt? -- Michael
Re: [Qemu-devel] [RFC][PATCH] configure: target dependent linking
On 25.04.2011, at 23:44, Michael Walle wrote: > Am Montag 25 April 2011, 22:04:58 schrieb Aurelien Jarno: >> On Thu, Apr 14, 2011 at 11:14:58PM +0200, Michael Walle wrote: >>> This patch is the first attempt to make configure more intelligent with >>> regard to how it links to libraries. It divides the softmmu libraries >>> into two lists, a general one and a list which depends on the target >>> architecture. >>> >>> --- >>> >>> configure | 12 +--- >>> 1 files changed, 9 insertions(+), 3 deletions(-) >> >> This looks fine to me. >> >> Reviewed-by: Aurelien Jarno > > Ok, the next question is, what libs are target dependent. Or should we just > start with lm32 (opengl) and ppc? That's a really good start :). > @alex: could you comment on the libs, which are only used for ppc, only fdt? For now, let's leave it at that :). Can't think of any others OTOH, but maybe I'm missing something - which could easily be added later on then :). Alex
Re: [Qemu-devel] [PATCH] target-arm: Minimal implementation of performance counters
On 25 April 2011 22:09, Aurelien Jarno wrote: > On Thu, Apr 21, 2011 at 05:01:48PM +0100, Peter Maydell wrote: >> + tb_flush(env); > > If you flush all tbs, you also have to ensure that on the translate.c > side, this is the last instruction of the tb. Otherwise, the rest of the > TB will be executed with the wrong access rights. This is OK, because we can't get here unless we're in privileged mode (PMUSERENR is never writable in user mode), and changing PMUSERENR doesn't affect the access rights for privileged mode. And a switch into user mode will be a change of TB anyway. (Compare the handling of the TEECR, which also doesn't need to change TB after a tb_flush(), for the same reasons.) > Instead of having this complex test for all cp15 access, but only for > catching a few access to performance registers, wouldn't it make more > sense to have this test and an exception triggering directly in > helper.c? That was what my first design did, but in discussions on IRC with Paul Brook he basically said that you can't generate an exception in the helper routine, you have to either generate runtime code to do the test or throw away the TBs. Unfortunately I forget the exact rationale, so I've cc'd Paul to remind me :-) On the subject of complexity: I have vague plans for overhauling the cp15 support code anyway, so you can effectively register handler functions for the cp15 registers you care about rather than having to have one enormous function full of nested case statements. You could then have the access checking code not so wildly far away from the register read/write implementation. (Plus we need support for banked cp15 registers at some point.) -- PMM
[Qemu-devel] [PATCH 2/2] configure: reenable opengl by default
Because the opengl library is only linked to for the lm32 target, we can now safely enable opengl by default again. Signed-off-by: Michael Walle --- configure |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/configure b/configure index 9825b12..6c131dd 100755 --- a/configure +++ b/configure @@ -177,7 +177,7 @@ spice="" rbd="" smartcard="" smartcard_nss="" -opengl="no" +opengl="" # parse CC options first for opt do -- 1.7.2.3
[Qemu-devel] [PATCH 1/2] configure: support target dependent linking
This patch is the first attempt to make configure more intelligent with regard to how it links to libraries. It divides the softmmu libraries into two lists, a general one and a list which depends on the target architecture. Signed-off-by: Michael Walle Reviewed-by: Aurelien Jarno --- configure | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/configure b/configure index da2da04..9825b12 100755 --- a/configure +++ b/configure @@ -1946,11 +1946,11 @@ int main(void) { return 0; } EOF if compile_prog "" "$fdt_libs" ; then fdt=yes -libs_softmmu="$fdt_libs $libs_softmmu" else if test "$fdt" = "yes" ; then feature_not_found "fdt" fi +fdt_libs= fdt=no fi fi @@ -1967,11 +1967,11 @@ int main(void) { GL_VERSION; return 0; } EOF if compile_prog "" "-lGL" ; then opengl=yes - libs_softmmu="$opengl_libs $libs_softmmu" else if test "$opengl" = "yes" ; then feature_not_found "opengl" fi +opengl_libs= opengl=no fi fi @@ -3071,6 +3071,7 @@ target_short_alignment=2 target_int_alignment=4 target_long_alignment=4 target_llong_alignment=8 +target_libs_softmmu= TARGET_ARCH="$target_arch2" TARGET_BASE_ARCH="" @@ -3104,6 +3105,7 @@ case "$target_arch2" in ;; lm32) target_phys_bits=32 +target_libs_softmmu="$opengl_libs" ;; m68k) bflt="yes" @@ -3142,6 +3144,7 @@ case "$target_arch2" in gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" target_phys_bits=32 target_nptl="yes" +target_libs_softmmu="$fdt_libs" ;; ppcemb) TARGET_BASE_ARCH=ppc @@ -3149,6 +3152,7 @@ case "$target_arch2" in gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" target_phys_bits=64 target_nptl="yes" +target_libs_softmmu="$fdt_libs" ;; ppc64) TARGET_BASE_ARCH=ppc @@ -3156,6 +3160,7 @@ case "$target_arch2" in gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" target_phys_bits=64 target_long_alignment=8 +target_libs_softmmu="$fdt_libs" ;; ppc64abi32) TARGET_ARCH=ppc64 @@ -3164,6 +3169,7 @@ case "$target_arch2" in echo "TARGET_ABI32=y" >> $config_target_mak gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" target_phys_bits=64 +target_libs_softmmu="$fdt_libs" ;; sh4|sh4eb) TARGET_ARCH=sh4 @@ -3249,7 +3255,7 @@ fi if test "$target_softmmu" = "yes" ; then echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak echo "CONFIG_SOFTMMU=y" >> $config_target_mak - echo "LIBS+=$libs_softmmu" >> $config_target_mak + echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak fi -- 1.7.2.3
Re: [Qemu-devel] [PATCH]fix ambiguity in "-d op_opt"
Am Montag 25 April 2011, 11:41:24 schrieb qemu_wanghuang: > In Ful-system emulation, when we use "-d op_opt",we can not find the pc of > guestinstruction in logfile.However,we can get this in log by using > command "-d op". It is funny that when we use "-d op,op_opt",we get pc in > both op's log and op_opt's log.It makes the command "-d op_opt" ambiguous. target-lm32 is missing in this patch. -- Michael
Re: [Qemu-devel] [PATCH 1/2] configure: support target dependent linking
On Tue, Apr 26, 2011 at 12:09:00AM +0200, Michael Walle wrote: > This patch is the first attempt to make configure more intelligent with > regard to how it links to libraries. It divides the softmmu libraries into > two lists, a general one and a list which depends on the target > architecture. Hi, I'm currently traveling and cannot test your patch, but please note that the microblaze arch also uses the fdt lib. Looking at it quickly it seems like it's missing for mb. Cheers
[Qemu-devel] [PATCH v2] configure: support target dependent linking
changes v2 - add libfdt for microblaze targets
[Qemu-devel] [PATCH] configure: support target dependent linking
This patch is the first attempt to make configure more intelligent with regard to how it links to libraries. It divides the softmmu libraries into two lists, a general one and a list which depends on the target architecture. Signed-off-by: Michael Walle Reviewed-by: Aurelien Jarno --- configure | 13 ++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/configure b/configure index da2da04..ca675f6 100755 --- a/configure +++ b/configure @@ -1946,11 +1946,11 @@ int main(void) { return 0; } EOF if compile_prog "" "$fdt_libs" ; then fdt=yes -libs_softmmu="$fdt_libs $libs_softmmu" else if test "$fdt" = "yes" ; then feature_not_found "fdt" fi +fdt_libs= fdt=no fi fi @@ -1967,11 +1967,11 @@ int main(void) { GL_VERSION; return 0; } EOF if compile_prog "" "-lGL" ; then opengl=yes - libs_softmmu="$opengl_libs $libs_softmmu" else if test "$opengl" = "yes" ; then feature_not_found "opengl" fi +opengl_libs= opengl=no fi fi @@ -3071,6 +3071,7 @@ target_short_alignment=2 target_int_alignment=4 target_long_alignment=4 target_llong_alignment=8 +target_libs_softmmu= TARGET_ARCH="$target_arch2" TARGET_BASE_ARCH="" @@ -3104,6 +3105,7 @@ case "$target_arch2" in ;; lm32) target_phys_bits=32 +target_libs_softmmu="$opengl_libs" ;; m68k) bflt="yes" @@ -3118,6 +3120,7 @@ case "$target_arch2" in bflt="yes" target_nptl="yes" target_phys_bits=32 +target_libs_softmmu="$fdt_libs" ;; mips|mipsel) TARGET_ARCH=mips @@ -3142,6 +3145,7 @@ case "$target_arch2" in gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" target_phys_bits=32 target_nptl="yes" +target_libs_softmmu="$fdt_libs" ;; ppcemb) TARGET_BASE_ARCH=ppc @@ -3149,6 +3153,7 @@ case "$target_arch2" in gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" target_phys_bits=64 target_nptl="yes" +target_libs_softmmu="$fdt_libs" ;; ppc64) TARGET_BASE_ARCH=ppc @@ -3156,6 +3161,7 @@ case "$target_arch2" in gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" target_phys_bits=64 target_long_alignment=8 +target_libs_softmmu="$fdt_libs" ;; ppc64abi32) TARGET_ARCH=ppc64 @@ -3164,6 +3170,7 @@ case "$target_arch2" in echo "TARGET_ABI32=y" >> $config_target_mak gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" target_phys_bits=64 +target_libs_softmmu="$fdt_libs" ;; sh4|sh4eb) TARGET_ARCH=sh4 @@ -3249,7 +3256,7 @@ fi if test "$target_softmmu" = "yes" ; then echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak echo "CONFIG_SOFTMMU=y" >> $config_target_mak - echo "LIBS+=$libs_softmmu" >> $config_target_mak + echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak fi -- 1.7.2.3
Re: [Qemu-devel] [PATCH] target-arm: Minimal implementation of performance counters
On Mon, Apr 25, 2011 at 10:59:52PM +0100, Peter Maydell wrote: > On 25 April 2011 22:09, Aurelien Jarno wrote: > > On Thu, Apr 21, 2011 at 05:01:48PM +0100, Peter Maydell wrote: > > >> + tb_flush(env); > > > > If you flush all tbs, you also have to ensure that on the translate.c > > side, this is the last instruction of the tb. Otherwise, the rest of the > > TB will be executed with the wrong access rights. > > This is OK, because we can't get here unless we're in privileged > mode (PMUSERENR is never writable in user mode), and changing > PMUSERENR doesn't affect the access rights for privileged mode. > And a switch into user mode will be a change of TB anyway. > > (Compare the handling of the TEECR, which also doesn't need to change > TB after a tb_flush(), for the same reasons.) Ok, fine then. > > Instead of having this complex test for all cp15 access, but only for > > catching a few access to performance registers, wouldn't it make more > > sense to have this test and an exception triggering directly in > > helper.c? > > That was what my first design did, but in discussions on IRC > with Paul Brook he basically said that you can't generate an > exception in the helper routine, you have to either generate > runtime code to do the test or throw away the TBs. Unfortunately > I forget the exact rationale, so I've cc'd Paul to remind me :-) This is something strange, plenty of targets are raising exceptions from helpers without any problem. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
Re: [Qemu-devel] [PATCH] target-arm: Minimal implementation of performance counters
On 25 April 2011 23:31, Aurelien Jarno wrote: > On Mon, Apr 25, 2011 at 10:59:52PM +0100, Peter Maydell wrote: >> On 25 April 2011 22:09, Aurelien Jarno wrote: >> > Instead of having this complex test for all cp15 access, but only for >> > catching a few access to performance registers, wouldn't it make more >> > sense to have this test and an exception triggering directly in >> > helper.c? >> >> That was what my first design did, but in discussions on IRC >> with Paul Brook he basically said that you can't generate an >> exception in the helper routine, you have to either generate >> runtime code to do the test or throw away the TBs. Unfortunately >> I forget the exact rationale, so I've cc'd Paul to remind me :-) > > This is something strange, plenty of targets are raising exceptions from > helpers without any problem. You'd at minimum need to move the cp15 helper functions to a different file, they're currently in helper.c which doesn't get compiled with access to the global 'env' register. But I got the impression there was something more significant than that. -- PMM
Re: [Qemu-devel] [PATCH] configure: support target dependent linking
On Tue, Apr 26, 2011 at 12:24:07AM +0200, Michael Walle wrote: > This patch is the first attempt to make configure more intelligent with > regard to how it links to libraries. It divides the softmmu libraries into > two lists, a general one and a list which depends on the target > architecture. > > Signed-off-by: Michael Walle > Reviewed-by: Aurelien Jarno Looks good, thanks. Acked-by: Edgar E. Iglesias
[Qemu-devel] [Bug 741887] Re: virsh snapshot-create too slow (kvm, qcow2, savevm)
I had posted a patch to fix the issue before:(http://patchwork.ozlabs.org/patch/64346/), saving memory state is time consuming, which may takes several minutes. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/741887 Title: virsh snapshot-create too slow (kvm, qcow2, savevm) Status in QEMU: New Status in “qemu-kvm” package in Ubuntu: Confirmed Bug description: Action == # time virsh snapshot-create 1 * Taking snapshot of a running KVM virtual machine Result == Domain snapshot 1300983161 created real4m46.994s user0m0.000s sys 0m0.010s Expected result === * Snapshot taken after few seconds instead of minutes. Environment === * Ubuntu Natty Narwhal upgraded from Lucid and Meerkat, fully updated. * Stock natty packages of libvirt and qemu installed (libvirt-bin 0.8.8-1ubuntu5; libvirt0 0.8.8-1ubuntu5; qemu-common 0.14.0+noroms- 0ubuntu3; qemu-kvm 0.14.0+noroms-0ubuntu3). * Virtual machine disk format is qcow2 (debian 5 installed) image: /storage/debian.qcow2 file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 1.2G cluster_size: 65536 Snapshot list: IDTAG VM SIZEDATE VM CLOCK 1 snap01 48M 2011-03-24 09:46:33 00:00:58.899 2 1300979368 58M 2011-03-24 11:09:28 00:01:03.589 3 1300983161 57M 2011-03-24 12:12:41 00:00:51.905 * qcow2 disk is stored on ext4 filesystem, without RAID or LVM or any special setup. * running guest VM takes about 40M RAM from inside, from outside 576M are given to that machine * host has fast dual-core pentium cpu with virtualization support, around 8G of RAM and 7200rpm harddrive (dd from urandom to file gives about 20M/s) * running processes: sshd, atd (empty), crond (empty), libvirtd, tmux, bash, rsyslogd, upstart-socket-bridge, udevd, dnsmasq, iotop (python) * networking is done by bridging and bonding Detail description == * Under root, command 'virsh create-snapshot 1' is issued on booted and running KVM machine with debian inside. * After about four minutes, the process is done. * 'iotop' shows two 'kvm' processes reading/writing to disk. First one has IO around 1500 K/s, second one has around 400 K/s. That takes about three minutes. Then first process grabs about 3 M/s of IO and suddenly dissapears (1-2 sec). Then second process does about 7.5 M/s of IO for around a 1-2 minutes. * Snapshot is successfuly created and is usable for reverting or extracting. * Pretty much the same behaviour occurs when command 'savevm' is issued directly from qemu monitor, without using libvirt at all (actually, virsh snapshot-create just calls 'savevm' to the monitor socket). * This behaviour was observed on lucid, meerkat, natty and even with git version of libvirt (f44bfb7fb978c9313ce050a1c4149bf04aa0a670). Also slowsave packages from https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/524447 gave this issue. Thank you for helping to solve this issue! ProblemType: Bug DistroRelease: Ubuntu 11.04 Package: libvirt-bin 0.8.8-1ubuntu5 ProcVersionSignature: Ubuntu 2.6.38-7.38-server 2.6.38 Uname: Linux 2.6.38-7-server x86_64 Architecture: amd64 Date: Thu Mar 24 12:19:41 2011 InstallationMedia: Ubuntu-Server 10.04.2 LTS "Lucid Lynx" - Release amd64 (20110211.1) ProcEnviron: LANG=en_US.UTF-8 SHELL=/bin/bash SourcePackage: libvirt UpgradeStatus: No upgrade log present (probably fresh install)
[Qemu-devel] Invitation to connect on LinkedIn
LinkedIn Zhai Edwin requested to add you as a connection on LinkedIn: -- Jiajun, I'd like to add you to my professional network on LinkedIn. - Zhai Accept invitation from Zhai Edwin http://www.linkedin.com/e/-kkb1ec-gmy4ma4j-70/qTMmi8QEI_f3FNXUkL1mvZgy00BGYniwg3/blk/I120227954_11/1BpC5vrmRLoRZcjkkZt5YCpnlOt3RApnhMpmdzgmhxrSNBszYNclYQdjATcz8Mcz59bQNehAURjnBHbPwTcPsMdP0SdP8LrCBxbOYWrSlI/EML_comm_afe/ View invitation from Zhai Edwin http://www.linkedin.com/e/-kkb1ec-gmy4ma4j-70/qTMmi8QEI_f3FNXUkL1mvZgy00BGYniwg3/blk/I120227954_11/34NnPgRejsOcz0OckALqnpPbOYWrSlI/svi/ -- DID YOU KNOW you can be the first to know when a trusted member of your network changes jobs? With Network Updates on your LinkedIn home page, you'll be notified as members of your network change their current position. Be the first to know and reach out! http://www.linkedin.com/ -- (c) 2011, LinkedIn Corporation
Re: [Qemu-devel] tcg/tcg.c:1892: tcg fatal error
On Tue, Apr 26, 2011 at 12:29 AM, Aurelien Jarno wrote: > On Fri, Apr 22, 2011 at 06:14:06PM +0400, Igor Kovalenko wrote: >> On Fri, Apr 22, 2011 at 2:39 AM, Laurent Desnogues >> wrote: >> > On Thu, Apr 21, 2011 at 9:45 PM, Igor Kovalenko >> > wrote: >> >> On Thu, Apr 21, 2011 at 7:44 PM, Laurent Desnogues >> >> wrote: >> >>> On Thu, Apr 21, 2011 at 4:57 PM, Artyom Tarasenko >> >>> wrote: >> On Tue, Apr 12, 2011 at 4:14 AM, Igor Kovalenko >> wrote: >> >>> Do you have public test case? >> >>> It is possible to code this delay slot write test but real issue may >> >>> be corruption elsewhere. >> >> The test case is trivial: it's just the two instructions, branch and >> wrpr. >> >> > In theory there could be multiple issues including compiler induced >> > ones. >> > I'd prefer to see some kind of reproducible testcase. >> >> Ok, attached a 40 byte long test (the first 32 bytes are not used and >> needed only because the bios entry point is 0x20). >> >> $ git pull && make && sparc64-softmmu/qemu-system-sparc64 -bios >> test-wrpr.bin -nographic >> Already up-to-date. >> make[1]: Nothing to be done for `all'. >> /mnt/terra/projects/vanilla/qemu/tcg/tcg.c:1892: tcg fatal error >> Aborted >> >>> >> >>> The problem seems to be that wrpr is using a non-local >> >>> TCG tmp (cpu_tmp0). >> >> >> >> Just tried the test case with write to %pil - seems like write itself is >> >> OK. >> >> The issue appears to be with save_state() call since adding save_state >> >> to %pil case provokes the same tcg abort. >> > >> > The problem is that cpu_tmp0, not being a local tmp, doesn't >> > need to be saved across helper calls. This results in the >> > TCG "optimizer" getting rid of it even though it's later used. >> > Look at the log and you'll see what I mean :-) >> >> I'm not very comfortable with tcg yet. Would it be possible to teach >> optimizer working with delay slots? Or do I look in the wrong place. >> > > The problem is not on the TCG side, but on the target-sparc/translate.c > side: > > | case 0x32: /* wrwim, V9 wrpr */ > | { > | if (!supervisor(dc)) > | goto priv_insn; > | tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); > | #ifdef TARGET_SPARC64 > > Here cpu_tmp0 is loaded. cpu_tmp0 is a TCG temp, which means it is not > saved across TCG branches. > > [...] > > | case 6: // pstate > | save_state(dc, cpu_cond); > | gen_helper_wrpstate(cpu_tmp0); > | dc->npc = DYNAMIC_PC; > | break; > > save_state() calls save_npc(), which in turns might call > gen_generic_branch(): > > | static inline void gen_generic_branch(target_ulong npc1, target_ulong npc2, > | TCGv r_cond) > | { > | int l1, l2; > | > | l1 = gen_new_label(); > | l2 = gen_new_label(); > | > | tcg_gen_brcondi_tl(TCG_COND_EQ, r_cond, 0, l1); > | > | tcg_gen_movi_tl(cpu_npc, npc1); > | tcg_gen_br(l2); > | > | gen_set_label(l1); > | tcg_gen_movi_tl(cpu_npc, npc2); > | gen_set_label(l2); > | } > > And here is the TCG branch, which drop the TCG temp cpu_temp0. > > The solution is either to rewrite gen_generic_branch() without TCG > branches, or to use a TCG temp local instead of a TCG temp. Thanks! I think the issue is more clear now, and loading to local temporary works in this case. Does not explain why unmodified qemu works with wrpr pstate not in delay slot. I looked at my linux kernel builds and do not see any wrpr pstate in delay slot. -- Kind regards, Igor V. Kovalenko
[Qemu-devel] Fedora Virt Status
Fedora 14 - We have 95 open bugs, 5 of which have fixes in awaiting updates. - 17 bugs have been closed in the last week Fedora 15 - We have 22 open bugs. - 9 bugs have been closed in the last week - Beta is released, go test! - Upcoming Dates of importance: 2011-05-09 Final Change Deadline 2011-05-10 Compose 'Final' RC 2011-05-24 Fedora 15 Final Release == Updates Needing review == The following packages are in updates-testing and need review and karma as appropriate: F14: - libguestfs-1.8.6-1.fc14 New stable version 1.8.6 - spice-protocol-0.8.0-1.fc14 Add support for copy and paste using the primary selection, to use this you need a spice-gtk widget based client and the latest spice-gtk code Various small bug fixes F15: - libguestfs-1.10.2-1.fc15 New upstream stable version 1.10.2. == Virt Preview Repository == The virt-preview repository is now active for F14 users wishing to run the latest F15 virt packages on their stable F14 systems. F13 virt-preview users will still get the latest F14 packages. For details on how to run enable virt-preview, please see: https://fedoraproject.org/wiki/Virtualization_Preview_Repository == Bugs of importance: == - 674530 Change CDROM of guest, new CD is truncated to the size of the old Installing a very old guest which requires several CDs, the CD size is truncated to the size of the first CD. This could be a bug in the guest kernel, but needs to be investigated to ensure that it is not a hypervisor issue. - 693530 Qemu does the wrong thing with Cache=None and looks like corruption btrfs complains about corruption when Windows guests do certain types of writes with cache=none.
Re: [Qemu-devel] [PATCH] char: Allow devices to use a single multiplexed chardev.
On (Tue) 26 Apr 2011 [00:30:28], Kusanagi Kouichi wrote: > On 2011-04-25 15:27:20 +0530, Amit Shah wrote: > > On (Fri) 22 Apr 2011 [21:59:42], Kusanagi Kouichi wrote: > > > This fixes regression caused by commit > > > 2d6c1ef40f3678ab47a4d14fb5dadaa486bfcda6 > > > ("char: Prevent multiple devices opening same chardev"). > > > > What's the regression? How do I test it? > > > > -nodefaults -nographic -chardev stdio,id=stdio,mux=on,signal=off -mon stdio > -device virtio-serial-pci -device virtconsole,chardev=stdio -device > isa-serial,chardev=stdio > fails with > qemu-system-x86_64: -device isa-serial,chardev=stdio: Property > 'isa-serial.chardev' can't take value 'stdio', it's in use OK, so please mention it in the commit message :-) > Is this intended? No, it's not. Just one more thing: > > > diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c > > > index 1088a26..0eed712 100644 > > > --- a/hw/qdev-properties.c > > > +++ b/hw/qdev-properties.c > > > @@ -354,10 +354,10 @@ static int parse_chr(DeviceState *dev, Property > > > *prop, const char *str) > > > if (*ptr == NULL) { > > > return -ENOENT; > > > } > > > -if ((*ptr)->assigned) { > > > +if ((*ptr)->avail < 1) { > > > return -EEXIST; > > > } > > > -(*ptr)->assigned = 1; > > > +--(*ptr)->avail; > > > return 0; > > > } 'avail' isn't readily intuitive. Can you use a better name, like 'avail_connections' or something like that? Please CC me on the updated patch. Amit
Re: [Qemu-devel] [RFC][PATCH v2 00/11] QEMU Guest Agent: QMP-based host/guest communication (virtagent)
On 04/21/11 22:58, Michael Roth wrote: > On 04/21/2011 09:10 AM, Jes Sorensen wrote: >> On 04/18/11 17:02, Michael Roth wrote: >> One thing I cannot seem to figure out with this tree - the agent >> commands do not seem to show up in the monitor? What am I missing? > > Hmm, for some reason this email never hit my inbox. > > You mean with the human monitor? Currently, with these new patches, > we're QMP only. And most of the command names/semantics have changed as > well. The qapi-schema.json changes in patch 16 have the new prototypes, > and the 0 patch has some usage examples. Hi Michael, Yeah it was the conclusion I came to on Thursday when I was working on porting the freeze patches over. After fighting the json %#$%#$%#$ I ended up with something I couldn't test in the end :( Any plans to add human monitor support in the near future? Cheers, Jes