[Qemu-devel] [Bug 1223477] Re: Unable to read USB filesystems with EFI Bios
[Expired for QEMU because there has been no activity for 60 days.] ** Changed in: qemu Status: Incomplete => Expired -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1223477 Title: Unable to read USB filesystems with EFI Bios Status in QEMU: Expired Bug description: Preamble and version: With respect to my fix for using USB devices as -hda mentioned in bug 1223467 Using Qemu 1.6.0 with OVMF r11337-alpha (Qemu is built from Source, OVMF is pre built) Command: qemu-system-i386.exe -m 1024 -hda \\.\PhysicalDrive1 -L ovmf-ia32 Fault: The EFI Shell is able to detect the hda block device, report its capacity and usage; but it sees no files or directories on the device. Similar commands: I have also seen the same with qemu-system-x86_64.exe -m 1024 -hda \\.\PhysicalDrive1 -L ovmf-ia32 and qemu-system-x86_64.exe -m 1024 -hda \\.\PhysicalDrive1 -L ovmf-x64 Investigations: I tried very small (500MB) and very large (32 GB) USB devices with no difference. I re-built several versions of Qemu in an identical build environment, and found that: Qemu 1.2.2 and before, all the above commands work and the EFI boot loader is called. Qemu 1.3.0-rc0 and after do not work and the USB device appears blank. I'm reporting the bug here and not with OVMF because older versions of Qemu with the same OVMF bios work perfectly. In all cases using '-L pc-bios' works perfectly. In all cases using an image of the USB device works. Thanks To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1223477/+subscriptions
[Qemu-devel] [Bug 1318746] Re: qemu Windows 7 BSOD when using hv-time
[Expired for QEMU because there has been no activity for 60 days.] ** Changed in: qemu Status: Incomplete => Expired -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1318746 Title: qemu Windows 7 BSOD when using hv-time Status in QEMU: Expired Bug description: When I use hv-time sub option and run CPU-Z or 3DMark (Physics Test) the Windows 7 guest stops with BSOD (SYSTEM_SERVICE_EXCEPTION). It can be easily reproduced by running CPU-Z. It will fail every second or third time you execute CPU-Z and fail during "PCI detection". If I disable hv-time I can run CPU-Z and 3DMark (Physics Test) without any problems. QEMU was called with the following options: /usr/bin/taskset -c 4,5,6,7 /usr/bin/qemu-system-x86_64 \ -machine q35,accel=kvm,kernel_irqchip=on \ -enable-kvm \ -serial none \ -parallel none \ -monitor none \ -vga std \ -boot order=dc \ -cpu host,hv-time \ -smp cores=4,threads=1,sockets=1 \ -m 8192 \ -k de \ -rtc base=localtime \ -drive file=/srv/kvm/maggie-drive0.img,id=drive0,if=none,cache=none,aio=threads \ -mon chardev=monitor0 \ -chardev socket,id=monitor0,path=/tmp/maggie.monitor,nowait,server \ -netdev tap,id=net0,vhost=on,helper=/usr/lib/qemu/qemu-bridge-helper \ -device virtio-net-pci,netdev=net0,mac=00:00:00:02:01:01 \ -device virtio-blk-pci,drive=drive0,ioeventfd=on \ -device ioh3420,bus=pcie.0,id=pcie0,port=1,chassis=1,multifunction=on I've removed the VFIO PCI passthrough line of my GPU to make reproduction easier. In any case it happens in both scenarios so VGA passthrough is not the root cause. It happens with linux-3.15-rc5 and linux-3.14.3 with patch from commit mentioned at https://bugzilla.kernel.org/show_bug.cgi?id=73721#c3 To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1318746/+subscriptions
[Qemu-devel] [Bug 1359394] Re: virtio block device hangs after "virtio_blk virtio3: requests:id 0 is not a head!"
[Expired for QEMU because there has been no activity for 60 days.] ** Changed in: qemu Status: Incomplete => Expired -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1359394 Title: virtio block device hangs after "virtio_blk virtio3: requests:id 0 is not a head!" Status in QEMU: Expired Bug description: The virtual machine is running block layer workloads, interrupted by unclean reboots (echo b > /proc/sysrq-trigger). Kernel version is 3.14. Sometimes, I get this message on boot: "virtio_blk virtio3: requests:id 0 is not a head!" Then, I/O to the virtio block devices just hangs. Unfortunately I don't have a test case and this is kind of hard to reproduce, but it seems related to having I/O in flight when the kernel is forced to reboot. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1359394/+subscriptions
[Qemu-devel] [Bug 1359383] Re: kernel panic at smpboot.c:134 when rebooting qemu with multiple cores
[Expired for QEMU because there has been no activity for 60 days.] ** Changed in: qemu Status: Incomplete => Expired -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1359383 Title: kernel panic at smpboot.c:134 when rebooting qemu with multiple cores Status in QEMU: Expired Bug description: Hi all, I can reproduce this with kernel 3.14 and 3.17rc1. I suspect it is a qemu issue, but I'm not sure. The test case is the following script: qemu-system-x86_64 -machine accel=kvm -pidfile /tmp/pid$$ -m 512M -smp 8,sockets=8 -kernel vmlinuz -append "init=/sbin/reboot -f console=ttyS0,115200 kgdboc=ttyS2,115200 root=/dev/sda rw" -nographic -serial stdio -drive format=raw,snapshot=on,file=/var/lib/ktest/root Note that we pass /sbin/reboot as the init program so it just reboots forever. After a dozen or so iterations, I hit this: [0.00] Initializing cgroup subsys cpuset [0.00] Initializing cgroup subsys cpu [0.00] Initializing cgroup subsys cpuacct [0.00] Linux version 3.17.0-rc1-0-2014.sp (sp@vodka) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #209 SMP Wed Aug 20 20:17:46 UTC 2014 [0.00] Command line: init=/sbin/reboot -f console=ttyS0,115200 kgdboc=ttyS2,115200 root=/dev/sda rw ktest.priority=9 [0.00] e820: BIOS-provided physical RAM map: [0.00] BIOS-e820: [mem 0x-0x0009fbff] usable [0.00] BIOS-e820: [mem 0x0009fc00-0x0009] reserved [0.00] BIOS-e820: [mem 0x000f-0x000f] reserved [0.00] BIOS-e820: [mem 0x0010-0x1fffcfff] usable [0.00] BIOS-e820: [mem 0x1fffd000-0x1fff] reserved [0.00] BIOS-e820: [mem 0xfeffc000-0xfeff] reserved [0.00] BIOS-e820: [mem 0xfffc-0x] reserved [0.00] process: using polling idle threads [0.00] NX (Execute Disable) protection: active [0.00] SMBIOS 2.4 present. [0.00] Hypervisor detected: KVM [0.00] e820: last_pfn = 0x1fffd max_arch_pfn = 0x4 [0.00] PAT not supported by CPU. [0.00] init_memory_mapping: [mem 0x-0x000f] [0.00] init_memory_mapping: [mem 0x1fc0-0x1fdf] [0.00] init_memory_mapping: [mem 0x1c00-0x1fbf] [0.00] init_memory_mapping: [mem 0x0010-0x1bff] [0.00] init_memory_mapping: [mem 0x1fe0-0x1fffcfff] [0.00] ACPI: Early table checksum verification disabled [0.00] ACPI: RSDP 0x000F0A90 14 (v00 BOCHS ) [0.00] ACPI: RSDT 0x1C21 34 (v01 BOCHS BXPCRSDT 0001 BXPC 0001) [0.00] ACPI: FACP 0x1FFFEF40 74 (v01 BOCHS BXPCFACP 0001 BXPC 0001) [0.00] ACPI: DSDT 0x1FFFDDC0 001180 (v01 BOCHS BXPCDSDT 0001 BXPC 0001) [0.00] ACPI: FACS 0x1FFFDD80 40 [0.00] ACPI: SSDT 0x1FFFEFB4 000B85 (v01 BOCHS BXPCSSDT 0001 BXPC 0001) [0.00] ACPI: APIC 0x1B39 B0 (v01 BOCHS BXPCAPIC 0001 BXPC 0001) [0.00] ACPI: HPET 0x1BE9 38 (v01 BOCHS BXPCHPET 0001 BXPC 0001) [0.00] No NUMA configuration found [0.00] Faking a node at [mem 0x-0x1fffcfff] [0.00] Initmem setup node 0 [mem 0x-0x1fffcfff] [0.00] NODE_DATA [mem 0x1fffa000-0x1fffcfff] [0.00] kvm-clock: Using msrs 4b564d01 and 4b564d00
[Qemu-devel] [Bug 1709025] Re: Disk corrupted after snapshot deletion
[Expired for QEMU because there has been no activity for 60 days.] ** Changed in: qemu Status: Incomplete => Expired -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1709025 Title: Disk corrupted after snapshot deletion Status in QEMU: Expired Bug description: I found the vm disk corruption after snapshot deletion sometimes(the probability is very low, I'm afraid i can't reproduce it). And I found there is a patch for it as follow, but I'm not sure whether the patch repaired the bug. Drain disk before snapshot deletion can't guarantee anything, there is still pending IO in snapshot-deletion process. Anyone can help? authorZhang Haoyu2014-10-21 16:38:01 +0800 committer Stefan Hajnoczi 2014-11-03 09:48:42 + commit3432a1929ee18e08787ce35476abd74f2c93a17c (patch) tree 13a81c0a46707d91622f1593ccf7b926935371fd /block/snapshot.c parent573742a5431a99ceaba6968ae269cee247727cce (diff) snapshot: add bdrv_drain_all() to bdrv_snapshot_delete() to avoid concurrency problem If there are still pending i/o while deleting snapshot, because deleting snapshot is done in non-coroutine context, and the pending i/o read/write (bdrv_co_do_rw) is done in coroutine context, so it's possible to cause concurrency problem between above two operations. Add bdrv_drain_all() to bdrv_snapshot_delete() to avoid this problem. Signed-off-by: Zhang Haoyu Reviewed-by: Paolo Bonzini Message-id: 201410211637596311...@sangfor.com Signed-off-by: Stefan Hajnoczi Diffstat (limited to 'block/snapshot.c') -rw-r--r--block/snapshot.c4 1 files changed, 4 insertions, 0 deletions diff --git a/block/snapshot.c b/block/snapshot.c index 85c52ff..698e1a1 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -236,6 +236,10 @@ int bdrv_snapshot_delete(BlockDriverState *bs, error_setg(errp, "snapshot_id and name are both NULL"); return -EINVAL; } + +/* drain all pending i/o before deleting snapshot */ +bdrv_drain_all(); + if (drv->bdrv_snapshot_delete) { return drv->bdrv_snapshot_delete(bs, snapshot_id, name, errp); } To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1709025/+subscriptions
Re: [Qemu-devel] [PATCH v2 0/6] aspeed: add a witherspoon-bmc machine
On 10/06/2017 05:13 PM, Peter Maydell wrote: > On 20 September 2017 at 08:01, Cédric Le Goaterwrote: >> Hello, >> >> This series adds a new Aspeed machine to emulate the BMC of a >> Witherspoon system. It also extends the other Aspeed machines with I2C >> devices and adds a simple model for the pca9552 LED blinker present on >> the witherspoon board. >> >> Thanks, >> >> C. >> >> Changes since v1: >> >> - introduced smbus_eeprom_init_one() >> >> Cédric Le Goater (6): >> aspeed: add support for the witherspoon-bmc board >> aspeed: add an I2C RTC device to all machines >> smbus: add a smbus_eeprom_init_one() routine >> aspeed: Add EEPROM I2C devices >> misc: add pca9552 LED blinker model >> aspeed: add the pc9552 chips to the witherspoon machine > > Hi -- I've made a couple of review comments and nothing else > leapt out as obviously wrong, but I'm hoping that somebody more > familiar with the aspeed devices will do review... Joel, Now that we have updated the DTs, could you please take a look to make sure that the I2C busses in the models have devices which makes sense with the real boards. Thanks, C.
Re: [Qemu-devel] [PATCH v2 1/6] aspeed: add support for the witherspoon-bmc board
On 10/06/2017 05:10 PM, Peter Maydell wrote: > On 20 September 2017 at 08:01, Cédric Le Goaterwrote: >> The Witherspoon boards are OpenPOWER system hosting POWER9 Processors. >> Let's add support for their BMC including a couple of I2C devices as >> found on real HW. >> >> Signed-off-by: Cédric Le Goater >> --- >> hw/arm/aspeed.c | 49 + >> 1 file changed, 49 insertions(+) >> >> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c >> index ab895ad490af..81f522f711ae 100644 >> --- a/hw/arm/aspeed.c >> +++ b/hw/arm/aspeed.c >> @@ -46,6 +46,7 @@ enum { >> PALMETTO_BMC, >> AST2500_EVB, >> ROMULUS_BMC, >> +WITHERSPOON_BMC, >> }; >> >> /* Palmetto hardware value: 0x120CE416 */ >> @@ -83,8 +84,12 @@ enum { >> SCU_AST2500_HW_STRAP_ACPI_ENABLE | \ >> SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER)) >> >> +/* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */ >> +#define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1 >> + >> static void palmetto_bmc_i2c_init(AspeedBoardState *bmc); >> static void ast2500_evb_i2c_init(AspeedBoardState *bmc); >> +static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc); >> >> static const AspeedBoardConfig aspeed_boards[] = { >> [PALMETTO_BMC] = { >> @@ -110,6 +115,14 @@ static const AspeedBoardConfig aspeed_boards[] = { >> .spi_model = "mx66l1g45g", >> .num_cs= 2, >> }, >> +[WITHERSPOON_BMC] = { >> +.soc_name = "ast2500-a1", >> +.hw_strap1 = WITHERSPOON_BMC_HW_STRAP1, >> +.fmc_model = "mx25l25635e", >> +.spi_model = "mx66l1g45g", >> +.num_cs= 2, >> +.i2c_init = witherspoon_bmc_i2c_init, >> +}, >> }; >> >> #define FIRMWARE_ADDR 0x0 >> @@ -337,11 +350,47 @@ static const TypeInfo romulus_bmc_type = { >> .class_init = romulus_bmc_class_init, >> }; >> >> +static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc) >> +{ >> +AspeedSoCState *soc = >soc; >> + >> +i2c_create_slave(aspeed_i2c_get_bus(DEVICE(>i2c), 4), "tmp423", >> 0x4c); >> +i2c_create_slave(aspeed_i2c_get_bus(DEVICE(>i2c), 5), "tmp423", >> 0x4c); >> + >> +i2c_create_slave(aspeed_i2c_get_bus(DEVICE(>i2c), 9), "tmp105", >> 0x4a); >> +} >> + >> +static void witherspoon_bmc_init(MachineState *machine) >> +{ >> +aspeed_board_init(machine, _boards[WITHERSPOON_BMC]); >> +} >> + >> +static void witherspoon_bmc_class_init(ObjectClass *oc, void *data) >> +{ >> +MachineClass *mc = MACHINE_CLASS(oc); >> + >> +mc->desc = "OpenPOWER Witherspoon BMC (ARM1176)"; >> +mc->init = witherspoon_bmc_init; >> +mc->max_cpus = 1; >> +mc->no_sdcard = 1; >> +mc->no_floppy = 1; >> +mc->no_cdrom = 1; >> +mc->no_parallel = 1; >> +mc->ignore_memory_transaction_failures = true; > > Please don't set this flag for new board models, it is only > for our legacy existing ones. Instead implement any devices > that you need for guest code to boot (stub them out with > create_unimplemented_device() if you like). OK. I am discovering this. I will take a look for the next round. C.
Re: [Qemu-devel] [PATCH v2 5/6] misc: add pca9552 LED blinker model
On 10/06/2017 05:12 PM, Peter Maydell wrote: > On 20 September 2017 at 08:01, Cédric Le Goaterwrote: >> Specs are available here : >> >> https://www.nxp.com/docs/en/data-sheet/PCA9552.pdf >> >> This is a simple model supporting the basic registers for led and GPIO >> mode. The device also supports two blinking rates but not the model >> yet. >> >> Signed-off-by: Cédric Le Goater > > >> --- /dev/null >> +++ b/include/hw/misc/pca9552.h >> @@ -0,0 +1,32 @@ >> +/* >> + * PCA9552 I2C LED blinker >> + * >> + * Copyright (c) 2017, IBM Corporation. >> + * >> + * This work is licensed under the terms of the GNU GPL, version 2 or >> + * later. See the COPYING file in the top-level directory. >> + */ >> +#ifndef PCA9552_H >> +#define PCA9552_H >> + >> +#include "hw/i2c/i2c.h" >> + >> +#define TYPE_PCA9552 "pca9552" >> +#define PCA9552(obj) OBJECT_CHECK(PCA9552State, (obj), TYPE_PCA9552) >> + >> + >> +#define PCA9552_NR_REGS 10 >> + >> +typedef struct PCA9552State { >> +/*< private >*/ >> +I2CSlave i2c; >> +/*< public >*/ >> + >> +uint8_t len; >> +uint8_t pointer; >> +uint8_t buf[1]; /* just to remember how to handle a larger buffer */ > > Changing this later is going to be a migration compatibility break > (or at least a bit painful to keep compat). > Do we know how big the buffer is supposed to be? one. > If so it would be best to make it the correct size to start with. yes I will change that. Thanks, C. > >> + >> +uint8_t regs[PCA9552_NR_REGS]; >> +} PCA9552State; > > thanks > -- PMM >
Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr_pci: fail gracefully with non-pseries machine types
On Sat, 7 Oct 2017 10:06:00 +0200 Greg Kurzwrote: > On Sat, 7 Oct 2017 16:19:25 +1100 > David Gibson wrote: > > > On Fri, Oct 06, 2017 at 05:09:04PM +0200, Greg Kurz wrote: > > > QEMU currently crashes when the user tries to add a spapr-pci-host-bridge > > > on a non-pseries machine: > > > > > > $ qemu-system-ppc64 -M ppce500 -device spapr-pci-host-bridge,index=1 > > > hw/ppc/spapr_pci.c:1535:spapr_phb_realize: > > > Object 0x1003dacae60 is not an instance of type spapr-machine > > > Aborted (core dumped) > > > > > > The same thing happens with the deprecated but still available child type > > > spapr-pci-vfio-host-bridge. > > > > > > Fix both by checking the machine type with object_dynamic_cast(). > > > > > > Signed-off-by: Greg Kurz > > > > > > > > > --- > > > hw/ppc/spapr_pci.c |8 +++- > > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > > > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > > > index 5049ced4e8b4..9e85106f51f8 100644 > > > --- a/hw/ppc/spapr_pci.c > > > +++ b/hw/ppc/spapr_pci.c > > > @@ -1507,7 +1507,7 @@ static void spapr_pci_unplug_request(HotplugHandler > > > *plug_handler, > > > > > > static void spapr_phb_realize(DeviceState *dev, Error **errp) > > > { > > > -sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine()); > > > +sPAPRMachineState *spapr; > > > SysBusDevice *s = SYS_BUS_DEVICE(dev); > > > sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s); > > > PCIHostState *phb = PCI_HOST_BRIDGE(s); > > > @@ -1519,6 +1519,12 @@ static void spapr_phb_realize(DeviceState *dev, > > > Error **errp) > > > const unsigned windows_supported = > > > sphb->ddw_enabled ? SPAPR_PCI_DMA_MAX_WINDOWS : 1; > > > > > > +spapr = (sPAPRMachineState *) qdev_get_machine(); > > > +if (!object_dynamic_cast((Object *) spapr, TYPE_SPAPR_MACHINE)) { > > > +error_setg(errp, TYPE_SPAPR_PCI_HOST_BRIDGE " needs a pseries > > > machine"); > > > +return; > > > +} > > > > This is slightly clunky. You could instead use OBJECT_CHECK in the > > initializer, then just if (!spapr) here. > > > > Unless I'm missing something, OBJECT_CHECK() is precisely what we're > removing with this patch to avoid the runtime assert... > > #define SPAPR_MACHINE(obj) \ > OBJECT_CHECK(sPAPRMachineState, (obj), TYPE_SPAPR_MACHINE) > Since we already do this in spapr-cpu-core, I guess I'll hide the ugliness in some macro. I'll send another patch. > > > + > > > if (sphb->index != (uint32_t)-1) { > > > sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr); > > > Error *local_err = NULL; > > > > > > > > pgpP2BLDJrlwx.pgp Description: OpenPGP digital signature
[Qemu-devel] [PATCH] oslib-posix: Fix compiler warning
gcc warning: /qemu/util/oslib-posix.c:304:11: error: variable ‘addr’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered] Use also an unsigned loop variable which better matches numpages. Signed-off-by: Stefan Weil--- Please cc qemu-trivial if you think this is trivial enough. Thanks, Stefan index 80086c549f..eb66a6f63c 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -301,11 +301,7 @@ static void sigbus_handler(int signal) static void *do_touch_pages(void *arg) { MemsetThread *memset_args = (MemsetThread *)arg; -char *addr = memset_args->addr; -uint64_t numpages = memset_args->numpages; -uint64_t hpagesize = memset_args->hpagesize; sigset_t set, oldset; -int i = 0; /* unblock SIGBUS */ sigemptyset(); @@ -315,6 +311,10 @@ static void *do_touch_pages(void *arg) if (sigsetjmp(memset_args->env, 1)) { memset_thread_failed = true; } else { +char *addr = memset_args->addr; +uint64_t numpages = memset_args->numpages; +uint64_t hpagesize = memset_args->hpagesize; +unsigned i; for (i = 0; i < numpages; i++) { /* * Read & write back the same value, so we don't -- 2.11.0
Re: [Qemu-devel] [PATCH 13/88] Dirty Bitmaps: use g_new() family of functions
On 10/06/2017 07:49 PM, Philippe Mathieu-Daudé wrote: > From: Marc-André Lureau> > Signed-off-by: Marc-André Lureau > Signed-off-by: Philippe Mathieu-Daudé > [PMD: squashed tests/test-hbitmap.c changes] > --- > tests/test-hbitmap.c | 2 +- > util/hbitmap.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c > index af41642346..fea3a64712 100644 > --- a/tests/test-hbitmap.c > +++ b/tests/test-hbitmap.c > @@ -122,7 +122,7 @@ static void hbitmap_test_truncate_impl(TestHBitmapData > *data, > > n = hbitmap_test_array_size(size); > m = hbitmap_test_array_size(data->old_size); > -data->bits = g_realloc(data->bits, sizeof(unsigned long) * n); > +data->bits = g_renew(unsigned long, data->bits, n); > if (n > m) { > memset(>bits[m], 0x00, sizeof(unsigned long) * (n - m)); > } > diff --git a/util/hbitmap.c b/util/hbitmap.c > index 2f9d0fdbd0..4eb0188836 100644 > --- a/util/hbitmap.c > +++ b/util/hbitmap.c > @@ -668,7 +668,7 @@ void hbitmap_truncate(HBitmap *hb, uint64_t size) > } > old = hb->sizes[i]; > hb->sizes[i] = size; > -hb->levels[i] = g_realloc(hb->levels[i], size * sizeof(unsigned > long)); > +hb->levels[i] = g_renew(unsigned long, hb->levels[i], size); > if (!shrink) { > memset(>levels[i][old], 0x00, > (size - old) * sizeof(*hb->levels[i])); > Hm, I guess g_renew() isn't a new addition to glib, and we can safely use it. Reviewed-by: John Snow And for convenience, this can be staged by whomever wishes to stage the whole 88 patch enchilada: Acked-by: John Snow
[Qemu-devel] [PATCH] io: Add missing GCC_FMT_ATTR (fix -Werror=suggest-attribute=format)
This fixes a compiler warning: /qemu/io/channel-websock.c:163:5: error: function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format] Signed-off-by: Stefan Weil--- io/channel-websock.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/io/channel-websock.c b/io/channel-websock.c index d1d471f86e..7bf1340958 100644 --- a/io/channel-websock.c +++ b/io/channel-websock.c @@ -151,9 +151,10 @@ enum { QIO_CHANNEL_WEBSOCK_OPCODE_PONG = 0xA }; -static void qio_channel_websock_handshake_send_res(QIOChannelWebsock *ioc, - const char *resmsg, - ...) +static void GCC_FMT_ATTR(2, 3) +qio_channel_websock_handshake_send_res(QIOChannelWebsock *ioc, + const char *resmsg, + ...) { va_list vargs; char *response; -- 2.11.0
Re: [Qemu-devel] [PATCH 00/88] use g_new() family of functions
On 7 October 2017 at 00:48, Philippe Mathieu-Daudéwrote: > Hi, > > This is a follow-up of Marc-André's clang-tidy series [1]. > While chatting we realized we were trying to reach the same goal, Marc-André > using clang-tidy and me using spatch; so he let me finish his series applying > my changes over his. > I also included Jan's patch which fits well. > > Summary: > - 1 bugfix (memory leak) > - few optimizations (avoid to zeroise when all memory is assigned) > - bunch of mechanical refactors 88 patches is way too many for a single series, even if it is mostly mechanical. thanks -- PMM
[Qemu-devel] Using qemu command not able launch VM
Hi All (qemu members), I installed qemu utility in my host machine. I want to start Virtual machine using qemu command. My host machine: Intel-X86 Script for launching VM : T=/home/koushik/vpp/cloud_ubuntu_img sudo qemu-system-i386 -enable-kvm -m 1024 -smp sockets=1,cpus=4,cores=2 -cpu host \ -vga none -nographic \ -kernel $T/vmlinuz-4.4.0-96-generic --append "console=ttyAMA0 root=/dev/vda rw" \ -drive file=$T/custom32.img,if=virtio,aio=threads \ -chardev socket,id=char1,path=/tmp/sock1.sock \ -netdev type=vhost-user,id=mynet1,chardev=char1,vhostforce\ -device virtio-net-pci,mac=00:00:00:00:00:01,netdev=mynet1 \ -object memory-backend-file,id=mem,size=1024M,mem-path=/dev/hugepages,share=on \ -numa node,memdev=mem -mem-prealloc \ #-debugcon file:debug.log -global isa-debugcon.iobase=0x402 Bug: Invalid netdev type Please let me know where i did wrong. Please help me. Thanks to all in advance. Thanks & Regards, Koushik
Re: [Qemu-devel] [PATCH 69/88] virtio-9p: use g_new() family of functions
On Fri, 6 Oct 2017 20:50:04 -0300 Philippe Mathieu-Daudéwrote: > From: Marc-André Lureau > > Signed-off-by: Marc-André Lureau > Signed-off-by: Philippe Mathieu-Daudé > [PMD: added 2 more uses in hw/9pfs/9p-synth.c] > --- Acked-by: Greg Kurz > hw/9pfs/9p-handle.c | 2 +- > hw/9pfs/9p-proxy.c | 2 +- > hw/9pfs/9p-synth.c | 8 > hw/9pfs/9p.c| 2 +- > 4 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/hw/9pfs/9p-handle.c b/hw/9pfs/9p-handle.c > index 9875f1894c..357ced3079 100644 > --- a/hw/9pfs/9p-handle.c > +++ b/hw/9pfs/9p-handle.c > @@ -609,7 +609,7 @@ static int handle_init(FsContext *ctx) > int ret, mnt_id; > struct statfs stbuf; > struct file_handle fh; > -struct handle_data *data = g_malloc(sizeof(struct handle_data)); > +struct handle_data *data = g_new(struct handle_data, 1); > > data->mountfd = open(ctx->fs_root, O_DIRECTORY); > if (data->mountfd < 0) { > diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c > index 28b20a7c3d..2de303d713 100644 > --- a/hw/9pfs/9p-proxy.c > +++ b/hw/9pfs/9p-proxy.c > @@ -1136,7 +1136,7 @@ static int proxy_parse_opts(QemuOpts *opts, struct > FsDriverEntry *fs) > > static int proxy_init(FsContext *ctx) > { > -V9fsProxy *proxy = g_malloc(sizeof(V9fsProxy)); > +V9fsProxy *proxy = g_new(V9fsProxy, 1); > int sock_id; > > if (ctx->export_flags & V9FS_PROXY_SOCK_NAME) { > diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c > index df0a8de08a..3aa69cf465 100644 > --- a/hw/9pfs/9p-synth.c > +++ b/hw/9pfs/9p-synth.c > @@ -43,7 +43,7 @@ static V9fsSynthNode *v9fs_add_dir_node(V9fsSynthNode > *parent, int mode, > > /* Add directory type and remove write bits */ > mode = ((mode & 0777) | S_IFDIR) & ~(S_IWUSR | S_IWGRP | S_IWOTH); > -node = g_malloc0(sizeof(V9fsSynthNode)); > +node = g_new0(V9fsSynthNode, 1); > if (attr) { > /* We are adding .. or . entries */ > node->attr = attr; > @@ -124,7 +124,7 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int > mode, > } > /* Add file type and remove write bits */ > mode = ((mode & 0777) | S_IFREG); > -node = g_malloc0(sizeof(V9fsSynthNode)); > +node = g_new0(V9fsSynthNode, 1); > node->attr = >actual_attr; > node->attr->inode = synth_node_count++; > node->attr->nlink = 1; > @@ -180,7 +180,7 @@ static int synth_opendir(FsContext *ctx, > V9fsSynthOpenState *synth_open; > V9fsSynthNode *node = *(V9fsSynthNode **)fs_path->data; > > -synth_open = g_malloc(sizeof(*synth_open)); > +synth_open = g_new(V9fsSynthOpenState, 1); > synth_open->node = node; > node->open_count++; > fs->private = synth_open; > @@ -264,7 +264,7 @@ static int synth_open(FsContext *ctx, V9fsPath *fs_path, > V9fsSynthOpenState *synth_open; > V9fsSynthNode *node = *(V9fsSynthNode **)fs_path->data; > > -synth_open = g_malloc(sizeof(*synth_open)); > +synth_open = g_new(V9fsSynthOpenState, 1); > synth_open->node = node; > node->open_count++; > fs->private = synth_open; > diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c > index 23ac7bb532..510867b4dc 100644 > --- a/hw/9pfs/9p.c > +++ b/hw/9pfs/9p.c > @@ -298,7 +298,7 @@ static V9fsFidState *alloc_fid(V9fsState *s, int32_t fid) > return NULL; > } > } > -f = g_malloc0(sizeof(V9fsFidState)); > +f = g_new0(V9fsFidState, 1); > f->fid = fid; > f->fid_type = P9_FID_NONE; > f->ref = 1;
[Qemu-devel] [Bug 1721952] [NEW] Network issue above 2.5.1.1
Public bug reported: Hi, WHen running a QEMU guest (Windows7) on a linux x86-64 server, the network stops working after some time for any version above 2.5.1.1 In 2.5.1.1, all is fine (no issue with network) Any version ablve (trying 2.10.1 now), the application in windows stops accessing the internet after a while THis is my starting line: /usr/bin/qemu-system-x86_64 -machine pc-i440fx-1.7,accel=kvm -usb -usbdevice tablet -usbdevice keyboard -enable-kvm -cpu core2duo -smp 2 -drive file=winpro.qcow,index=0,media=disk,format=qco w2 -m 4096 -vga vmware -vnc :3 -k en-us -device e1000,netdev=nic1 -netdev user,id=nic1,smb=/data/vps/files/,hostfwd=tcp::10053-:10053,hostfwd=tcp::3387-:3389 -rtc base=utc,clock=host -daemon ize Thisis my configure line: ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-kvm --disable-gtk --disable-xen --disable-user --enable-vnc-sasl --disable-libusb --disable-debug-info --disable-spi ce --enable-lzo --enable-pie --disable-werror --enable-linux-aio --enable-vhost-net --disable-tcmalloc --enable-vde --enable-nettle --disable-smartcard --enable-curl ** 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/1721952 Title: Network issue above 2.5.1.1 Status in QEMU: New Bug description: Hi, WHen running a QEMU guest (Windows7) on a linux x86-64 server, the network stops working after some time for any version above 2.5.1.1 In 2.5.1.1, all is fine (no issue with network) Any version ablve (trying 2.10.1 now), the application in windows stops accessing the internet after a while THis is my starting line: /usr/bin/qemu-system-x86_64 -machine pc-i440fx-1.7,accel=kvm -usb -usbdevice tablet -usbdevice keyboard -enable-kvm -cpu core2duo -smp 2 -drive file=winpro.qcow,index=0,media=disk,format=qco w2 -m 4096 -vga vmware -vnc :3 -k en-us -device e1000,netdev=nic1 -netdev user,id=nic1,smb=/data/vps/files/,hostfwd=tcp::10053-:10053,hostfwd=tcp::3387-:3389 -rtc base=utc,clock=host -daemon ize Thisis my configure line: ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-kvm --disable-gtk --disable-xen --disable-user --enable-vnc-sasl --disable-libusb --disable-debug-info --disable-spi ce --enable-lzo --enable-pie --disable-werror --enable-linux-aio --enable-vhost-net --disable-tcmalloc --enable-vde --enable-nettle --disable-smartcard --enable-curl To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1721952/+subscriptions
Re: [Qemu-devel] [PATCH 20/88] Migration: use g_new() family of functions
Philippe Mathieu-Daudéwrote: > From: Marc-André Lureau > > Signed-off-by: Marc-André Lureau > Signed-off-by: Philippe Mathieu-Daudé > [PMD: indented, added migration/migration.c and migration/page_cache.c] Reviewed-by: Juan Quintela Do you want me to include it, or you want to include it yourself? Later, Juan.
Re: [Qemu-devel] [Qemu-trivial] [PATCH 63/88] bsd-user/syscall: fix a memory leak on EFAULT, use g_new()
On 07.10.2017 01:49, Philippe Mathieu-Daudé wrote: > Signed-off-by: Philippe Mathieu-Daudé> --- > Kamil are you interested in maintaining bsd-user? :) > Long term yes, short term I'm occupied full-time on getting modern debuggers as fully-functional and as fully-featured on NetBSD as possible. ( http://blog.netbsd.org/tnf/entry/eurobsdcon_2017_paris_report ) > bsd-user/syscall.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c > index 66492aaf5d..9120cea61e 100644 > --- a/bsd-user/syscall.c > +++ b/bsd-user/syscall.c > @@ -227,7 +227,7 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, > int32_t namelen, abi_ulong ol > void *hnamep, *holdp, *hnewp = NULL; > size_t holdlen; > abi_ulong oldlen = 0; > -int32_t *snamep = g_malloc(sizeof(int32_t) * namelen), *p, *q, i; > +int32_t *snamep, *p, *q, i; > uint32_t kind = 0; > > if (oldlenp) > @@ -239,6 +239,7 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, > int32_t namelen, abi_ulong ol > if (!(holdp = lock_user(VERIFY_WRITE, oldp, oldlen, 0))) > return -TARGET_EFAULT; > holdlen = oldlen; > +snamep = g_new(int32_t, namelen); > for (p = hnamep, q = snamep, i = 0; i < namelen; p++, i++) > *q++ = tswap32(*p); > oidfmt(snamep, namelen, NULL, ); > signature.asc Description: OpenPGP digital signature
Re: [Qemu-devel] [PATCH v2 3/3] scripts: Remove debug parameter from QEMUMachine
Dne 5.10.2017 v 19:20 Eduardo Habkost napsal(a): > All scripts that use the QEMUMachine and QEMUQtestMachine classes > (device-crash-test, tests/migration/*, iotests.py, basevm.py) > already configure logging. > > The basicConfig() call inside QEMUMachine.__init__() is being > kept just to make sure a script would still work if it didn't > configure logging. > > Signed-off-by: Eduardo Habkost> --- > scripts/qemu.py | 6 ++ > tests/migration/guestperf/engine.py | 6 ++ > tests/qemu-iotests/iotests.py | 2 -- > 3 files changed, 4 insertions(+), 10 deletions(-) > > diff --git a/scripts/qemu.py b/scripts/qemu.py > index f6d2e68627..9bfdf6d37d 100644 > --- a/scripts/qemu.py > +++ b/scripts/qemu.py > @@ -54,7 +54,7 @@ class QEMUMachine(object): > > def __init__(self, binary, args=None, wrapper=None, name=None, > test_dir="/var/tmp", monitor_address=None, > - socket_scm_helper=None, debug=False): > + socket_scm_helper=None): > ''' > Initialize a QEMUMachine > > @@ -65,7 +65,6 @@ class QEMUMachine(object): > @param test_dir: where to create socket and log file > @param monitor_address: address for QMP monitor > @param socket_scm_helper: helper program, required for send_fd_scm()" > -@param debug: enable debug mode > @note: Qemu process is not started until launch() is used. > ''' > if args is None: > @@ -85,12 +84,11 @@ class QEMUMachine(object): > self._events = [] > self._iolog = None > self._socket_scm_helper = socket_scm_helper > -self._debug = debug > self._qmp = None > self._qemu_full_args = None > > # just in case logging wasn't configured by the main script: > -logging.basicConfig(level=(logging.DEBUG if debug else logging.WARN)) > +logging.basicConfig() Yes, this behaves the same as `debug=False` > > def __enter__(self): > return self > diff --git a/tests/migration/guestperf/engine.py > b/tests/migration/guestperf/engine.py > index 0a13050bc6..e14d4320b2 100644 > --- a/tests/migration/guestperf/engine.py > +++ b/tests/migration/guestperf/engine.py > @@ -388,15 +388,13 @@ class Engine(object): > args=self._get_src_args(hardware), > wrapper=self._get_src_wrapper(hardware), > name="qemu-src-%d" % os.getpid(), > - monitor_address=srcmonaddr, > - debug=self._debug) > + monitor_address=srcmonaddr) > > dst = qemu.QEMUMachine(self._binary, > args=self._get_dst_args(hardware, uri), > wrapper=self._get_dst_wrapper(hardware), > name="qemu-dst-%d" % os.getpid(), > - monitor_address=dstmonaddr, > - debug=self._debug) > + monitor_address=dstmonaddr) > > try: > src.launch() > diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py > index 36a7757aaf..6f057904a9 100644 > --- a/tests/qemu-iotests/iotests.py > +++ b/tests/qemu-iotests/iotests.py > @@ -195,8 +195,6 @@ class VM(qtest.QEMUQtestMachine): > super(VM, self).__init__(qemu_prog, qemu_opts, name=name, > test_dir=test_dir, > socket_scm_helper=socket_scm_helper) > -if debug: > -self._debug = True And this is the main issue. So instead of the fix I proposed in previous commit major changes to "tests/qemu-iotests/iotests.py" are necessary. > self._num_drives = 0 > > def add_device(self, opts): > signature.asc Description: OpenPGP digital signature
Re: [Qemu-devel] [PATCH v2 2/3] scripts: Remove debug parameter from QEMUMonitorProtocol
Dne 5.10.2017 v 19:20 Eduardo Habkost napsal(a): > Use logging module for the QMP debug messages. The only scripts > that set debug=True are iotests.py and guestperf/engine.py, and > they already call logging.basicConfig() to set up logging. > > Scripts that don't configure logging are safe as long as they > don't need debugging output, because debug messages don't trigger > the "No handlers could be found for logger" message from the > Python logging module. > > Scripts that already configure logging but don't use debug=True > (e.g. scripts/vm/basevm.py) will get QMP debugging enabled for > free. > > Cc: "Alex Bennée"> Cc: Fam Zheng > Cc: "Philippe Mathieu-Daudé" > Signed-off-by: Eduardo Habkost > --- > Changes v1 -> v2: > * Actually remove debug parameter from method definition > (Fam Zheng) > * Fix "<<<" vs ">>>" confusion > (Fam Zheng) > * Remove "import sys" line > (Lukáš Doktor) > --- > scripts/qemu.py| 3 +-- > scripts/qmp/qmp.py | 16 +++- > 2 files changed, 8 insertions(+), 11 deletions(-) > > diff --git a/scripts/qemu.py b/scripts/qemu.py > index c9a106fbce..f6d2e68627 100644 > --- a/scripts/qemu.py > +++ b/scripts/qemu.py > @@ -177,8 +177,7 @@ class QEMUMachine(object): > > def _pre_launch(self): > self._qmp = qmp.qmp.QEMUMonitorProtocol(self._monitor_address, > -server=True, > -debug=self._debug) > +server=True) > > def _post_launch(self): > self._qmp.accept() > diff --git a/scripts/qmp/qmp.py b/scripts/qmp/qmp.py > index ef12e8a1a0..07c9632e9e 100644 > --- a/scripts/qmp/qmp.py > +++ b/scripts/qmp/qmp.py > @@ -11,7 +11,7 @@ > import json > import errno > import socket > -import sys > +import logging > > > class QMPError(Exception): > @@ -32,12 +32,14 @@ class QMPTimeoutError(QMPError): > > class QEMUMonitorProtocol(object): > > +#: Logger object for debugging messages > +logger = logging.getLogger('QMP') > #: Socket's error class > error = socket.error > #: Socket's timeout > timeout = socket.timeout > > -def __init__(self, address, server=False, debug=False): > +def __init__(self, address, server=False): > """ > Create a QEMUMonitorProtocol class. > > @@ -51,7 +53,6 @@ class QEMUMonitorProtocol(object): > """ > self.__events = [] > self.__address = address > -self._debug = debug > self.__sock = self.__get_sock() > self.__sockfile = None > if server: > @@ -83,8 +84,7 @@ class QEMUMonitorProtocol(object): > return > resp = json.loads(data) > if 'event' in resp: > -if self._debug: > -print >>sys.stderr, "QMP:<<< %s" % resp > +self.logger.debug("<<< %s", resp) > self.__events.append(resp) > if not only_event: > continue > @@ -164,8 +164,7 @@ class QEMUMonitorProtocol(object): > @return QMP response as a Python dict or None if the connection has > been closed > """ > -if self._debug: > -print >>sys.stderr, "QMP:>>> %s" % qmp_cmd > +self.logger.debug(">>> %s", qmp_cmd) > try: > self.__sock.sendall(json.dumps(qmp_cmd)) > except socket.error as err: > @@ -173,8 +172,7 @@ class QEMUMonitorProtocol(object): > return > raise socket.error(err) > resp = self.__json_read() > -if self._debug: > -print >>sys.stderr, "QMP:<<< %s" % resp > +self.logger.debug("<<< %s", resp) > return resp > > def cmd(self, name, args=None, cmd_id=None): > This one looks good, but in order to no break qemu-iotests verbose mode it requires fix to qtest/iotests: ```diff diff --git a/scripts/qtest.py b/scripts/qtest.py index df0daf2..0e955a8 100644 --- a/scripts/qtest.py +++ b/scripts/qtest.py @@ -77,12 +77,12 @@ class QEMUQtestMachine(qemu.QEMUMachine): '''A QEMU VM''' def __init__(self, binary, args=None, name=None, test_dir="/var/tmp", - socket_scm_helper=None): + socket_scm_helper=None, debug=False): if name is None: name = "qemu-%d" % os.getpid() super(QEMUQtestMachine, self).__init__(binary, args, name=name, test_dir=test_dir, - socket_scm_helper=socket_scm_helper) + socket_scm_helper=socket_scm_helper, debug=debug) self._qtest = None self._qtest_path = os.path.join(test_dir, name + "-qtest.sock") diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 1af117e..989ebd3 100644 ---
Re: [Qemu-devel] [PATCH] spapr_pci: fail gracefully with non-pseries machine types
On Sat, 7 Oct 2017 16:19:25 +1100 David Gibsonwrote: > On Fri, Oct 06, 2017 at 05:09:04PM +0200, Greg Kurz wrote: > > QEMU currently crashes when the user tries to add a spapr-pci-host-bridge > > on a non-pseries machine: > > > > $ qemu-system-ppc64 -M ppce500 -device spapr-pci-host-bridge,index=1 > > hw/ppc/spapr_pci.c:1535:spapr_phb_realize: > > Object 0x1003dacae60 is not an instance of type spapr-machine > > Aborted (core dumped) > > > > The same thing happens with the deprecated but still available child type > > spapr-pci-vfio-host-bridge. > > > > Fix both by checking the machine type with object_dynamic_cast(). > > > > Signed-off-by: Greg Kurz > > > > > --- > > hw/ppc/spapr_pci.c |8 +++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > > index 5049ced4e8b4..9e85106f51f8 100644 > > --- a/hw/ppc/spapr_pci.c > > +++ b/hw/ppc/spapr_pci.c > > @@ -1507,7 +1507,7 @@ static void spapr_pci_unplug_request(HotplugHandler > > *plug_handler, > > > > static void spapr_phb_realize(DeviceState *dev, Error **errp) > > { > > -sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine()); > > +sPAPRMachineState *spapr; > > SysBusDevice *s = SYS_BUS_DEVICE(dev); > > sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s); > > PCIHostState *phb = PCI_HOST_BRIDGE(s); > > @@ -1519,6 +1519,12 @@ static void spapr_phb_realize(DeviceState *dev, > > Error **errp) > > const unsigned windows_supported = > > sphb->ddw_enabled ? SPAPR_PCI_DMA_MAX_WINDOWS : 1; > > > > +spapr = (sPAPRMachineState *) qdev_get_machine(); > > +if (!object_dynamic_cast((Object *) spapr, TYPE_SPAPR_MACHINE)) { > > +error_setg(errp, TYPE_SPAPR_PCI_HOST_BRIDGE " needs a pseries > > machine"); > > +return; > > +} > > This is slightly clunky. You could instead use OBJECT_CHECK in the > initializer, then just if (!spapr) here. > Unless I'm missing something, OBJECT_CHECK() is precisely what we're removing with this patch to avoid the runtime assert... #define SPAPR_MACHINE(obj) \ OBJECT_CHECK(sPAPRMachineState, (obj), TYPE_SPAPR_MACHINE) > > + > > if (sphb->index != (uint32_t)-1) { > > sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr); > > Error *local_err = NULL; > > > > pgpvsZro7qEUl.pgp Description: OpenPGP digital signature
Re: [Qemu-devel] Patch to add helpful tracing output for driver authors in NVMe emulation
Completely re-implemented patch, with significant improvements (now specifies values in several places I missed, also reduced the amount of redundant lines). I used the nvme_ as the tracing infrastructure prefix. Tested with -trace nvme_* on the qemu command line, worked for me. >From 166f57458d60d363a10a0933c3e860985531ac96 Mon Sep 17 00:00:00 2001 From: Doug GaleDate: Thu, 5 Oct 2017 19:02:03 -0400 Subject: [PATCH] Add tracing output to NVMe emulation to help driver authors. This uses the tracing infrastructure using nvme_ as the prefix. Signed-off-by: Doug Gale --- hw/block/nvme.c | 158 +- hw/block/trace-events | 89 2 files changed, 233 insertions(+), 14 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 9aa32692a3..3e3cd820a3 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -34,6 +34,7 @@ #include "qapi/visitor.h" #include "sysemu/block-backend.h" +#include "trace.h" #include "nvme.h" static void nvme_process_sq(void *opaque); @@ -86,10 +87,14 @@ static void nvme_isr_notify(NvmeCtrl *n, NvmeCQueue *cq) { if (cq->irq_enabled) { if (msix_enabled(&(n->parent_obj))) { +trace_nvme_msix_intr(cq->vector); msix_notify(&(n->parent_obj), cq->vector); } else { +trace_nvme_pin_intr(); pci_irq_pulse(>parent_obj); } +} else { +trace_nvme_masked_intr(); } } @@ -101,6 +106,7 @@ static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1, int num_prps = (len >> n->page_bits) + 1; if (!prp1) { +trace_nvme_invalid_prp(); return NVME_INVALID_FIELD | NVME_DNR; } else if (n->cmbsz && prp1 >= n->ctrl_mem.addr && prp1 < n->ctrl_mem.addr + int128_get64(n->ctrl_mem.size)) { @@ -114,6 +120,7 @@ static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1, len -= trans_len; if (len) { if (!prp2) { +trace_nvme_invalid_prp2_missing(); goto unmap; } if (len > n->page_size) { @@ -129,6 +136,7 @@ static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1, if (i == n->max_prp_ents - 1 && len > n->page_size) { if (!prp_ent || prp_ent & (n->page_size - 1)) { +trace_nvme_invalid_prplist_ent(prp_ent); goto unmap; } @@ -141,6 +149,7 @@ static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1, } if (!prp_ent || prp_ent & (n->page_size - 1)) { +trace_nvme_invalid_prplist_ent(prp_ent); goto unmap; } @@ -155,6 +164,7 @@ static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1, } } else { if (prp2 & (n->page_size - 1)) { +trace_nvme_invalid_prp2_align(prp2); goto unmap; } if (qsg->nsg) { @@ -178,16 +188,20 @@ static uint16_t nvme_dma_read_prp(NvmeCtrl *n, uint8_t *ptr, uint32_t len, QEMUIOVector iov; uint16_t status = NVME_SUCCESS; +trace_nvme_dma_read(prp1, prp2); + if (nvme_map_prp(, , prp1, prp2, len, n)) { return NVME_INVALID_FIELD | NVME_DNR; } if (qsg.nsg > 0) { if (dma_buf_read(ptr, len, )) { +trace_nvme_dma_too_short(); status = NVME_INVALID_FIELD | NVME_DNR; } qemu_sglist_destroy(); } else { if (qemu_iovec_to_buf(, 0, ptr, len) != len) { +trace_nvme_dma_too_short(); status = NVME_INVALID_FIELD | NVME_DNR; } qemu_iovec_destroy(); @@ -274,6 +288,7 @@ static uint16_t nvme_write_zeros(NvmeCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, uint32_t aio_nlb = nlb << (data_shift - BDRV_SECTOR_BITS); if (slba + nlb > ns->id_ns.nsze) { +trace_nvme_invalid_lba_range(slba, nlb, ns->id_ns.nsze); return NVME_LBA_RANGE | NVME_DNR; } @@ -301,8 +316,11 @@ static uint16_t nvme_rw(NvmeCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, int is_write = rw->opcode == NVME_CMD_WRITE ? 1 : 0; enum BlockAcctType acct = is_write ? BLOCK_ACCT_WRITE : BLOCK_ACCT_READ; +trace_nvme_rw(is_write ? "write" : "read", nlb, data_size, slba); + if ((slba + nlb) > ns->id_ns.nsze) { block_acct_invalid(blk_get_stats(n->conf.blk), acct); +trace_nvme_invalid_lba_range(slba, nlb, ns->id_ns.nsze); return NVME_LBA_RANGE | NVME_DNR; } @@ -337,6 +355,7 @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req) uint32_t nsid = le32_to_cpu(cmd->nsid); if (nsid == 0 || nsid > n->num_namespaces) { +trace_nvme_invalid_ns(nsid, n->num_namespaces); return NVME_INVALID_NSID |
Re: [Qemu-devel] [PATCH v2 1/3] guestperf: Configure logging on all shell frontends
Dne 5.10.2017 v 19:20 Eduardo Habkost napsal(a): > The logging module will eventually replace the 'debug' parameter > in QEMUMachine and QEMUMonitorProtocol. > > Cc: Daniel P. Berrange> Signed-off-by: Eduardo Habkost > --- > Changes v1 -> v2: > * Inline init_logging() method on all callers because not all > classes derive from BaseShell (reported by Lukáš Doktor) > --- > tests/migration/guestperf/shell.py | 13 + > 1 file changed, 13 insertions(+) > > diff --git a/tests/migration/guestperf/shell.py > b/tests/migration/guestperf/shell.py > index 7992459a97..b272978f47 100644 > --- a/tests/migration/guestperf/shell.py > +++ b/tests/migration/guestperf/shell.py > @@ -26,6 +26,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), > import argparse > import fnmatch > import platform > +import logging > > from guestperf.hardware import Hardware > from guestperf.engine import Engine > @@ -147,6 +148,10 @@ class Shell(BaseShell): > > def run(self, argv): > args = self._parser.parse_args(argv) > +logging.basicConfig(level=(logging.DEBUG if args.debug else > + logging.INFO if args.verbose else > + logging.WARN)) > + > > engine = self.get_engine(args) > hardware = self.get_hardware(args) > @@ -179,6 +184,10 @@ class BatchShell(BaseShell): > > def run(self, argv): > args = self._parser.parse_args(argv) > +logging.basicConfig(level=(logging.DEBUG if args.debug else > + logging.INFO if args.verbose else > + logging.WARN)) > + > > engine = self.get_engine(args) > hardware = self.get_hardware(args) > @@ -231,6 +240,10 @@ class PlotShell(object): > > def run(self, argv): > args = self._parser.parse_args(argv) > +logging.basicConfig(level=(logging.DEBUG if args.debug else > + logging.INFO if args.verbose else > + logging.WARN)) > + > > if len(args.reports) == 0: > print >>sys.stderr, "At least one report required" > Yep, this does the trick, also using a shared function would be IMO better (especially if we need to tweak the setup), something like ```diff diff --git a/tests/migration/guestperf/shell.py b/tests/migration/guestperf/shell.py index b272978..c1108ae 100644 --- a/tests/migration/guestperf/shell.py +++ b/tests/migration/guestperf/shell.py @@ -36,6 +36,12 @@ from guestperf.plot import Plot from guestperf.report import Report +def _init_logging(args): +logging.basicConfig(level=(logging.DEBUG if args.debug else + logging.INFO if args.verbose else + logging.WARN)) + + class BaseShell(object): def __init__(self): @@ -148,10 +154,7 @@ class Shell(BaseShell): def run(self, argv): args = self._parser.parse_args(argv) -logging.basicConfig(level=(logging.DEBUG if args.debug else - logging.INFO if args.verbose else - logging.WARN)) - +_init_logging(args) engine = self.get_engine(args) hardware = self.get_hardware(args) @@ -184,10 +187,7 @@ class BatchShell(BaseShell): def run(self, argv): args = self._parser.parse_args(argv) -logging.basicConfig(level=(logging.DEBUG if args.debug else - logging.INFO if args.verbose else - logging.WARN)) - +_init_logging(args) engine = self.get_engine(args) hardware = self.get_hardware(args) @@ -240,10 +240,7 @@ class PlotShell(object): def run(self, argv): args = self._parser.parse_args(argv) -logging.basicConfig(level=(logging.DEBUG if args.debug else - logging.INFO if args.verbose else - logging.WARN)) - +_init_logging(args) if len(args.reports) == 0: print >>sys.stderr, "At least one report required" ``` Anyway both versions are fine by me. Reviewed-by: Lukáš Doktor signature.asc Description: OpenPGP digital signature
Re: [Qemu-devel] [PATCH 66/88] util/qemu-thread-win32: use g_new() family of functions
Am 07.10.2017 um 01:50 schrieb Philippe Mathieu-Daudé: > Signed-off-by: Philippe Mathieu-Daudé> --- > util/qemu-thread-win32.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/util/qemu-thread-win32.c b/util/qemu-thread-win32.c > index 94f3491a87..098fddb2af 100644 > --- a/util/qemu-thread-win32.c > +++ b/util/qemu-thread-win32.c > @@ -394,7 +394,7 @@ void qemu_thread_create(QemuThread *thread, const char > *name, > HANDLE hThread; > struct QemuThreadData *data; > > -data = g_malloc(sizeof *data); > +data = g_new(struct QemuThreadData, 1); > data->start_routine = start_routine; > data->arg = arg; > data->mode = mode; > Reviewed-by: Stefan Weil Maybe you can use this simplified variant: QemuThreadData *data = g_new(QemuThreadData, 1); Stefan