RE: [PATCH 1/3] colo-compare: return -1 if no packet is queued

2020-09-22 Thread Zhang, Chen
> -Original Message- > From: Li Zhijian > Sent: Wednesday, September 23, 2020 2:18 PM > To: Zhang, Chen ; jasow...@redhat.com > Cc: qemu-devel@nongnu.org > Subject: Re: [PATCH 1/3] colo-compare: return -1 if no packet is queued > > > > On 9/23/20 9:41 AM, Zhang, Chen wrote: > > > >> -

RE: [PATCH 3/4] net/colo-compare.c: Add secondary old packet detection

2020-09-22 Thread Zhang, Chen
> -Original Message- > From: Li Zhijian > Sent: Tuesday, September 22, 2020 2:47 PM > To: Zhang, Chen ; Jason Wang > ; qemu-dev > Cc: Zhang Chen > Subject: Re: [PATCH 3/4] net/colo-compare.c: Add secondary old packet > detection > > > > On 9/18/20 5:22 PM, Zhang Chen wrote: > > From

Re: [PATCH v26 03/17] vfio: Add save and load functions for VFIO PCI devices

2020-09-22 Thread Zenghui Yu
Hi Kirti, A few trivial comments from the first read through. On 2020/9/23 7:24, Kirti Wankhede wrote: These functions save and restore PCI device specific data - config space of PCI device. Used VMStateDescription to save and restore interrupt state. Signed-off-by: Kirti Wankhede Reviewed-by

Re: [PATCH 8/9] audio: restore mixing-engine playback buffer size

2020-09-22 Thread Gerd Hoffmann
> diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c > index 21b7a0484b..cb931d0fda 100644 > --- a/audio/sdlaudio.c > +++ b/audio/sdlaudio.c > @@ -253,6 +253,7 @@ static void sdl_callback (void *opaque, Uint8 *buf, int > len) > return ret;

Re: [PATCH v5 13/15] docs: convert replay.txt to rst

2020-09-22 Thread Pavel Dovgalyuk
On 22.09.2020 16:13, Paolo Bonzini wrote: On 22/09/20 14:16, Pavel Dovgalyuk wrote: + +When you need to use snapshots with diskless virtual machine, +it must be started with 'orphan' qcow2 image. This image will be used +for storing VM snapshots. Here is the example of the command line for this:

Re: [PATCH 1/3] colo-compare: return -1 if no packet is queued

2020-09-22 Thread Li Zhijian
On 9/23/20 9:41 AM, Zhang, Chen wrote: -Original Message- From: Li Zhijian Sent: Tuesday, September 22, 2020 5:55 PM To: Zhang, Chen ; jasow...@redhat.com Cc: qemu-devel@nongnu.org; Li Zhijian Subject: [PATCH 1/3] colo-compare: return -1 if no packet is queued Return 0 will trigge

Re: [Bug 1896096] Re: Git version: Build process is broken in block_curl.c.o

2020-09-22 Thread Paolo Bonzini
Yes that's a silly mistake that invokes the linker with a dummy empty argument. I'll fix it and repost, thanks for testing on Arch! Paolo Il mar 22 set 2020, 23:41 Toolybird <1896...@bugs.launchpad.net> ha scritto: > ** Attachment added: "meson-log.txt" > > https://bugs.launchpad.net/qemu/+bug/1

Re: [PATCH v1 1/8] s390x/tcg: Implement ADD HALFWORD (AGH)

2020-09-22 Thread Thomas Huth
On 22/09/2020 12.31, David Hildenbrand wrote: > Easy, just like ADD HALFWORD IMMEDIATE (AGHI). > > Signed-off-by: David Hildenbrand > --- > target/s390x/insn-data.def | 1 + > target/s390x/translate.c | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/target/s390x/insn-data.def b/targ

Re: [PATCH v2 0/2] block: deprecate the sheepdog driver

2020-09-22 Thread Vladimir Sementsov-Ogievskiy
22.09.2020 21:11, Neal Gompa wrote: On Tue, Sep 22, 2020 at 1:43 PM Daniel P. Berrangé wrote: On Tue, Sep 22, 2020 at 01:09:06PM -0400, Neal Gompa wrote: On Tue, Sep 22, 2020 at 12:16 PM Daniel P. Berrangé wrote: 2 years back I proposed dropping the sheepdog mailing list from the MAINTAINE

Re: [PATCH v1 2/8] s390x/tcg: Implement SUBTRACT HALFWORD (SGH)

2020-09-22 Thread Thomas Huth
On 22/09/2020 12.31, David Hildenbrand wrote: > Easy to wire up. > > Signed-off-by: David Hildenbrand > --- > target/s390x/insn-data.def | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def > index 8dbeaf8c49..e851e9df5e 100644 > --- a

