Re: [PATCH 1/2] ppc/translate: Implement lxvwsx opcode

2020-11-13 Thread David Gibson
On Tue, Nov 10, 2020 at 10:14:23AM +0100, LemonBoy wrote:
> Is there any chance for this patch series to be merged for 5.2?

No.  We are now in hard freeze, and this is not a bugfix.

> 
> On 09/11/20 18:39, Richard Henderson wrote:
> > On 11/9/20 1:17 AM, LemonBoy wrote:
> >> Implement the "Load VSX Vector Word & Splat Indexed" opcode, introduced
> >> in Power ISA v3.0.
> >>
> >> Buglink: https://bugs.launchpad.net/qemu/+bug/1793608
> >> Signed-off-by: Giuseppe Musacchio 
> >> ---
> >>  target/ppc/translate/vsx-impl.c.inc | 30 +
> >>  target/ppc/translate/vsx-ops.c.inc  |  1 +
> >>  2 files changed, 31 insertions(+)
> > 
> > Reviewed-by: Richard Henderson 
> > 
> > r~
> > 
> 

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [PATCH v2-for-5.2] macio: set user_creatable to false in macio_class_init()

2020-11-13 Thread David Gibson
On Tue, Nov 10, 2020 at 10:31:11AM +, Mark Cave-Ayland wrote:
> Commit 348b8d1a76 "macio: don't reference serial_hd() directly within the 
> device"
> removed the setting of user_creatable to false on the basis that the 
> restriction
> was due to the use of serial_hd() in macio_instance_init().
> 
> Unfortunately this isn't the full story since the PIC object property links
> must still be set before the device is realized. Whilst it is possible to 
> update
> the macio device and Mac machines to resolve this, the fix is too invasive at
> this point in the release cycle.
> 
> For now simply set user_creatable back to false in macio_class_init() to
> prevent QEMU from segfaulting in anticipation of the proper fix arriving in
> QEMU 6.0.
> 
> Reported-by: Thomas Huth 
> Signed-off-by: Mark Cave-Ayland 
> Reviewed-by: Philippe Mathieu-Daudé 
> Reviewed-by: Thomas Huth 

Reviewed-by: David Gibson 

> ---
>  hw/misc/macio/macio.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> v2:
> - Rebase onto master
> - Add for-5.2 into subject prefix
> - Add R-B tags from Philippe and Thomas
> 
> 
> diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
> index 51368884d0..bb601f782c 100644
> --- a/hw/misc/macio/macio.c
> +++ b/hw/misc/macio/macio.c
> @@ -456,6 +456,8 @@ static void macio_class_init(ObjectClass *klass, void 
> *data)
>  k->class_id = PCI_CLASS_OTHERS << 8;
>  device_class_set_props(dc, macio_properties);
>  set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
> +/* Reason: requires PIC property links to be set in macio_*_realize() */
> +dc->user_creatable = false;
>  }
>  
>  static const TypeInfo macio_bus_info = {

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [PATCH] hw: add compat machines for 6.0

2020-11-13 Thread David Gibson
On Mon, Nov 09, 2020 at 06:39:28PM +0100, Cornelia Huck wrote:
> Add 6.0 machine types for arm/i440fx/q35/s390x/spapr.

ppc part
Acked-by: David Gibson 

> 
> Signed-off-by: Cornelia Huck 
> ---
>  hw/arm/virt.c  |  9 -
>  hw/core/machine.c  |  3 +++
>  hw/i386/pc.c   |  3 +++
>  hw/i386/pc_piix.c  | 14 +-
>  hw/i386/pc_q35.c   | 13 -
>  hw/ppc/spapr.c | 15 +--
>  hw/s390x/s390-virtio-ccw.c | 14 +-
>  include/hw/boards.h|  3 +++
>  include/hw/i386/pc.h   |  3 +++
>  9 files changed, 71 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 27dbeb549ef1..d21dad4491c4 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -2587,10 +2587,17 @@ static void machvirt_machine_init(void)
>  }
>  type_init(machvirt_machine_init);
>  
> +static void virt_machine_6_0_options(MachineClass *mc)
> +{
> +}
> +DEFINE_VIRT_MACHINE_AS_LATEST(6, 0)
> +
>  static void virt_machine_5_2_options(MachineClass *mc)
>  {
> +virt_machine_6_0_options(mc);
> +compat_props_add(mc->compat_props, hw_compat_5_2, hw_compat_5_2_len);
>  }
> -DEFINE_VIRT_MACHINE_AS_LATEST(5, 2)
> +DEFINE_VIRT_MACHINE(5, 2)
>  
>  static void virt_machine_5_1_options(MachineClass *mc)
>  {
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index 98b87f76cbbe..c5a6c517bb9d 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -28,6 +28,9 @@
>  #include "hw/mem/nvdimm.h"
>  #include "migration/vmstate.h"
>  
> +GlobalProperty hw_compat_5_2[] = {};
> +const size_t hw_compat_5_2_len = G_N_ELEMENTS(hw_compat_5_2);
> +
>  GlobalProperty hw_compat_5_1[] = {
>  { "vhost-scsi", "num_queues", "1"},
>  { "vhost-user-blk", "num-queues", "1"},
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 5e6c0023e0c7..d386c5662698 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -97,6 +97,9 @@
>  #include "trace.h"
>  #include CONFIG_DEVICES
>  
> +GlobalProperty pc_compat_5_2[] = {};
> +const size_t pc_compat_5_2_len = G_N_ELEMENTS(pc_compat_5_2);
> +
>  GlobalProperty pc_compat_5_1[] = {
>  { "ICH9-LPC", "x-smi-cpu-hotplug", "off" },
>  };
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 13d1628f13bf..6188c3e97eaf 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -426,7 +426,7 @@ static void pc_i440fx_machine_options(MachineClass *m)
>  machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
>  }
>  
> -static void pc_i440fx_5_2_machine_options(MachineClass *m)
> +static void pc_i440fx_6_0_machine_options(MachineClass *m)
>  {
>  PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
>  pc_i440fx_machine_options(m);
> @@ -435,6 +435,18 @@ static void pc_i440fx_5_2_machine_options(MachineClass 
> *m)
>  pcmc->default_cpu_version = 1;
>  }
>  
> +DEFINE_I440FX_MACHINE(v6_0, "pc-i440fx-6.0", NULL,
> +  pc_i440fx_6_0_machine_options);
> +
> +static void pc_i440fx_5_2_machine_options(MachineClass *m)
> +{
> +pc_i440fx_6_0_machine_options(m);
> +m->alias = NULL;
> +m->is_default = false;
> +compat_props_add(m->compat_props, hw_compat_5_2, hw_compat_5_2_len);
> +compat_props_add(m->compat_props, pc_compat_5_2, pc_compat_5_2_len);
> +}
> +
>  DEFINE_I440FX_MACHINE(v5_2, "pc-i440fx-5.2", NULL,
>pc_i440fx_5_2_machine_options);
>  
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index a3f4959c4357..0a212443aa84 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -344,7 +344,7 @@ static void pc_q35_machine_options(MachineClass *m)
>  m->max_cpus = 288;
>  }
>  
> -static void pc_q35_5_2_machine_options(MachineClass *m)
> +static void pc_q35_6_0_machine_options(MachineClass *m)
>  {
>  PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
>  pc_q35_machine_options(m);
> @@ -352,6 +352,17 @@ static void pc_q35_5_2_machine_options(MachineClass *m)
>  pcmc->default_cpu_version = 1;
>  }
>  
> +DEFINE_Q35_MACHINE(v6_0, "pc-q35-6.0", NULL,
> +   pc_q35_6_0_machine_options);
> +
> +static void pc_q35_5_2_machine_options(MachineClass *m)
> +{
> +pc_q35_6_0_machine_options(m);
> +m->alias = NULL;
> +compat_props_add(m->compat_props, hw_compat_5_2, hw_compat_5_2_len);
> +compat_props_add(m->compat_props, pc_compat_5_2, pc_compat_5_2_len);
> +}
> +
>  DEFINE_Q35_MACHINE(v5_2, "pc-q35-5.2", NULL,
> pc_q35_5_2_machine_options);
>  
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 227075103e9a..45e0afbeba49 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -4515,15 +4515,26 @@ static void 
> spapr_machine_latest_class_options(MachineClass *mc)
>  }\
>  type_init(spapr_machine_register_##suffix)
>  
> +/*
> + * pseries-6.0
> + */
> +static void spapr_machine_6_0_class_options(MachineClass *mc)
> +{
> +/* Defaults for the latest behaviour inherited from 

[Bug 1770724] Re: e1000 takes a long time (2 seconds) to set link ready

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1770724

Title:
  e1000 takes a long time (2 seconds) to set link ready

Status in QEMU:
  Incomplete

Bug description:
  When a VM is booted with e1000 NIC, it takes a long time (2 seconds)
  for the guest to bring up the link. This can be seen in the following
  dmesg messages:

  [4.899773] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
  [6.889165] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow 
Control: RX
  [6.891372] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

  The first message happens when the guest calls to ifup eth0; ifup does
  not hold control until the link is established. The guest I am using
  (cirros 0.4.0) then starts udhcpc DHCP client that issues a DHCP
  request, then waits for 60 seconds for reply, then repeats the DHCP
  request. When the first request is sent, the link is not ready yet, so
  the frame is lost; when the second request is sent, the link is up and
  DHCP lease is received.

  If I use different NICs (e1000e, virtio, rtl*), there are no dmesg
  messages, and the very first DHCP request correctly reaches outside
  and results in a lease acquired.

  The qemu version I am using is 2.10.1 from Fedora 27. I tried to
  reproduce with runtime from Fedora 29 that includes 2.12 but I have
  different issues there that block me from reproducing the original
  issue (there, I get kernel traces, irq interrupt errors, and no
  network link at all).

  For the record, the qemu in question is started by kubevirt inside a
  docker container with Fedora 27 based image.

  ===

  The command line of qemu is as follows:

  27404 ?Sl 0:10 /usr/bin/qemu-system-x86_64 -machine
  accel=kvm -name guest=default_ovm-cirros,debug-threads=on -S -object
  secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-1
  -default_ovm-cirros/master-key.aes -machine
  pc-q35-2.10,accel=kvm,usb=off,dump-guest-core=off -m 62 -realtime
  mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid
  8769fdbe-d957-5567-bd71-114ba0eb4811 -no-user-config -nodefaults
  -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-1
  -default_ovm-cirros/monitor.sock,server,nowait -mon
  chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown
  -no-acpi -boot strict=on -device
  i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e -device pci-
  bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 -device pcie-root-
  port,port=0x10,chassis=3,id=pci.3,bus=pcie.0,multifunction=on,addr=0x2
  -device pcie-root-
  port,port=0x11,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x1 -device
  pcie-root-port,port=0x12,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x2
  -device pcie-root-
  port,port=0x13,chassis=6,id=pci.6,bus=pcie.0,addr=0x2.0x3 -device
  pcie-root-port,port=0x14,chassis=7,id=pci.7,bus=pcie.0,addr=0x2.0x4
  -device nec-usb-xhci,id=usb,bus=pci.3,addr=0x0 -drive
  file=/var/run/libvirt/kubevirt-ephemeral-disk/registry-disk-
  data/default/ovm-cirros/disk_registryvolume/disk-
  image.raw,format=raw,if=none,id=drive-virtio-disk0 -device virtio-blk-
  pci,scsi=off,bus=pci.4,addr=0x0,drive=drive-virtio-disk0,id=virtio-
  disk0,bootindex=1 -drive file=/var/run/libvirt/kubevirt-ephemeral-disk
  /cloud-init-data/default/ovm-cirros/noCloud.iso,format=raw,if=none,id
  =drive-virtio-disk1 -device virtio-blk-
  pci,scsi=off,bus=pci.5,addr=0x0,drive=drive-virtio-disk1,id=virtio-
  disk1 -netdev tap,fd=23,id=hostnet0 -device
  e1000,netdev=hostnet0,id=net0,mac=0a:58:0a:f4:01:e1,bus=pci.2,addr=0x1
  -chardev socket,id=charserial0,path=/var/run/kubevirt-private/default
  /ovm-cirros/virt-serial0,server,nowait -device isa-
  serial,chardev=charserial0,id=serial0 -vnc vnc=unix:/var/run/kubevirt-
  private/default/ovm-cirros/virt-vnc -device
  VGA,id=video0,vgamem_mb=16,bus=pcie.0,addr=0x1 -device virtio-balloon-
  pci,id=balloon0,bus=pci.6,addr=0x0 -msg timestamp=on

  

  Hypervisor versions of interest:

  [vagrant@node02 ~]$ sudo docker exec -it $(sudo docker ps | grep 
virt-launcher-ovm-cirros | grep entrypoint | awk -e '{print $1}') rpm -qa | 
grep 'qemu\|libvirt'
  qemu-block-curl-2.10.1-2.fc27.x86_64
  qemu-block-ssh-2.10.1-2.fc27.x86_64
  qemu-block-nfs-2.10.1-2.fc27.x86_64
  

[Bug 1799919] Re: IDE HDD emulation random read/write errors

2020-11-13 Thread Thomas Huth
Thanks, Peter! Looking at the bug description again and at the point in time 
when it happened, this was maybe a bug that we also saw with FreeDOS, caused by 
the CONFIG_ATA_DMA setting in Seabios, which had been fixed here: 
https://patchwork.kernel.org/project/qemu-devel/patch/20190318130809.31670-3-kra...@redhat.com/
Anyway, let's mark this as fixed, if it happens again, then please re-open or 
file a new bug.

** Changed in: qemu
   Status: Incomplete => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1799919

Title:
  IDE HDD emulation random read/write errors

Status in QEMU:
  Fix Released

Bug description:
  I unfortunately can’t give more tracks other than how to reproduce the
  bug, especially that the bug occurs randomly.

  Basically, I’m trying to install DOS 6.22 on an emulated ISA machine,
  and it fails, DOS complaining about read or write error on drive C.
  Repeating the operation multiple time, I see it occurs at random
  stage, sometime even before it partitions the drive, sometime when it
  formats the drive, sometime when it copies the files from the floppy
  to the drive.

  To test it, unpack the attached archive and execute `./run` from the
  extracted directory. The archive contains three raw floppy images for
  installing DOS 6.22, and a Bourne Shell script which invokes QEmu.
  Just press enter at any installation stage, the bug may occurs at any
  stage.

  I tried with `cache=none` to be sure it’s not a cache issue, but its
  the same whatever the cache policy is.

  Version and environment: using QEmu 3.0 on Ubuntu 16.04 on a 32 bits
  DELL Inspiron 9400 (not an emulation, that’s my real laptop).

  For why I’m using QEmu for this: the installation proceeds with not
  error in VirtualBox, but I wanted to use QEmu to have a serial mouse
  which is not available with QEmu and to have finer control over the
  machine configuration ; VirtualBox although good, is more limited in
  that regard.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1799919/+subscriptions



[Bug 1758091] Re: vmxnet3 unable to send IPv6 ESP packets

2020-11-13 Thread Thomas Jansen
** Changed in: qemu
   Status: Incomplete => 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/1758091

Title:
  vmxnet3 unable to send IPv6 ESP packets

Status in QEMU:
  New

Bug description:
  My vmxnet3 network driver (in a closed source custom OS) is unable to
  send network packets that are structured as follows: Ethernet-
  Header(IPv6-Header(ESP(encrypted data))). I can verify that the packet
  is sent in the VM but is dropped in qemu. I first encountered this
  problem on qemu 2.10.1 but master is affected as well. After some
  debug printing in qemu I could identify the following call chain as
  being problematic:

  eth_is_ip6_extension_header_type
  eth_parse_ipv6_hdr
  net_tx_pkt_parse_headers
  net_tx_pkt_parse
  vmxnet3_process_tx_queue

  The problem seems to be the definition of the ESP header
  (https://en.wikipedia.org/wiki/IPsec#Encapsulating_Security_Payload)
  that does not follow the standard IPv6 extension header format
  starting with next type and length. Thus the parsed ext_hdr in
  eth_parse_ipv6_hdr does not contain valid data, in particular the
  length will contain bogus data and lead to a info->full_hdr_len that
  is larger than the packet itself and the loop would then try to read
  beyond the end of the packet.

  Using the e1000 driver I can send these packets. My guess is that the
  net_tx_pkt_parse function is not called in that case.

  My guess for a fix would be to remove "case IP6_ESP:" from
  eth_is_ip6_extension_header_type and not regard the ESP header as a
  IPv6 extension header. In a quick test this seems to fix the problem.
  But that should be verified by someone who is familiar with the code.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1758091/+subscriptions



[PULL 2/2] intc/ibex_plic: Ensure we don't loose interrupts

2020-11-13 Thread Alistair Francis
If an interrupt occurs between when we claim and complete an interrupt
we currently drop the interrupt in ibex_plic_irqs_set_pending(). This
somewhat matches hardware that also ignore the interrupt between the
claim and complete process.

In the case of hardware though the physical interrupt line will still
be asserted after we have completed the interrupt. This means we will
still act on the interrupt after the complete process. In QEMU we don't
and instead we drop the interrupt as it is never recorded.

This patch changed the behaviour of the Ibex PLIC so that we save all
interrupts that occur while we are between claiming and completing an
interrupt so that we can act on them after the completition process.

This fixes interrupts being dropped when running Tock on OpenTitain in
QEMU.

Signed-off-by: Alistair Francis 
Message-id: 
e7bcf98c6925b1e6e7828e7c3f85293a09a65b12.1605136387.git.alistair.fran...@wdc.com
---
 include/hw/intc/ibex_plic.h |  1 +
 hw/intc/ibex_plic.c | 17 -
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/hw/intc/ibex_plic.h b/include/hw/intc/ibex_plic.h
index 37f03356b3..7fc495db99 100644
--- a/include/hw/intc/ibex_plic.h
+++ b/include/hw/intc/ibex_plic.h
@@ -33,6 +33,7 @@ struct IbexPlicState {
 MemoryRegion mmio;
 
 uint32_t *pending;
+uint32_t *hidden_pending;
 uint32_t *claimed;
 uint32_t *source;
 uint32_t *priority;
diff --git a/hw/intc/ibex_plic.c b/hw/intc/ibex_plic.c
index db9e0aa25f..341c9db405 100644
--- a/hw/intc/ibex_plic.c
+++ b/hw/intc/ibex_plic.c
@@ -48,6 +48,7 @@ static void ibex_plic_irqs_set_pending(IbexPlicState *s, int 
irq, bool level)
  * The interrupt has been claimed, but not completed.
  * The pending bit can't be set.
  */
+s->hidden_pending[pending_num] |= level << (irq % 32);
 return;
 }
 
@@ -176,8 +177,21 @@ static void ibex_plic_write(void *opaque, hwaddr addr,
 s->claim = 0;
 }
 if (s->claimed[value / 32] & 1 << (value % 32)) {
+int pending_num = value / 32;
+
 /* This value was already claimed, clear it. */
-s->claimed[value / 32] &= ~(1 << (value % 32));
+s->claimed[pending_num] &= ~(1 << (value % 32));
+
+if (s->hidden_pending[pending_num] & (1 << (value % 32))) {
+/*
+ * If the bit in hidden_pending is set then that means we
+ * received an interrupt between claiming and completing
+ * the interrupt that hasn't since been de-asserted.
+ * On hardware this would trigger an interrupt, so let's
+ * trigger one here as well.
+ */
+s->pending[pending_num] |= 1 << (value % 32);
+}
 }
 }
 
@@ -239,6 +253,7 @@ static void ibex_plic_realize(DeviceState *dev, Error 
**errp)
 int i;
 
 s->pending = g_new0(uint32_t, s->pending_num);
+s->hidden_pending = g_new0(uint32_t, s->pending_num);
 s->claimed = g_new0(uint32_t, s->pending_num);
 s->source = g_new0(uint32_t, s->source_num);
 s->priority = g_new0(uint32_t, s->priority_num);
-- 
2.29.2




[PULL 0/2] riscv-to-apply queue

2020-11-13 Thread Alistair Francis
The following changes since commit 5ececc3a0b0086c6168e12f4d032809477b30fe5:

  Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20201113' into 
staging (2020-11-13 13:40:23 +)

are available in the Git repository at:

  g...@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20201113-1

for you to fetch changes up to deef3d2568a7fbaa62d9bee07708cf3a4dc3ac53:

  intc/ibex_plic: Ensure we don't loose interrupts (2020-11-13 21:43:48 -0800)


Two small additional fixes for the Ibex PLIC.


Alistair Francis (2):
  intc/ibex_plic: Fix some typos in the comments
  intc/ibex_plic: Ensure we don't loose interrupts

 include/hw/intc/ibex_plic.h |  1 +
 hw/intc/ibex_plic.c | 21 ++---
 2 files changed, 19 insertions(+), 3 deletions(-)



[PULL 1/2] intc/ibex_plic: Fix some typos in the comments

2020-11-13 Thread Alistair Francis
Signed-off-by: Alistair Francis 
Message-id: 
22d2fb0d7af5ca316c67ac909926368d1bcb7cf5.1605136387.git.alistair.fran...@wdc.com
---
 hw/intc/ibex_plic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/intc/ibex_plic.c b/hw/intc/ibex_plic.c