Re: [PATCH v1 1/8] s390x/tcg: Implement ADD HALFWORD (AGH)

2020-09-22 Thread Thomas Huth
On 22/09/2020 12.31, David Hildenbrand wrote: > Easy, just like ADD HALFWORD IMMEDIATE (AGHI). > > Signed-off-by: David Hildenbrand > --- > target/s390x/insn-data.def | 1 + > target/s390x/translate.c | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/target/s390x/insn-data.def b/targ

Re: [PATCH v2 2/3] Reduce the time of checkpoint for COLO

2020-09-22 Thread Li Zhijian
On 9/22/20 5:24 PM, leirao wrote: we should set ram_bulk_stage to false after ram_state_init, otherwise the bitmap will be unused in migration_bitmap_find_dirty. all pages in ram cache will be flushed to the ram of secondary guest for each checkpoint. Signed-off-by: leirao --- migration/ra

[PATCH] add maximum combined fw size as machine configuration option

2020-09-22 Thread Erich Mcmillan
From: Erich McMillan Signed-off-by: Erich McMillan --- hw/i386/pc.c | 50 hw/i386/pc_sysfw.c | 13 ++-- include/hw/i386/pc.h | 2 ++ 3 files changed, 54 insertions(+), 11 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index

Re: [External] Re: [PATCH v2 3/3] target-i386: post memory failure event to uplayer

2020-09-22 Thread zhenwei pi
On 9/22/20 6:30 PM, Philippe Mathieu-Daudé wrote: On 9/22/20 11:56 AM, zhenwei pi wrote: Post memory failure event to uplayer to handle hardware memory corrupted event. Rather than simple QEMU log, QEMU could report more effective message to uplayer. For example, guest crashes by MCE, selecti

[PATCH] target/i386: kvm: require KVM_CAP_IRQ_ROUTING

2020-09-22 Thread Paolo Bonzini
KVM_CAP_IRQ_ROUTING has been available for x86 since Linux 2.6.33. We can make it a requirement since that was more than ten years ago. Signed-off-by: Paolo Bonzini --- hw/i386/fw_cfg.c | 2 +- hw/i386/kvm/apic.c | 4 +--- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 2 +

[PATCH] target/i386: kvm: do not use kvm_check_extension to find paravirtual capabilities

2020-09-22 Thread Paolo Bonzini
Paravirtualized features have been listed in KVM_GET_SUPPORTED_CPUID since Linux 2.6.35 (commit 84478c829d0f, "KVM: x86: export paravirtual cpuid flags in KVM_GET_SUPPORTED_CPUID", 2010-05-19). It has been more than 10 years, so remove the fallback code. Signed-off-by: Paolo Bonzini --- target/

RE: [PATCH v1 0/3] Remove the limitation of Intel PT CPUID info

2020-09-22 Thread Kang, Luwei
> > Hi Eduardo, > > This patch set will remove some limitations of Intel PT CPUID > > information. > > 1. The "IP payloads" feature will disable the Intel PT in guests and it > > will be > coming soon. > > 2. To make the live migration safe, we set the Intel PT CPUID as a > > constan

Re: [PATCH] bios-tables-test: Remove kernel-irqchip=off option

2020-09-22 Thread Paolo Bonzini
On 22/09/20 21:47, Eduardo Habkost wrote: > We don't need to use kernel-irqchip=off for irq0 override if IRQ > routing is supported by the host, which is the case since 2009 > (IRQ routing was added to KVM in Linux v2.6.30). > > This is a more straightforward fix for Launchpad bug #1896263, as > i

RE: [PATCH 3/3] colo-compare: check mark in mutual exclusion

2020-09-22 Thread Zhang, Chen
> -Original Message- > From: Li Zhijian > Sent: Tuesday, September 22, 2020 5:55 PM > To: Zhang, Chen ; jasow...@redhat.com > Cc: qemu-devel@nongnu.org; Li Zhijian > Subject: [PATCH 3/3] colo-compare: check mark in mutual exclusion > > Signed-off-by: Li Zhijian Reviewed-by: Zhang Ch

RE: [PATCH 2/3] colo-compare: fix missing compare_seq initialization

2020-09-22 Thread Zhang, Chen
> -Original Message- > From: Li Zhijian > Sent: Tuesday, September 22, 2020 5:55 PM > To: Zhang, Chen ; jasow...@redhat.com > Cc: qemu-devel@nongnu.org; Li Zhijian > Subject: [PATCH 2/3] colo-compare: fix missing compare_seq initialization > > Signed-off-by: Li Zhijian Reviewed-by:

RE: [PATCH 1/3] colo-compare: return -1 if no packet is queued

2020-09-22 Thread Zhang, Chen
> -Original Message- > From: Li Zhijian > Sent: Tuesday, September 22, 2020 5:55 PM > To: Zhang, Chen ; jasow...@redhat.com > Cc: qemu-devel@nongnu.org; Li Zhijian > Subject: [PATCH 1/3] colo-compare: return -1 if no packet is queued > > Return 0 will trigger a packet comparison > Y

RE: [PATCH v2 3/3] Fix the qemu crash when guest shutdown in COLO mode

2020-09-22 Thread Zhang, Chen
> -Original Message- > From: Rao, Lei > Sent: Tuesday, September 22, 2020 5:25 PM > To: Zhang, Chen ; lizhij...@cn.fujitsu.com; > jasow...@redhat.com; quint...@redhat.com; dgilb...@redhat.com; > pbonz...@redhat.com > Cc: qemu-devel@nongnu.org; Rao, Lei > Subject: [PATCH v2 3/3] Fix the

RE: [PATCH v2 2/3] Reduce the time of checkpoint for COLO

2020-09-22 Thread Zhang, Chen
> -Original Message- > From: Rao, Lei > Sent: Tuesday, September 22, 2020 5:25 PM > To: Zhang, Chen ; lizhij...@cn.fujitsu.com; > jasow...@redhat.com; quint...@redhat.com; dgilb...@redhat.com; > pbonz...@redhat.com > Cc: qemu-devel@nongnu.org; Rao, Lei > Subject: [PATCH v2 2/3] Reduce

RE: [PATCH v2 1/3] Optimize seq_sorter function for colo-compare

2020-09-22 Thread Zhang, Chen
> -Original Message- > From: Rao, Lei > Sent: Tuesday, September 22, 2020 5:25 PM > To: Zhang, Chen ; lizhij...@cn.fujitsu.com; > jasow...@redhat.com; quint...@redhat.com; dgilb...@redhat.com; > pbonz...@redhat.com > Cc: qemu-devel@nongnu.org; Rao, Lei > Subject: [PATCH v2 1/3] Optimiz

Re: [PATCH v2 03/38] qapi: move generator entrypoint into module

2020-09-22 Thread Cleber Rosa
On Tue, Sep 22, 2020 at 05:00:26PM -0400, John Snow wrote: > As part of delinting and adding type hints to the QAPI generator, it's > helpful for the entrypoint to be part of the package, only leaving a > very tiny entrypoint shim outside of the module. > > Signed-off-by: John Snow > --- > scrip

[PATCH v26 16/17] vfio: Make vfio-pci device migration capable

2020-09-22 Thread Kirti Wankhede
If the device is not a failover primary device, call vfio_migration_probe() and vfio_migration_finalize() to enable migration support for those devices that support it respectively to tear it down again. Removed vfio_pci_vmstate structure. Removed migration blocker from VFIO PCI device specific str

[PATCH v26 15/17] vfio: Add ioctl to get dirty pages bitmap during dma unmap.

2020-09-22 Thread Kirti Wankhede
With vIOMMU, IO virtual address range can get unmapped while in pre-copy phase of migration. In that case, unmap ioctl should return pages pinned in that range and QEMU should find its correcponding guest physical addresses and report those dirty. Suggested-by: Alex Williamson Signed-off-by: Kirt

[PATCH v26 14/17] vfio: Add vfio_listener_log_sync to mark dirty pages

2020-09-22 Thread Kirti Wankhede
vfio_listener_log_sync gets list of dirty pages from container using VFIO_IOMMU_GET_DIRTY_BITMAP ioctl and mark those pages dirty when all devices are stopped and saving state. Return early for the RAM block section of mapped MMIO region. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- h

[PATCH v26 13/17] vfio: create mapped iova list when vIOMMU is enabled

2020-09-22 Thread Kirti Wankhede
Create mapped iova list when vIOMMU is enabled. For each mapped iova save translated address. Add node to list on MAP and remove node from list on UNMAP. This list is used to track dirty pages during migration. Signed-off-by: Kirti Wankhede --- hw/vfio/common.c | 58

[PATCH v26 12/17] vfio: Add function to start and stop dirty pages tracking

2020-09-22 Thread Kirti Wankhede
Call VFIO_IOMMU_DIRTY_PAGES ioctl to start and stop dirty pages tracking for VFIO devices. Signed-off-by: Kirti Wankhede Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c | 36 1 file changed, 36 insertions(+) diff --git a/hw/vfio/migration.c b/hw

[PATCH v26 10/17] memory: Set DIRTY_MEMORY_MIGRATION when IOMMU is enabled