index 235e6b88ff..db9e0aa25f 100644
--- a/hw/intc/ibex_plic.c
+++ b/hw/intc/ibex_plic.c
@@ -45,7 +45,7 @@ static void ibex_plic_irqs_set_pending(IbexPlicState *s, int 
irq, bool level)
 
 if (s->claimed[pending_num] & 1 << (irq % 32)) {
 /*
- * The interrupt has been claimed, but not compelted.
+ * The interrupt has been claimed, but not completed.
  * The pending bit can't be set.
  */
 return;
@@ -133,7 +133,7 @@ static uint64_t ibex_plic_read(void *opaque, hwaddr addr,
 int pending_num = s->claim / 32;
 s->pending[pending_num] &= ~(1 << (s->claim % 32));
 
-/* Set the interrupt as claimed, but not compelted */
+/* Set the interrupt as claimed, but not completed */
 s->claimed[pending_num] |= 1 << (s->claim % 32);
 
 /* Return the current claimed interrupt */
-- 
2.29.2




[PATCH] tests/vm: update NetBSD to 9.1

2020-11-13 Thread Brad Smith
tests/vm: update NetBSD to 9.1

Signed-off-by: Brad Smith 
Reviewed-by: Gerd Hoffmann 
Tested-by: Gerd Hoffmann 
---
 tests/vm/netbsd | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/vm/netbsd b/tests/vm/netbsd
index 447de9747d..596717cc76 100755
--- a/tests/vm/netbsd
+++ b/tests/vm/netbsd
@@ -22,8 +22,8 @@ class NetBSDVM(basevm.BaseVM):
 name = "netbsd"
 arch = "x86_64"
 
-link = 
"https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/images/NetBSD-9.0-amd64.iso;
-csum = 
"34da4882ee61bdbf69f241195a8933dc800949d30b43fc6988da853d57fc2b8cac50cf97a0d2adaf93250b4e329d189c1a8b83c33bd515226f37745d50c33369"
+link = 
"https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.1/images/NetBSD-9.1-amd64.iso;
+csum = 
"65bddc95945991c3b2021f9c8ded7f34c25f0a7611b7aa15a15fe23399e902307e926ae97fcd01dc1662ac67b5f6e4be643c6a2b581692ddcb616d30125066f9"
 size = "20G"
 pkgs = [
 # tools
@@ -38,7 +38,7 @@ class NetBSDVM(basevm.BaseVM):
 "bash",
 "gmake",
 "gsed",
-"gettext",
+"gettext-tools",
 
 # libs: crypto
 "gnutls",
-- 
2.28.0




[Bug 1904259] Re: include/qemu/atomic.h:495:5: error: misaligned atomic operation may incur significant performance penalty (Clang 11; Ubuntu 16 i686)

2020-11-13 Thread Ivan Serdyuk
Solved by removing -Werror flag

** Also affects: ubuntu
   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/1904259

Title:
  include/qemu/atomic.h:495:5: error: misaligned atomic operation may
  incur significant performance penalty (Clang 11; Ubuntu 16 i686)

Status in QEMU:
  New
Status in Ubuntu:
  New

Bug description:
  Hello.
  I haven't found any "official" executables, for emulating RISC-V (32bit; 
64bit) so I had to compile those myself.

  I found that auto-generated build scripts, for Ninja, contained some
  warnings interpreted as errors:

  
  oceanfish81@gollvm:~/Desktop/qemu/build$ ninja -j 1
  [2/1977] Compiling C object libqemuutil.a.p/util_qsp.c.o
  FAILED: libqemuutil.a.p/util_qsp.c.o 
  clang-11 -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader 
-I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include 
-I/usr/include/gio-unix-2.0/ -Xclang -fcolor-diagnostics -pipe -Wall 
-Winvalid-pch -Werror -std=gnu99 -O2 -g -m32 -D_GNU_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes 
-Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes 
-fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits 
-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body 
-Wnested-externs -Wendif-labels -Wexpansion-to-defined 
-Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value 
-Wno-string-plus-int -Wno-typedef-redefinition 
-Wno-tautological-type-limit-compare -Wno-psabi -fstack-protector-strong 
-isystem /home/oceanfish81/Desktop/qemu/linux-headers -isystem linux-headers 
-iquote /home/oceanfish81/Desktop/qemu/tcg/i386 -iquote . -iquote 
/home/oceanfish81/Desktop/qemu -iquote /home/oceanfish81/Desktop/qemu/accel/tcg 
-iquote /home/oceanfish81/Desktop/qemu/include -iquote 
/home/oceanfish81/Desktop/qemu/disas/libvixl -pthread -Wno-unused-function 
-fPIC -MD -MQ libqemuutil.a.p/util_qsp.c.o -MF libqemuutil.a.p/util_qsp.c.o.d 
-o libqemuutil.a.p/util_qsp.c.o -c ../util/qsp.c
  In file included from ../util/qsp.c:62:
  In file included from /home/oceanfish81/Desktop/qemu/include/qemu/thread.h:4:
  In file included from 
/home/oceanfish81/Desktop/qemu/include/qemu/processor.h:10:
  /home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:495:5: error: misaligned 
atomic operation may incur significant performance penalty 
[-Werror,-Watomic-alignment]
  qatomic_set__nocheck(ptr, val);
  ^
  /home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:138:5: note: expanded 
from macro 'qatomic_set__nocheck'
  __atomic_store_n(ptr, i, __ATOMIC_RELAXED)
  ^
  /home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:485:12: error: 
misaligned atomic operation may incur significant performance penalty 
[-Werror,-Watomic-alignment]
  return qatomic_read__nocheck(ptr);
 ^
  /home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:129:5: note: expanded 
from macro 'qatomic_read__nocheck'
  __atomic_load_n(ptr, __ATOMIC_RELAXED)
  ^
  2 errors generated.
  ninja: build stopped: subcommand failed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1904259/+subscriptions



[Bug 1904259] Re: include/qemu/atomic.h:495:5: error: misaligned atomic operation may incur significant performance penalty (Clang 11; Ubuntu 16 i686)

2020-11-13 Thread Ivan Serdyuk
$ python3.7 ../meson/meson.py --version
0.55.3

$ clang-11 --version
Ubuntu clang version 
11.0.0-++20200721055954+cebd637c886-1~exp1~20200721161335.13
Target: i686-pc-linux-gnu
Thread model: posix

$ ninja --version
1.10.0.git.kitware.jobserver-1

$ uname -a
Linux laptop 4.15.0-123-generic #126~16.04.1-Ubuntu SMP Wed Oct 21 13:51:51 UTC 
2020 i686 i686 i686 GNU/Linux

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1904259

Title:
  include/qemu/atomic.h:495:5: error: misaligned atomic operation may
  incur significant performance penalty (Clang 11; Ubuntu 16 i686)

Status in QEMU:
  New

Bug description:
  Hello.
  I haven't found any "official" executables, for emulating RISC-V (32bit; 
64bit) so I had to compile those myself.

  I found that auto-generated build scripts, for Ninja, contained some
  warnings interpreted as errors:

  
  oceanfish81@gollvm:~/Desktop/qemu/build$ ninja -j 1
  [2/1977] Compiling C object libqemuutil.a.p/util_qsp.c.o
  FAILED: libqemuutil.a.p/util_qsp.c.o 
  clang-11 -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader 
-I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include 
-I/usr/include/gio-unix-2.0/ -Xclang -fcolor-diagnostics -pipe -Wall 
-Winvalid-pch -Werror -std=gnu99 -O2 -g -m32 -D_GNU_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes 
-Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes 
-fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits 
-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body 
-Wnested-externs -Wendif-labels -Wexpansion-to-defined 
-Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value 
-Wno-string-plus-int -Wno-typedef-redefinition 
-Wno-tautological-type-limit-compare -Wno-psabi -fstack-protector-strong 
-isystem /home/oceanfish81/Desktop/qemu/linux-headers -isystem linux-headers 
-iquote /home/oceanfish81/Desktop/qemu/tcg/i386 -iquote . -iquote 
/home/oceanfish81/Desktop/qemu -iquote /home/oceanfish81/Desktop/qemu/accel/tcg 
-iquote /home/oceanfish81/Desktop/qemu/include -iquote 
/home/oceanfish81/Desktop/qemu/disas/libvixl -pthread -Wno-unused-function 
-fPIC -MD -MQ libqemuutil.a.p/util_qsp.c.o -MF libqemuutil.a.p/util_qsp.c.o.d 
-o libqemuutil.a.p/util_qsp.c.o -c ../util/qsp.c
  In file included from ../util/qsp.c:62:
  In file included from /home/oceanfish81/Desktop/qemu/include/qemu/thread.h:4:
  In file included from 
/home/oceanfish81/Desktop/qemu/include/qemu/processor.h:10:
  /home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:495:5: error: misaligned 
atomic operation may incur significant performance penalty 
[-Werror,-Watomic-alignment]
  qatomic_set__nocheck(ptr, val);
  ^
  /home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:138:5: note: expanded 
from macro 'qatomic_set__nocheck'
  __atomic_store_n(ptr, i, __ATOMIC_RELAXED)
  ^
  /home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:485:12: error: 
misaligned atomic operation may incur significant performance penalty 
[-Werror,-Watomic-alignment]
  return qatomic_read__nocheck(ptr);
 ^
  /home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:129:5: note: expanded 
from macro 'qatomic_read__nocheck'
  __atomic_load_n(ptr, __ATOMIC_RELAXED)
  ^
  2 errors generated.
  ninja: build stopped: subcommand failed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1904259/+subscriptions



[Bug 1894836] Re: kernel panic using hvf with CPU passthrough

2020-11-13 Thread Jessica Clarke
0f 01 f9 is RDTSCP; use -cpu host,-rdtscp to mask out the feature. KVM
couldn't pass the feature through for a while, and HVF currently can't,
though HVF should be modified to automatically hide the feature until it
can emulate 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/1894836

Title:
  kernel panic using hvf with CPU passthrough

Status in QEMU:
  New

Bug description:
  Host Details
  QEMU 5.1 (Homebrew)
  macOS 10.15.6 Catalina
  Late 2014 iMac
  i5-4690 @ 3.5 GHz
  8 GB RAM

  Guest Details
  Ubuntu Desktop 20.04.1 Installer ISO

  Problem
  Whenever I boot with "-accel hvf -cpu host", the Ubuntu desktop installer 
will immediately crash with a kernel panic after the initial splash screen.
  See the attached picture of the kernel panic for more details.

  Steps to recreate
  From 
https://www.jwillikers.com/posts/virtualize_ubuntu_desktop_on_macos_with_qemu/

  1. Install QEMU with Homebrew.
  $ brew install qemu

  2. Create a qcow2 disk image to which to install.
  $ qemu-img create -f qcow2 ubuntu2004.qcow2 60G

  3. Download the ISO.
  $ curl -L -o ubuntu-20.04.1-desktop-amd64.iso 
https://releases.ubuntu.com/20.04/ubuntu-20.04.1-desktop-amd64.iso

  4. Run the installer in QEMU.
  $ qemu-system-x86_64 \
    -accel hvf \
    -cpu host \
    -smp 2 \
    -m 4G \
    -usb \
    -device usb-tablet \
    -vga virtio \
    -display default,show-cursor=on \
    -device virtio-net,netdev=vmnic -netdev user,id=vmnic \
    -audiodev coreaudio,id=snd0 \
    -device ich9-intel-hda -device hda-output,audiodev=snd0 \
    -cdrom ubuntu-20.04.1-desktop-amd64.iso \
    -drive file=ubuntu2004.qcow2,if=virtio

  Workaround
  Emulating the CPU with "-cpu qemu64" does not result in a kernel panic.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1894836/+subscriptions



[Bug 1904259] [NEW] include/qemu/atomic.h:495:5: error: misaligned atomic operation may incur significant performance penalty (Clang 11; Ubuntu 16 i686)

2020-11-13 Thread Ivan Serdyuk
Public bug reported:

Hello.
I haven't found any "official" executables, for emulating RISC-V (32bit; 64bit) 
so I had to compile those myself.

I found that auto-generated build scripts, for Ninja, contained some
warnings interpreted as errors:


oceanfish81@gollvm:~/Desktop/qemu/build$ ninja -j 1
[2/1977] Compiling C object libqemuutil.a.p/util_qsp.c.o
FAILED: libqemuutil.a.p/util_qsp.c.o 
clang-11 -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader 
-I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include 
-I/usr/include/gio-unix-2.0/ -Xclang -fcolor-diagnostics -pipe -Wall 
-Winvalid-pch -Werror -std=gnu99 -O2 -g -m32 -D_GNU_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes 
-Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes 
-fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits 
-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body 
-Wnested-externs -Wendif-labels -Wexpansion-to-defined 
-Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value 
-Wno-string-plus-int -Wno-typedef-redefinition 
-Wno-tautological-type-limit-compare -Wno-psabi -fstack-protector-strong 
-isystem /home/oceanfish81/Desktop/qemu/linux-headers -isystem linux-headers 
-iquote /home/oceanfish81/Desktop/qemu/tcg/i386 -iquote . -iquote 
/home/oceanfish81/Desktop/qemu -iquote /home/oceanfish81/Desktop/qemu/accel/tcg 
-iquote /home/oceanfish81/Desktop/qemu/include -iquote 
/home/oceanfish81/Desktop/qemu/disas/libvixl -pthread -Wno-unused-function 
-fPIC -MD -MQ libqemuutil.a.p/util_qsp.c.o -MF libqemuutil.a.p/util_qsp.c.o.d 
-o libqemuutil.a.p/util_qsp.c.o -c ../util/qsp.c
In file included from ../util/qsp.c:62:
In file included from /home/oceanfish81/Desktop/qemu/include/qemu/thread.h:4:
In file included from 
/home/oceanfish81/Desktop/qemu/include/qemu/processor.h:10:
/home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:495:5: error: misaligned 
atomic operation may incur significant performance penalty 
[-Werror,-Watomic-alignment]
qatomic_set__nocheck(ptr, val);
^
/home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:138:5: note: expanded from 
macro 'qatomic_set__nocheck'
__atomic_store_n(ptr, i, __ATOMIC_RELAXED)
^
/home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:485:12: error: misaligned 
atomic operation may incur significant performance penalty 
[-Werror,-Watomic-alignment]
return qatomic_read__nocheck(ptr);
   ^
/home/oceanfish81/Desktop/qemu/include/qemu/atomic.h:129:5: note: expanded from 
macro 'qatomic_read__nocheck'
__atomic_load_n(ptr, __ATOMIC_RELAXED)
^
2 errors generated.
ninja: build stopped: subcommand failed.

** Affects: qemu
 Importance: Undecided
 Status: New

** Attachment added: "Attaching my build.ninja file, in case it would be of 
help"
   
https://bugs.launchpad.net/bugs/1904259/+attachment/5434234/+files/build.ninja

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1904259

Title:
  include/qemu/atomic.h:495:5: error: misaligned atomic operation may
  incur significant performance penalty (Clang 11; Ubuntu 16 i686)

Status in QEMU:
  New

Bug description:
  Hello.
  I haven't found any "official" executables, for emulating RISC-V (32bit; 
64bit) so I had to compile those myself.

  I found that auto-generated build scripts, for Ninja, contained some
  warnings interpreted as errors:

  
  oceanfish81@gollvm:~/Desktop/qemu/build$ ninja -j 1
  [2/1977] Compiling C object libqemuutil.a.p/util_qsp.c.o
  FAILED: libqemuutil.a.p/util_qsp.c.o 
  clang-11 -Ilibqemuutil.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader 
-I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include 
-I/usr/include/gio-unix-2.0/ -Xclang -fcolor-diagnostics -pipe -Wall 
-Winvalid-pch -Werror -std=gnu99 -O2 -g -m32 -D_GNU_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes 
-Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes 
-fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits 
-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body 
-Wnested-externs -Wendif-labels -Wexpansion-to-defined 
-Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value 
-Wno-string-plus-int -Wno-typedef-redefinition 
-Wno-tautological-type-limit-compare -Wno-psabi -fstack-protector-strong 
-isystem /home/oceanfish81/Desktop/qemu/linux-headers -isystem linux-headers 
-iquote /home/oceanfish81/Desktop/qemu/tcg/i386 -iquote . -iquote 
/home/oceanfish81/Desktop/qemu -iquote /home/oceanfish81/Desktop/qemu/accel/tcg 
-iquote /home/oceanfish81/Desktop/qemu/include -iquote 
/home/oceanfish81/Desktop/qemu/disas/libvixl -pthread -Wno-unused-function 
-fPIC -MD -MQ libqemuutil.a.p/util_qsp.c.o -MF libqemuutil.a.p/util_qsp.c.o.d 
-o libqemuutil.a.p/util_qsp.c.o -c ../util/qsp.c
  In file included from 

[PATCH 2/5 v5] KVM: SVM: Fill in conforming svm_x86_ops via macro

2020-11-13 Thread Krish Sadhukhan
The names of some of the svm_x86_ops functions do not have a corresponding
'svm_' prefix. Generate the names using a macro so that the names are
conformant. Fixing the naming will help in better readability and
maintenance of the code.

Suggested-by: Vitaly Kuznetsov 
Suggested-by: Paolo Bonzini 
Signed-off-by: Sean Christopherson 
Reported-by: kernel test robot 
Signed-off-by: Krish Sadhukhan 
---
 arch/x86/kvm/pmu.h  |   2 +-
 arch/x86/kvm/svm/avic.c |  11 +-
 arch/x86/kvm/svm/pmu.c  |   2 +-
 arch/x86/kvm/svm/sev.c  |   4 +-
 arch/x86/kvm/svm/svm.c  | 298 ++--
 arch/x86/kvm/svm/svm.h  |  15 +-
 arch/x86/kvm/x86.c  |  11 +-
 7 files changed, 188 insertions(+), 155 deletions(-)

diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h
index 067fef51760c..a7f1f048c6a8 100644
--- a/arch/x86/kvm/pmu.h
+++ b/arch/x86/kvm/pmu.h
@@ -161,5 +161,5 @@ int kvm_vm_ioctl_set_pmu_event_filter(struct kvm *kvm, void 
__user *argp);
 bool is_vmware_backdoor_pmc(u32 pmc_idx);
 
 extern struct kvm_pmu_ops intel_pmu_ops;
-extern struct kvm_pmu_ops amd_pmu_ops;
+extern struct kvm_pmu_ops svm_pmu_ops;
 #endif /* __KVM_X86_PMU_H */
diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index 8c550999ace0..1e709237a77f 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -577,7 +577,12 @@ int avic_init_vcpu(struct vcpu_svm *svm)
return ret;
 }
 
-void avic_post_state_restore(struct kvm_vcpu *vcpu)
+int svm_sync_pir_to_irr(struct kvm_vcpu *vcpu)
+{
+   return kvm_lapic_find_highest_irr(vcpu);
+}
+
+void svm_apicv_post_state_restore(struct kvm_vcpu *vcpu)
 {
if (avic_handle_apic_id_update(vcpu) != 0)
return;
@@ -658,7 +663,7 @@ void svm_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu)
 * we need to check and update the AVIC logical APIC ID table
 * accordingly before re-activating.
 */
-   avic_post_state_restore(vcpu);
+   svm_apicv_post_state_restore(vcpu);
vmcb->control.int_ctl |= AVIC_ENABLE_MASK;
} else {
vmcb->control.int_ctl &= ~AVIC_ENABLE_MASK;
@@ -673,7 +678,7 @@ void svm_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 
*eoi_exit_bitmap)
return;
 }
 
-int svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec)
+int svm_deliver_interrupt(struct kvm_vcpu *vcpu, int vec)
 {
if (!vcpu->arch.apicv_active)
return -1;
diff --git a/arch/x86/kvm/svm/pmu.c b/arch/x86/kvm/svm/pmu.c
index 035da07500e8..e518372ab292 100644
--- a/arch/x86/kvm/svm/pmu.c
+++ b/arch/x86/kvm/svm/pmu.c
@@ -311,7 +311,7 @@ static void amd_pmu_reset(struct kvm_vcpu *vcpu)
}
 }
 
-struct kvm_pmu_ops amd_pmu_ops = {
+struct kvm_pmu_ops svm_pmu_ops = {
.find_arch_event = amd_find_arch_event,
.find_fixed_event = amd_find_fixed_event,
.pmc_is_enabled = amd_pmc_is_enabled,
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index c0b14106258a..53d8a6fbaf8e 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -984,7 +984,7 @@ int svm_mem_enc_op(struct kvm *kvm, void __user *argp)
return r;
 }
 
-int svm_register_enc_region(struct kvm *kvm,
+int svm_mem_enc_register_region(struct kvm *kvm,
struct kvm_enc_region *range)
 {
struct kvm_sev_info *sev = _kvm_svm(kvm)->sev_info;
@@ -1053,7 +1053,7 @@ static void __unregister_enc_region_locked(struct kvm 
*kvm,
kfree(region);
 }
 
-int svm_unregister_enc_region(struct kvm *kvm,
+int svm_mem_enc_unregister_region(struct kvm *kvm,
  struct kvm_enc_region *range)
 {
struct enc_region *region;
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 5ee8eef1905a..2c96a0e88b1e 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -332,7 +332,7 @@ static void svm_set_interrupt_shadow(struct kvm_vcpu *vcpu, 
int mask)
 
 }
 
-static int skip_emulated_instruction(struct kvm_vcpu *vcpu)
+static int svm_skip_emulated_instruction(struct kvm_vcpu *vcpu)
 {
struct vcpu_svm *svm = to_svm(vcpu);
 
@@ -371,7 +371,7 @@ static void svm_queue_exception(struct kvm_vcpu *vcpu)
 * raises a fault that is not intercepted. Still better than
 * failing in all cases.
 */
-   (void)skip_emulated_instruction(>vcpu);
+   (void)svm_skip_emulated_instruction(>vcpu);
rip = kvm_rip_read(>vcpu);
svm->int3_rip = rip + svm->vmcb->save.cs.base;
svm->int3_injected = rip - old_rip;
@@ -1284,7 +1284,7 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu, bool 
init_event)
avic_update_vapic_bar(svm, APIC_DEFAULT_PHYS_BASE);
 }
 
-static int svm_create_vcpu(struct kvm_vcpu *vcpu)
+static int svm_vcpu_create(struct kvm_vcpu *vcpu)
 {
struct vcpu_svm *svm;
struct page *vmcb_page;
@@ -1338,7 +1338,7 @@ static 

[PATCH 3/5 v5] KVM: nSVM: Fill in conforming svm_nested_ops via macro

2020-11-13 Thread Krish Sadhukhan
The names of the nested_svm_ops functions do not have a corresponding
'nested_svm_' prefix. Generate the names using a macro so that the names are
conformant. Fixing the naming will help in better readability and
maintenance of the code.

Suggested-by: Vitaly Kuznetsov 
Suggested-by: Paolo Bonzini 
Signed-off-by: Sean Christopherson 
Signed-off-by: Krish Sadhukhan 
---
 arch/x86/kvm/svm/nested.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index 200674190449..4cdeacaf768f 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -196,7 +196,7 @@ static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
return true;
 }
 
-static bool svm_get_nested_state_pages(struct kvm_vcpu *vcpu)
+static bool nested_svm_get_pages(struct kvm_vcpu *vcpu)
 {
struct vcpu_svm *svm = to_svm(vcpu);
if (!nested_svm_vmrun_msrpm(svm)) {
@@ -834,7 +834,7 @@ static int nested_svm_intercept(struct vcpu_svm *svm)
/*
 * Host-intercepted exceptions have been checked already in
 * nested_svm_exit_special.  There is nothing to do here,
-* the vmexit is injected by svm_check_nested_events.
+* the vmexit is injected by nested_svm_check_events.
 */
vmexit = NESTED_EXIT_DONE;
break;
@@ -965,7 +965,7 @@ static void nested_svm_init(struct vcpu_svm *svm)
 }
 
 
-static int svm_check_nested_events(struct kvm_vcpu *vcpu)
+static int nested_svm_check_events(struct kvm_vcpu *vcpu)
 {
struct vcpu_svm *svm = to_svm(vcpu);
bool block_nested_events =
@@ -1049,7 +1049,7 @@ int nested_svm_exit_special(struct vcpu_svm *svm)
return NESTED_EXIT_CONTINUE;
 }
 
-static int svm_get_nested_state(struct kvm_vcpu *vcpu,
+static int nested_svm_get_state(struct kvm_vcpu *vcpu,
struct kvm_nested_state __user 
*user_kvm_nested_state,
u32 user_data_size)
 {
@@ -1106,7 +1106,7 @@ static int svm_get_nested_state(struct kvm_vcpu *vcpu,
return kvm_state.size;
 }
 
-static int svm_set_nested_state(struct kvm_vcpu *vcpu,
+static int nested_svm_set_state(struct kvm_vcpu *vcpu,
struct kvm_nested_state __user 
*user_kvm_nested_state,
struct kvm_nested_state *kvm_state)
 {
@@ -1209,9 +1209,11 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,
return ret;
 }
 
+#define KVM_X86_NESTED_OP_NAME(name) .name = nested_svm_##name
+
 struct kvm_x86_nested_ops svm_nested_ops = {
-   .check_events = svm_check_nested_events,
-   .get_pages = svm_get_nested_state_pages,
-   .get_state = svm_get_nested_state,
-   .set_state = svm_set_nested_state,
+   KVM_X86_NESTED_OP_NAME(check_events),
+   KVM_X86_NESTED_OP_NAME(get_pages),
+   KVM_X86_NESTED_OP_NAME(get_state),
+   KVM_X86_NESTED_OP_NAME(set_state),
 };
-- 
2.27.0




[PATCH 4/5 v5] KVM: VMX: Fill in conforming vmx_x86_ops via macro

2020-11-13 Thread Krish Sadhukhan
The names of some of the vmx_x86_ops functions do not have a corresponding
'vmx_' prefix. Generate the names using a macro so that the names are
conformant. Fixing the naming will help in better readability and
maintenance of the code.

Suggested-by: Vitaly Kuznetsov 
Suggested-by: Paolo Bonzini 
Signed-off-by: Sean Christopherson 
Signed-off-by: Krish Sadhukhan 
---
 arch/x86/kvm/pmu.h |   2 +-
 arch/x86/kvm/vmx/nested.c  |   2 +-
 arch/x86/kvm/vmx/pmu_intel.c   |   2 +-
 arch/x86/kvm/vmx/posted_intr.c |   6 +-
 arch/x86/kvm/vmx/posted_intr.h |   4 +-
 arch/x86/kvm/vmx/vmx.c | 260 +
 arch/x86/kvm/vmx/vmx.h |   2 +-
 7 files changed, 141 insertions(+), 137 deletions(-)

diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h
index a7f1f048c6a8..b8049ee4d1ab 100644
--- a/arch/x86/kvm/pmu.h
+++ b/arch/x86/kvm/pmu.h
@@ -160,6 +160,6 @@ int kvm_vm_ioctl_set_pmu_event_filter(struct kvm *kvm, void 
__user *argp);
 
 bool is_vmware_backdoor_pmc(u32 pmc_idx);
 
-extern struct kvm_pmu_ops intel_pmu_ops;
+extern struct kvm_pmu_ops vmx_pmu_ops;
 extern struct kvm_pmu_ops svm_pmu_ops;
 #endif /* __KVM_X86_PMU_H */
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 6c32f73cffd5..104d6782ddc3 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -2532,7 +2532,7 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct 
vmcs12 *vmcs12,
 * bitwise-or of what L1 wants to trap for L2, and what we want to
 * trap. Note that CR0.TS also needs updating - we do this later.
 */
-   update_exception_bitmap(vcpu);
+   vmx_update_exception_bitmap(vcpu);
vcpu->arch.cr0_guest_owned_bits &= ~vmcs12->cr0_guest_host_mask;
vmcs_writel(CR0_GUEST_HOST_MASK, ~vcpu->arch.cr0_guest_owned_bits);
 
diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c
index a886a47daebd..c39f1dbcd436 100644
--- a/arch/x86/kvm/vmx/pmu_intel.c
+++ b/arch/x86/kvm/vmx/pmu_intel.c
@@ -427,7 +427,7 @@ static void intel_pmu_reset(struct kvm_vcpu *vcpu)
pmu->global_ovf_ctrl = 0;
 }
 
-struct kvm_pmu_ops intel_pmu_ops = {
+struct kvm_pmu_ops vmx_pmu_ops = {
.find_arch_event = intel_find_arch_event,
.find_fixed_event = intel_find_fixed_event,
.pmc_is_enabled = intel_pmc_is_enabled,
diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c
index f02962dcc72c..39c7ccabfd82 100644
--- a/arch/x86/kvm/vmx/posted_intr.c
+++ b/arch/x86/kvm/vmx/posted_intr.c
@@ -228,7 +228,7 @@ void __init pi_init_cpu(int cpu)
spin_lock_init(_cpu(blocked_vcpu_on_cpu_lock, cpu));
 }
 
-bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu)
+bool vmx_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu)
 {
struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu);
 
@@ -238,7 +238,7 @@ bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu)
 
 
 /*
- * pi_update_irte - set IRTE for Posted-Interrupts
+ * vmx_pi_update_irte - set IRTE for Posted-Interrupts
  *
  * @kvm: kvm
  * @host_irq: host irq of the interrupt
@@ -246,7 +246,7 @@ bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu)
  * @set: set or unset PI
  * returns 0 on success, < 0 on failure
  */
-int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq,
+int vmx_update_pi_irte(struct kvm *kvm, unsigned int host_irq, uint32_t 
guest_irq,
   bool set)
 {
struct kvm_kernel_irq_routing_entry *e;
diff --git a/arch/x86/kvm/vmx/posted_intr.h b/arch/x86/kvm/vmx/posted_intr.h
index 0bdc41391c5b..76ab06faec26 100644
--- a/arch/x86/kvm/vmx/posted_intr.h
+++ b/arch/x86/kvm/vmx/posted_intr.h
@@ -92,8 +92,8 @@ int pi_pre_block(struct kvm_vcpu *vcpu);
 void pi_post_block(struct kvm_vcpu *vcpu);
 void pi_wakeup_handler(void);
 void __init pi_init_cpu(int cpu);
-bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu);
-int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq,
+bool vmx_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu);
+int vmx_update_pi_irte(struct kvm *kvm, unsigned int host_irq, uint32_t 
guest_irq,
   bool set);
 
 #endif /* __KVM_X86_VMX_POSTED_INTR_H */
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index ddfc127d5c4f..0b8539759ad9 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -629,7 +629,7 @@ static inline bool cpu_need_virtualize_apic_accesses(struct 
kvm_vcpu *vcpu)
return flexpriority_enabled && lapic_in_kernel(vcpu);
 }
 
-static inline bool report_flexpriority(void)
+static inline bool vmx_cpu_has_accelerated_tpr(void)
 {
return flexpriority_enabled;
 }
@@ -807,7 +807,7 @@ static u32 vmx_read_guest_seg_ar(struct vcpu_vmx *vmx, 
unsigned seg)
return *p;
 }
 
-void update_exception_bitmap(struct kvm_vcpu *vcpu)
+void vmx_update_exception_bitmap(struct kvm_vcpu *vcpu)
 {
u32 eb;
 
@@ -2283,7 +2283,7 @@ static int kvm_cpu_vmxon(u64 vmxon_pointer)

[PATCH 1/5 v5] KVM: x86: Change names of some of the kvm_x86_ops functions to make them more semantical and readable

2020-11-13 Thread Krish Sadhukhan
Suggested-by: Vitaly Kuznetsov 
Suggested-by: Paolo Bonzini 
Signed-off-by: Sean Christopherson 
Signed-off-by: Krish Sadhukhan 
---
 arch/arm64/include/asm/kvm_host.h   |  2 +-
 arch/mips/include/asm/kvm_host.h|  2 +-
 arch/powerpc/include/asm/kvm_host.h |  2 +-
 arch/s390/kvm/kvm-s390.c|  2 +-
 arch/x86/include/asm/kvm_host.h | 18 
 arch/x86/kvm/lapic.c|  2 +-
 arch/x86/kvm/svm/nested.c   |  2 +-
 arch/x86/kvm/svm/svm.c  | 14 ++---
 arch/x86/kvm/vmx/nested.c   |  2 +-
 arch/x86/kvm/vmx/vmx.c  | 10 -
 arch/x86/kvm/x86.c  | 32 ++---
 include/linux/kvm_host.h|  2 +-
 include/uapi/linux/kvm.h|  6 +++---
 tools/include/uapi/linux/kvm.h  |  6 +++---
 virt/kvm/kvm_main.c |  4 ++--
 15 files changed, 53 insertions(+), 53 deletions(-)

diff --git a/arch/arm64/include/asm/kvm_host.h 
b/arch/arm64/include/asm/kvm_host.h
index 781d029b8aa8..50d0768f3aef 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -592,7 +592,7 @@ static inline bool kvm_arch_requires_vhe(void)
 
 void kvm_arm_vcpu_ptrauth_trap(struct kvm_vcpu *vcpu);
 
-static inline void kvm_arch_hardware_unsetup(void) {}
+static inline void kvm_arch_hardware_teardown(void) {}
 static inline void kvm_arch_sync_events(struct kvm *kvm) {}
 static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
 static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {}
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index 24f3d0f9996b..88ec47f7a56a 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -1145,7 +1145,7 @@ extern unsigned long kvm_mips_get_ramsize(struct kvm 
*kvm);
 extern int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
 struct kvm_mips_interrupt *irq);
 
-static inline void kvm_arch_hardware_unsetup(void) {}
+static inline void kvm_arch_hardware_teardown(void) {}
 static inline void kvm_arch_sync_events(struct kvm *kvm) {}
 static inline void kvm_arch_free_memslot(struct kvm *kvm,
 struct kvm_memory_slot *slot) {}
diff --git a/arch/powerpc/include/asm/kvm_host.h 
b/arch/powerpc/include/asm/kvm_host.h
index d67a470e95a3..5a702ce6398a 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -860,7 +860,7 @@ struct kvm_vcpu_arch {
 #define __KVM_HAVE_CREATE_DEVICE
 
 static inline void kvm_arch_hardware_disable(void) {}
-static inline void kvm_arch_hardware_unsetup(void) {}
+static inline void kvm_arch_hardware_teardown(void) {}
 static inline void kvm_arch_sync_events(struct kvm *kvm) {}
 static inline void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen) {}
 static inline void kvm_arch_flush_shadow_all(struct kvm *kvm) {}
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 6b74b92c1a58..e503263a0ef7 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -312,7 +312,7 @@ int kvm_arch_hardware_setup(void *opaque)
return 0;
 }
 