2020-09-22 Thread Kirti Wankhede
mr->ram_block is NULL when mr->is_iommu is true, then fr.dirty_log_mask wasn't set correctly due to which memory listener's log_sync doesn't get called. This patch returns log_mask with DIRTY_MEMORY_MIGRATION set when IOMMU is enabled. Signed-off-by: Kirti Wankhede --- softmmu/memory.c | 2 +- 1

[PATCH v26 08/17] vfio: Add save state functions to SaveVMHandlers

2020-09-22 Thread Kirti Wankhede
Added .save_live_pending, .save_live_iterate and .save_live_complete_precopy functions. These functions handles pre-copy and stop-and-copy phase. In _SAVING|_RUNNING device state or pre-copy phase: - read pending_bytes. If pending_bytes > 0, go through below steps. - read data_offset - indicates k

[PATCH v26 09/17] vfio: Add load state functions to SaveVMHandlers

2020-09-22 Thread Kirti Wankhede
Sequence during _RESUMING device state: While data for this device is available, repeat below steps: a. read data_offset from where user application should write data. b. write data of data_size to migration region from data_offset. c. write data_size which indicates vendor driver that data is wri

[PATCH v26 11/17] vfio: Get migration capability flags for container

2020-09-22 Thread Kirti Wankhede
Added helper functions to get IOMMU info capability chain. Added function to get migration capability information from that capability chain for IOMMU container. Similar change was proposed earlier: https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg03759.html Disable migration for devices

[PATCH v26 17/17] qapi: Add VFIO devices migration stats in Migration stats

2020-09-22 Thread Kirti Wankhede
Added amount of bytes transferred to the target VM by all VFIO devices Signed-off-by: Kirti Wankhede --- Note: Comments from v25 for this patch are not addressed yet. https://www.mail-archive.com/qemu-devel@nongnu.org/msg715620.html Alex, need more pointer on documentation part raised Markus Ar

[PATCH v26 06/17] vfio: Add migration state change notifier

2020-09-22 Thread Kirti Wankhede
Added migration state change notifier to get notification on migration state change. These states are translated to VFIO device state and conveyed to vendor driver. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c | 29 +++

[PATCH v26 05/17] vfio: Add VM state change handler to know state of VM

2020-09-22 Thread Kirti Wankhede
VM state change handler gets called on change in VM's state. This is used to set VFIO device state to _RUNNING. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c | 136 ++ hw/vfio/tra

[PATCH v26 04/17] vfio: Add migration region initialization and finalize function

2020-09-22 Thread Kirti Wankhede
Whether the VFIO device supports migration or not is decided based of migration region query. If migration region query is successful and migration region initialization is successful then migration is supported else migration is blocked. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Acked-

[PATCH v26 02/17] vfio: Add vfio_get_object callback to VFIODeviceOps

2020-09-22 Thread Kirti Wankhede
Hook vfio_get_object callback for PCI devices. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Suggested-by: Cornelia Huck Reviewed-by: Cornelia Huck --- hw/vfio/pci.c | 8 include/hw/vfio/vfio-common.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/vfio/

[PATCH v26 07/17] vfio: Register SaveVMHandlers for VFIO device

2020-09-22 Thread Kirti Wankhede
Define flags to be used as delimeter in migration file stream. Added .save_setup and .save_cleanup functions. Mapped & unmapped migration region from these functions at source during saving or pre-copy phase. Set VFIO device state depending on VM's state. During live migration, VM is running when .

[PATCH v26 03/17] vfio: Add save and load functions for VFIO PCI devices

2020-09-22 Thread Kirti Wankhede
These functions save and restore PCI device specific data - config space of PCI device. Used VMStateDescription to save and restore interrupt state. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/pci.c | 134 ++ hw/vfio/pci

[PATCH v26 01/17] vfio: Add function to unmap VFIO region

2020-09-22 Thread Kirti Wankhede
This function will be used for migration region. Migration region is mmaped when migration starts and will be unmapped when migration is complete. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Cornelia Huck --- hw/vfio/common.c | 32 --

[PATCH QEMU v25 00/17] Add migration support for VFIO devices

2020-09-22 Thread Kirti Wankhede
Hi, This Patch set adds migration support for VFIO devices in QEMU. This Patch set include patches as below: Patch 1-2: - Few code refactor Patch 3: - Added save and restore functions for PCI configuration space. Used pci_device_save() and pci_device_load() so that config space cache is saved

Re: [PATCH v2 02/38] qapi-gen: Separate arg-parsing from generation

2020-09-22 Thread Cleber Rosa
On Tue, Sep 22, 2020 at 05:00:25PM -0400, John Snow wrote: > This is a minor re-work of the entrypoint script. It isolates a > generate() method from the actual command-line mechanism. > > Signed-off-by: John Snow > --- > scripts/qapi-gen.py | 87 - >