-void kvm_arch_hardware_unsetup(void)
+void kvm_arch_hardware_teardown(void)
 {
gmap_unregister_pte_notifier(_notifier);
gmap_unregister_pte_notifier(_gmap_notifier);
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index d44858b69353..a7664db47cfd 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -1085,7 +1085,7 @@ static inline u16 kvm_lapic_irq_dest_mode(bool 
dest_mode_logical)
 struct kvm_x86_ops {
int (*hardware_enable)(void);
void (*hardware_disable)(void);
-   void (*hardware_unsetup)(void);
+   void (*hardware_teardown)(void);
bool (*cpu_has_accelerated_tpr)(void);
bool (*has_emulated_msr)(u32 index);
void (*vcpu_after_set_cpuid)(struct kvm_vcpu *vcpu);
@@ -1099,7 +1099,7 @@ struct kvm_x86_ops {
void (*vcpu_free)(struct kvm_vcpu *vcpu);
void (*vcpu_reset)(struct kvm_vcpu *vcpu, bool init_event);
 
-   void (*prepare_guest_switch)(struct kvm_vcpu *vcpu);
+   void (*prepare_switch_to_guest)(struct kvm_vcpu *vcpu);
void (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu);
void (*vcpu_put)(struct kvm_vcpu *vcpu);
 
@@ -1146,7 +1146,7 @@ struct kvm_x86_ops {
 */
void (*tlb_flush_guest)(struct kvm_vcpu *vcpu);
 
-   enum exit_fastpath_completion (*run)(struct kvm_vcpu *vcpu);
+   enum exit_fastpath_completion (*vcpu_run)(struct kvm_vcpu *vcpu);
int (*handle_exit)(struct kvm_vcpu *vcpu,
enum exit_fastpath_completion exit_fastpath);
int (*skip_emulated_instruction)(struct kvm_vcpu *vcpu);
@@ -1155,8 +1155,8 @@ struct kvm_x86_ops {
u32 (*get_interrupt_shadow)(struct kvm_vcpu *vcpu);
void (*patch_hypercall)(struct kvm_vcpu *vcpu,
   

[PATCH 0/5 v5] KVM: x86: Fill in conforming {vmx|svm}_x86_ops and {vmx|svm}_nested_ops via macros

2020-11-13 Thread Krish Sadhukhan
v4 -> v5:
1. The op 'prepare_guest_switch' has been renamed to
   'prepare_switch_to_guest'.
2. The following functions were missing the 'static' keyword (reported
   by kernel test robot ):

svm_get_cs_db_l_bits
svm_tlb_flush_all
svm_tlb_flush_current
svm_tlb_flush_guest


[PATCH 1/5 v5] KVM: x86: Change names of some of the kvm_x86_ops
[PATCH 2/5 v5] KVM: SVM: Fill in conforming svm_x86_ops via macro
[PATCH 3/5 v5] KVM: nSVM: Fill in conforming svm_nested_ops via macro
[PATCH 4/5 v5] KVM: VMX: Fill in conforming vmx_x86_ops via macro
[PATCH 5/5 v5] KVM: nVMX: Fill in conforming vmx_nested_ops via macro

 arch/arm64/include/asm/kvm_host.h   |   2 +-
 arch/mips/include/asm/kvm_host.h|   2 +-
 arch/powerpc/include/asm/kvm_host.h |   2 +-
 arch/s390/kvm/kvm-s390.c|   2 +-
 arch/x86/include/asm/kvm_host.h |  18 +--
 arch/x86/kvm/lapic.c|   2 +-
 arch/x86/kvm/pmu.h  |   4 +-
 arch/x86/kvm/svm/avic.c |  11 +-
 arch/x86/kvm/svm/nested.c   |  20 +--
 arch/x86/kvm/svm/pmu.c  |   2 +-
 arch/x86/kvm/svm/sev.c  |   4 +-
 arch/x86/kvm/svm/svm.c  | 298 
 arch/x86/kvm/svm/svm.h  |  15 +-
 arch/x86/kvm/vmx/evmcs.c|   6 +-
 arch/x86/kvm/vmx/evmcs.h|   4 +-
 arch/x86/kvm/vmx/nested.c   |  37 +++--
 arch/x86/kvm/vmx/pmu_intel.c|   2 +-
 arch/x86/kvm/vmx/posted_intr.c  |   6 +-
 arch/x86/kvm/vmx/posted_intr.h  |   4 +-
 arch/x86/kvm/vmx/vmx.c  | 260 +++
 arch/x86/kvm/vmx/vmx.h  |   2 +-
 arch/x86/kvm/x86.c  |  43 ++
 include/linux/kvm_host.h|   2 +-
 include/uapi/linux/kvm.h|   6 +-
 tools/include/uapi/linux/kvm.h  |   6 +-
 virt/kvm/kvm_main.c |   4 +-
 26 files changed, 405 insertions(+), 359 deletions(-)

Krish Sadhukhan (5):
  KVM: x86: Change names of some of the kvm_x86_ops functions to make them m
ore semantical and readable
  KVM: SVM: Fill in conforming svm_x86_ops via macro
  KVM: nSVM: Fill in conforming svm_nested_ops via macro
  KVM: VMX: Fill in conforming vmx_x86_ops via macro
  KVM: nVMX: Fill in conforming vmx_nested_ops via macro




[PATCH 5/5 v5] KVM: nVMX: Fill in conforming vmx_nested_ops via macro

2020-11-13 Thread Krish Sadhukhan
The names of some of the vmx_nested_ops functions do not have a corresponding
'nested_vmx_' prefix. Generate the names using a macro so that the names are
conformant. Fixing the naming will help in better readability and
maintenance of the code.

Suggested-by: Vitaly Kuznetsov 
Suggested-by: Paolo Bonzini 
Signed-off-by: Sean Christopherson 
Signed-off-by: Krish Sadhukhan 
---
 arch/x86/kvm/vmx/evmcs.c  |  6 +++---
 arch/x86/kvm/vmx/evmcs.h  |  4 ++--
 arch/x86/kvm/vmx/nested.c | 35 +--
 3 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/arch/x86/kvm/vmx/evmcs.c b/arch/x86/kvm/vmx/evmcs.c
index f3199bb02f22..e54b366ea114 100644
--- a/arch/x86/kvm/vmx/evmcs.c
+++ b/arch/x86/kvm/vmx/evmcs.c
@@ -324,7 +324,7 @@ bool nested_enlightened_vmentry(struct kvm_vcpu *vcpu, u64 
*evmcs_gpa)
return true;
 }
 
-uint16_t nested_get_evmcs_version(struct kvm_vcpu *vcpu)
+uint16_t nested_vmx_get_evmcs_version(struct kvm_vcpu *vcpu)
 {
struct vcpu_vmx *vmx = to_vmx(vcpu);
/*
@@ -418,7 +418,7 @@ int nested_evmcs_check_controls(struct vmcs12 *vmcs12)
return ret;
 }
 
-int nested_enable_evmcs(struct kvm_vcpu *vcpu,
+int nested_vmx_enable_evmcs(struct kvm_vcpu *vcpu,
uint16_t *vmcs_version)
 {
struct vcpu_vmx *vmx = to_vmx(vcpu);
@@ -426,7 +426,7 @@ int nested_enable_evmcs(struct kvm_vcpu *vcpu,
vmx->nested.enlightened_vmcs_enabled = true;
 
if (vmcs_version)
-   *vmcs_version = nested_get_evmcs_version(vcpu);
+   *vmcs_version = nested_vmx_get_evmcs_version(vcpu);
 
return 0;
 }
diff --git a/arch/x86/kvm/vmx/evmcs.h b/arch/x86/kvm/vmx/evmcs.h
index bd41d9462355..150e7921b5fd 100644
--- a/arch/x86/kvm/vmx/evmcs.h
+++ b/arch/x86/kvm/vmx/evmcs.h
@@ -205,8 +205,8 @@ enum nested_evmptrld_status {
 };
 
 bool nested_enlightened_vmentry(struct kvm_vcpu *vcpu, u64 *evmcs_gpa);
-uint16_t nested_get_evmcs_version(struct kvm_vcpu *vcpu);
-int nested_enable_evmcs(struct kvm_vcpu *vcpu,
+uint16_t nested_vmx_get_evmcs_version(struct kvm_vcpu *vcpu);
+int nested_vmx_enable_evmcs(struct kvm_vcpu *vcpu,
uint16_t *vmcs_version);
 void nested_evmcs_filter_control_msr(u32 msr_index, u64 *pdata);
 int nested_evmcs_check_controls(struct vmcs12 *vmcs12);
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 104d6782ddc3..ecff1117f598 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -3223,7 +3223,12 @@ static bool nested_get_vmcs12_pages(struct kvm_vcpu 
*vcpu)
return true;
 }
 
-static int nested_vmx_write_pml_buffer(struct kvm_vcpu *vcpu, gpa_t gpa)
+static bool nested_vmx_get_pages(struct kvm_vcpu *vcpu)
+{
+   return nested_get_vmcs12_pages(vcpu);
+}
+
+static int nested_vmx_write_log_dirty(struct kvm_vcpu *vcpu, gpa_t gpa)
 {
struct vmcs12 *vmcs12;
struct vcpu_vmx *vmx = to_vmx(vcpu);
@@ -3769,13 +3774,13 @@ static void nested_vmx_update_pending_dbg(struct 
kvm_vcpu *vcpu)
vcpu->arch.exception.payload);
 }
 
-static bool nested_vmx_preemption_timer_pending(struct kvm_vcpu *vcpu)
+static bool nested_vmx_hv_timer_pending(struct kvm_vcpu *vcpu)
 {
return nested_cpu_has_preemption_timer(get_vmcs12(vcpu)) &&
   to_vmx(vcpu)->nested.preemption_timer_expired;
 }
 
-static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
+static int nested_vmx_check_events(struct kvm_vcpu *vcpu)
 {
struct vcpu_vmx *vmx = to_vmx(vcpu);
unsigned long exit_qual;
@@ -3830,7 +3835,7 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
return 0;
}
 
-   if (nested_vmx_preemption_timer_pending(vcpu)) {
+   if (nested_vmx_hv_timer_pending(vcpu)) {
if (block_nested_events)
return -EBUSY;
nested_vmx_vmexit(vcpu, EXIT_REASON_PREEMPTION_TIMER, 0, 0);
@@ -5964,7 +5969,7 @@ bool nested_vmx_reflect_vmexit(struct kvm_vcpu *vcpu)
return true;
 }
 
-static int vmx_get_nested_state(struct kvm_vcpu *vcpu,
+static int nested_vmx_get_state(struct kvm_vcpu *vcpu,
struct kvm_nested_state __user 
*user_kvm_nested_state,
u32 user_data_size)
 {
@@ -6088,7 +6093,7 @@ void vmx_leave_nested(struct kvm_vcpu *vcpu)
free_nested(vcpu);
 }
 
-static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
+static int nested_vmx_set_state(struct kvm_vcpu *vcpu,
struct kvm_nested_state __user 
*user_kvm_nested_state,
struct kvm_nested_state *kvm_state)
 {
@@ -6568,13 +6573,15 @@ __init int nested_vmx_hardware_setup(int 
(*exit_handlers[])(struct kvm_vcpu *))
return 0;
 }
 
+#define KVM_X86_NESTED_OP_NAME(name) .name = nested_vmx_##name
+
 struct kvm_x86_nested_ops vmx_nested_ops = {
-   .check_events = vmx_check_nested_events,
-   .hv_timer_pending = 

Re: [Bug 1904206] Re: install QEMU

2020-11-13 Thread abou
Thank you very much for your answer. I have already watched two
tutorials, but it does not work. Do you have a tutorial for me? Thank
you

Regard
Le vendredi 13 novembre 2020 à 16:55:40 UTC+1, Peter Maydell 
<1904...@bugs.launchpad.net> a écrit :  
 
 QEMU is working fine, but your guest kernel has crashed. Either your
guest kernel is the wrong one for the "versatilepb" machine type, or the
kernel wants a dtb file and you are not passing one via QEMU's -dtb
argument.

Unless you like debugging "board bring-up" issues, I recommend that you
find a good tutorial on running an Arm Linux system on QEMU and follow
it; that will be faster than trying to diagnose and fix what
config/kernel/etc mismatch you've made.

-- 
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/1904206

Title:
  install QEMU

Status in QEMU:
  New

Bug description:
  I want install QEMU on Kali, I write :

  qemu-system-arm -kernel ~/qemu_vms/kernel-qemu-3.10.25-wheezy -cpu
  arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2
  rootfstype=ext4 rw" -hda ~/qemu_vms/2020-08-20-raspios-buster-armhf-
  full.img -nic user,hostfwd=tcp::5022-:22 -no-reboot

  The answer :

  WARNING: Image format was not specified for 
'/home/kali/qemu_vms/2020-08-20-raspios-buster-armhf-full.img' and probing 
guessed raw.
          Automatically detecting the format is dangerous for raw images, write 
operations on block 0 will be restricted.
          Specify the 'raw' format explicitly to remove the restrictions.
  pulseaudio: set_sink_input_volume() failed
  pulseaudio: Reason: Invalid argument
  pulseaudio: set_sink_input_mute() failed
  pulseaudio: Reason: Invalid argument
  Uncompressing Linux... done, booting the kernel.

  I tried a lot of solutions but nothing worked. Please help

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1904206/+subscriptions

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1904206

Title:
  install QEMU

Status in QEMU:
  New

Bug description:
  I want install QEMU on Kali, I write :

  qemu-system-arm -kernel ~/qemu_vms/kernel-qemu-3.10.25-wheezy -cpu
  arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2
  rootfstype=ext4 rw" -hda ~/qemu_vms/2020-08-20-raspios-buster-armhf-
  full.img -nic user,hostfwd=tcp::5022-:22 -no-reboot

  The answer :

  WARNING: Image format was not specified for 
'/home/kali/qemu_vms/2020-08-20-raspios-buster-armhf-full.img' and probing 
guessed raw.
   Automatically detecting the format is dangerous for raw images, 
write operations on block 0 will be restricted.
   Specify the 'raw' format explicitly to remove the restrictions.
  pulseaudio: set_sink_input_volume() failed
  pulseaudio: Reason: Invalid argument
  pulseaudio: set_sink_input_mute() failed
  pulseaudio: Reason: Invalid argument
  Uncompressing Linux... done, booting the kernel.

  I tried a lot of solutions but nothing worked. Please help

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1904206/+subscriptions



Re: [PATCH 14/17] target/arm: set HPFAR_EL2.NS on secure stage 2 faults

2020-11-13 Thread Richard Henderson
On 11/9/20 6:10 AM, remi.denis.courm...@huawei.com wrote:
> @@ -3444,6 +3444,9 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t 
> value,
>  target_el = 3;
>  } else {
>  env->cp15.hpfar_el2 = extract64(fi.s2addr, 12, 47) << 4;
> +if (fi.s1ns) {
> +env->cp15.hpfar_el2 |= HPFAR_NS;
> +}

This should only be set for SEL2, not non-secure EL2.

> +if (arm_is_secure_below_el3(env) && fi->s1ns) {
> +env->cp15.hpfar_el2 |= HPFAR_NS;
> +}

... like you did here.


r~



Re: [PATCH 13/17] target/arm: handle VMID change in secure state

2020-11-13 Thread Richard Henderson
On 11/9/20 6:10 AM, remi.denis.courm...@huawei.com wrote:
> From: Rémi Denis-Courmont 
> 
> The VTTBR write callback so far assumes that the underlying VM lies in
> non-secure state. This handles the secure state scenario.
> 
> Signed-off-by: Rémi Denis-Courmont 
> ---
>  target/arm/helper.c | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)

Reviewed-by: Richard Henderson 

r~



Re: [PATCH 11/17] target/arm: do S1_ptw_translate() before address space lookup

2020-11-13 Thread Richard Henderson
On 11/9/20 6:10 AM, remi.denis.courm...@huawei.com wrote:
> From: Rémi Denis-Courmont 
> 
> In the secure stage 2 translation regime, the VSTCR.SW and VTCR.NSW
> bits can invert the secure flag for pagetable walks. This patchset
> allows S1_ptw_translate() to change the non-secure bit.
> 
> Signed-off-by: Rémi Denis-Courmont 
> ---
>  target/arm/helper.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Reviewed-by: Richard Henderson 

r~



Re: [PATCH 10/17] target/arm: add ARMv8.4-SEL2 system registers

2020-11-13 Thread Richard Henderson
On 11/9/20 6:10 AM, remi.denis.courm...@huawei.com wrote:
> From: Rémi Denis-Courmont 
> 
> Signed-off-by: Rémi Denis-Courmont 
> ---
>  target/arm/cpu.h|  2 ++
>  target/arm/helper.c | 24 
>  2 files changed, 26 insertions(+)

Reviewed-by: Richard Henderson 

r~



Re: [PATCH 09/17] target/arm: add MMU stage 1 for Secure EL2

2020-11-13 Thread Richard Henderson
On 11/9/20 6:10 AM, remi.denis.courm...@huawei.com wrote:
> From: Rémi Denis-Courmont 
> 
> This adds the MMU indices for EL2 stage 1 in secure mode.
> 
> To keep code contained, which is largelly identical between secure and
> non-secure modes, the MMU indices are reassigned. The new assignments
> provide a systematic pattern with a non-secure bit.
> 
> Signed-off-by: Rémi Denis-Courmont 
> ---
>  target/arm/cpu-param.h |   2 +-
>  target/arm/cpu.h   |  37 +++
>  target/arm/helper.c| 127 -
>  target/arm/internals.h |  12 
>  target/arm/translate-a64.c |   4 ++
>  5 files changed, 124 insertions(+), 58 deletions(-)

Reviewed-by: Richard Henderson 

r~



Re: [PATCH 01/17] target/arm: remove redundant tests

2020-11-13 Thread Richard Henderson
On 11/9/20 6:10 AM, remi.denis.courm...@huawei.com wrote:
> From: Rémi Denis-Courmont 
> 
> In this context, the HCR value is the effective value, and thus is
> zero in secure mode. The tests for HCR.{F,I}MO are sufficient.
> 
> Signed-off-by: Rémi Denis-Courmont 
> ---
>  target/arm/cpu.c|  8 
>  target/arm/helper.c | 10 --
>  2 files changed, 8 insertions(+), 10 deletions(-)

Reviewed-by: Richard Henderson 

r~



[PATCH 1/3] quorum: Require WRITE perm with rewrite-corrupted

2020-11-13 Thread Max Reitz
Using rewrite-corrupted means quorum may issue writes to its children
just from receiving read requests from its parents.  Thus, it must take
the WRITE permission when rewrite-corrupted is used.

Signed-off-by: Max Reitz 
---
 block/quorum.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/block/quorum.c b/block/quorum.c
index b70d365ba9..01e49e94a3 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -1195,7 +1195,12 @@ static void quorum_child_perm(BlockDriverState *bs, 
BdrvChild *c,
   uint64_t perm, uint64_t shared,
   uint64_t *nperm, uint64_t *nshared)
 {
+BDRVQuorumState *s = bs->opaque;
+
 *nperm = perm & DEFAULT_PERM_PASSTHROUGH;
+if (s->rewrite_corrupted) {
+*nperm |= BLK_PERM_WRITE;
+}
 
 /*
  * We cannot share RESIZE or WRITE, as this would make the
-- 
2.28.0




Re: [PATCH 02/17] target/arm: add arm_is_el2_enabled() helper

2020-11-13 Thread Richard Henderson
On 11/9/20 6:10 AM, remi.denis.courm...@huawei.com wrote:
> From: Rémi Denis-Courmont 
> 
> This checks if EL2 is enabled (meaning EL2 registers take effects) in
> the current security context.
> 
> Signed-off-by: Rémi Denis-Courmont 
> ---
>  target/arm/cpu.h | 16 
>  1 file changed, 16 insertions(+)

Reviewed-by: Richard Henderson 

r~



[PATCH 3/3] iotests/081: Test rewrite-corrupted without WRITE

2020-11-13 Thread Max Reitz
Test what happens when a rewrite-corrupted quorum node performs such a
rewrite, while there is no parent that has taken the WRITE permission.

Signed-off-by: Max Reitz 
---
 tests/qemu-iotests/081 | 54 ++
 tests/qemu-iotests/081.out | 27 +++
 2 files changed, 81 insertions(+)

diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081
index 253b7576be..4e19972931 100755
--- a/tests/qemu-iotests/081
+++ b/tests/qemu-iotests/081
@@ -42,6 +42,7 @@ _supported_fmt raw
 _supported_proto file
 _supported_os Linux
 _require_drivers quorum
+_require_devices virtio-scsi
 
 do_run_qemu()
 {
@@ -155,6 +156,59 @@ echo "== checking that quorum has corrected the corrupted 
file =="
 
 $QEMU_IO -c "read -P 0x32 0 $size" "$TEST_DIR/2.raw" | _filter_qemu_io
 
+echo
+echo "== using quorum rewrite corrupted mode without WRITE permission =="
+
+# The same as above, but this time, do it on a quorum node whose only
+# parent will not take the WRITE permission
+
+echo '-- corrupting --'
+# Only corrupt a portion: The guest device (scsi-hd on virtio-scsi)
+# will read some data (looking for a partition table to guess the
+# disk's geometry), which would trigger a quorum mismatch if the
+# beginning of the image was corrupted.  The subsequent
+# QUORUM_REPORT_BAD event would be suppressed (because at that point,
+# there cannot have been a qmp_capabilities on the monitor).  Because
+# that event is rate-limited, the next QUORUM_REPORT_BAD that happens
+# thanks to our qemu-io read (which should trigger a mismatch) would
+# then be delayed past the VM quit and not appear in the output.
+# So we keep the first 1M intact to see a QUORUM_REPORT_BAD resulting
+# from the qemu-io invocation.
+$QEMU_IO -c "write -P 0x42 1M 1M" "$TEST_DIR/2.raw" | _filter_qemu_io
+
+# Fix the corruption (on a read-only quorum node, i.e. without taking
+# the WRITE permission on it -- its child nodes need to be R/W OTOH,
+# so that rewrite-corrupted works)
+echo
+echo '-- running quorum --'
+run_qemu \
+-blockdev file,node-name=file1,filename="$TEST_DIR/1.raw" \
+-blockdev file,node-name=file2,filename="$TEST_DIR/2.raw" \
+-blockdev file,node-name=file3,filename="$TEST_DIR/3.raw" \
+-blockdev '{
+"driver": "quorum",
+"node-name": "quorum",
+"read-only": true,
+"vote-threshold": 2,
+"rewrite-corrupted": true,
+"children": [ "file1", "file2", "file3" ]
+}' \
+-device virtio-scsi,id=scsi \
+-device scsi-hd,id=quorum-drive,bus=scsi.0,drive=quorum \
+<

[PATCH 0/3] quorum: Require WRITE perm with rewrite-corrupted

2020-11-13 Thread Max Reitz
Hi,

While reviewing Berto’s block-status/write-zeroes series for quorum, I
wondered how quorum’s permission code handles rewrite-corrupted.  It
turns out it doesn’t, and so qemu with a read-only rewrite-corrupted
quorum node simply crashes once there is a mismatch that leads to a
rewrite.

It looks to me like this bug has existed for quite some time, so I don’t
think this series must go into 5.2.  OTOH, it’s a simple bug fix, so I
suppose it might as well.


Max Reitz (3):
  quorum: Require WRITE perm with rewrite-corrupted
  iotests/081: Filter image format after testdir
  iotests/081: Test rewrite-corrupted without WRITE

 block/quorum.c |  5 
 tests/qemu-iotests/081 | 61 --
 tests/qemu-iotests/081.out | 27 +
 3 files changed, 90 insertions(+), 3 deletions(-)

-- 
2.28.0




[PATCH 2/3] iotests/081: Filter image format after testdir

2020-11-13 Thread Max Reitz
Otherwise, this breaks whenever the test directory contains the image
format (e.g. "/tmp/test-raw-file" is filtered to "/tmp/test-IMGFMT-file"
instead of "TEST_DIR").

Signed-off-by: Max Reitz 
---
 tests/qemu-iotests/081 | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081
index 537d40dfd5..253b7576be 100755
--- a/tests/qemu-iotests/081
+++ b/tests/qemu-iotests/081
@@ -45,15 +45,16 @@ _require_drivers quorum
 
 do_run_qemu()
 {
-echo Testing: "$@" | _filter_imgfmt
+echo Testing: "$@"
 $QEMU -nographic -qmp stdio -serial none "$@"
 echo
 }
 
 run_qemu()
 {
-do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
-  | _filter_qemu_io | _filter_generated_node_ids
+do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_imgfmt | _filter_qemu \
+  | _filter_qmp | _filter_qemu_io \
+  | _filter_generated_node_ids
 }
 
 quorum="driver=raw,file.driver=quorum,file.vote-threshold=2"
-- 
2.28.0




Re: [PATCH v4 2/2] quorum: Implement bdrv_co_pwrite_zeroes()

2020-11-13 Thread Max Reitz

On 13.11.20 17:52, Alberto Garcia wrote:

This simply calls bdrv_co_pwrite_zeroes() in all children.

bs->supported_zero_flags is also set to the flags that are supported
by all children.

Signed-off-by: Alberto Garcia 
---
  block/quorum.c | 36 ++--
  tests/qemu-iotests/312 | 11 +++
  tests/qemu-iotests/312.out |  8 
  3 files changed, 53 insertions(+), 2 deletions(-)


Reviewed-by: Max Reitz 


@@ -897,6 +910,21 @@ static QemuOptsList quorum_runtime_opts = {
  },
  };
  
+static void quorum_refresh_flags(BlockDriverState *bs)

+{
+BDRVQuorumState *s = bs->opaque;
+int i;
+
+bs->supported_zero_flags =
+BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK;
+
+for (i = 0; i < s->num_children; i++) {
+bs->supported_zero_flags &= s->children[i]->bs->supported_zero_flags;
+}
+
+bs->supported_zero_flags |= BDRV_REQ_WRITE_UNCHANGED;


This made me wonder whether it’s true when rewrite_corrupted is set.  I 
think it is, because that only does something when reading from the 
children (i.e. not for write requests from parents, where this flag 
might be set).


Looking into quorum_child_perm(), quorum doesn’t take the WRITE 
permission on its children even if rewrite_corrupted is true.  Hm... 
Something to look into.


Max


+}
+
  static int quorum_open(BlockDriverState *bs, QDict *options, int flags,
 Error **errp)
  {





Re: [PATCH v4 0/2] quorum: Implement bdrv_co_block_status()

2020-11-13 Thread Max Reitz

On 13.11.20 17:52, Alberto Garcia wrote:

Following Max's suggestion, this version sets supported_zero_flags.

Berto

v4:
- Set supported_zero_flags in quorum [Max]
- Update test to verify the data written before doing 'write -z' [Max]

v3: https://lists.gnu.org/archive/html/qemu-block/2020-11/msg00371.html
- Fall back to BDRV_BLOCK_DATA if a child returns an error.

v2: https://lists.gnu.org/archive/html/qemu-block/2020-11/msg00259.html
- Implement bdrv_co_pwrite_zeroes() for quorum

v1: https://lists.gnu.org/archive/html/qemu-block/2020-11/msg00163.html


Alberto Garcia (2):
   quorum: Implement bdrv_co_block_status()
   quorum: Implement bdrv_co_pwrite_zeroes()


Thanks, applied to my block-next branch (for 6.0):

https://git.xanclic.moe/XanClic/qemu/commits/branch/block-next

Max




Re: [PATCH v2 7/7] qapi: More complex uses of QAPI_LIST_APPEND

2020-11-13 Thread Dr. David Alan Gilbert
* Eric Blake (ebl...@redhat.com) wrote:
> These cases require a bit more thought to review; in each case, the
> code was appending to a list, but not with a FOOList **tail variable.
> 
> Signed-off-by: Eric Blake 
> ---
>  block/gluster.c|  13 +---
>  block/qapi.c   |  14 +
>  dump/dump.c|  22 ++-
>  hw/core/machine-qmp-cmds.c | 125 +++--
>  hw/mem/memory-device.c |  12 +---
>  hw/pci/pci.c   |  60 ++
>  migration/migration.c  |  20 ++
>  monitor/hmp-cmds.c |  23 +++
>  net/net.c  |  13 +---
>  qga/commands-posix.c   | 101 +++---
>  qga/commands-win32.c   |  88 +-
>  softmmu/tpm.c  |  38 ++-
>  ui/spice-core.c|  27 +++-
>  13 files changed, 180 insertions(+), 376 deletions(-)
> 



> diff --git a/migration/migration.c b/migration/migration.c
> index 84e5f4982fb2..b97eb2d0494e 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -797,29 +797,21 @@ void migrate_send_rp_resume_ack(MigrationIncomingState 
> *mis, uint32_t value)
> 
>  MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp)
>  {
> -MigrationCapabilityStatusList *head = NULL;
> -MigrationCapabilityStatusList *caps;
> +MigrationCapabilityStatusList *head = NULL, **tail = 
> +MigrationCapabilityStatus *caps;
>  MigrationState *s = migrate_get_current();
>  int i;
> 
> -caps = NULL; /* silence compiler warning */
>  for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) {
>  #ifndef CONFIG_LIVE_BLOCK_MIGRATION
>  if (i == MIGRATION_CAPABILITY_BLOCK) {
>  continue;
>  }
>  #endif
> -if (head == NULL) {
> -head = g_malloc0(sizeof(*caps));
> -caps = head;
> -} else {
> -caps->next = g_malloc0(sizeof(*caps));
> -caps = caps->next;
> -}
> -caps->value =
> -g_malloc(sizeof(*caps->value));
> -caps->value->capability = i;
> -caps->value->state = s->enabled_capabilities[i];
> +caps = g_malloc(sizeof(*caps));
> +caps->capability = i;
> +caps->state = s->enabled_capabilities[i];
> +QAPI_LIST_APPEND(tail, caps);
>  }
> 
>  return head;
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index 01a7d317c3c9..678f388d2e1f 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -1699,7 +1699,8 @@ void hmp_closefd(Monitor *mon, const QDict *qdict)
>  void hmp_sendkey(Monitor *mon, const QDict *qdict)
>  {
>  const char *keys = qdict_get_str(qdict, "keys");
> -KeyValueList *keylist, *head = NULL, *tmp = NULL;
> +KeyValue *v;
> +KeyValueList *head = NULL, **tail = 
>  int has_hold_time = qdict_haskey(qdict, "hold-time");
>  int hold_time = qdict_get_try_int(qdict, "hold-time", -1);
>  Error *err = NULL;
> @@ -1716,16 +1717,7 @@ void hmp_sendkey(Monitor *mon, const QDict *qdict)
>  keyname_len = 4;
>  }
> 
> -keylist = g_malloc0(sizeof(*keylist));
> -keylist->value = g_malloc0(sizeof(*keylist->value));
> -
> -if (!head) {
> -head = keylist;
> -}
> -if (tmp) {
> -tmp->next = keylist;
> -}
> -tmp = keylist;
> +v = g_malloc0(sizeof(*v));
> 
>  if (strstart(keys, "0x", NULL)) {
>  char *endp;
> @@ -1734,16 +1726,17 @@ void hmp_sendkey(Monitor *mon, const QDict *qdict)
>  if (endp != keys + keyname_len) {
>  goto err_out;
>  }
> -keylist->value->type = KEY_VALUE_KIND_NUMBER;
> -keylist->value->u.number.data = value;
> +v->type = KEY_VALUE_KIND_NUMBER;
> +v->u.number.data = value;
>  } else {
>  int idx = index_from_key(keys, keyname_len);
>  if (idx == Q_KEY_CODE__MAX) {
>  goto err_out;
>  }
> -keylist->value->type = KEY_VALUE_KIND_QCODE;
> -keylist->value->u.qcode.data = idx;
> +v->type = KEY_VALUE_KIND_QCODE;
> +v->u.qcode.data = idx;
>  }
> +QAPI_LIST_APPEND(tail, v);
> 
>  if (!*separator) {
>  break;

Don't you need to arrange for 'v' to be free'd in the err_out case?

Dave

> diff --git a/net/net.c b/net/net.c
> index eb65e110871a..453865db6f10 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -1199,10 +1199,9 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, 
> const char *name,
>Error **errp)
>  {
>  NetClientState *nc;
> -RxFilterInfoList *filter_list = NULL, *last_entry = NULL;
> +RxFilterInfoList *filter_list = NULL, **last = _list;
> 
>  QTAILQ_FOREACH(nc, _clients, next) {
> -RxFilterInfoList *entry;
>  RxFilterInfo 

Re: [PATCH v7 00/21] preallocate filter

2020-11-13 Thread Max Reitz

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Hi all!

Here is a filter, which does preallocation on write.

v7:
01: add Alberto's r-b
07: don't remove sentence from the comment
08: - drop extra "s->file_end = end;" line
 - improve check/set perm handlers
09: add Max's r-b
10: add Max's r-b
11: new
12: - skip if preallocate unsupported
 - drop auto and quick groups
13: new
14: - improve 'average' field of result spec
 - drop extra 'dim = ...' line
15-18: new
19: a lot of changes
20: new
21: add results dump to json


Thanks, applied to my block-next branch (for 6.0):

https://git.xanclic.moe/XanClic/qemu/commits/branch/block-next

Max




Re: [PATCH v7 21/21] scripts/simplebench: add bench_prealloc.py

2020-11-13 Thread Max Reitz

On 13.11.20 19:00, Vladimir Sementsov-Ogievskiy wrote:

13.11.2020 19:24, Max Reitz wrote:

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Benchmark for new preallocate filter.

Example usage:
 ./bench_prealloc.py ../../build/qemu-img \
 ssd-ext4:/path/to/mount/point \
 ssd-xfs:/path2 hdd-ext4:/path3 hdd-xfs:/path4

The benchmark shows performance improvement (or degradation) when use
new preallocate filter with qcow2 image.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  scripts/simplebench/bench_prealloc.py | 132 ++
  1 file changed, 132 insertions(+)
  create mode 100755 scripts/simplebench/bench_prealloc.py


Reviewed-by: Max Reitz 




Thanks for reviewing! Could you take this all through you tree?


Sure, if you can live with the fact that I’ll be on PTO for the next two 
weeks :)


(Shouldn’t matter for block-next, as 5.2 won’t be released until December.)

Max




[PATCH for-5.2] qga: update schema for guest-get-disks 'dependents' field

2020-11-13 Thread Michael Roth
The recently-added 'guest-get-disk' command returns a list of
GuestDiskInfo entries, which in turn have a 'dependents' field which
lists devices these entries are dependent upon. Thus, 'dependencies'
is a better name for this field. Address this by renaming the field
accordingly.

Additionally, 'dependents' is specified as non-optional, even though
it's not implemented for w32. This is misleading, since it gives users
the impression that a particular disk might not have dependencies,
when in reality that information is simply not known to the guest
agent. Address this by making 'dependents' an optional field, and only
marking it as in-use when the facilities to obtain this information are
available to the guest agent.

Cc: Eric Blake 
Cc: Tomáš Golembiovský 
Cc: Marc-André Lureau 
Signed-off-by: Michael Roth 
---
 qga/commands-posix.c | 10 ++
 qga/qapi-schema.json |  8 
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 12c1ba5ef7..c089e38120 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -1285,6 +1285,7 @@ static void get_disk_deps(const char *disk_dir, 
GuestDiskInfo *disk)
 g_debug("failed to list entries in %s", deps_dir);
 return;
 }
+disk->has_dependencies = true;
 while ((dep = g_dir_read_name(dp_deps)) != NULL) {
 g_autofree char *dep_dir = NULL;
 strList *dep_item = NULL;
@@ -1297,8 +1298,8 @@ static void get_disk_deps(const char *disk_dir, 
GuestDiskInfo *disk)
 g_debug("  adding dependent device: %s", dev_name);
 dep_item = g_new0(strList, 1);
 dep_item->value = dev_name;
-dep_item->next = disk->dependents;
-disk->dependents = dep_item;
+dep_item->next = disk->dependencies;
+disk->dependencies = dep_item;
 }
 }
 g_dir_close(dp_deps);
@@ -1351,8 +1352,9 @@ static GuestDiskInfoList *get_disk_partitions(
 partition->name = dev_name;
 partition->partition = true;
 /* Add parent disk as dependent for easier tracking of hierarchy */
-partition->dependents = g_new0(strList, 1);
-partition->dependents->value = g_strdup(disk_dev);
+partition->dependencies = g_new0(strList, 1);
+partition->dependencies->value = g_strdup(disk_dev);
+partition->has_dependencies = true;
 
 item = g_new0(GuestDiskInfoList, 1);
 item->value = partition;
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
index 6ca85f995f..3b3d1d0bd9 100644
--- a/qga/qapi-schema.json
+++ b/qga/qapi-schema.json
@@ -870,9 +870,9 @@
 #
 # @name: device node (Linux) or device UNC (Windows)
 # @partition: whether this is a partition or disk
-# @dependents: list of dependent devices; e.g. for LVs of the LVM this will
-#  hold the list of PVs, for LUKS encrypted volume this will
-#  contain the disk where the volume is placed. (Linux)
+# @dependencies: list of device dependencies; e.g. for LVs of the LVM this will
+#hold the list of PVs, for LUKS encrypted volume this will
+#contain the disk where the volume is placed. (Linux)
 # @address: disk address information (only for non-virtual devices)
 # @alias: optional alias assigned to the disk, on Linux this is a name assigned
 # by device mapper
@@ -880,7 +880,7 @@
 # Since 5.2
 ##
 { 'struct': 'GuestDiskInfo',
-  'data': {'name': 'str', 'partition': 'bool', 'dependents': ['str'],
+  'data': {'name': 'str', 'partition': 'bool', '*dependencies': ['str'],
'*address': 'GuestDiskAddress', '*alias': 'str'} }
 
 ##
-- 
2.25.1




Re: [PULL 0/3] hmp queue

2020-11-13 Thread Peter Maydell
On Fri, 13 Nov 2020 at 13:11, Dr. David Alan Gilbert (git)
 wrote:
>
> From: "Dr. David Alan Gilbert" 
>
> The following changes since commit be2df2ac6f6b921cc057de0a119ac30fbc60:
>
>   Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20201112' into 
> staging (2020-11-13 11:36:30 +)
>
> are available in the Git repository at:
>
>   git://github.com/dagrh/qemu.git tags/pull-hmp-20201113
>
> for you to fetch changes up to e7cff9c68d4a46343861fbc3cc6b2a0b63b2dbb8:
>
>   hmp: Pass monitor to mon_get_cpu_env() (2020-11-13 12:45:51 +)
>
> 
> HMP fixes
>
> Kevin's HMP fixes


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.

-- PMM



Re: [PATCH 11/13] hmp/char: Use qemu_chr_parse_cli_str() for chardev-change

2020-11-13 Thread Dr. David Alan Gilbert
* Kevin Wolf (kw...@redhat.com) wrote:
> Instead of going through the QemuOpts-based parser, go directly from the
> given option string to ChardevOptions. This doesn't only avoid legacy
> code, but it also simplifies the implementation.
> 
> Signed-off-by: Kevin Wolf 

OK, from HMP I think

Acked-by: Dr. David Alan Gilbert 

I'm assuming there's no change in the escaping from you extracting it
from the qdict and then printfing it back to go throguh the parser?

Dave

> ---
>  monitor/hmp-cmds.c | 27 +--
>  1 file changed, 9 insertions(+), 18 deletions(-)
> 
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index a6a6684df1..0244068de8 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -1793,34 +1793,25 @@ void hmp_chardev_add(Monitor *mon, const QDict *qdict)
>  void hmp_chardev_change(Monitor *mon, const QDict *qdict)
>  {
>  const char *args = qdict_get_str(qdict, "args");
> -const char *id;
> +const char *id = qdict_get_str(qdict, "id");
> +char *optstr;
>  Error *err = NULL;
> -ChardevBackend *backend = NULL;
> +ChardevOptions *options = NULL;
>  ChardevReturn *ret = NULL;
> -QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("chardev"), args,
> - true);
> -if (!opts) {
> -error_setg(, "Parsing chardev args failed");
> -goto end;
> -}
>  
> -id = qdict_get_str(qdict, "id");
> -if (qemu_opts_id(opts)) {
> -error_setg(, "Unexpected 'id' parameter");
> -goto end;
> -}
> +optstr = g_strdup_printf("%s,id=%s", args, id);
>  
> -backend = qemu_chr_parse_opts(opts, );
> -if (!backend) {
> +options = qemu_chr_parse_cli_str(optstr, );
> +if (!options) {
>  goto end;
>  }
>  
> -ret = qmp_chardev_change(id, backend, );
> +ret = qmp_chardev_change(options->id, options->backend, );
>  
>  end:
> +g_free(optstr);
>  qapi_free_ChardevReturn(ret);
> -qapi_free_ChardevBackend(backend);
> -qemu_opts_del(opts);
> +qapi_free_ChardevOptions(options);
>  hmp_handle_error(mon, err);
>  }
>  
> -- 
> 2.28.0
> 
-- 
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK




[Bug 1799792] Re: Broken scaling with gtk,gl=on on a hidpi display

2020-11-13 Thread Sebastian Krzyszkowiak
Still happening in QEMU 5.1.0

** Changed in: qemu
   Status: Incomplete => 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/1799792

Title:
  Broken scaling with gtk,gl=on on a hidpi display

Status in QEMU:
  New

Bug description:
  Tested on QEMU 3.0.0 on Arch Linux.

  I'm using a hidpi screen, and therefore use those environment
  variables in order to have GTK+ apps properly scaled:

  GDK_SCALE=2
  GDK_DPI_SCALE=0.5

  However, QEMU, when launched with "-display gtk,gl=on" option, doesn't
  scale the window content properly, as seen on the attached screenshot.

  Switching to "-display gtk,gl=off" and "-display sdl,gl=on" makes it
  work fine.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1799792/+subscriptions



[PATCH] configure: Force-remove temp dir

2020-11-13 Thread Dan Church
Sometimes the compiler will leave a write-protected .o file in the temp
directory, and GNU rm will ask before deleting it unless -f is
specified.

Signed-off-by: Dan Church 
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 4cef321d9d..663b91a334 100755
--- a/configure
+++ b/configure
@@ -7080,4 +7080,4 @@ done
 echo ' "$@"' >>config.status
 chmod +x config.status
 
-rm -r "$TMPDIR1"
+rm -rf "$TMPDIR1"
-- 
2.29.2




Re: [PATCH] scsi-disk: convert more errno values back to SCSI statuses

2020-11-13 Thread Paolo Bonzini

On 12/11/20 16:04, Hannes Reinecke wrote:

On 11/12/20 10:52 AM, Paolo Bonzini wrote:
Well, ironically I'm currently debugging a customer escalation which 
touches exactly this area. It revolves more around the SG_IO handling;


Technically this patch is for *non* passthrough, but yeah it's a similar 
case.



qemu ignores the host_status setting completely, leading to data
corruption if the host has to abort commands. (Not that the host
_does_ abort commands, as qemu SG_IO sets an infinite timeout. But
that's another story).


And part of the patchset is to enable passing of the host_status code 
back to the drivers. In particular virtio_scsi has a 'response' code 
which matches pretty closely to the linux SCSI DID_XXX codes.


Yeah, most of the time that's just because it's what can go wrong in 
SCSI.  Sometimes it's because I had no clue when writing the virtio-scsi 
spec and just copied blindly from Linux.  For example 
VIRTIO_SCSI_S_NEXUS_FAILURE probably should have never existed, since 
DID_NEXUS_FAILURE really should have been DID_RESRVATION_CONFLICT.


As an aside, I hate Linux host_status.  It's never clear when looking at 
the code if the statuses have been mapped back to BLK_STS codes or not, 
so you don't know if you already have gotten rid of DID_TARGET_FAILURE, 
DID_NEXUS_FAILURE, DID_ALLOC_FAILURE and DID_MEDIUM_ERROR (which are 
just weird way to store the SCSI status or sense key for future use, and 
not really "host statuses), and would really be a nexus failure only in 
the rare case of path-specific reservations).


So my idea is to pass the host_status directly down to the drivers, 
allowing virtio-scsi to do a mapping between DID_XX and virtio response 
codes.


But yeah, this is a good idea.  But since I hate host_status, please 
define your own enum instead of DID_*.  Of course you can use the same 
values as DID_* and assert with QEMU_BUILD_BUG_ON that they are the 
same, but I don't want people to read the code and have to think of 
DID_ALLOC_FAILURE and the like.


Paolo




Re: [PATCH v7 21/21] scripts/simplebench: add bench_prealloc.py

2020-11-13 Thread Vladimir Sementsov-Ogievskiy

13.11.2020 19:24, Max Reitz wrote:

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Benchmark for new preallocate filter.

Example usage:
 ./bench_prealloc.py ../../build/qemu-img \
 ssd-ext4:/path/to/mount/point \
 ssd-xfs:/path2 hdd-ext4:/path3 hdd-xfs:/path4

The benchmark shows performance improvement (or degradation) when use
new preallocate filter with qcow2 image.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  scripts/simplebench/bench_prealloc.py | 132 ++
  1 file changed, 132 insertions(+)
  create mode 100755 scripts/simplebench/bench_prealloc.py


Reviewed-by: Max Reitz 




Thanks for reviewing! Could you take this all through you tree?

--
Best regards,
Vladimir



Re: [RFC PATCH] .gitlab-ci.d/check-patch: tweak output for CI logs

2020-11-13 Thread Daniel P . Berrangé
On Fri, Nov 13, 2020 at 05:44:04PM +, Alex Bennée wrote:
> We don't need running commentary for the CI logs and by keeping it
> short we might just see the problem on the first page. While we are at
> it flush the previous line so order is maintained between script and
> sub process.
> 
> Signed-off-by: Alex Bennée 
> ---
>  .gitlab-ci.d/check-patch.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/.gitlab-ci.d/check-patch.py b/.gitlab-ci.d/check-patch.py
> index 0ff30ee077..39e2b403c9 100755
> --- a/.gitlab-ci.d/check-patch.py
> +++ b/.gitlab-ci.d/check-patch.py
> @@ -45,9 +45,9 @@ if log == "":
>  
>  errors = False
>  
> -print("\nChecking all commits since %s...\n" % ancestor)
> +print("\nChecking all commits since %s...\n" % ancestor, flush=True)
>  
> -ret = subprocess.run(["scripts/checkpatch.pl", ancestor + "..."])
> +ret = subprocess.run(["scripts/checkpatch.pl", "--terse", ancestor + "..."])

Reviewed-by: Daniel P. Berrangé 


Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|




[RFC PATCH] .gitlab-ci.d/check-patch: tweak output for CI logs

2020-11-13 Thread Alex Bennée
We don't need running commentary for the CI logs and by keeping it
short we might just see the problem on the first page. While we are at
it flush the previous line so order is maintained between script and
sub process.

Signed-off-by: Alex Bennée 
---
 .gitlab-ci.d/check-patch.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.d/check-patch.py b/.gitlab-ci.d/check-patch.py
index 0ff30ee077..39e2b403c9 100755
--- a/.gitlab-ci.d/check-patch.py
+++ b/.gitlab-ci.d/check-patch.py
@@ -45,9 +45,9 @@ if log == "":
 
 errors = False
 
-print("\nChecking all commits since %s...\n" % ancestor)
+print("\nChecking all commits since %s...\n" % ancestor, flush=True)
 
-ret = subprocess.run(["scripts/checkpatch.pl", ancestor + "..."])
+ret = subprocess.run(["scripts/checkpatch.pl", "--terse", ancestor + "..."])
 
 if ret.returncode != 0:
 print("❌ FAIL one or more commits failed scripts/checkpatch.pl")
-- 
2.20.1




[PATCH 1/1] gitlab-ci: Use $CI_REGISTRY instead of hard-coding registry.gitlab.com

2020-11-13 Thread Rebecca Cran
Update containers.yml to use the $CI_REGISTRY variable as other files
such as edk2.yml do.

Signed-off-by: Rebecca Cran 
---
 .gitlab-ci.d/containers.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.d/containers.yml b/.gitlab-ci.d/containers.yml
index 11d079ea5810..892ca8d838ce 100644
--- a/.gitlab-ci.d/containers.yml
+++ b/.gitlab-ci.d/containers.yml
@@ -8,7 +8,7 @@
 - export COMMON_TAG="$CI_REGISTRY/qemu-project/qemu/$NAME:latest"
 - apk add python3
 - docker info
-- docker login registry.gitlab.com -u "$CI_REGISTRY_USER" -p 
"$CI_REGISTRY_PASSWORD"
+- docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p 
"$CI_REGISTRY_PASSWORD"
   script:
 - echo "TAG:$TAG"
 - echo "COMMON_TAG:$COMMON_TAG"
-- 
2.26.2




[PATCH v4 1/2] quorum: Implement bdrv_co_block_status()

2020-11-13 Thread Alberto Garcia
The quorum driver does not implement bdrv_co_block_status() and
because of that it always reports to contain data even if all its
children are known to be empty.

One consequence of this is that if we for example create a quorum with
a size of 10GB and we mirror it to a new image the operation will
write 10GB of actual zeroes to the destination image wasting a lot of
time and disk space.

Since a quorum has an arbitrary number of children of potentially
different formats there is no way to report all possible allocation
status flags in a way that makes sense, so this implementation only
reports when a given region is known to contain zeroes
(BDRV_BLOCK_ZERO) or not (BDRV_BLOCK_DATA).

If all children agree that a region contains zeroes then we can return
BDRV_BLOCK_ZERO using the smallest size reported by the children
(because all agree that a region of at least that size contains
zeroes).

If at least one child disagrees we have to return BDRV_BLOCK_DATA.
In this case we use the largest of the sizes reported by the children
that didn't return BDRV_BLOCK_ZERO (because we know that there won't
be an agreement for at least that size).

Signed-off-by: Alberto Garcia 
Tested-by: Tao Xu 
Reviewed-by: Max Reitz 
---
 block/quorum.c |  52 +
 tests/qemu-iotests/312 | 148 +
 tests/qemu-iotests/312.out |  67 +
 tests/qemu-iotests/group   |   1 +
 4 files changed, 268 insertions(+)
 create mode 100755 tests/qemu-iotests/312
 create mode 100644 tests/qemu-iotests/312.out

diff --git a/block/quorum.c b/block/quorum.c
index e846a7e892..9691a9bee9 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -18,6 +18,7 @@
 #include "qemu/module.h"
 #include "qemu/option.h"
 #include "block/block_int.h"
+#include "block/coroutines.h"
 #include "block/qdict.h"
 #include "qapi/error.h"
 #include "qapi/qapi-events-block.h"
@@ -1174,6 +1175,56 @@ static void quorum_child_perm(BlockDriverState *bs, 
BdrvChild *c,
  | DEFAULT_PERM_UNCHANGED;
 }
 
+/*
+ * Each one of the children can report different status flags even
+ * when they contain the same data, so what this function does is
+ * return BDRV_BLOCK_ZERO if *all* children agree that a certain
+ * region contains zeroes, and BDRV_BLOCK_DATA otherwise.
+ */
+static int coroutine_fn quorum_co_block_status(BlockDriverState *bs,
+   bool want_zero,
+   int64_t offset, int64_t count,
+   int64_t *pnum, int64_t *map,
+   BlockDriverState **file)
+{
+BDRVQuorumState *s = bs->opaque;
+int i, ret;
+int64_t pnum_zero = count;
+int64_t pnum_data = 0;
+
+for (i = 0; i < s->num_children; i++) {
+int64_t bytes;
+ret = bdrv_co_common_block_status_above(s->children[i]->bs, NULL, 
false,
+want_zero, offset, count,
+, NULL, NULL, NULL);
+if (ret < 0) {
+quorum_report_bad(QUORUM_OP_TYPE_READ, offset, count,
+  s->children[i]->bs->node_name, ret);
+pnum_data = count;
+break;
+}
+/*
+ * Even if all children agree about whether there are zeroes
+ * or not at @offset they might disagree on the size, so use
+ * the smallest when reporting BDRV_BLOCK_ZERO and the largest
+ * when reporting BDRV_BLOCK_DATA.
+ */
+if (ret & BDRV_BLOCK_ZERO) {
+pnum_zero = MIN(pnum_zero, bytes);
+} else {
+pnum_data = MAX(pnum_data, bytes);
+}
+}
+
+if (pnum_data) {
+*pnum = pnum_data;
+return BDRV_BLOCK_DATA;
+} else {
+*pnum = pnum_zero;
+return BDRV_BLOCK_ZERO;
+}
+}
+
 static const char *const quorum_strong_runtime_opts[] = {
 QUORUM_OPT_VOTE_THRESHOLD,
 QUORUM_OPT_BLKVERIFY,
@@ -1192,6 +1243,7 @@ static BlockDriver bdrv_quorum = {
 .bdrv_close = quorum_close,
 .bdrv_gather_child_options  = quorum_gather_child_options,
 .bdrv_dirname   = quorum_dirname,
+.bdrv_co_block_status   = quorum_co_block_status,
 
 .bdrv_co_flush_to_disk  = quorum_co_flush,
 
diff --git a/tests/qemu-iotests/312 b/tests/qemu-iotests/312
new file mode 100755
index 00..1b08f1552f
--- /dev/null
+++ b/tests/qemu-iotests/312
@@ -0,0 +1,148 @@
+#!/usr/bin/env bash
+#
+# Test drive-mirror with quorum
+#
+# The goal of this test is to check how the quorum driver reports
+# regions that are known to read as zeroes (BDRV_BLOCK_ZERO). The idea
+# is that drive-mirror will try the efficient representation of zeroes
+# in the destination image instead of writing actual zeroes.
+#
+# Copyright (C) 2020 Igalia, S.L.
+# Author: Alberto Garcia 

[PATCH v4 0/2] quorum: Implement bdrv_co_block_status()

2020-11-13 Thread Alberto Garcia
Following Max's suggestion, this version sets supported_zero_flags.

Berto

v4:
- Set supported_zero_flags in quorum [Max]
- Update test to verify the data written before doing 'write -z' [Max]

v3: https://lists.gnu.org/archive/html/qemu-block/2020-11/msg00371.html
- Fall back to BDRV_BLOCK_DATA if a child returns an error.

v2: https://lists.gnu.org/archive/html/qemu-block/2020-11/msg00259.html
- Implement bdrv_co_pwrite_zeroes() for quorum

v1: https://lists.gnu.org/archive/html/qemu-block/2020-11/msg00163.html


Alberto Garcia (2):
  quorum: Implement bdrv_co_block_status()
  quorum: Implement bdrv_co_pwrite_zeroes()

 block/quorum.c |  88 +++-
 tests/qemu-iotests/312 | 159 +
 tests/qemu-iotests/312.out |  75 +
 tests/qemu-iotests/group   |   1 +
 4 files changed, 321 insertions(+), 2 deletions(-)
 create mode 100755 tests/qemu-iotests/312
 create mode 100644 tests/qemu-iotests/312.out

-- 
2.20.1




[PATCH v4 2/2] quorum: Implement bdrv_co_pwrite_zeroes()

2020-11-13 Thread Alberto Garcia
This simply calls bdrv_co_pwrite_zeroes() in all children.

bs->supported_zero_flags is also set to the flags that are supported
by all children.

Signed-off-by: Alberto Garcia 
---
 block/quorum.c | 36 ++--
 tests/qemu-iotests/312 | 11 +++
 tests/qemu-iotests/312.out |  8 
 3 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/block/quorum.c b/block/quorum.c
index 9691a9bee9..b70d365ba9 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -692,8 +692,13 @@ static void write_quorum_entry(void *opaque)
 QuorumChildRequest *sacb = >qcrs[i];
 
 sacb->bs = s->children[i]->bs;
-sacb->ret = bdrv_co_pwritev(s->children[i], acb->offset, acb->bytes,
-acb->qiov, acb->flags);
+if (acb->flags & BDRV_REQ_ZERO_WRITE) {
+sacb->ret = bdrv_co_pwrite_zeroes(s->children[i], acb->offset,
+  acb->bytes, acb->flags);
+} else {
+sacb->ret = bdrv_co_pwritev(s->children[i], acb->offset, acb->bytes,
+acb->qiov, acb->flags);
+}
 if (sacb->ret == 0) {
 acb->success_count++;
 } else {
@@ -739,6 +744,14 @@ static int quorum_co_pwritev(BlockDriverState *bs, 
uint64_t offset,
 return ret;
 }
 
+static int quorum_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset,
+   int bytes, BdrvRequestFlags flags)
+
+{
+return quorum_co_pwritev(bs, offset, bytes, NULL,
+ flags | BDRV_REQ_ZERO_WRITE);
+}
+
 static int64_t quorum_getlength(BlockDriverState *bs)
 {
 BDRVQuorumState *s = bs->opaque;
@@ -897,6 +910,21 @@ static QemuOptsList quorum_runtime_opts = {
 },
 };
 
+static void quorum_refresh_flags(BlockDriverState *bs)
+{
+BDRVQuorumState *s = bs->opaque;
+int i;
+
+bs->supported_zero_flags =
+BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK;
+
+for (i = 0; i < s->num_children; i++) {
+bs->supported_zero_flags &= s->children[i]->bs->supported_zero_flags;
+}
+
+bs->supported_zero_flags |= BDRV_REQ_WRITE_UNCHANGED;
+}
+
 static int quorum_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
 {
@@ -991,6 +1019,7 @@ static int quorum_open(BlockDriverState *bs, QDict 
*options, int flags,
 s->next_child_index = s->num_children;
 
 bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED;
+quorum_refresh_flags(bs);
 
 g_free(opened);
 goto exit;
@@ -1062,6 +1091,7 @@ static void quorum_add_child(BlockDriverState *bs, 
BlockDriverState *child_bs,
 }
 s->children = g_renew(BdrvChild *, s->children, s->num_children + 1);
 s->children[s->num_children++] = child;
+quorum_refresh_flags(bs);
 
 out:
 bdrv_drained_end(bs);
@@ -1106,6 +1136,7 @@ static void quorum_del_child(BlockDriverState *bs, 
BdrvChild *child,
 s->children = g_renew(BdrvChild *, s->children, --s->num_children);
 bdrv_unref_child(bs, child);
 
+quorum_refresh_flags(bs);
 bdrv_drained_end(bs);
 }
 
@@ -1251,6 +1282,7 @@ static BlockDriver bdrv_quorum = {
 
 .bdrv_co_preadv = quorum_co_preadv,
 .bdrv_co_pwritev= quorum_co_pwritev,
+.bdrv_co_pwrite_zeroes  = quorum_co_pwrite_zeroes,
 
 .bdrv_add_child = quorum_add_child,
 .bdrv_del_child = quorum_del_child,
diff --git a/tests/qemu-iotests/312 b/tests/qemu-iotests/312
index 1b08f1552f..41340494b0 100755
--- a/tests/qemu-iotests/312
+++ b/tests/qemu-iotests/312
@@ -114,6 +114,17 @@ $QEMU_IO -c "write -P 0 $((0x20)) $((0x1))" 
"$TEST_IMG.0" | _filter_qemu
 $QEMU_IO -c "write -z   $((0x20)) $((0x3))" "$TEST_IMG.1" | 
_filter_qemu_io
 $QEMU_IO -c "write -P 0 $((0x20)) $((0x2))" "$TEST_IMG.2" | 
_filter_qemu_io
 
+# Test 5: write data to a region and then zeroize it, doing it
+# directly on the quorum device instead of the individual images.
+# This has no effect on the end result but proves that the quorum driver
+# supports 'write -z'.
+$QEMU_IO -c "open -o $quorum" -c "write -P 1 $((0x25)) $((0x1))" | 
_filter_qemu_io
+# Verify the data that we just wrote
+$QEMU_IO -c "open -o $quorum" -c "read -P 1 $((0x25)) $((0x1))" | 
_filter_qemu_io
+$QEMU_IO -c "open -o $quorum" -c "write -z $((0x25)) $((0x1))" | 
_filter_qemu_io
+# Now it should read back as zeroes
+$QEMU_IO -c "open -o $quorum" -c "read -P 0 $((0x25)) $((0x1))" | 
_filter_qemu_io
+
 echo
 echo '### Launch the drive-mirror job'
 echo
diff --git a/tests/qemu-iotests/312.out b/tests/qemu-iotests/312.out
index 4ae749175b..cdd5c40e08 100644
--- a/tests/qemu-iotests/312.out
+++ b/tests/qemu-iotests/312.out
@@ -39,6 +39,14 @@ wrote 196608/196608 bytes at offset 2097152
 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 131072/131072 bytes at offset 2097152
 128 KiB, X 

Re: [Bug 1759338] Re: qemu-system-sparc w/ SS-20 ROM does not add processors

2020-11-13 Thread m...@papersolve.com
Yes this can be closed, no problems now using open bios to boot Solaris
and it does support multiple processors though this is actually slower
than one.

Sent from my mobile device

On Nov 13, 2020, at 11:41 AM, Peter Maydell <1759...@bugs.launchpad.net>
wrote:

 Reporter said in comment #1 that the bug can be closed, so let's close
it :-)


** Changed in: qemu
Status: Incomplete => Fix Released

--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/1759338

Title:
qemu-system-sparc w/ SS-20 ROM does not add processors

Status in QEMU:
Fix Released

Bug description:
When booting a SPARCstation-20 with the original ROM, qemu does not
set the number of processors in a way that this ROM can understand it,
and the ROM always reports only 1 processor installed:


~/qemu  /usr/local/bin/qemu-system-sparc -bios ./ss20_v2.25_rom -M SS-20 -cpu 
"TI SuperSparc 60" -smp 2 -nographic

Power-ON Reset


SMCC SPARCstation 10/20 UP/MP POST version VRV3.45 (09/11/95)


CPU_#0 TI, TMS390Z50(3.x) 0Mb External cache

CPU_#1 *** NOT installed ***
CPU_#2 *** NOT installed ***
CPU_#3 *** NOT installed ***

<<< CPU_ on MBus Slot_ >>> IS RUNNING (MID =
0008)


...

Cpu #0 TI,TMS390Z50
Cpu #1 Nothing there
Cpu #2 Nothing there
Cpu #3 Nothing there

...

SPARCstation 20 (1 X 390Z50), No Keyboard
ROM Rev. 2.25, 128 MB memory installed, Serial #1193046.
Ethernet address 52:54:0:12:34:56, Host ID: 72123456.


(It is necessary use SS-20 since it is the only sun4m model that
supports 512MB RAM, and I can't get Solaris to install on the SS-20
using OpenBIOS.)

When booting with OpenBIOS I can't seem to boot any version of Solaris
though I had heard this did work. Solaris 8 and 9 do work nicely with
this ROM, but I am opening this to see if it is possible to fix this
to allow the original OBP ROM to see multiple processors.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1759338/+subscriptions

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1759338

Title:
  qemu-system-sparc w/ SS-20 ROM does not add processors

Status in QEMU:
  Fix Released

Bug description:
  When booting a SPARCstation-20 with the original ROM, qemu does not
  set the number of processors in a way that this ROM can understand it,
  and the ROM always reports only 1 processor installed:

  
   ~/qemu  /usr/local/bin/qemu-system-sparc -bios ./ss20_v2.25_rom -M SS-20 
-cpu "TI SuperSparc 60" -smp 2 -nographic

  Power-ON Reset


  
 SMCC SPARCstation 10/20 UP/MP POST version VRV3.45 (09/11/95)

  
  CPU_#0   TI, TMS390Z50(3.x)   0Mb External cache

  CPU_#1   *** NOT installed ***
  CPU_#2   *** NOT installed ***
  CPU_#3   *** NOT installed ***

  <<< CPU_ on MBus Slot_ >>> IS RUNNING (MID =
  0008)

  
  ...

  Cpu #0 TI,TMS390Z50 
  Cpu #1 Nothing there 
  Cpu #2 Nothing there 
  Cpu #3 Nothing there 

  ...

  SPARCstation 20 (1 X 390Z50), No Keyboard
  ROM Rev. 2.25, 128 MB memory installed, Serial #1193046.
  Ethernet address 52:54:0:12:34:56, Host ID: 72123456.


  
  (It is necessary use SS-20 since it is the only sun4m model that supports 
512MB RAM, and I can't get Solaris to install on the SS-20 using OpenBIOS.) 

  When booting with OpenBIOS I can't seem to boot any version of Solaris
  though I had heard this did work.  Solaris 8 and 9 do work nicely with
  this ROM, but I am opening this to see if it is possible to fix this
  to allow the original OBP ROM to see multiple processors.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1759338/+subscriptions



Re: [PATCH v2 05/11] qapi/introspect.py: add preliminary type hint annotations

2020-11-13 Thread Markus Armbruster
John Snow  writes:

> The typing of _make_tree and friends is a bit involved, but it can be
> done with some stubbed out types and a bit of elbow grease. The
> forthcoming patches attempt to make some simplifications, but having the
> type hints in advance may aid in review of subsequent patches.
>
>
> Some notes on the abstract types used at this point, and what they
> represent:
>
> - TreeValue represents any object in the type tree. _make_tree is an
>   optional call -- not every node in the final type tree will have been
>   passed to _make_tree, so this type encompasses not only what is passed
>   to _make_tree (dicts, strings) or returned from it (dicts, strings, a
>   2-tuple), but any recursive value for any of the dicts passed to
>   _make_tree -- which includes lists, strings, integers, null constants,
>   and so on.
>
> - _DObject is a type alias I use to mean "A JSON-style object,
>   represented as a Python dict." There is no "JSON" type in Python, they
>   are converted natively to recursively nested dicts and lists, with
>   leaf values of str, int, float, None, True/False and so on. This type
>   structure is not possible to accurately portray in mypy yet, so a
>   placeholder is used.
>
>   In this case, _DObject is being used to refer to SchemaInfo-like
>   structures as defined in qapi/introspect.json, OR any sub-object
>   values they may reference. We don't have strong typing available for
>   those, so a generic alternative is used.
>
> - Extra refers explicitly to the dict containing "extra" information
>   about a node in the tree. mypy does not offer per-key typing for dicts
>   in Python 3.6, so this is the best we can do here.
>
> - Annotated refers to (one of) the return types of _make_tree:
>   It represents a 2-tuple of (TreeValue, Extra).
>
>
> Signed-off-by: Eduardo Habkost 
> Signed-off-by: John Snow 
> ---
>  scripts/qapi/introspect.py | 157 -
>  scripts/qapi/mypy.ini  |   5 --
>  scripts/qapi/schema.py |   2 +-
>  3 files changed, 121 insertions(+), 43 deletions(-)
>
> diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
> index 63f721ebfb6..803288a64e7 100644
> --- a/scripts/qapi/introspect.py
> +++ b/scripts/qapi/introspect.py
> @@ -10,7 +10,16 @@
>  See the COPYING file in the top-level directory.
>  """
>  
> -from typing import Optional, Sequence, cast
> +from typing import (
> +Any,
> +Dict,
> +List,
> +Optional,
> +Sequence,
> +Tuple,
> +Union,
> +cast,
> +)
>  
>  from .common import (
>  c_name,
> @@ -20,13 +29,56 @@
>  )
>  from .gen import QAPISchemaMonolithicCVisitor
>  from .schema import (
> +QAPISchema,
>  QAPISchemaArrayType,
>  QAPISchemaBuiltinType,
> +QAPISchemaEntity,
> +QAPISchemaEnumMember,
> +QAPISchemaFeature,
> +QAPISchemaObjectType,
> +QAPISchemaObjectTypeMember,
>  QAPISchemaType,
> +QAPISchemaVariant,
> +QAPISchemaVariants,
>  )
> +from .source import QAPISourceInfo
>  
>  
> -def _make_tree(obj, ifcond, features, extra=None):
> +# This module constructs a tree-like data structure that is used to

"Tree-like" suggests it's not a tree, it just looks like one if you
squint.  Drop "-like"?

> +# generate the introspection information for QEMU. It behaves similarly
> +# to a JSON value.
> +#
> +# A complexity over JSON is that our values may or may not be annotated.

It's the obvious abstract syntax tree for JSON, hacked up^W^Wextended to
support certain annotations.

Let me add a bit of context and history.

The module's job is generating qapi-introspect.[ch] for a QAPISchema.

The purpose of qapi-introspect.[ch] is providing the information
query-qmp-schema needs, i.e. (a suitable C representation of) a JSON
value conforming to [SchemaInfo].  Details of this C representation are
not interesting right now.

We first go from QAPISchema to a suitable Python representation of
[SchemaInfo], then from there to the C source code, neatly separating
concerns.

Stupidest solution Python representation that could possibly work: the
obvious abstract syntax tree for JSON (that's also how Python's json
module works).

Parts corresponding to QAPISchema parts guarded by 'if' conditionals
need to be guarded by #if conditionals.

We want to prefix parts corresponding to certain QAPISchema parts with a
comment.

These two requirements came later, and were hacked into the existing
stupidest solution: any tree node can be a tuple (json, extra), where
json is the "stupidest" node, and extra is a dict of annotations.  In
other words, to annotate an unannotated node N with dict D, replace N by
(N, D).

Possible annotations:

'comment': str
'if': Sequence[str]

They say there are just three answers a Marine may give to an officer's
questions: "Yes, sir!", "No, sir!", "No excuse, sir!".  Let me put that
to use here:

Is this an elegant design?  No, sir!

Is the code easy to read?  No excuse, sir!

Was it cheap to 

[Bug 1759338] Re: qemu-system-sparc w/ SS-20 ROM does not add processors

2020-11-13 Thread Peter Maydell
Reporter said in comment #1 that the bug can be closed, so let's close
it :-)


** Changed in: qemu
   Status: Incomplete => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1759338

Title:
  qemu-system-sparc w/ SS-20 ROM does not add processors

Status in QEMU:
  Fix Released

Bug description:
  When booting a SPARCstation-20 with the original ROM, qemu does not
  set the number of processors in a way that this ROM can understand it,
  and the ROM always reports only 1 processor installed:

  
   ~/qemu  /usr/local/bin/qemu-system-sparc -bios ./ss20_v2.25_rom -M SS-20 
-cpu "TI SuperSparc 60" -smp 2 -nographic

  Power-ON Reset


  
 SMCC SPARCstation 10/20 UP/MP POST version VRV3.45 (09/11/95)

  
  CPU_#0   TI, TMS390Z50(3.x)   0Mb External cache

  CPU_#1   *** NOT installed ***
  CPU_#2   *** NOT installed ***
  CPU_#3   *** NOT installed ***

  <<< CPU_ on MBus Slot_ >>> IS RUNNING (MID =
  0008)

  
  ...

  Cpu #0 TI,TMS390Z50 
  Cpu #1 Nothing there 
  Cpu #2 Nothing there 
  Cpu #3 Nothing there 

  ...

  SPARCstation 20 (1 X 390Z50), No Keyboard
  ROM Rev. 2.25, 128 MB memory installed, Serial #1193046.
  Ethernet address 52:54:0:12:34:56, Host ID: 72123456.


  
  (It is necessary use SS-20 since it is the only sun4m model that supports 
512MB RAM, and I can't get Solaris to install on the SS-20 using OpenBIOS.) 

  When booting with OpenBIOS I can't seem to boot any version of Solaris
  though I had heard this did work.  Solaris 8 and 9 do work nicely with
  this ROM, but I am opening this to see if it is possible to fix this
  to allow the original OBP ROM to see multiple processors.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1759338/+subscriptions



[Bug 1799919] Re: IDE HDD emulation random read/write errors

2020-11-13 Thread Peter Maydell
I tried the repro case five times and each time it ran OK to the point
of asking for floppy 2. So that suggests we probably fixed whatever it
was...

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1799919

Title:
  IDE HDD emulation random read/write errors

Status in QEMU:
  Incomplete

Bug description:
  I unfortunately can’t give more tracks other than how to reproduce the
  bug, especially that the bug occurs randomly.

  Basically, I’m trying to install DOS 6.22 on an emulated ISA machine,
  and it fails, DOS complaining about read or write error on drive C.
  Repeating the operation multiple time, I see it occurs at random
  stage, sometime even before it partitions the drive, sometime when it
  formats the drive, sometime when it copies the files from the floppy
  to the drive.

  To test it, unpack the attached archive and execute `./run` from the
  extracted directory. The archive contains three raw floppy images for
  installing DOS 6.22, and a Bourne Shell script which invokes QEmu.
  Just press enter at any installation stage, the bug may occurs at any
  stage.

  I tried with `cache=none` to be sure it’s not a cache issue, but its
  the same whatever the cache policy is.

  Version and environment: using QEmu 3.0 on Ubuntu 16.04 on a 32 bits
  DELL Inspiron 9400 (not an emulation, that’s my real laptop).

  For why I’m using QEmu for this: the installation proceeds with not
  error in VirtualBox, but I wanted to use QEmu to have a serial mouse
  which is not available with QEmu and to have finer control over the
  machine configuration ; VirtualBox although good, is more limited in
  that regard.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1799919/+subscriptions



Re: [PATCH 4/6] migration: Check xbzrle-cache-size more carefully

2020-11-13 Thread Dr. David Alan Gilbert
* Markus Armbruster (arm...@redhat.com) wrote:
> "Dr. David Alan Gilbert"  writes:
> 
> > * Markus Armbruster (arm...@redhat.com) wrote:
> >> migrate-set-parameters passes the size to xbzrle_cache_resize().
> >> xbzrle_cache_resize() checks it fits into size_t before it passes it
> >> on to cache_init().  cache_init() checks it is a power of two no
> >> smaller than @page_size.
> >> 
> >> cache_init() is also called from xbzrle_init(), bypassing
> >> xbzrle_cache_resize()'s check.
> >> 
> >> Drop xbzrle_cache_resize()'s check, and check more carefully in
> >> cache_init().
> >> 
> >> Signed-off-by: Markus Armbruster 
> >> ---
> >>  migration/page_cache.c | 15 ---
> >>  migration/ram.c|  7 ---
> >>  2 files changed, 4 insertions(+), 18 deletions(-)
> >> 
> >> diff --git a/migration/page_cache.c b/migration/page_cache.c
> >> index b384f265fb..e07f4ad1dc 100644
> >> --- a/migration/page_cache.c
> >> +++ b/migration/page_cache.c
> >> @@ -41,17 +41,10 @@ struct PageCache {
> >>  PageCache *cache_init(uint64_t new_size, size_t page_size, Error **errp)
> >>  {
> >>  int64_t i;
> >> -size_t num_pages = new_size / page_size;
> >> +uint64_t num_pages = new_size / page_size;
> >>  PageCache *cache;
> >>  
> >> -if (new_size < page_size) {
> >> -error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
> >> -   "is smaller than one target page size");
> >> -return NULL;
> >> -}
> >> -
> >> -/* round down to the nearest power of 2 */
> >> -if (!is_power_of_2(num_pages)) {
> >> +if (num_pages != (size_t)num_pages || !is_power_of_2(num_pages)) {
> >>  error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
> >> "is not a power of two number of pages");
> >
> > That error message is now wrong since it includes a whole bunch of
> > reasons.
> 
> We could argue about "wrong", but I readily concedede it needs
> improvement:
> 
> Parameter 'cache size' expects is not a power of two number of pages
> 
> is crap.  I fixed similar crap in my "[PATCH 00/10] Chipping away at
> qerror.h"

The wording may be crap, but it does at least talk about the correct
problem.

> but missed this one.
> 
> What about
> 
> Parameter 'xbzrle-cache-size' expects a power of two larger than 
> $page_size

Yes, although you've also put a too-large check in ther=e with that
size_t cast.

> ?
> 
> > Also, the comparison is now on the divided num_pages, it's not that
> > obvious to me that checking the num_pages makes sense in acomparison to
> > checking the actual cache size.
> 
> Would you accept
> 
> if (!is_power_of_2(new_size)
> || !num_pages || num_pages != (size_t)num_pages) {

Well, why is it not  || new_size != (size_t)new_size   like in the
original?

> ?
> 
> If not, please propose something you like better.
> 
> > (Arguably the check should also happen in migrate_params_test_apply)
> 
> Feels like one bridge too far for this patch.

Sure.

Dave

-- 
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK




Re: [PATCH v3 2/2] quorum: Implement bdrv_co_pwrite_zeroes()

2020-11-13 Thread Max Reitz

On 13.11.20 17:26, Alberto Garcia wrote:

On Fri 13 Nov 2020 05:11:20 PM CET, Max Reitz wrote:


We could set all supported_zero_flags as long as all children support
them, right?


Sure, I was just thinking that we could set these regardless of
whether the children support them, because (on zero-writes) the block
layer will figure out for us whether the child nodes support them. O:)


But it can happen that one child supports e.g. BDRV_REQ_NO_FALLBACK but
the rest don't. In this case I think the block layer should return
-ENOTSUP earlier without writing to the child(ren) that do support that
flag.


That’s true.


So Quorum's supported_zero_flags would be the logical and of all of its
children's flags, right?


Yes.  (And so it would need to be recalculated whenever a child is added 
or removed.)



I'm unsure about BDRV_REQ_WRITE_UNCHANGED, many filters set that on top
of the other flags, but when would a BDS not support this flag?


The WRITE_UNCHANGED flag is basically just a hint for the permission 
system that for such a write, the WRITE_UNCHANGED permission is 
sufficient.  So drivers that can pass through *all* WRITE_UNCHANGED 
requests as they are (i.e., filter drivers) can support this write/zero 
flag and then pass that flag on.  This way, they are safe not to take 
the WRITE permission on their child unless their parent has taken the 
WRITE permission on them.


(Otherwise, they’d also have to take the WRITE permission if the parent 
only holds the WRITE_UNCHANGED permission.)


Supporting this flag doesn’t make sense for drivers that won’t be able 
to pass it on all the time.  For example, qcow2 generally cannot pass it 
on, because it still needs to perform WRITE_UNCHANGED requests as normal 
writes.  (WRITE_UNCHANGED comes from copy-on-read; the data will read 
the same, hence the _UNCHANGED, but it still needs to be allocated on 
the receiving format layer.)


(Technically, qcow2 could figure out whether the requests it generates 
from a WRITE_UNCHANGED request still result in unchanging writes in the 
protocol layer, but there is no reason to.  It needs the WRITE 
permission anyway, because there are going to be some non-unchanging 
writes it has to perform.  And if it holds the WRITE permission, there 
is no need to bother with the WRITE_UNCHANGED flag.)



pwrite_zeroes() does this additionaly:

  if (!(child->bs->open_flags & BDRV_O_UNMAP)) {
  flags &= ~BDRV_REQ_MAY_UNMAP;
  }


Interesting.  Technically, Quorum doesn’t support that flag (in
supported_zero_flags O:))), so it shouldn’t appear, but, er, well
then.


It would with the change that I'm proposing above.


Yes, I know.  Hence the “O:)”. O:)

Max




Re: [PATCH] configure: Force-remove temp dir

2020-11-13 Thread Peter Maydell
On Fri, 13 Nov 2020 at 16:26, Dan Church  wrote:
>
> Sometimes the compiler will leave a write-protected .o file in the temp
> directory, and GNU rm will ask before deleting it unless -f is
> specified.
>
> Signed-off-by: Dan Church 
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 4cef321d9d..663b91a334 100755
> --- a/configure
> +++ b/configure
> @@ -7080,4 +7080,4 @@ done
>  echo ' "$@"' >>config.status
>  chmod +x config.status
>
> -rm -r "$TMPDIR1"
> +rm -rf "$TMPDIR1"

We rm -rf this directory at the top of configure, so it seems
like an oversight that we don't use '-f' here at the bottom too.

Reviewed-by: Peter Maydell 

You should probably look into why your compiler is generating
write-protected .o files, though -- that doesn't sound normal.

thanks
-- PMM



[Bug 1759338] Re: qemu-system-sparc w/ SS-20 ROM does not add processors

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1759338

Title:
  qemu-system-sparc w/ SS-20 ROM does not add processors

Status in QEMU:
  Incomplete

Bug description:
  When booting a SPARCstation-20 with the original ROM, qemu does not
  set the number of processors in a way that this ROM can understand it,
  and the ROM always reports only 1 processor installed:

  
   ~/qemu  /usr/local/bin/qemu-system-sparc -bios ./ss20_v2.25_rom -M SS-20 
-cpu "TI SuperSparc 60" -smp 2 -nographic

  Power-ON Reset


  
 SMCC SPARCstation 10/20 UP/MP POST version VRV3.45 (09/11/95)

  
  CPU_#0   TI, TMS390Z50(3.x)   0Mb External cache

  CPU_#1   *** NOT installed ***
  CPU_#2   *** NOT installed ***
  CPU_#3   *** NOT installed ***

  <<< CPU_ on MBus Slot_ >>> IS RUNNING (MID =
  0008)

  
  ...

  Cpu #0 TI,TMS390Z50 
  Cpu #1 Nothing there 
  Cpu #2 Nothing there 
  Cpu #3 Nothing there 

  ...

  SPARCstation 20 (1 X 390Z50), No Keyboard
  ROM Rev. 2.25, 128 MB memory installed, Serial #1193046.
  Ethernet address 52:54:0:12:34:56, Host ID: 72123456.


  
  (It is necessary use SS-20 since it is the only sun4m model that supports 
512MB RAM, and I can't get Solaris to install on the SS-20 using OpenBIOS.) 

  When booting with OpenBIOS I can't seem to boot any version of Solaris
  though I had heard this did work.  Solaris 8 and 9 do work nicely with
  this ROM, but I am opening this to see if it is possible to fix this
  to allow the original OBP ROM to see multiple processors.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1759338/+subscriptions



Re: [PATCH v3 2/2] quorum: Implement bdrv_co_pwrite_zeroes()

2020-11-13 Thread Alberto Garcia
On Fri 13 Nov 2020 05:11:20 PM CET, Max Reitz wrote:

>> We could set all supported_zero_flags as long as all children support
>> them, right?
>
> Sure, I was just thinking that we could set these regardless of
> whether the children support them, because (on zero-writes) the block
> layer will figure out for us whether the child nodes support them. O:)

But it can happen that one child supports e.g. BDRV_REQ_NO_FALLBACK but
the rest don't. In this case I think the block layer should return
-ENOTSUP earlier without writing to the child(ren) that do support that
flag.

So Quorum's supported_zero_flags would be the logical and of all of its
children's flags, right?

I'm unsure about BDRV_REQ_WRITE_UNCHANGED, many filters set that on top
of the other flags, but when would a BDS not support this flag?

>> pwrite_zeroes() does this additionaly:
>> 
>>  if (!(child->bs->open_flags & BDRV_O_UNMAP)) {
>>  flags &= ~BDRV_REQ_MAY_UNMAP;
>>  }
>
> Interesting.  Technically, Quorum doesn’t support that flag (in
> supported_zero_flags O:))), so it shouldn’t appear, but, er, well
> then.

It would with the change that I'm proposing above.

Berto



Re: [PATCH v7 21/21] scripts/simplebench: add bench_prealloc.py

2020-11-13 Thread Max Reitz

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Benchmark for new preallocate filter.

Example usage:
 ./bench_prealloc.py ../../build/qemu-img \
 ssd-ext4:/path/to/mount/point \
 ssd-xfs:/path2 hdd-ext4:/path3 hdd-xfs:/path4

The benchmark shows performance improvement (or degradation) when use
new preallocate filter with qcow2 image.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  scripts/simplebench/bench_prealloc.py | 132 ++
  1 file changed, 132 insertions(+)
  create mode 100755 scripts/simplebench/bench_prealloc.py


Reviewed-by: Max Reitz 




[Bug 1759337] Re: 'Failed to get "write" lock' error when trying to run a VM with disk image file on an SMB share

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1759337

Title:
  'Failed to get "write" lock' error when trying to run a VM with disk
  image file on an SMB share

Status in QEMU:
  Incomplete

Bug description:
  This has been reported and discussed downstream:

  https://bugzilla.redhat.com/show_bug.cgi?id=1484130

  but doesn't seem to be getting a lot of traction there.

  Basically, with qemu since at least 2.10, you cannot use a disk image
  on an SMB share that's mounted with protocol version 3 (I think
  possibly 2 or higher). This is made much more serious because kernel
  4.13 upstream made version 3 the *default* for SMB mounts, because
  version 1 is insecure and should not be used.

  So basically, anyone with a recent qemu and kernel cannot use disk
  images stored on an SMB share. This is a major inconvenience for me
  because, well, an SMB share is exactly where I store my VM disk
  images, usually: I have a big NAS drive where I keep them all, only
  now I can't because of this bug, and I'm manually swapping them in and
  out of the very limited space I have on my system drive (SSD).

  The error you get is:

  qemu-system-x86_64: -drive 
file=/share/data/isos/vms/desktop_test_1.qcow2,format=qcow2,if=none,id=drive-virtio-disk0:
 Failed to get "write" lock
  Is another process using the image?

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1759337/+subscriptions



Re: [PATCH v7 18/21] simplebench/results_to_text: improve view of the table

2020-11-13 Thread Vladimir Sementsov-Ogievskiy

13.11.2020 18:59, Max Reitz wrote:

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Move to generic format for floats and percentage for error.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  scripts/simplebench/results_to_text.py | 13 -
  1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/scripts/simplebench/results_to_text.py 
b/scripts/simplebench/results_to_text.py
index 58d909ffd9..479f7ac1d4 100644
--- a/scripts/simplebench/results_to_text.py
+++ b/scripts/simplebench/results_to_text.py
@@ -16,11 +16,22 @@
  # along with this program.  If not, see .
  #
+import math
+
+
+def format_value(x, stdev):
+    stdev_pr = stdev / x * 100
+    if stdev_pr < 1.5:
+    # don't care too much
+    return f'{x:.2g}'
+    else:
+    return f'{x:.2g} ± {math.ceil(stdev_pr)}%'


OK, so no magnitude-based precision this time (except for the %f -> %g change). 
 Works for me.

Other than that, I personally don’t like the relative standard deviation much, 
because the absolute SD immediately shows the 68 % boundaries (and an idea on 
the 95 % boundaries with 2σ), whereas the RSD just gives an impression on how 
spread out the data is.  (Which I find the absolute SD also does, when given 
together with the average, which is the case here.)


I realized that for myself, the only thing I need from +-deviation is a kind of 
"reliability" of the result. And it's more obvious for me in percentage. 
Looking at the table with a lot of numbers, where most of values have deviation less than 
+-5%, some values with deviation +-30 would catch the eye immediately. And with absolute 
SD I have to look through the table more carefully.



To be completely honest, though, I didn’t even know the term “relative SD” 
existed until a couple of minutes ago, and I didn’t know it was something that 
was used at all.
And if I haven’t seen the RSD used in practice, I can’t confidently say that I 
have good reasons not to like it.

But, well, I can’t have any confidence in liking it either, and because the 
change from ASD to RSD is basically the most important change of this patch 
(which I can’t really agree is an improvement), I can’t really give an R-b.

Perhaps this is OK:

Acked-by: Max Reitz 



Thanks!

I don't have strict opinion about how this should look. For now these scripts 
don't have wide usage... We can always add an option to adjust table view, and 
I will not mind making absolute SD the default view.


--
Best regards,
Vladimir



[PATCH] configure: Force-remove temp dir

2020-11-13 Thread Dan Church
Sometimes the compiler will leave a write-protected .o file in the temp
directory, and GNU rm will ask before deleting it unless -f is
specified.

Signed-off-by: Dan Church 
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 4cef321d9d..663b91a334 100755
--- a/configure
+++ b/configure
@@ -7080,4 +7080,4 @@ done
 echo ' "$@"' >>config.status
 chmod +x config.status
 
-rm -r "$TMPDIR1"
+rm -rf "$TMPDIR1"
-- 
2.29.2




Re: [PATCH v7 20/21] simplebench/results_to_text: make executable

2020-11-13 Thread Max Reitz

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Make results_to_text a tool to dump results saved in JSON file.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  scripts/simplebench/results_to_text.py | 14 ++
  1 file changed, 14 insertions(+)
  mode change 100644 => 100755 scripts/simplebench/results_to_text.py


Reviewed-by: Max Reitz 




Re: [PATCH v7 19/21] simplebench/results_to_text: add difference line to the table

2020-11-13 Thread Max Reitz

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Performance improvements / degradations are usually discussed in
percentage. Let's make the script calculate it for us.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  scripts/simplebench/results_to_text.py | 67 +++---
  1 file changed, 60 insertions(+), 7 deletions(-)

diff --git a/scripts/simplebench/results_to_text.py 
b/scripts/simplebench/results_to_text.py
index 479f7ac1d4..56fdacf7ca 100644
--- a/scripts/simplebench/results_to_text.py
+++ b/scripts/simplebench/results_to_text.py


[...]


+for j in range(0, i):
+env_j = results['envs'][j]
+res_j = case_results[env_j['id']]
+cell += ' '
+
+if 'average' not in res_j:
+# Failed result
+cell += '--'
+continue
+
+col_j = tab[0][j + 1] if named_columns else ''
+diff_pr = round((res['average'] - res_j['average']) /
+res_j['average'] * 100)
+cell += f' {col_j}{diff_pr:+}%'


Contrasting to v6, you added the "cell += ' '" line, dropped a space in 
the "cell += '--'" line (was: "cell += ' --'"), but kept the space here. 
 I would have assumed that the leading space is dropped here, too.  But 
I don’t quite know, what I should be expecting, so.


Anyway, I’ll just leave this here:

Reviewed-by: Max Reitz 


+row.append(cell)
+tab.append(row)
+
+return f'All results are in {dim}\n\n' + tabulate.tabulate(tab)






[Bug 1758091] Re: vmxnet3 unable to send IPv6 ESP packets

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1758091

Title:
  vmxnet3 unable to send IPv6 ESP packets

Status in QEMU:
  Incomplete

Bug description:
  My vmxnet3 network driver (in a closed source custom OS) is unable to
  send network packets that are structured as follows: Ethernet-
  Header(IPv6-Header(ESP(encrypted data))). I can verify that the packet
  is sent in the VM but is dropped in qemu. I first encountered this
  problem on qemu 2.10.1 but master is affected as well. After some
  debug printing in qemu I could identify the following call chain as
  being problematic:

  eth_is_ip6_extension_header_type
  eth_parse_ipv6_hdr
  net_tx_pkt_parse_headers
  net_tx_pkt_parse
  vmxnet3_process_tx_queue

  The problem seems to be the definition of the ESP header
  (https://en.wikipedia.org/wiki/IPsec#Encapsulating_Security_Payload)
  that does not follow the standard IPv6 extension header format
  starting with next type and length. Thus the parsed ext_hdr in
  eth_parse_ipv6_hdr does not contain valid data, in particular the
  length will contain bogus data and lead to a info->full_hdr_len that
  is larger than the packet itself and the loop would then try to read
  beyond the end of the packet.

  Using the e1000 driver I can send these packets. My guess is that the
  net_tx_pkt_parse function is not called in that case.

  My guess for a fix would be to remove "case IP6_ESP:" from
  eth_is_ip6_extension_header_type and not regard the ESP header as a
  IPv6 extension header. In a quick test this seems to fix the problem.
  But that should be verified by someone who is familiar with the code.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1758091/+subscriptions



[Bug 1799919] Re: IDE HDD emulation random read/write errors

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1799919

Title:
  IDE HDD emulation random read/write errors

Status in QEMU:
  Incomplete

Bug description:
  I unfortunately can’t give more tracks other than how to reproduce the
  bug, especially that the bug occurs randomly.

  Basically, I’m trying to install DOS 6.22 on an emulated ISA machine,
  and it fails, DOS complaining about read or write error on drive C.
  Repeating the operation multiple time, I see it occurs at random
  stage, sometime even before it partitions the drive, sometime when it
  formats the drive, sometime when it copies the files from the floppy
  to the drive.

  To test it, unpack the attached archive and execute `./run` from the
  extracted directory. The archive contains three raw floppy images for
  installing DOS 6.22, and a Bourne Shell script which invokes QEmu.
  Just press enter at any installation stage, the bug may occurs at any
  stage.

  I tried with `cache=none` to be sure it’s not a cache issue, but its
  the same whatever the cache policy is.

  Version and environment: using QEmu 3.0 on Ubuntu 16.04 on a 32 bits
  DELL Inspiron 9400 (not an emulation, that’s my real laptop).

  For why I’m using QEmu for this: the installation proceeds with not
  error in VirtualBox, but I wanted to use QEmu to have a serial mouse
  which is not available with QEmu and to have finer control over the
  machine configuration ; VirtualBox although good, is more limited in
  that regard.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1799919/+subscriptions



[Bug 1759333] Re: Illegal Instruction with HVF when encountering SSE instructions in the emulator

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1759333

Title:
  Illegal Instruction with HVF when encountering SSE instructions in the
  emulator

Status in QEMU:
  Incomplete

Bug description:
  The latest version of QEMU doesn't seem to support emulated SSE instructions 
with HVF acceleration on macOS.
  The decoder will treat SSE instructions as invalid, get the instruction sizes 
wrong and quickly crash the guest OS because of illegal instructions.
  After having a quick look at target/i386/hvf/x86_decode.c, it seems that SSE 
instruction emulation isn't implemented in the current version of the x86 
emulator.

  A way to reproduce the issue is to run a macOS 10.13 guest with HVF
  acceleration enabled, this will crash in the guest once it's loading
  up the GUI (and also print a "Unimplemented handler" warning from
  target/i386/hvf/x86_emu.c).

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1759333/+subscriptions



[Bug 1800401] Re: efifb on Linux guest fails to load when using VGA passthrough

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1800401

Title:
  efifb on Linux guest fails to load when using VGA passthrough

Status in QEMU:
  Incomplete

Bug description:
  The EFI framebuffer fails to load when booting a Gentoo guest using
  ovmf + vga_passthrough.  I retested using they system rescue CD and
  saw the same issue, but also noticed that when a second framebuffer
  loads, nouveaufb in my case, the terminal appears.  I have also
  verified that the Gentoo min CD is not hanging at boot as I can type
  'poweroff' after waiting a few minutes and the system responds by
  powering off.  I am unable to reproduce with seabios as I have been
  unable to get vga passthrough to work with that BIOS.

  Steps to Reproduce:
  1. Install qemu and ovmf
  2. Download systemrescuecd-x86-5.3.1.iso
  3. Run qemu using one of the configurations below
  4. Select first boot option in GRUB menu
  5. Wait 30 seconds
  6. Press enter # System rescue is prompting for the keymap between steps 
5 and 6
  7. Wait 2 minutes
  8. Observe fb console
  9. Note lack of output until very late in boot process
 10. Check dmesg
 11. Note efifb failed to load (invalid address)
 12. Note nouveaufb started late in boot process 

  Expected Results:
 The EFI FB to load and display output to monitor.  This is the behavior I 
see when booting the host system via UEFI.

  Actual Results:
 The EFI FB fails to load and display output.  System fails to display any 
output until nouveaufb loads.  When booting using the Gentoo minCD, this makes 
the system largely unusable.

  Additional information:

  Tested using Gentoo's app-emulation/qemu-3.0.0 version.  Bug report:
  https://bugs.gentoo.org/669880

  I also tested qemu at git commit
  179f9ac887973c818b2578bd79fa3ed2522657d4.  Configuration log for the
  build will be attached.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1800401/+subscriptions



[Bug 1800088] Re: Assertion fail while usb camera redirect

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1800088

Title:
  Assertion fail while usb camera redirect

Status in QEMU:
  Incomplete

Bug description:
  This may happen during usb camera redirect. But if i move the camera
  lens from left to right or up to down, this always happen. My qemu-
  version is 2.10.0 and following is the error information:

  2018-10-26T03:37:54.925231Z qemu-kvm: usbredirparser: error unexpected extra 
data ep 00
  qemu-kvm: hw/usb/redirect.c:1313: usbredir_chardev_read: Assertion 
`dev->read_buf == ((void *)0)' failed.
  2018-10-26 03:37:57.120+: shutting down, reason=crashed

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1800088/+subscriptions



[Bug 1799792] Re: Broken scaling with gtk,gl=on on a hidpi display

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1799792

Title:
  Broken scaling with gtk,gl=on on a hidpi display

Status in QEMU:
  Incomplete

Bug description:
  Tested on QEMU 3.0.0 on Arch Linux.

  I'm using a hidpi screen, and therefore use those environment
  variables in order to have GTK+ apps properly scaled:

  GDK_SCALE=2
  GDK_DPI_SCALE=0.5

  However, QEMU, when launched with "-display gtk,gl=on" option, doesn't
  scale the window content properly, as seen on the attached screenshot.

  Switching to "-display gtk,gl=off" and "-display sdl,gl=on" makes it
  work fine.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1799792/+subscriptions



Re: [PATCH v3 2/2] quorum: Implement bdrv_co_pwrite_zeroes()

2020-11-13 Thread Max Reitz

On 13.11.20 17:07, Alberto Garcia wrote:

On Fri 13 Nov 2020 12:49:04 PM CET, Max Reitz wrote:

On 11.11.20 17:53, Alberto Garcia wrote:

This simply calls bdrv_co_pwrite_zeroes() in all children

Signed-off-by: Alberto Garcia 
---
   block/quorum.c | 18 --
   tests/qemu-iotests/312 |  7 +++
   tests/qemu-iotests/312.out |  4 
   3 files changed, 27 insertions(+), 2 deletions(-)


Should we set supported_zero_flags to something?  I think we can at
least set BDRV_REQ_NO_FALLBACK.  We could also try BDRV_REQ_FUA.


We could set all supported_zero_flags as long as all children support
them, right?


Sure, I was just thinking that we could set these regardless of whether 
the children support them, because (on zero-writes) the block layer will 
figure out for us whether the child nodes support them. O:)



+if (acb->flags & BDRV_REQ_ZERO_WRITE) {
+sacb->ret = bdrv_co_pwrite_zeroes(s->children[i], acb->offset,
+  acb->bytes, acb->flags);
+} else {
+sacb->ret = bdrv_co_pwritev(s->children[i], acb->offset, acb->bytes,
+acb->qiov, acb->flags);
+}


Seems unnecessary (bdrv_co_pwritev() can handle BDRV_REQ_ZERO_WRITE),
but perhaps it’s good to be explicit.


pwrite_zeroes() does this additionaly:

 if (!(child->bs->open_flags & BDRV_O_UNMAP)) {
 flags &= ~BDRV_REQ_MAY_UNMAP;
 }


Interesting.  Technically, Quorum doesn’t support that flag (in 
supported_zero_flags O:))), so it shouldn’t appear, but, er, well then.


Max




Re: [PATCH v3 2/2] quorum: Implement bdrv_co_pwrite_zeroes()

2020-11-13 Thread Alberto Garcia
On Fri 13 Nov 2020 12:49:04 PM CET, Max Reitz wrote:
> On 11.11.20 17:53, Alberto Garcia wrote:
>> This simply calls bdrv_co_pwrite_zeroes() in all children
>> 
>> Signed-off-by: Alberto Garcia 
>> ---
>>   block/quorum.c | 18 --
>>   tests/qemu-iotests/312 |  7 +++
>>   tests/qemu-iotests/312.out |  4 
>>   3 files changed, 27 insertions(+), 2 deletions(-)
>
> Should we set supported_zero_flags to something?  I think we can at 
> least set BDRV_REQ_NO_FALLBACK.  We could also try BDRV_REQ_FUA.

We could set all supported_zero_flags as long as all children support
them, right? 

>> +if (acb->flags & BDRV_REQ_ZERO_WRITE) {
>> +sacb->ret = bdrv_co_pwrite_zeroes(s->children[i], acb->offset,
>> +  acb->bytes, acb->flags);
>> +} else {
>> +sacb->ret = bdrv_co_pwritev(s->children[i], acb->offset, acb->bytes,
>> +acb->qiov, acb->flags);
>> +}
>
> Seems unnecessary (bdrv_co_pwritev() can handle BDRV_REQ_ZERO_WRITE), 
> but perhaps it’s good to be explicit.

pwrite_zeroes() does this additionaly:

if (!(child->bs->open_flags & BDRV_O_UNMAP)) {
flags &= ~BDRV_REQ_MAY_UNMAP;
}

Berto



[Bug 1791763] Re: broken signal handling in nios2 user-mode emulation

2020-11-13 Thread Peter Maydell
A quick eyeball of the patch and the current QEMU tree indicates that at
least some of the bugs it's trying to fix still exist (notably a lot of
use of "long" in various target_* structures, which should not be using
types with a width dependent on the host system.)

** Changed in: qemu
   Status: Incomplete => Confirmed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1791763

Title:
  broken signal handling in nios2 user-mode emulation

Status in QEMU:
  Confirmed

Bug description:
  This bug is against the 3.0 release.

  It appears that the signal handling parts of the nios2 user-mode
  emulation have never really been completed or tested.  Some examples
  of failing tests from the GCC testsuite are gcc.dg/pr78185.c and
  gcc.dg/cleanup-10.c.

  Some problems I've identified and tried to fix with the attached patch
  are:

  - Code copied from the Linux kernel wasn't adjusted to differentiate
  between host and target data types and address spaces.

  - The sigaltstack() system call returns EINVAL because fields are
  listed in the wrong order in struct target_sigaltstack.

  With this patch, the system calls to set up the signal handler are
  returning successfully, but the handler isn't being invoked, so
  something is still wrong.  I think I need another pair of eyes to look
  over this code.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1791763/+subscriptions



Deprecate the nios2-linux-user target?

2020-11-13 Thread Thomas Huth


 Hi all,

looking at some bug reports in the launchpad bug tracker:

https://bugs.launchpad.net/qemu/+bug/1791763
https://bugs.launchpad.net/qemu/+bug/1791796

... it seems like the nios2-linux-user target is rather broken and
neglected? Is anybody still using it? If not, should we mark it as deprecated?

 Thomas




[Bug 1791796] Re: unimplemented thread syscalls in nios2 user-mode emulation

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1791796

Title:
  unimplemented thread syscalls in nios2 user-mode emulation

Status in QEMU:
  Incomplete

Bug description:
  This bug is reported against the 3.0 release.

  I noticed that the GCC test gcc.dg/torture/tls/tls-test.c is failing
  when run in user-mode qemu for nios2 target.  The problem appears to
  be that the thread-related syscalls are unimplemented in qemu.  Here
  is output from running with -strace:

  22484 brk(NULL) = 0x5000
  22484 uname(0x7fffef5a) = 0
  22484 faccessat(AT_FDCWD,"/etc/ld.so.preload",R_OK,0x5) = -1 errno=2 (No such 
file or directory)
  22484 
openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-99-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./tls/libm.so.6",O_RDONLY|O_LARGEFILE|O_CLOEXEC)
 = -1 errno=2 (No such file or directory)
  22484 
fstatat64(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-99-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./tls",0x7fffe870,0)
 = -1 errno=2 (No such file or directory)
  22484 
openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-99-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./libm.so.6",O_RDONLY|O_LARGEFILE|O_CLOEXEC)
 = 3
  22484 read(3,0x7fffe954,512) = 512
  22484 fstat64(3,0x7fffe870) = 0
  22484 mmap2(NULL,803596,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 
0x7f716000
  22484 
mmap2(0x7f7d8000,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0xc1)
 = 0x7f7d8000
  22484 close(3) = 0
  22484 
openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-99-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./libpthread.so.0",O_RDONLY|O_LARGEFILE|O_CLOEXEC)
 = 3
  22484 read(3,0x7fffe948,512) = 512
  22484 mmap2(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 
0x7f714000
  22484 fstat64(3,0x7fffe864) = 0
  22484 mmap2(NULL,120700,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 
0x7f6f6000
  22484 mprotect(0x7f70e000,4096,PROT_NONE) = 0
  22484 
mmap2(0x7f70f000,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x18)
 = 0x7f70f000
  22484 
mmap2(0x7f712000,6012,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0)
 = 0x7f712000
  22484 close(3) = 0
  22484 
openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-99-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./libc.so.6",O_RDONLY|O_LARGEFILE|O_CLOEXEC)
 = 3
  22484 read(3,0x7fffe93c,512) = 512
  22484 fstat64(3,0x7fffe858) = 0
  22484 mmap2(NULL,1491048,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 
0x7f589000
  22484 
mmap2(0x7f6de000,86016,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x154)
 = 0x7f6de000
  22484 
mmap2(0x7f6f3000,8296,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0)
 = 0x7f6f3000
  22484 close(3) = 0
  22484 mprotect(0x7f6de000,65536,PROT_READ) = 0
  22484 mprotect(0x7f70f000,8192,PROT_READ) = 0
  22484 mprotect(0x7f7d8000,4096,PROT_READ) = 0
  22484 mprotect(0x3000,4096,PROT_READ) = 0
  22484 mprotect(0x7f7fc000,4096,PROT_READ) = 0
  22484 set_tid_address(2138131700,2147480980,2147480988,2147480988,87148,47) = 
22484
  22484 set_robust_list(2138131708,12,2147480988,0,87148,47) = -1 errno=38 
(Function not implemented)
  22484 rt_sigaction(32,0x736c,NULL) = 0
  22484 rt_sigaction(33,0x736c,NULL) = -1 errno=22 (Invalid argument)
  22484 rt_sigprocmask(SIG_UNBLOCK,0x74a8,NULL) = 0
  22484 getrlimit(3,2147480732,3,0,62512,47) = 0
  22484 mmap2(NULL,8392704,PROT_NONE,MAP_PRIVATE|MAP_ANONYMOUS|0x2,-1,0) = 
0x7ed88000
  22484 mprotect(0x7ed89000,8388608,PROT_READ|PROT_WRITE) = 0
  22484 brk(NULL) = 0x5000
  22484 brk(0x00026000) = 0x00026000
  22484 
clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,child_stack=0x7f588018,parent_tidptr=0x7f5884fc,tls=0x7f58f928,child_tidptr=0x7f5884fc)
 = 22503
  22484 io_setup(4001536,2136506392,2136507644,2136507644,2136537384,4100) = -1 
errno=38 (Function not implemented)
  22484 

Re: [PATCH v7 18/21] simplebench/results_to_text: improve view of the table

2020-11-13 Thread Max Reitz

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Move to generic format for floats and percentage for error.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  scripts/simplebench/results_to_text.py | 13 -
  1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/scripts/simplebench/results_to_text.py 
b/scripts/simplebench/results_to_text.py
index 58d909ffd9..479f7ac1d4 100644
--- a/scripts/simplebench/results_to_text.py
+++ b/scripts/simplebench/results_to_text.py
@@ -16,11 +16,22 @@
  # along with this program.  If not, see .
  #
  
+import math

+
+
+def format_value(x, stdev):
+stdev_pr = stdev / x * 100
+if stdev_pr < 1.5:
+# don't care too much
+return f'{x:.2g}'
+else:
+return f'{x:.2g} ± {math.ceil(stdev_pr)}%'


OK, so no magnitude-based precision this time (except for the %f -> %g 
change).  Works for me.


Other than that, I personally don’t like the relative standard deviation 
much, because the absolute SD immediately shows the 68 % boundaries (and 
an idea on the 95 % boundaries with 2σ), whereas the RSD just gives an 
impression on how spread out the data is.  (Which I find the absolute SD 
also does, when given together with the average, which is the case here.)


To be completely honest, though, I didn’t even know the term “relative 
SD” existed until a couple of minutes ago, and I didn’t know it was 
something that was used at all.
And if I haven’t seen the RSD used in practice, I can’t confidently say 
that I have good reasons not to like it.


But, well, I can’t have any confidence in liking it either, and because 
the change from ASD to RSD is basically the most important change of 
this patch (which I can’t really agree is an improvement), I can’t 
really give an R-b.


Perhaps this is OK:

Acked-by: Max Reitz 

  
  def result_to_text(result):

  """Return text representation of bench_one() returned dict."""
  if 'average' in result:
-s = '{:.2f} +- {:.2f}'.format(result['average'], result['stdev'])
+s = format_value(result['average'], result['stdev'])
  if 'n-failed' in result:
  s += '\n({} failed)'.format(result['n-failed'])
  return s






[Bug 1787002] Re: disas/i386.c compile error

2020-11-13 Thread Thomas Huth
Looking through old bug tickets ... This sounds like it was rather a bug
in your toolchain ... is it still reproducible with a newer version of
your Linux distro and the latest version of QEMU?

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1787002

Title:
  disas/i386.c compile error

Status in QEMU:
  Incomplete

Bug description:
  QEMU Version: 2.12.1, 3.0.0-rc4
  Compiling with GCC 8.2.0
  System: Plop Linux, 32 bit 

  Error:
CC  disas/i386.o
  /tmp/ccK8tHRs.s: Assembler messages:
  /tmp/ccK8tHRs.s:53353: Error: can't resolve `L0' {*ABS* section} - `obuf' 
{.bss section}

  
  The problematic line is in 'disas/i386.c' in the function 'INVLPG_Fixup (int 
bytemode, int sizeflag)':
  strcpy (obuf + strlen (obuf) - 6, alt);

  If I comment out this line, then compiling works without problems.

  
  The error comes only on 32 bit. On 64 bit, compiling works without problems.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1787002/+subscriptions



[Bug 1788275] Re: -cpu ...,+topoext works only with EPYC CPU model

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1788275

Title:
  -cpu ...,+topoext works only with EPYC CPU model

Status in QEMU:
  Incomplete

Bug description:
  See bug report at:
  https://bugzilla.redhat.com/show_bug.cgi?id=1615682

  Probably this is caused by the inconsistent legacy cache information
  on all CPU models except EPYC.

  -
  Description of problem:
  Guest should get 2 threads per core and all of them should be on-line when 
booting guest with old amd cpu model + smt

  Steps to Reproduce:
  1.Boot rhel7.6 guest with cli:
  /usr/libexec/qemu-kvm -name rhel7.6 -m 16G -machine pc,accel=kvm \
  -S \
  -cpu Opteron_G3,+topoext,xlevel=0x801e,enforce \
  -smp 2,threads=2 \
  -monitor stdio \
  -qmp unix:/tmp/qmp2,server,nowait \
  -device VGA \
  -vnc :0 \
  -serial unix:/tmp/console2,server,nowait \
  -uuid 115e11b2-a869-41b5-91cd-6a32a907be7f \
  -drive 
file=rhel7.6-20180812.qcow2,if=none,id=drive-scsi-disk0,format=qcow2,cache=none,werror=stop,rerror=stop
 -device ide-hd,drive=drive-scsi-disk0,id=scsi-disk0 \
  -netdev tap,id=idinWyYY,vhost=on -device 
virtio-net-pci,mac=2e:39:fa:ff:88:a1,id=idlbq7eA,netdev=idinWyYY \

  2.check cpu info inside guest
  3.

  Actual results:
  Guest gets one online cpu, one offline cpu and one thread per core:
  # lscpu
  lscpu
  Architecture:  x86_64
  CPU op-mode(s):32-bit, 64-bit
  Byte Order:Little Endian
  CPU(s):2
  On-line CPU(s) list:   0
  Off-line CPU(s) list:  1
  Thread(s) per core:1
  Core(s) per socket:1
  Socket(s): 1
  NUMA node(s):  1
  Vendor ID: AuthenticAMD
  CPU family:16
  Model: 2
  Model name:AMD Opteron 23xx (Gen 3 Class Opteron)
  Stepping:  3
  CPU MHz:   2096.060
  BogoMIPS:  4192.12
  Hypervisor vendor: KVM
  Virtualization type:   full
  L1d cache: 64K
  L1i cache: 64K
  L2 cache:  512K
  L3 cache:  16384K
  NUMA node0 CPU(s): 0
  Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm art rep_good nopl 
extd_apicid pni cx16 x2apic popcnt hypervisor lahf_lm cmp_legacy abm sse4a 
misalignsse topoext retpoline_amd ibp_disable vmmcall

  
  Expected results:
  Guest should get 2 threads per core and all of them should be on-line

  -

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1788275/+subscriptions



[Bug 1787070] Re: Guests using the qxl-vga are freezing

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1787070

Title:
  Guests using the qxl-vga are freezing

Status in QEMU:
  Incomplete

Bug description:
  I have noticed that guests using qxl-vga are freezing. They may freeze
  after a few minutes or after many hours. The freeze consists of the
  entire system hanging, except the cursor, but the cursor animation
  stops too. Changing to tty is not possible after this. There are three
  things noticed in common on the guests when they freeze:

  -The guest is using the QXL VGA (freezes weren't observed with other VGAs);
  -A new workload is starting;
  -The mouse cursor is the animated as the one of loading. For example, 
https://i.imgur.com/raQFteG.png
   
  The host is Xubuntu 18.04 amd64, QEMU version is 3.0.0-dirty. The guests 
tested were:

  -openSUSE Tumbleweed;
  -openSUSE Leap 15;
  -Xubuntu 18.04 Bionic Beaver;
  -CentOS 7.

  With openSUSE guests, the install process couldn't even be finished,
  as the installer would freeze. There were 2 GB of available memory
  (checked in a tty before the freeze) and netconsole was enabled.
  Unfortunately, it was impossible to obtain any information from them.
  This is an image of one openSUSE guest frozen:
  https://i.imgur.com/ZP0eQKq.png

  The command line used was:

  qemu-system-x86_64 -nodefaults -m 3072 -M pc,usb=true -accel kvm -cpu
  host -smp cores=2,threads=2 -device qemu-xhci -drive
  id=centusb,if=none,file=leap.qcow2 -device usb-
  storage,id=centusb,drive=centusb -netdev user,id=n0 -device usb-
  tablet,id=usbtablet -device e1000,netdev=n0 -device usb-
  audio,id=usbaudio -device qxl-vga,xres=1366,yres=768 -display gtk
  -monitor vc -serial vc  -cdrom "openSUSE-Leap-15.0-DVD-x86_64.iso"
  -boot d

  With CentOS guests, the install process fail sometimes, but sometimes
  it's able to install. However, on the yum update, it would freeze too.
  In one instance it froze while updating glibc, which made the guest
  unbootable. https://i.imgur.com/B3WhSDX.png

  The command line used was:

  qemu-system-x86_64 -nodefaults -m 2048 -M pc,usb=true -accel kvm -cpu
  host -smp cores=2,threads=2 -device qemu-xhci -drive
  id=centusb,if=none,file=centos.qcow2 -device usb-
  storage,id=centusb,drive=centusb -netdev user,id=n0 -device usb-
  tablet,id=usbtablet -device e1000,netdev=n0 -device usb-
  audio,id=usbaudio -device virtio-vga,virgl=true -display gtk -monitor
  vc -serial vc -cdrom "CentOS-7-livecd-GNOME-x86_64.iso" -bios
  /usr/share/ovmf/OVMF.fd

  With Xubuntu 18.04 guests, the system worked for many hours until the
  freeze happened. On this case it happened when opening Audacious.
  Fortunately, the logging services worked for some time, which allowed
  me to get a relevant message which can be seen at
  http://termbin.com/nuof . It repeated a few times, but then the
  logging stopped. https://i.imgur.com/2zckqj5.png shows the guest
  screen in the moment it froze.

  The command line used was:

  qemu-system-x86_64 -nodefaults -m 1024 -M pc,usb=true -accel kvm -cpu
  host -smp cores=2,threads=2 -device qemu-xhci -drive
  id=centusb,if=none,file=xubmini -device usb-
  storage,id=centusb,drive=centusb -netdev user,id=n0 -device usb-
  tablet,id=usbtablet -device e1000,netdev=n0 -device usb-
  audio,id=usbaudio -device qxl-vga,xres=1366,yres=768 -display gtk
  -monitor vc -serial vc

  I'm sorry for not having more detailed information but, even setting
  netconsole, openSUSE and CentOS guests were unable to print any
  information.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1787070/+subscriptions



[Bug 1791763] Re: broken signal handling in nios2 user-mode emulation

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1791763

Title:
  broken signal handling in nios2 user-mode emulation

Status in QEMU:
  Incomplete

Bug description:
  This bug is against the 3.0 release.

  It appears that the signal handling parts of the nios2 user-mode
  emulation have never really been completed or tested.  Some examples
  of failing tests from the GCC testsuite are gcc.dg/pr78185.c and
  gcc.dg/cleanup-10.c.

  Some problems I've identified and tried to fix with the attached patch
  are:

  - Code copied from the Linux kernel wasn't adjusted to differentiate
  between host and target data types and address spaces.

  - The sigaltstack() system call returns EINVAL because fields are
  listed in the wrong order in struct target_sigaltstack.

  With this patch, the system calls to set up the signal handler are
  returning successfully, but the handler isn't being invoked, so
  something is still wrong.  I think I need another pair of eyes to look
  over this code.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1791763/+subscriptions



[Bug 1788701] Re: "Zoom to fit" doesn't work with -display gtk -vga virtio

2020-11-13 Thread Thomas Huth
The QEMU project is currently considering to move its bug tracking to another 
system. For this we need to know which bugs are still valid and which could be 
closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state 
back to "New" within the next 60 days, otherwise this report will be marked as 
"Expired". Or mark it as "Fix Released" if the problem has been solved with a 
newer version of QEMU already. Thank you and sorry for the inconvenience.

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1788701

Title:
  "Zoom to fit" doesn't work  with -display gtk -vga virtio

Status in QEMU:
  Incomplete

Bug description:
  qemu version: 2.12.1, 3.0.0

  When using -display gtk for all -vga options (std,qxl,vmware,cirrus)
  the option "Zoom To Fit" is unchecked by default and thus auto-
  resizing of the window works well; except for -vga virtio: here "Zoom
  To Fit" is checked and auto-resizing doesn't work.

  Proposal: make "Zoom To Fit" unchecked by default for virtio as well
  Extended proposal: make GTK window options configurable via parameters

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1788701/+subscriptions



[Bug 1904206] Re: install QEMU

2020-11-13 Thread Peter Maydell
QEMU is working fine, but your guest kernel has crashed. Either your
guest kernel is the wrong one for the "versatilepb" machine type, or the
kernel wants a dtb file and you are not passing one via QEMU's -dtb
argument.

Unless you like debugging "board bring-up" issues, I recommend that you
find a good tutorial on running an Arm Linux system on QEMU and follow
it; that will be faster than trying to diagnose and fix what
config/kernel/etc mismatch you've made.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1904206

Title:
  install QEMU

Status in QEMU:
  New

Bug description:
  I want install QEMU on Kali, I write :

  qemu-system-arm -kernel ~/qemu_vms/kernel-qemu-3.10.25-wheezy -cpu
  arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2
  rootfstype=ext4 rw" -hda ~/qemu_vms/2020-08-20-raspios-buster-armhf-
  full.img -nic user,hostfwd=tcp::5022-:22 -no-reboot

  The answer :

  WARNING: Image format was not specified for 
'/home/kali/qemu_vms/2020-08-20-raspios-buster-armhf-full.img' and probing 
guessed raw.
   Automatically detecting the format is dangerous for raw images, 
write operations on block 0 will be restricted.
   Specify the 'raw' format explicitly to remove the restrictions.
  pulseaudio: set_sink_input_volume() failed
  pulseaudio: Reason: Invalid argument
  pulseaudio: set_sink_input_mute() failed
  pulseaudio: Reason: Invalid argument
  Uncompressing Linux... done, booting the kernel.

  I tried a lot of solutions but nothing worked. Please help

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1904206/+subscriptions



Re: [PATCH v7 08/21] block: introduce preallocate filter

2020-11-13 Thread Vladimir Sementsov-Ogievskiy

13.11.2020 17:32, Max Reitz wrote:

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

It's intended to be inserted between format and protocol nodes to
preallocate additional space (expanding protocol file) on writes
crossing EOF. It improves performance for file-systems with slow
allocation.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  docs/system/qemu-block-drivers.rst.inc |  26 ++
  qapi/block-core.json   |  20 +-
  block/preallocate.c    | 559 +
  block/meson.build  |   1 +
  4 files changed, 605 insertions(+), 1 deletion(-)
  create mode 100644 block/preallocate.c


[...]


+    if (end <= s->file_end) {
+    /* No preallocation needed. */
+    return want_merge_zero && offset >= s->zero_start;
+    }
+
+    /* Now we want new preallocation, as request writes beyond s->data_end. */


True, but isn’t s->file_end more important?


Yes, file_end should be here.




+
+    prealloc_start = want_merge_zero ? MIN(offset, s->file_end) : s->file_end;
+    prealloc_end = QEMU_ALIGN_UP(end + s->opts.prealloc_size,
+ s->opts.prealloc_align);


[...]


+    if (prealloc == PREALLOC_MODE_FALLOC) {
+    /*
+ * If offset <= s->file_end, the task is already done, just
+ * update s->file_end, to move part of "filter preallocation"


s/file_end/data_end/


yes



With those fixed, and with %s/5\.2/6.0/:

Reviewed-by: Max Reitz 


Thanks!


--
Best regards,
Vladimir



[PATCH] io_uring: do not use pointer after free

2020-11-13 Thread Paolo Bonzini
Even though only the pointer value is only printed, it is untidy
and Coverity complains.

Cc: Stefan Hajnoczi 
Signed-off-by: Paolo Bonzini 
---
 block/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/io_uring.c b/block/io_uring.c
index 037af09471..00a3ee9fb8 100644
--- a/block/io_uring.c
+++ b/block/io_uring.c
@@ -425,6 +425,6 @@ LuringState *luring_init(Error **errp)
 void luring_cleanup(LuringState *s)
 {
 io_uring_queue_exit(>ring);
-g_free(s);
 trace_luring_cleanup_state(s);
+g_free(s);
 }
-- 
2.26.2




Re: [PATCH v7 17/21] simplebench: move results_to_text() into separate file

2020-11-13 Thread Max Reitz

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Let's keep view part in separate: this way it's better to improve it in
the following commits.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  scripts/simplebench/bench-example.py   |  3 +-
  scripts/simplebench/bench_write_req.py |  3 +-
  scripts/simplebench/results_to_text.py | 48 ++
  scripts/simplebench/simplebench.py | 31 -
  4 files changed, 52 insertions(+), 33 deletions(-)
  create mode 100644 scripts/simplebench/results_to_text.py


Reviewed-by: Max Reitz 




Re: [PATCH v7 15/21] scripts/simplebench: use standard deviation for +- error

2020-11-13 Thread Max Reitz

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Standard deviation is more usual to see after +- than current maximum
of deviations.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  scripts/simplebench/simplebench.py | 11 ++-
  1 file changed, 6 insertions(+), 5 deletions(-)


Reviewed-by: Max Reitz 




Re: [PATCH v7 16/21] simplebench: rename ascii() to results_to_text()

2020-11-13 Thread Max Reitz

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Next patch will use utf8 plus-minus symbol, let's use more generic (and
more readable) name.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  scripts/simplebench/bench-example.py   |  2 +-
  scripts/simplebench/bench_write_req.py |  2 +-
  scripts/simplebench/simplebench.py | 10 +-
  3 files changed, 7 insertions(+), 7 deletions(-)


Reviewed-by: Max Reitz 




[PATCH] python, tests: do not use short-form boolean options

2020-11-13 Thread Paolo Bonzini
They are going to be deprecated, avoid warnings on stdout while the
tests run.

Signed-off-by: Paolo Bonzini 
---
 python/qemu/machine.py   | 2 +-
 tests/qtest/pflash-cfi02-test.c  | 4 ++--
 tests/qtest/test-filter-redirector.c | 8 
 tests/qtest/vhost-user-test.c| 8 
 tests/test-char.c| 8 
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/python/qemu/machine.py b/python/qemu/machine.py
index 6420f01bed..06e3e22935 100644
--- a/python/qemu/machine.py
+++ b/python/qemu/machine.py
@@ -292,7 +292,7 @@ class QEMUMachine:
 for _ in range(self._console_index):
 args.extend(['-serial', 'null'])
 if self._console_set:
-chardev = ('socket,id=console,path=%s,server,nowait' %
+chardev = ('socket,id=console,path=%s,server=yes,wait=no' %
self._console_address)
 args.extend(['-chardev', chardev])
 if self._console_device_type is None:
diff --git a/tests/qtest/pflash-cfi02-test.c b/tests/qtest/pflash-cfi02-test.c
index afb702b565..60db81a3a2 100644
--- a/tests/qtest/pflash-cfi02-test.c
+++ b/tests/qtest/pflash-cfi02-test.c
@@ -261,7 +261,7 @@ static void test_geometry(const void *opaque)
 const FlashConfig *config = opaque;
 QTestState *qtest;
 qtest = qtest_initf("-M musicpal"
-" -drive if=pflash,file=%s,format=raw,copy-on-read"
+" -drive if=pflash,file=%s,format=raw,copy-on-read=on"
 /* Device geometry properties. */
 " -global driver=cfi.pflash02,"
 "property=num-blocks0,value=%d"
@@ -581,7 +581,7 @@ static void test_cfi_in_autoselect(const void *opaque)
 const FlashConfig *config = opaque;
 QTestState *qtest;
 qtest = qtest_initf("-M musicpal"
-" -drive if=pflash,file=%s,format=raw,copy-on-read",
+" -drive if=pflash,file=%s,format=raw,copy-on-read=on",
 image_path);
 FlashConfig explicit_config = expand_config_defaults(config);
 explicit_config.qtest = qtest;
diff --git a/tests/qtest/test-filter-redirector.c 
b/tests/qtest/test-filter-redirector.c
index 829db8c2ea..963fe2ba26 100644
--- a/tests/qtest/test-filter-redirector.c
+++ b/tests/qtest/test-filter-redirector.c
@@ -95,8 +95,8 @@ static void test_redirector_tx(void)
 qts = qtest_initf(
 "-netdev socket,id=qtest-bn0,fd=%d "
 "-device %s,netdev=qtest-bn0,id=qtest-e0 "
-"-chardev socket,id=redirector0,path=%s,server,nowait "
-"-chardev socket,id=redirector1,path=%s,server,nowait "
+"-chardev socket,id=redirector0,path=%s,server=yes,wait=no "
+"-chardev socket,id=redirector1,path=%s,server=yes,wait=no "
 "-chardev socket,id=redirector2,path=%s "
 "-object filter-redirector,id=qtest-f0,netdev=qtest-bn0,"
 "queue=tx,outdev=redirector0 "
@@ -165,8 +165,8 @@ static void test_redirector_rx(void)
 qts = qtest_initf(
 "-netdev socket,id=qtest-bn0,fd=%d "
 "-device %s,netdev=qtest-bn0,id=qtest-e0 "
-"-chardev socket,id=redirector0,path=%s,server,nowait "
-"-chardev socket,id=redirector1,path=%s,server,nowait "
+"-chardev socket,id=redirector0,path=%s,server=yes,wait=no "
+"-chardev socket,id=redirector1,path=%s,server=yes,wait=no "
 "-chardev socket,id=redirector2,path=%s "
 "-object filter-redirector,id=qtest-f0,netdev=qtest-bn0,"
 "queue=rx,indev=redirector0 "
diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index 3df5322614..2cf1208645 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -537,7 +537,7 @@ static void test_server_create_chr(TestServer *server, 
const gchar *opt)
 
 static void test_server_listen(TestServer *server)
 {
-test_server_create_chr(server, ",server,nowait");
+test_server_create_chr(server, ",server=yes,wait=no");
 }
 
 static void test_server_free(TestServer *server)
@@ -846,7 +846,7 @@ static void *vhost_user_test_setup_reconnect(GString 
*cmd_line, void *arg)
 
 g_thread_new("connect", connect_thread, s);
 append_mem_opts(s, cmd_line, 256, TEST_MEMFD_AUTO);
-s->vu_ops->append_opts(s, cmd_line, ",server");
+s->vu_ops->append_opts(s, cmd_line, ",server=yes");
 
 g_test_queue_destroy(vhost_user_test_cleanup, s);
 
@@ -883,7 +883,7 @@ static void *vhost_user_test_setup_connect_fail(GString 
*cmd_line, void *arg)
 
 g_thread_new("connect", connect_thread, s);
 append_mem_opts(s, cmd_line, 256, TEST_MEMFD_AUTO);
-s->vu_ops->append_opts(s, cmd_line, ",server");
+s->vu_ops->append_opts(s, cmd_line, ",server=yes");
 
 g_test_queue_destroy(vhost_user_test_cleanup, s);
 
@@ -898,7 +898,7 @@ static void *vhost_user_test_setup_flags_mismatch(GString 
*cmd_line, void *arg)
 
 g_thread_new("connect", 

Re: [PATCH] Clean up includes

2020-11-13 Thread Michael S. Tsirkin
On Fri, Nov 13, 2020 at 07:12:16AM +0100, Markus Armbruster wrote:
> Clean up includes so that osdep.h is included first and headers
> which it implies are not included manually.
> 
> This commit was created with scripts/clean-includes, with the changes
> to the following files manually reverted:
> 
> contrib/libvhost-user/libvhost-user-glib.h
> contrib/libvhost-user/libvhost-user.c
> contrib/libvhost-user/libvhost-user.h
> contrib/plugins/hotblocks.c
> contrib/plugins/hotpages.c
> contrib/plugins/howvec.c
> contrib/plugins/lockstep.c
> linux-user/mips64/cpu_loop.c
> linux-user/mips64/signal.c
> linux-user/sparc64/cpu_loop.c
> linux-user/sparc64/signal.c
> linux-user/x86_64/cpu_loop.c
> linux-user/x86_64/signal.c
> target/s390x/gen-features.c
> tests/fp/platform.h
> tests/migration/s390x/a-b-bios.c
> tests/plugin/bb.c
> tests/plugin/empty.c
> tests/plugin/insn.c
> tests/plugin/mem.c
> tests/test-rcu-simpleq.c
> tests/test-rcu-slist.c
> tests/test-rcu-tailq.c
> tests/uefi-test-tools/UefiTestToolsPkg/BiosTablesTest/BiosTablesTest.c
> 
> contrib/plugins/, tests/plugin/, and tests/test-rcu-slist.c appear not
> to include osdep.h intentionally.  The remaining reverts are the same
> as in commit bbfff19688d.
> 
> Signed-off-by: Markus Armbruster 

Acked-by: Michael S. Tsirkin 

> ---
> No real need to get this into 5.2 at this stage.  No real risk either.
> 
>  contrib/vhost-user-gpu/vugbm.h  |  2 --
>  contrib/vhost-user-gpu/vugpu.h  |  1 -
>  include/hw/block/swim.h |  1 -
>  include/hw/display/macfb.h  |  1 -
>  include/qemu/nvdimm-utils.h |  1 -
>  tests/qtest/fuzz/fuzz.h |  1 -
>  tests/qtest/fuzz/generic_fuzz_configs.h |  1 -
>  tools/virtiofsd/fuse_common.h   |  2 --
>  tools/virtiofsd/fuse_log.h  |  1 -
>  tools/virtiofsd/fuse_lowlevel.h |  3 ---
>  tools/virtiofsd/fuse_misc.h |  1 -
>  tools/virtiofsd/passthrough_seccomp.h   |  1 -
>  contrib/vhost-user-gpu/virgl.c  |  1 +
>  contrib/vhost-user-gpu/vugbm.c  |  1 +
>  contrib/vhost-user-input/main.c |  1 -
>  hw/display/artist.c |  1 -
>  hw/s390x/s390-pci-vfio.c|  3 ++-
>  tools/virtiofsd/buffer.c|  5 -
>  tools/virtiofsd/fuse_log.c  |  2 --
>  tools/virtiofsd/fuse_lowlevel.c | 10 --
>  tools/virtiofsd/fuse_opt.c  |  4 
>  tools/virtiofsd/fuse_signals.c  |  5 -
>  tools/virtiofsd/fuse_virtio.c   | 10 --
>  tools/virtiofsd/helper.c|  8 
>  tools/virtiofsd/passthrough_ll.c| 12 
>  tools/virtiofsd/passthrough_seccomp.c   |  3 ---
>  util/nvdimm-utils.c |  1 +
>  27 files changed, 5 insertions(+), 78 deletions(-)
> 
> diff --git a/contrib/vhost-user-gpu/vugbm.h b/contrib/vhost-user-gpu/vugbm.h
> index 07e698fcd7..66f1520764 100644
> --- a/contrib/vhost-user-gpu/vugbm.h
> +++ b/contrib/vhost-user-gpu/vugbm.h
> @@ -10,10 +10,8 @@
>  #ifndef VHOST_USER_GPU_VUGBM_H
>  #define VHOST_USER_GPU_VUGBM_H
>  
> -#include "qemu/osdep.h"
>  
>  #ifdef CONFIG_MEMFD
> -#include 
>  #include 
>  #endif
>  
> diff --git a/contrib/vhost-user-gpu/vugpu.h b/contrib/vhost-user-gpu/vugpu.h
> index 3153c9a6de..5eca2a96ab 100644
> --- a/contrib/vhost-user-gpu/vugpu.h
> +++ b/contrib/vhost-user-gpu/vugpu.h
> @@ -15,7 +15,6 @@
>  #ifndef VUGPU_H
>  #define VUGPU_H
>  
> -#include "qemu/osdep.h"
>  
>  #include "contrib/libvhost-user/libvhost-user-glib.h"
>  #include "standard-headers/linux/virtio_gpu.h"
> diff --git a/include/hw/block/swim.h b/include/hw/block/swim.h
> index 5a49029543..c1bd5f6555 100644
> --- a/include/hw/block/swim.h
> +++ b/include/hw/block/swim.h
> @@ -11,7 +11,6 @@
>  #ifndef SWIM_H
>  #define SWIM_H
>  
> -#include "qemu/osdep.h"
>  #include "hw/sysbus.h"
>  #include "qom/object.h"
>  
> diff --git a/include/hw/display/macfb.h b/include/hw/display/macfb.h
> index c133fa271e..80806b0306 100644
> --- a/include/hw/display/macfb.h
> +++ b/include/hw/display/macfb.h
> @@ -13,7 +13,6 @@
>  #ifndef MACFB_H
>  #define MACFB_H
>  
> -#include "qemu/osdep.h"
>  #include "exec/memory.h"
>  #include "ui/console.h"
>  #include "qom/object.h"
> diff --git a/include/qemu/nvdimm-utils.h b/include/qemu/nvdimm-utils.h
> index 4b8b198ba7..5f45774c2c 100644
> --- a/include/qemu/nvdimm-utils.h
> +++ b/include/qemu/nvdimm-utils.h
> @@ -1,7 +1,6 @@
>  #ifndef NVDIMM_UTILS_H
>  #define NVDIMM_UTILS_H
>  
> -#include "qemu/osdep.h"
>  
>  GSList *nvdimm_get_device_list(void);
>  #endif
> diff --git a/tests/qtest/fuzz/fuzz.h b/tests/qtest/fuzz/fuzz.h
> index 08e9560a79..3a8570e84c 100644
> --- a/tests/qtest/fuzz/fuzz.h
> +++ b/tests/qtest/fuzz/fuzz.h
> @@ -14,7 +14,6 @@
>  #ifndef FUZZER_H_
>  #define FUZZER_H_
>  
> -#include "qemu/osdep.h"
>  #include "qemu/units.h"

[PATCH for-5.2] spapr/xive: Create IPIs in KVM on demand

2020-11-13 Thread Greg Kurz
Recent commit acbdb9956fe9 introduced a dedicated path to create
IPIs in KVM. This is done from under kvmppc_xive_cpu_connect() with
the assumption that the IPI number is equal to the vCPU id. The
latter is wrong: the guest chooses an arbitrary LISN from the
"ibm,xive-lisn-ranges" and assigns it to a target vCPU with the
H_INT_SET_SOURCE_CONFIG hcall. This went unnoticed so far because
IPI numbers and vCPU ids happen to match by default. This is no
longer the case though when setting the VSMT machine property to
a value that is different from (ie. bigger than) the number of
vCPUs per core (ie. -smp threads). Wrong IPIs end up being created
in KVM but the guest still uses the ones it has allocated and gets
very confused (see BugLink below).

Fix this by creating the IPI at the only place where we have
its appropriate number : when the guest allocates it with the
H_INT_SET_SOURCE_CONFIG hcall. We detect this is an IPI because
it is < SPAPR_XIRQ_BASE and we get the vCPU id from the hcall
arguments. The EAS of the IPI is tracked in the kvm_enabled_cpus
list. It is now used instead of vcpu_id to filter unallocated IPIs
out in xive_source_is_valid(). It also allows to only reset the
IPI on the first call to H_INT_SET_SOURCE_CONFIG.

Restore unmasked IPIs from the vCPU contexts in kvmppc_xive_post_load().
Masked ones will be created when the guests eventually unmask them
with H_INT_SET_SOURCE_CONFIG.

Reported-by: Satheesh Rajendran 
Fixes: acbdb9956fe9 ("spapr/xive: Allocate IPIs independently from the other 
sources")
BugLink: https://bugs.launchpad.net/qemu/+bug/1900241
Cc: c...@kaod.org
Signed-off-by: Greg Kurz 
---
 hw/intc/spapr_xive_kvm.c |  141 +-
 1 file changed, 127 insertions(+), 14 deletions(-)

diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c
index 66bf4c06fe55..4e5871c3aac2 100644
--- a/hw/intc/spapr_xive_kvm.c
+++ b/hw/intc/spapr_xive_kvm.c
@@ -30,6 +30,7 @@
  */
 typedef struct KVMEnabledCPU {
 unsigned long vcpu_id;
+XiveEAS *ipi_eas;
 QLIST_ENTRY(KVMEnabledCPU) node;
 } KVMEnabledCPU;
 
@@ -55,6 +56,7 @@ static void kvm_cpu_enable(CPUState *cs)
 
 enabled_cpu = g_malloc(sizeof(*enabled_cpu));
 enabled_cpu->vcpu_id = vcpu_id;
+enabled_cpu->ipi_eas = NULL;
 QLIST_INSERT_HEAD(_enabled_cpus, enabled_cpu, node);
 }
 
@@ -156,26 +158,29 @@ int kvmppc_xive_cpu_synchronize_state(XiveTCTX *tctx, 
Error **errp)
  */
 typedef struct {
 SpaprXive *xive;
+uint32_t lisn;
 Error *err;
 int rc;
 } XiveInitIPI;
 
 static void kvmppc_xive_reset_ipi_on_cpu(CPUState *cs, run_on_cpu_data arg)
 {
-unsigned long ipi = kvm_arch_vcpu_id(cs);
 XiveInitIPI *s = arg.host_ptr;
+unsigned long ipi = s->lisn;
 uint64_t state = 0;
 
 s->rc = kvm_device_access(s->xive->fd, KVM_DEV_XIVE_GRP_SOURCE, ipi,
   , true, >err);
 }
 
-static int kvmppc_xive_reset_ipi(SpaprXive *xive, CPUState *cs, Error **errp)
+static int kvmppc_xive_reset_ipi(SpaprXive *xive, CPUState *cs, uint32_t lisn,
+ Error **errp)
 {
 XiveInitIPI s = {
 .xive = xive,
 .err  = NULL,
 .rc   = 0,
+.lisn = lisn,
 };
 
 run_on_cpu(cs, kvmppc_xive_reset_ipi_on_cpu, RUN_ON_CPU_HOST_PTR());
@@ -214,12 +219,6 @@ int kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **errp)
 return ret;
 }
 
-/* Create/reset the vCPU IPI */
-ret = kvmppc_xive_reset_ipi(xive, tctx->cs, errp);
-if (ret < 0) {
-return ret;
-}
-
 kvm_cpu_enable(tctx->cs);
 return 0;
 }
@@ -228,6 +227,62 @@ int kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **errp)
  * XIVE Interrupt Source (KVM)
  */
 
+static bool spapr_xive_is_ipi(uint32_t lisn)
+{
+return lisn < SPAPR_XIRQ_BASE;
+}
+
+static bool kvm_ipi_is_enabled(SpaprXive *xive, uint32_t lisn)
+{
+KVMEnabledCPU *enabled_cpu;
+
+g_assert(spapr_xive_is_ipi(lisn));
+
+QLIST_FOREACH(enabled_cpu, _enabled_cpus, node) {
+if (enabled_cpu->ipi_eas == >eat[lisn]) {
+return true;
+}
+}
+return false;
+}
+
+static int kvm_ipi_enable(SpaprXive *xive, uint32_t lisn, uint32_t vcpu_id,
+  Error **errp)
+{
+KVMEnabledCPU *enabled_cpu;
+
+g_assert(spapr_xive_is_ipi(lisn));
+
+QLIST_FOREACH(enabled_cpu, _enabled_cpus, node) {
+if (enabled_cpu->vcpu_id == vcpu_id) {
+CPUState *cs = CPU(spapr_find_cpu(vcpu_id));
+XiveEAS *eas = >eat[lisn];
+
+/* No change ? */
+if (enabled_cpu->ipi_eas && enabled_cpu->ipi_eas == eas) {
+return 0;
+}
+
+/* XXX: abort ? */
+if (!cs) {
+break;
+}
+
+/* Create/reset the vCPU IPI */
+int ret = kvmppc_xive_reset_ipi(xive, cs, lisn, errp);
+if (ret < 0) {
+return ret;
+}
+
+

[PATCH v2] json: Fix a memleak in parse_pair()

2020-11-13 Thread Alex Chen
In qobject_type(), NULL is returned when the 'QObject' returned from 
parse_value() is not of QString type,
and this 'QObject' memory will leaked.
So we need to first cache the 'QObject' returned from parse_value(), and finally
free 'QObject' memory at the end of the function.
Also, we add a testcast about invalid dict key.

The memleak stack is as follows:
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0xfffe4b3c34fb in __interceptor_malloc (/lib64/libasan.so.4+0xd34fb)
#1 0xfffe4ae48aa3 in g_malloc (/lib64/libglib-2.0.so.0+0x58aa3)
#2 0xaaab3557d9f7 in qnum_from_int 
/Images/source_org/qemu_master/qemu/qobject/qnum.c:25
#3 0xaaab35584d23 in parse_literal 
/Images/source_org/qemu_master/qemu/qobject/json-parser.c:511
#4 0xaaab35584d23 in parse_value 
/Images/source_org/qemu_master/qemu/qobject/json-parser.c:554
#5 0xaaab35583d77 in parse_pair 
/Images/source_org/qemu_master/qemu/qobject/json-parser.c:270
#6 0xaaab355845db in parse_object 
/Images/source_org/qemu_master/qemu/qobject/json-parser.c:327
#7 0xaaab355845db in parse_value 
/Images/source_org/qemu_master/qemu/qobject/json-parser.c:546
#8 0xaaab35585b1b in json_parser_parse 
/Images/source_org/qemu_master/qemu/qobject/json-parser.c:580
#9 0xaaab35583703 in json_message_process_token 
/Images/source_org/qemu_master/qemu/qobject/json-streamer.c:92
#10 0xaaab355ddccf in json_lexer_feed_char 
/Images/source_org/qemu_master/qemu/qobject/json-lexer.c:313
#11 0xaaab355de0eb in json_lexer_feed 
/Images/source_org/qemu_master/qemu/qobject/json-lexer.c:350
#12 0xaaab354aff67 in tcp_chr_read 
/Images/source_org/qemu_master/qemu/chardev/char-socket.c:525
#13 0xfffe4ae429db in g_main_context_dispatch 
(/lib64/libglib-2.0.so.0+0x529db)
#14 0xfffe4ae42d8f  (/lib64/libglib-2.0.so.0+0x52d8f)
#15 0xfffe4ae430df in g_main_loop_run (/lib64/libglib-2.0.so.0+0x530df)
#16 0xaaab34d70bff in iothread_run 
/Images/source_org/qemu_master/qemu/iothread.c:82
#17 0xaaab3559d71b in qemu_thread_start 
/Images/source_org/qemu_master/qemu/util/qemu-thread-posix.c:519

Fixes: 532fb5328473 ("qapi: Make more of qobject_to()")
Reported-by: Euler Robot 
Signed-off-by: Alex Chen 
Signed-off-by: Chen Qun 
Signed-off-by: Markus Armbruster 
---
 qobject/json-parser.c | 12 ++--
 tests/check-qjson.c   |  9 +
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/qobject/json-parser.c b/qobject/json-parser.c
index d083810d37..c0f521b56b 100644
--- a/qobject/json-parser.c
+++ b/qobject/json-parser.c
@@ -257,8 +257,9 @@ static JSONToken 
*parser_context_peek_token(JSONParserContext *ctxt)
  */
 static int parse_pair(JSONParserContext *ctxt, QDict *dict)
 {
+QObject *key_obj = NULL;
+QString *key;
 QObject *value;
-QString *key = NULL;
 JSONToken *peek, *token;
 
 peek = parser_context_peek_token(ctxt);
@@ -267,7 +268,8 @@ static int parse_pair(JSONParserContext *ctxt, QDict *dict)
 goto out;
 }
 
-key = qobject_to(QString, parse_value(ctxt));
+key_obj = parse_value(ctxt);
+key = qobject_to(QString, key_obj);
 if (!key) {
 parse_error(ctxt, peek, "key is not a string in object");
 goto out;
@@ -297,13 +299,11 @@ static int parse_pair(JSONParserContext *ctxt, QDict 
*dict)
 
 qdict_put_obj(dict, qstring_get_str(key), value);
 
-qobject_unref(key);
-
+qobject_unref(key_obj);
 return 0;
 
 out:
-qobject_unref(key);
-
+qobject_unref(key_obj);
 return -1;
 }
 
diff --git a/tests/check-qjson.c b/tests/check-qjson.c
index 07a773e653..9a02079099 100644
--- a/tests/check-qjson.c
+++ b/tests/check-qjson.c
@@ -1415,6 +1415,14 @@ static void invalid_dict_comma(void)
 g_assert(obj == NULL);
 }
 
+static void invalid_dict_key(void)
+{
+Error *err = NULL;
+QObject *obj = qobject_from_json("{32:'abc'}", );
+error_free_or_abort();
+g_assert(obj == NULL);
+}
+
 static void unterminated_literal(void)
 {
 Error *err = NULL;
@@ -1500,6 +1508,7 @@ int main(int argc, char **argv)
 g_test_add_func("/errors/unterminated/dict_comma", 
unterminated_dict_comma);
 g_test_add_func("/errors/invalid_array_comma", invalid_array_comma);
 g_test_add_func("/errors/invalid_dict_comma", invalid_dict_comma);
+g_test_add_func("/errors/invalid_dict_key", invalid_dict_key);
 g_test_add_func("/errors/unterminated/literal", unterminated_literal);
 g_test_add_func("/errors/limits/nesting", limits_nesting);
 g_test_add_func("/errors/multiple_values", multiple_values);
-- 
2.19.1




Re: [PATCH v7 14/21] scripts/simplebench: support iops

2020-11-13 Thread Max Reitz

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Support benchmarks returning not seconds but iops. We'll use it for
further new test.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  scripts/simplebench/simplebench.py | 38 ++
  1 file changed, 28 insertions(+), 10 deletions(-)


Reviewed-by: Max Reitz 




[Bug 1904210] [NEW] Crashed with 'uncaught target signal SIGILL' while program has registered by signal(SIGILL, handler)

2020-11-13 Thread Wang Zhongwei
Public bug reported:

This binary is an CTF reverse challenge binary, it registers signal
handler via 'signal(SIGILL, 0x1193D);' while 0x1193D is the SIGILL
handler.

Please see the attachment, the file 'repair' is the binary i mentioned
above, the file 'qemu-arm' is an old version qemu at 2.5.0, and it seems
an official release (not modified).

Which means, it could be a bug in recent release.

You need to input 'flag{' to the stdin to let the binary execute the
illegal instruction at 0x10A68.

In 2.5.0 version the -strace logs:
116 uname(0xf6ffed40) = 0
116 brk(NULL) = 0x0009f000
116 brk(0x0009fd00) = 0x0009fd00
116 readlink("/proc/self/exe",0xf6ffde78,4096) = 21
116 brk(0x000c0d00) = 0x000c0d00
116 brk(0x000c1000) = 0x000c1000
116 access("/etc/ld.so.nohwcap",F_OK) = -1 errno=2 (No such file or directory)
116 rt_sigaction(SIGILL,0xf6ffec48,0xf6ffecd4) = 0
116 fstat64(1,0xf6ffe8e8) = 0
116 ioctl(1,21505,-151000980,-151000924,652480,640808) = 0
116 fstat64(0,0xf6ffe7d0) = 0
116 ioctl(0,21505,-151001260,-151001204,652480,641152) = 0
116 write(1,0xa5548,6)input: = 6
116 read(0,0xa6550,4096)flag{
 = 6
116 write(1,0xa5548,7)wrong!
 = 7
116 _llseek(0,4294967295,4294967295,0xf6ffee18,SEEK_CUR) = -1 errno=29 (Illegal 
seek)
116 exit_group(0)

In 2.11.1, it shows:
113 uname(0xfffeed30) = 0
113 brk(NULL) = 0x0009f000
113 brk(0x0009fd00) = 0x0009fd00
113 readlink("/proc/self/exe",0xfffede68,4096) = 21
113 brk(0x000c0d00) = 0x000c0d00
113 brk(0x000c1000) = 0x000c1000
113 access("/etc/ld.so.nohwcap",F_OK) = -1 errno=2 (No such file or directory)
113 rt_sigaction(SIGILL,0xfffeec38,0xfffeecc4) = 0
113 fstat64(1,0xfffee8d8) = 0
113 ioctl(1,21505,-71588,-71532,652480,640808) = 0
113 fstat64(0,0xfffee7c0) = 0
113 ioctl(0,21505,-71868,-71812,652480,641152) = 0
113 write(1,0xa5548,6)input: = 6
113 read(0,0xa6550,4096)flag{
 = 6
--- SIGILL {si_signo=SIGILL, si_code=2, si_addr=0x00010a68} ---
--- SIGILL {si_signo=SIGILL, si_code=2, si_addr=0x0001182c} ---
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction (core dumped)

** Affects: qemu
 Importance: Undecided
 Status: New

** Attachment added: "repair.zip"
   https://bugs.launchpad.net/bugs/1904210/+attachment/5434169/+files/repair.zip

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1904210

Title:
  Crashed with 'uncaught target signal SIGILL' while program has
  registered by signal(SIGILL, handler)

Status in QEMU:
  New

Bug description:
  This binary is an CTF reverse challenge binary, it registers signal
  handler via 'signal(SIGILL, 0x1193D);' while 0x1193D is the SIGILL
  handler.

  Please see the attachment, the file 'repair' is the binary i mentioned
  above, the file 'qemu-arm' is an old version qemu at 2.5.0, and it
  seems an official release (not modified).

  Which means, it could be a bug in recent release.

  You need to input 'flag{' to the stdin to let the binary execute the
  illegal instruction at 0x10A68.

  In 2.5.0 version the -strace logs:
  116 uname(0xf6ffed40) = 0
  116 brk(NULL) = 0x0009f000
  116 brk(0x0009fd00) = 0x0009fd00
  116 readlink("/proc/self/exe",0xf6ffde78,4096) = 21
  116 brk(0x000c0d00) = 0x000c0d00
  116 brk(0x000c1000) = 0x000c1000
  116 access("/etc/ld.so.nohwcap",F_OK) = -1 errno=2 (No such file or directory)
  116 rt_sigaction(SIGILL,0xf6ffec48,0xf6ffecd4) = 0
  116 fstat64(1,0xf6ffe8e8) = 0
  116 ioctl(1,21505,-151000980,-151000924,652480,640808) = 0
  116 fstat64(0,0xf6ffe7d0) = 0
  116 ioctl(0,21505,-151001260,-151001204,652480,641152) = 0
  116 write(1,0xa5548,6)input: = 6
  116 read(0,0xa6550,4096)flag{
   = 6
  116 write(1,0xa5548,7)wrong!
   = 7
  116 _llseek(0,4294967295,4294967295,0xf6ffee18,SEEK_CUR) = -1 errno=29 
(Illegal seek)
  116 exit_group(0)

  In 2.11.1, it shows:
  113 uname(0xfffeed30) = 0
  113 brk(NULL) = 0x0009f000
  113 brk(0x0009fd00) = 0x0009fd00
  113 readlink("/proc/self/exe",0xfffede68,4096) = 21
  113 brk(0x000c0d00) = 0x000c0d00
  113 brk(0x000c1000) = 0x000c1000
  113 access("/etc/ld.so.nohwcap",F_OK) = -1 errno=2 (No such file or directory)
  113 rt_sigaction(SIGILL,0xfffeec38,0xfffeecc4) = 0
  113 fstat64(1,0xfffee8d8) = 0
  113 ioctl(1,21505,-71588,-71532,652480,640808) = 0
  113 fstat64(0,0xfffee7c0) = 0
  113 ioctl(0,21505,-71868,-71812,652480,641152) = 0
  113 write(1,0xa5548,6)input: = 6
  113 read(0,0xa6550,4096)flag{
   = 6
  --- SIGILL {si_signo=SIGILL, si_code=2, si_addr=0x00010a68} ---
  --- SIGILL {si_signo=SIGILL, si_code=2, si_addr=0x0001182c} ---
  qemu: uncaught target signal 4 (Illegal instruction) - core dumped
  Illegal instruction (core dumped)

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1904210/+subscriptions



Re: [PATCH] json: Fix a memleak in parse_pair()

2020-11-13 Thread Alex Chen
On 2020/11/12 14:37, Markus Armbruster wrote:
> Alex Chen  writes:
> 
>> In qobject_type(), NULL is returned when the 'QObject' returned from 
>> parse_value() is not of QString type,
>> and this 'QObject' memory will leaked.
>> So we need to first check whether the 'QObject' returned from parse_value() 
>> is of QString type,
>> and if not, we free 'QObject' memory and return an error.
>>
>> The memleak stack is as follows:
>> Direct leak of 32 byte(s) in 1 object(s) allocated from:
>> #0 0xfffe4b3c34fb in __interceptor_malloc (/lib64/libasan.so.4+0xd34fb)
>> #1 0xfffe4ae48aa3 in g_malloc (/lib64/libglib-2.0.so.0+0x58aa3)
>> #2 0xaaab3557d9f7 in qnum_from_int 
>> /Images/source_org/qemu_master/qemu/qobject/qnum.c:25
>> #3 0xaaab35584d23 in parse_literal 
>> /Images/source_org/qemu_master/qemu/qobject/json-parser.c:511
>> #4 0xaaab35584d23 in parse_value 
>> /Images/source_org/qemu_master/qemu/qobject/json-parser.c:554
>> #5 0xaaab35583d77 in parse_pair 
>> /Images/source_org/qemu_master/qemu/qobject/json-parser.c:270
>> #6 0xaaab355845db in parse_object 
>> /Images/source_org/qemu_master/qemu/qobject/json-parser.c:327
>> #7 0xaaab355845db in parse_value 
>> /Images/source_org/qemu_master/qemu/qobject/json-parser.c:546
>> #8 0xaaab35585b1b in json_parser_parse 
>> /Images/source_org/qemu_master/qemu/qobject/json-parser.c:580
>> #9 0xaaab35583703 in json_message_process_token 
>> /Images/source_org/qemu_master/qemu/qobject/json-streamer.c:92
>> #10 0xaaab355ddccf in json_lexer_feed_char 
>> /Images/source_org/qemu_master/qemu/qobject/json-lexer.c:313
>> #11 0xaaab355de0eb in json_lexer_feed 
>> /Images/source_org/qemu_master/qemu/qobject/json-lexer.c:350
>> #12 0xaaab354aff67 in tcp_chr_read 
>> /Images/source_org/qemu_master/qemu/chardev/char-socket.c:525
>> #13 0xfffe4ae429db in g_main_context_dispatch 
>> (/lib64/libglib-2.0.so.0+0x529db)
>> #14 0xfffe4ae42d8f  (/lib64/libglib-2.0.so.0+0x52d8f)
>> #15 0xfffe4ae430df in g_main_loop_run (/lib64/libglib-2.0.so.0+0x530df)
>> #16 0xaaab34d70bff in iothread_run 
>> /Images/source_org/qemu_master/qemu/iothread.c:82
>> #17 0xaaab3559d71b in qemu_thread_start 
>> /Images/source_org/qemu_master/qemu/util/qemu-thread-posix.c:519
> 
> Good catch, thanks!
> 
>> Fixes: 532fb5328473 ("qapi: Make more of qobject_to()")
>> Reported-by: Euler Robot 
>> Signed-off-by: Alex Chen 
>> Signed-off-by: Chen Qun 
>> ---
>>  qobject/json-parser.c | 9 ++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/qobject/json-parser.c b/qobject/json-parser.c
>> index d083810d37..b37762a203 100644
>> --- a/qobject/json-parser.c
>> +++ b/qobject/json-parser.c
>> @@ -267,10 +267,13 @@ static int parse_pair(JSONParserContext *ctxt, QDict 
>> *dict)
>>  goto out;
>>  }
>>  
>> -key = qobject_to(QString, parse_value(ctxt));
>> -if (!key) {
>> -parse_error(ctxt, peek, "key is not a string in object");
>> +value = parse_value(ctxt);
>> +if (!value || qobject_type(value) != QTYPE_QSTRING) {
> 
> The "is string" test becomes more cumbersome.  Also, we reuse @value for
> another purpose.
> 
>> +qobject_unref(value);
>> +parse_error(ctxt, peek, "value is not a string in object");
> 
> Changing error messages in a memory leak fix is inappropriate.
> Accident?
> 
>>  goto out;
>> +} else {
>> +key = qobject_to(QString, value);
>>  }
>>  
>>  token = parser_context_pop_token(ctxt);
> 
> Here's a simpler, straightforward fix, with a test case thrown in:
> 
> diff --git a/qobject/json-parser.c b/qobject/json-parser.c
> index d083810d37..c0f521b56b 100644
> --- a/qobject/json-parser.c
> +++ b/qobject/json-parser.c
> @@ -257,8 +257,9 @@ static JSONToken 
> *parser_context_peek_token(JSONParserContext *ctxt)
>   */
>  static int parse_pair(JSONParserContext *ctxt, QDict *dict)
>  {
> +QObject *key_obj = NULL;
> +QString *key;
>  QObject *value;
> -QString *key = NULL;
>  JSONToken *peek, *token;
>  
>  peek = parser_context_peek_token(ctxt);
> @@ -267,7 +268,8 @@ static int parse_pair(JSONParserContext *ctxt, QDict 
> *dict)
>  goto out;
>  }
>  
> -key = qobject_to(QString, parse_value(ctxt));
> +key_obj = parse_value(ctxt);
> +key = qobject_to(QString, key_obj);
>  if (!key) {
>  parse_error(ctxt, peek, "key is not a string in object");
>  goto out;
> @@ -297,13 +299,11 @@ static int parse_pair(JSONParserContext *ctxt, QDict 
> *dict)
>  
>  qdict_put_obj(dict, qstring_get_str(key), value);
>  
> -qobject_unref(key);
> -
> +qobject_unref(key_obj);
>  return 0;
>  
>  out:
> -qobject_unref(key);
> -
> +qobject_unref(key_obj);
>  return -1;
>  }
>  
> diff --git a/tests/check-qjson.c b/tests/check-qjson.c
> index 07a773e653..9a02079099 100644
> --- a/tests/check-qjson.c
> +++ b/tests/check-qjson.c
> @@ -1415,6 +1415,14 @@ static void 

Re: [PATCH v7 13/21] scripts/simplebench: fix grammar: s/successed/succeeded/

2020-11-13 Thread Max Reitz

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  scripts/simplebench/simplebench.py | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)


Reviewed-by: Max Reitz 




Re: [PATCH v7 12/21] iotests: add 298 to test new preallocate filter driver

2020-11-13 Thread Max Reitz

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  tests/qemu-iotests/298 | 186 +
  tests/qemu-iotests/298.out |   5 +
  tests/qemu-iotests/group   |   1 +
  3 files changed, 192 insertions(+)
  create mode 100644 tests/qemu-iotests/298
  create mode 100644 tests/qemu-iotests/298.out


Reviewed-by: Max Reitz 




Re: [PATCH for-5.2] iotests: Replace deprecated ConfigParser.readfp()

2020-11-13 Thread Eric Blake
On 11/13/20 8:40 AM, Kevin Wolf wrote:
> Am 13.11.2020 um 14:47 hat Eric Blake geschrieben:
>> On 11/13/20 4:06 AM, Kevin Wolf wrote:
>>> iotest 277 fails on Fedora 33 (Python 3.9) because a deprecation warning
>>> changes the output:
>>>
>>> nbd-fault-injector.py:230: DeprecationWarning: This method will be
>>> removed in future versions.  Use 'parser.read_file()' instead.
>>>
>>> In fact, readfp() has already been deprecated in Python 3.2 and the
>>> replacement has existed since the same version, so we can now
>>> unconditionally switch to read_file().
>>>
>>> Signed-off-by: Kevin Wolf 
>>> ---
>>>  tests/qemu-iotests/nbd-fault-injector.py | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> Reviewed-by: Eric Blake 
>>
>> I'm happy to queue this through my NBD tree for -rc2.
> 
> If you don't have other patches to send, I can take it through my own
> tree, but if you send a pull request anyway, that's fine, too.

I've got at least one other NBD patch, and am double-checking my trees
and flagged inbox messages to see if there are any other last-minute
-rc2 candidates, so I will be sending a Pull Request on Monday.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




Re: [PATCH v7 11/21] iotests.py: execute_setup_common(): add required_fmts argument

2020-11-13 Thread Max Reitz

On 21.10.20 16:58, Vladimir Sementsov-Ogievskiy wrote:

Add a parameter to skip test if some needed additional formats are not
supported (for example filter drivers).

Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  tests/qemu-iotests/iotests.py | 9 -
  1 file changed, 8 insertions(+), 1 deletion(-)


Reviewed-by: Max Reitz 




Re: [PATCH for-5.2] iotests: Replace deprecated ConfigParser.readfp()

2020-11-13 Thread Kevin Wolf
Am 13.11.2020 um 14:47 hat Eric Blake geschrieben:
> On 11/13/20 4:06 AM, Kevin Wolf wrote:
> > iotest 277 fails on Fedora 33 (Python 3.9) because a deprecation warning
> > changes the output:
> > 
> > nbd-fault-injector.py:230: DeprecationWarning: This method will be
> > removed in future versions.  Use 'parser.read_file()' instead.
> > 
> > In fact, readfp() has already been deprecated in Python 3.2 and the
> > replacement has existed since the same version, so we can now
> > unconditionally switch to read_file().
> > 
> > Signed-off-by: Kevin Wolf 
> > ---
> >  tests/qemu-iotests/nbd-fault-injector.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Reviewed-by: Eric Blake 
> 
> I'm happy to queue this through my NBD tree for -rc2.

If you don't have other patches to send, I can take it through my own
tree, but if you send a pull request anyway, that's fine, too.

Kevin




  1   2   3   >