Re: [PATCH v2 01/38] [DO-NOT-MERGE] qapi: add debugging tools

2020-09-22 Thread Cleber Rosa
On Tue, Sep 22, 2020 at 05:00:24PM -0400, John Snow wrote: > This adds some really childishly simple debugging tools. Maybe they're > interesting for someone else, too? > > Signed-off-by: John Snow > --- > scripts/qapi/debug.py | 78 +++ > 1 file changed,

Re: [PATCH 0/3] Hyper-V Dynamic Memory Protocol driver (hv-balloon)

2020-09-22 Thread Maciej S. Szmigiero
On 22.09.2020 09:26, David Hildenbrand wrote: > On 22.09.20 00:22, Maciej S. Szmigiero wrote: >> Hi David, >> >> Thank you for your comments. >> (...) >> >> The idea is to use virtual DIMM sticks for hot-adding extra memory at >> runtime, while using ballooning for runtime adjustment of the guest >

Re: [PATCH] MAINTAINERS: Change my role to reviewer of Python scripts

2020-09-22 Thread John Snow
On 9/22/20 5:31 PM, Eduardo Habkost wrote: I'm stepping out as maintainer of ./scripts/*.py, but still willing to help review patches for Python code. Signed-off-by: Eduardo Habkost --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS

[PATCH v2 0/1] MAINTAINERS: Add Python library stanza

2020-09-22 Thread John Snow
John Snow (1): MAINTAINERS: Add Python library stanza MAINTAINERS | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.26.2

[PATCH 24/25] qapi/schema.py: Add module docstring

2020-09-22 Thread John Snow
Add some microdocumentation that gives a nice file-level overview of this 1300+ line file. Signed-off-by: John Snow --- scripts/qapi/schema.py | 36 +--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py

Re: [PATCH 00/26] qapi: static typing conversion, pt5

2020-09-22 Thread John Snow
On 9/22/20 6:34 PM, John Snow wrote: based-on: <20200922210101.4081073-1-js...@redhat.com> ^ Copy-paste malfunction based-on: <20200922212115.4084301-1-js...@redhat.com> [PATCH 0/6] qapi: static typing conversion, pt4 Hi, this series adds static type hints to the QAPI module. Thi

[PATCH 22/25] qapi/schema.py: Ignore unused argument for check()

2020-09-22 Thread John Snow
This is an interface with a default implementation. Pylint doesn't have enough context to be aware of this. Signed-off-by: John Snow --- scripts/qapi/schema.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 271befea1c..6ecbc2aa6b 100644

[PATCH 25/25] qapi/schema.py: Use python3 style super()

2020-09-22 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index baafe3babf..6b47ca26e0 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -309,7 +309,7 @@ def doc_type(se

[PATCH 08/25] qapi/schema.py: Allow alternate_type to assert

2020-09-22 Thread John Snow
It is generally nicer to just let things fail, because it makes the static type hints less infected with Optional[T], where a future programmer using the library has to wonder what that means. Let errors be errors. Signed-off-by: John Snow --- scripts/qapi/schema.py | 7 --- 1 file changed,

[PATCH v2 1/1] MAINTAINERS: Add Python library stanza

2020-09-22 Thread John Snow
I'm proposing that I split the actual Python library off from the other miscellaneous python scripts we have and declare it maintained. Add myself as a maintainer of this folder, along with Cleber. v2: change python/* to python/, thanks Alex. Signed-off-by: John Snow Reviewed-by: Philippe Mathie

[PATCH 07/25] qapi/schema.py: constrain tag_member type

2020-09-22 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/schema.py | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index aaf20f776b..15ff441660 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -546,15 +546,18 @@ def se

Re: tools/virtiofs: Multi threading seems to hurt performance

2020-09-22 Thread Vivek Goyal
On Tue, Sep 22, 2020 at 12:09:46PM +0100, Dr. David Alan Gilbert wrote: > > Do you have the numbers for: >epool >epool thread-pool-size=1 >spool Hi David, Ok, I re-ran my numbers again after upgrading to latest qemu and also upgraded host kernel to latest upstream. Apart from compari

[PATCH 16/25] qapi/schema.py: enable checking

2020-09-22 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/mypy.ini | 6 -- 1 file changed, 6 deletions(-) diff --git a/scripts/qapi/mypy.ini b/scripts/qapi/mypy.ini index 20ab509946..df60c18de1 100644 --- a/scripts/qapi/mypy.ini +++ b/scripts/qapi/mypy.ini @@ -1,10 +1,4 @@ [mypy] strict = True strict_opt

[PATCH 02/25] qapi/schema.py: Move meta-type into class instances

2020-09-22 Thread John Snow
We are using meta as a class variable, but union types use this as a mutable value which changes the value for the class, not the instance. Use the empty string as the default/empty value for ease of typing. It is still false-ish, so it will work just fine. Signed-off-by: John Snow --- scripts/

[PATCH 18/25] qapi/schema.py: Add pylint warning suppressions

2020-09-22 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/schema.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 8907bec0b5..61238c0686 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -39,6 +39,8 @@ class Visitable: """Ab

[PATCH 17/25] qapi: Disable similarity checks in pylint entirely

2020-09-22 Thread John Snow
The pylint similarity checks cannot distinguish parameter lists from other code; with the QAPISchemaVisitor interface having long lists of parameters, these similarity checks fire off in a way that's difficult to disable in a targeted way without littering the code with pylint pragmas. There is a

[PATCH 15/25] qapi/schema.py: add type hint annotations

2020-09-22 Thread John Snow
Annotations do not change runtime behavior. This commit *only* adds annotations. Signed-off-by: John Snow --- scripts/qapi/schema.py | 519 - 1 file changed, 361 insertions(+), 158 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py

[PATCH 00/25] qapi: static typing conversion, pt6

2020-09-22 Thread John Snow
based-on: <2020093525.4085762-1-js...@redhat.com> [PATCH 00/26] qapi: static typing conversion, pt5 Hi, this series adds static type hints to the QAPI module. This is the final part, part six! Part 6 (Everything): https://gitlab.com/jsnow/qemu/-/tree/python-qapi-cleanup-pt6 - R

[PATCH 19/25] qapi/schema.py: Convert several methods to classmethods

2020-09-22 Thread John Snow
If they don't use self and nothing that extends them needs self either, they can be classmethods. Signed-off-by: John Snow --- scripts/qapi/schema.py | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 61238c0686..2d2

[PATCH 23/25] qapi/schema.py: enable pylint checks

2020-09-22 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/pylintrc | 5 - 1 file changed, 5 deletions(-) diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc index fb444e93bb..539e5f65a0 100644 --- a/scripts/qapi/pylintrc +++ b/scripts/qapi/pylintrc @@ -1,10 +1,5 @@ [MASTER] -# Add files or directo

[PATCH 20/25] qapi/schema.py: Replace one-letter variable names

2020-09-22 Thread John Snow
I hope you like butter, because here comes the churn! Signed-off-by: John Snow --- scripts/qapi/schema.py | 184 + 1 file changed, 95 insertions(+), 89 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 2d23ce04eb..a0e047c735

[PATCH 01/25] qapi/schema: add Visitable mixin

2020-09-22 Thread John Snow
Python doesn't have anything quite exactly like Traits, Interfaces, or Mixins; but we can approximate it. Add a 'Visitable' class that enforces a type signature for the visit() method; this way, mypy is ensuring that even for otherwise unrelated classes that do not inherit from a common base, this

[PATCH 11/25] qapi/schema.py: Constrain type of QAPISchemaObjectType members field

2020-09-22 Thread John Snow
This must always be QAPISchemaObjectTypeMember, and we do check and enforce this -- but because the seen dict is invariant and check methods need to operate in terms of a more abstract type, we need to tell the type system to believe us. Signed-off-by: John Snow --- scripts/qapi/schema.py | 6 ++

[PATCH 21/25] qapi/schema.py: disable pylint line limit

2020-09-22 Thread John Snow
It's a big file, but there's really nothing in here that doesn't belong in here -- and I don't think it's large enough to justify the one-module-per-class approach. Signed-off-by: John Snow --- scripts/qapi/schema.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/qapi/schema.py b/

[PATCH 22/26] qapi/parser.py: add type hint annotations (QAPIDoc)

2020-09-22 Thread John Snow
Annotations do not change runtime behavior. This commit *only* adds annotations. Signed-off-by: John Snow --- scripts/qapi/parser.py | 68 +++--- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py in

[PATCH 13/25] qapi/schema.py: Test type of self.ret_type instead of local temp

2020-09-22 Thread John Snow
This is obscure: If we test the type on a local copy instead of the stored state AFTER the assignment, mypy does not constrain the type of the copy. If we test on the stored state, it works out fine. Corrects this warning: qapi/schema.py:887: error: "QAPISchemaType" has no attribute "element_type

[PATCH 14/25] qapi/schema.py: Assert variants of an object are also objects

2020-09-22 Thread John Snow
The 'seen' dictionaries are invariant types and require the most abstracted type to maintain a consistent interface with other check_clash implementations. In this case, we happen to know (and require) that they will be object types, so add a runtime assertion to constrain that type. Corrects thi

[PATCH 12/25] qapi/schema.py: remove 'and' from non-bool rvalue expressions

2020-09-22 Thread John Snow
There's nothing inherently wrong with using 'and' in this manner, but the type returned is more loose than you might expect. Any value can be false-ish, so mypy assumes that the type of the expression must be the Union of both types, because a type can always be false-ish. To tighten the static an

[PATCH 05/25] qapi/schema.py: constrain QAPISchemaObjectTypeMember arg_type type

2020-09-22 Thread John Snow
Re-order the check method slightly in order to provide stronger typing for the arg_type field. Signed-off-by: John Snow --- scripts/qapi/schema.py | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 3aa842be08..c9a62711

[PATCH 26/26] qapi/parser.py: enable pylint checks

2020-09-22 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/pylintrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc index 88efbf71cb..5091a08f12 100644 --- a/scripts/qapi/pylintrc +++ b/scripts/qapi/pylintrc @@ -2,8 +2,7 @@ # Add files or dire

[PATCH 06/25] qapi/schema.py: constrain QAPISchemaEvent arg_type type

2020-09-22 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/schema.py | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index c9a62711c2..aaf20f776b 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -792,13 +792,14 @@ def __

[PATCH 10/25] qapi/schema.py: Add assertion to ifcond property

2020-09-22 Thread John Snow
ifcond's initialization allows a fairly confusing type, but we want to assert that after the QAPISchema is built, this always returns a List[str]. Add an assertion to allow us to say that. (Note: Technically, I only assert that it's a list -- but type hints that will be added later will make it cl

[PATCH 20/26] qapi/parser.py: remove unused check_args_section arguments

2020-09-22 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/parser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index fa0ddad922..a3403d4017 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -650,7 +650,7 @@ def check

[PATCH 24/26] qapi/parser.py: remove one and two-letter variables

2020-09-22 Thread John Snow
Standard pylint complaint: use more descriptibe variable names. OK, fine. Signed-off-by: John Snow --- scripts/qapi/parser.py | 28 +++- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index cdb64ffc22..818f8

[PATCH 09/25] qapi/schema.py: remove superfluous assert

2020-09-22 Thread John Snow
We'll actually get a better error message by just letting the dictionary lookup fail. Signed-off-by: John Snow --- scripts/qapi/schema.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index a84d8549a4..b35f741c6f 100644 --- a/scripts/qapi/sche

[PATCH 14/26] qapi/parser.py: add docstrings

2020-09-22 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/parser.py | 38 ++ 1 file changed, 38 insertions(+) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index d9aae4ddb7..490436b48a 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -61,7 +6

[PATCH 21/26] qapi/parser.py: QAPIDoc: convert @staticmethod to @classmethod

2020-09-22 Thread John Snow
For consistency: replace @staticmethod with @classmethod. Signed-off-by: John Snow --- scripts/qapi/parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index a3403d4017..f5f40ffa16 100644 --- a/scripts/qapi/parser.py +

Re: [PATCH v2 13/38] qapi/common.py: add type hint annotations

2020-09-22 Thread Eduardo Habkost
On Tue, Sep 22, 2020 at 05:00:36PM -0400, John Snow wrote: > Annotations do not change runtime behavior. > This commit *only* adds annotations. > > Signed-off-by: John Snow > --- > scripts/qapi/common.py | 27 --- > 1 file changed, 16 insertions(+), 11 deletions(-) > > d

[PATCH 04/25] qapi/schema.py: constrain QAPISchemaObjectType base type

2020-09-22 Thread John Snow
Re-order check slightly so we can provide a stronger guarantee on the typing of the base field. Signed-off-by: John Snow --- scripts/qapi/schema.py | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index a53631e660..3aa

[PATCH 25/26] qapi/parser.py: Silence too-few-public-methods warning

2020-09-22 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/parser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 818f8bc580..e3481b02f2 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -412,6 +412,8 @@ class QAPIDoc: """

[PATCH 15/26] qapi/parser.py: add ParsedExpression type

2020-09-22 Thread John Snow
This is an immutable, named, typed tuple; it's nicer than arbitrary dicts for passing data around when using strict typing. Turn parser.exprs into a list of ParsedExpressions instead, and adjust expr.py to match. Signed-off-by: John Snow --- scripts/qapi/expr.py | 56 +++--

[PATCH 11/26] qapi/parser.py: Convert several methods to @classmethod

2020-09-22 Thread John Snow
It's usually nicer to keep static methods as class methods -- this allows them to call other class methods, to be subclassed and extended, etc. Meanwhile, any method that doesn't utilize `self` can be a class method. Signed-off-by: John Snow --- scripts/qapi/parser.py | 10 ++ 1 file ch

[PATCH 23/26] qapi/parser.py: enable mypy checks

2020-09-22 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/mypy.ini | 5 - 1 file changed, 5 deletions(-) diff --git a/scripts/qapi/mypy.ini b/scripts/qapi/mypy.ini index 4d341c6b2d..20ab509946 100644 --- a/scripts/qapi/mypy.ini +++ b/scripts/qapi/mypy.ini @@ -4,11 +4,6 @@ strict_optional = False disallow_u

[PATCH 10/26] qapi/parser.py: assert object keys are strings

2020-09-22 Thread John Snow
Since values can also be other data types, add an assertion to ensure we're dealing with strings. Signed-off-by: John Snow --- scripts/qapi/parser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 1bc33e85ea..756c904257 100644 --- a/sc

[PATCH 03/25] qapi/schema.py: add assert in stub methods

2020-09-22 Thread John Snow
Instead of pass (an implicit return none), use raise NotImplementedError to mark a function as abstract -- one that doesn't return. This allows us to correctly type the stub. Signed-off-by: John Snow --- scripts/qapi/schema.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff -

[PATCH 16/26] qapi/pragma.py: Move QAPISchemaPragma into its own module

2020-09-22 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/pragma.py | 25 + scripts/qapi/source.py | 15 ++- 2 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 scripts/qapi/pragma.py diff --git a/scripts/qapi/pragma.py b/scripts/qapi/pragma.py new file mod

[PATCH 19/26] qapi/parser.py: add parent argument

2020-09-22 Thread John Snow
Instead of passing previously_included and info separately, we can pass the parent parser itself. This cuts down on the number of parameters to pass when creating a parser; and makes it easier to add new shared data members between parent and child. Signed-off-by: John Snow --- scripts/qapi/pars

[PATCH 09/26] qapi/parser.py: assert get_expr returns object in outer loop

2020-09-22 Thread John Snow
get_expr can return many things, depending on where it is used. In the outer parsing loop, we expect and require it to return an object. Signed-off-by: John Snow --- scripts/qapi/parser.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py inde

[PATCH 12/26] qapi/parser.py: add casts to pragma checks

2020-09-22 Thread John Snow
This kind of type checking at runtime is not something mypy can introspect, so add a do-nothing cast to help mypy out. Signed-off-by: John Snow --- scripts/qapi/parser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py ind

[PATCH 13/26] qapi/parser.py: add type hint annotations

2020-09-22 Thread John Snow
Annotations do not change runtime behavior. This commit *only* adds annotations. Annotations for QAPIDoc are in a later commit. Signed-off-by: John Snow --- scripts/qapi/parser.py | 69 ++ 1 file changed, 49 insertions(+), 20 deletions(-) diff --git a/sc

[PATCH 17/26] qapi/pragma.py: Move pragma parsing out of parser.py

2020-09-22 Thread John Snow
parser.py is a JSON parser at heart and shouldn't necessarily understand what it is parsing on a semantic level. Move pragma parsing to pragma.py, and leave the parser a little more happily ignorant. Note: the type annotation in error.py now creates a cyclic import, because error -> source -> prag

[PATCH 06/26] qapi/parser.py: raise QAPIParseError during file opening

2020-09-22 Thread John Snow
Now that we can have exception contexts that don't specify a specific line, we can use that context to raise errors when opening the file. If we don't have a parent context, we can simply use our own. Signed-off-by: John Snow --- scripts/qapi/parser.py | 12 +++- 1 file changed, 7 inser

[PATCH 08/26] qapi/parser.py: Assert lexer value is a string

2020-09-22 Thread John Snow
The type checker can't constrain the token value to string in this case, because it's only loosely correlated with the return token, which is "stringly typed". Signed-off-by: John Snow --- scripts/qapi/parser.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/qapi/parser.py b/scripts

[PATCH 01/26] qapi/parser.py: refactor parsing routine into method

2020-09-22 Thread John Snow
For the sake of keeping __init__ easier to reason about, with fewer variables in play. Signed-off-by: John Snow --- scripts/qapi/parser.py | 30 ++ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 8b

[PATCH 18/26] qapi/parser.py: Modify _include() to use parser state

2020-09-22 Thread John Snow
It doesn't need to take quite so many arguments. Signed-off-by: John Snow --- scripts/qapi/parser.py | 21 - 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 5b3a9b5da8..77067b2f5d 100644 --- a/scripts/qapi/p

[PATCH 07/26] qapi/parser.py: fully remove 'null' constant

2020-09-22 Thread John Snow
Based on the docs, we don't support the null constant, and the code agrees. There's a few remnants where callers check .tok for 'n', and these can be removed. Signed-off-by: John Snow --- scripts/qapi/parser.py| 8 tests/qapi-schema/leading-comma-list.err | 2 +- te

  1   2   3   4   5   6   >