Re: [PATCH v4 14/25] memory: Add Error** argument to the global_dirty_log routines

2024-03-15 Thread Yong Huang
On Wed, Mar 6, 2024 at 9:35 PM Cédric Le Goater wrote: > Now that the log_global*() handlers take an Error** parameter and > return a bool, do the same for memory_global_dirty_log_start() and > memory_global_dirty_log_stop(). The error is reported in the callers > for now and it will be

[PATCH 20/22] plugins: Move qemu_plugin_insn_cleanup_fn to tcg.c

2024-03-15 Thread Richard Henderson
This is only used in one place, and usage requires an out-of-line function. Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 12 tcg/tcg.c | 12 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/qemu/plugin.h

[PATCH 06/22] plugins: Create TCGHelperInfo for all out-of-line callbacks

2024-03-15 Thread Richard Henderson
TCGHelperInfo includes the ABI for every function call. Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 1 + plugins/core.c| 51 ++- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/include/qemu/plugin.h

[PATCH 02/22] tcg: Make tcg/helper-info.h self-contained

2024-03-15 Thread Richard Henderson
Move MAX_CALL_IARGS from tcg.h and include for the define of TCG_TARGET_REG_BITS. Signed-off-by: Richard Henderson --- include/tcg/helper-info.h | 3 +++ include/tcg/tcg.h | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/tcg/helper-info.h

[PATCH 05/22] plugins: Move function pointer in qemu_plugin_dyn_cb

2024-03-15 Thread Richard Henderson
The out-of-line function pointer is mutually exclusive with inline expansion, so move it into the union. Wrap the pointer in a structure named 'regular' to match PLUGIN_CB_REGULAR. Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 4 +++- accel/tcg/plugin-gen.c | 4 ++--

[PATCH 17/22] plugins: Replace pr_ops with a proper debug dump flag

2024-03-15 Thread Richard Henderson
The DEBUG_PLUGIN_GEN_OPS ifdef is replaced with "-d op_plugin". The second pr_ops call can be obtained with "-d op". Signed-off-by: Richard Henderson --- include/qemu/log.h | 1 + include/tcg/tcg.h | 1 + accel/tcg/plugin-gen.c | 68 --

[PATCH 19/22] plugins: Merge qemu_plugin_tb_insn_get to plugin-gen.c

2024-03-15 Thread Richard Henderson
Merge qemu_plugin_insn_alloc and qemu_plugin_tb_insn_get into plugin_gen_insn_start, since it is used nowhere else. Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 39 --- accel/tcg/plugin-gen.c | 39 --- 2

[PATCH 04/22] plugins: Zero new qemu_plugin_dyn_cb entries

2024-03-15 Thread Richard Henderson
Signed-off-by: Richard Henderson --- plugins/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/core.c b/plugins/core.c index 11ca20e626..4487cb7c48 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -307,7 +307,7 @@ static struct qemu_plugin_dyn_cb

[PATCH 21/22] plugins: Inline plugin_gen_empty_callback

2024-03-15 Thread Richard Henderson
Each caller can use tcg_gen_plugin_cb directly. Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 70914c3bf8..fd52ea3987 100644 ---

[PATCH 16/22] plugins: Introduce PLUGIN_CB_MEM_REGULAR

2024-03-15 Thread Richard Henderson
Use different enumerators for vcpu_udata and vcpu_mem callbacks. Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 1 + accel/tcg/plugin-gen.c | 2 +- plugins/core.c | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/qemu/plugin.h

[PATCH 18/22] plugins: Split out common cb expanders

2024-03-15 Thread Richard Henderson
Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 84 +- 1 file changed, 41 insertions(+), 43 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 10d917abd3..28414c4ff1 100644 --- a/accel/tcg/plugin-gen.c +++

[PATCH 22/22] plugins: Update the documentation block for plugin-gen.c

2024-03-15 Thread Richard Henderson
Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 31 --- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index fd52ea3987..c354825779 100644 --- a/accel/tcg/plugin-gen.c +++

[PATCH 13/22] tcg: Remove TCG_CALL_PLUGIN

2024-03-15 Thread Richard Henderson
Since we no longer emit plugin helpers during the initial code translation phase, we don't need to specially mark plugin helpers. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 2 -- plugins/core.c| 10 -- tcg/tcg.c | 4 +--- 3 files changed, 5 insertions(+), 11

[PATCH 15/22] plugins: Simplify callback queues

2024-03-15 Thread Richard Henderson
We have qemu_plugin_dyn_cb.type to differentiate the various callback types, so we do not need to keep them in separate queues. Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 35 ++-- accel/tcg/plugin-gen.c | 90 ++

[PATCH 10/22] plugins: Use emit_before_op for PLUGIN_GEN_FROM_INSN

2024-03-15 Thread Richard Henderson
Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 1 - accel/tcg/plugin-gen.c | 286 ++--- plugins/api.c | 8 +- 3 files changed, 67 insertions(+), 228 deletions(-) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index

[PATCH 09/22] plugins: Add PLUGIN_GEN_AFTER_TB

2024-03-15 Thread Richard Henderson
Delay test of plugin_tb->mem_helper until the inject pass. Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 37 - 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index

[PATCH 14/22] tcg: Remove INDEX_op_plugin_cb_{start,end}

2024-03-15 Thread Richard Henderson
These opcodes are no longer used. Signed-off-by: Richard Henderson --- include/tcg/tcg-op-common.h | 2 -- include/tcg/tcg-opc.h | 2 -- accel/tcg/plugin-gen.c | 18 -- tcg/tcg-op.c| 10 -- 4 files changed, 32 deletions(-) diff --git

[PATCH 01/22] tcg: Add TCGContext.emit_before_op

2024-03-15 Thread Richard Henderson
Allow operations to be emitted via normal expanders into the middle of the opcode stream. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 1 + tcg/tcg.c | 14 -- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h

[PATCH 11/22] plugins: Use emit_before_op for PLUGIN_GEN_FROM_MEM

2024-03-15 Thread Richard Henderson
Introduce a new plugin_mem_cb op to hold the address temp and meminfo computed by tcg-op-ldst.c. Because this now has its own opcode, we no longer need PLUGIN_GEN_FROM_MEM. Signed-off-by: Richard Henderson --- include/exec/plugin-gen.h | 4 - include/tcg/tcg-op-common.h | 1 +

[PATCH 12/22] plugins: Remove plugin helpers

2024-03-15 Thread Richard Henderson
These placeholder helpers are no longer required. Signed-off-by: Richard Henderson --- accel/tcg/plugin-helpers.h | 5 - include/exec/helper-gen-common.h | 4 include/exec/helper-proto-common.h | 4 accel/tcg/plugin-gen.c | 20 4 files

[PATCH 03/22] tcg: Pass function pointer to tcg_gen_call*

2024-03-15 Thread Richard Henderson
For normal helpers, read the function pointer from the structure earlier. For plugins, this will allow the function pointer to come from elsewhere. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 21 +--- include/exec/helper-gen.h.inc | 24 ---

[PATCH 08/22] plugins: Use emit_before_op for PLUGIN_GEN_FROM_TB

2024-03-15 Thread Richard Henderson
By having the qemu_plugin_cb_flags be recorded in the TCGHelperInfo, we no longer need to distinguish PLUGIN_CB_REGULAR from PLUGIN_CB_REGULAR_R, so place all TB callbacks in the same queue. Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 96

[PATCH 07/22] plugins: Use emit_before_op for PLUGIN_GEN_AFTER_INSN

2024-03-15 Thread Richard Henderson
Introduce a new plugin_cb op and migrate one operation. By using emit_before_op, we do not need to emit opcodes early and modify them later -- we can simply emit the final set of opcodes once. Signed-off-by: Richard Henderson --- include/tcg/tcg-op-common.h | 1 + include/tcg/tcg-opc.h |

[PATCH 00/22] plugins: Rewrite plugin code generation

2024-03-15 Thread Richard Henderson
As I mooted with Pierrick earlier this week: (1) Add a (trivial) mechanism for emitting code into the middle of the opcode sequence: tcg_ctx->emit_before_op. (2) Rip out all of the "empty" generation and "copy" to modify those sequences. Replace with regular code generation once we know what

Re: [PATCH V4 1/1] target/loongarch: Fixed tlb huge page loading issue

2024-03-15 Thread lixianglai
在 2024/3/16 上午1:06, Richard Henderson 写道: > On 3/14/24 23:01, lixianglai wrote: >> Hi Richard : >> >>> On 3/14/24 20:22, lixianglai wrote: Hi Richard: > On 3/13/24 15:33, Xianglai Li wrote: >> +    if (unlikely((level == 0) || (level > 4))) { >> +    return base; >> +   

Re: [PATCH-for-9.1 12/12] exec/poison: Poison CONFIG_SOFTMMU again

2024-03-15 Thread Richard Henderson
On 3/13/24 11:33, Philippe Mathieu-Daudé wrote: Now that the confusion around SOFTMMU vs SYSTEM emulation was clarified, we can restore the CONFIG_SOFTMMU poison pragma. This reverts commit d31b84041d4353ef310ffde23c87b78c2aa32ead ("exec/poison: Do not poison CONFIG_SOFTMMU"). Signed-off-by:

Re: [PATCH-for-9.1 06/12] tcg/sparc64: Check for USER_ONLY definition instead of SOFTMMU one

2024-03-15 Thread Richard Henderson
On 3/13/24 11:33, Philippe Mathieu-Daudé wrote: Since we *might* have user emulation with softmmu, replace the system emulation check by !user emulation one. Signed-off-by: Philippe Mathieu-Daudé --- tcg/sparc64/tcg-target.c.inc | 8 1 file changed, 4 insertions(+), 4 deletions(-)

Re: [PATCH-for-9.1 11/12] tcg: Remove unused CONFIG_SOFTMMU definition from libtcg_system.fa

2024-03-15 Thread Richard Henderson
On 3/13/24 11:33, Philippe Mathieu-Daudé wrote: Signed-off-by: Philippe Mathieu-Daudé --- tcg/meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/tcg/meson.build b/tcg/meson.build index 8251589fd4..b5246676c6 100644 --- a/tcg/meson.build +++ b/tcg/meson.build @@ -42,7 +42,6 @@

Re: [PATCH-for-9.1 10/12] exec/cpu-defs: Restrict SOFTMMU specific definitions to accel/tcg/

2024-03-15 Thread Richard Henderson
On 3/13/24 11:33, Philippe Mathieu-Daudé wrote: CPU_TLB_foo definitions are specific to SoftMMU and only used in accel/tcg/. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/internal-target.h | 26 ++ include/exec/cpu-defs.h | 26 -- 2

Re: [PATCH-for-9.1 09/12] accel/tcg/internal: Check for USER_ONLY definition instead of SOFTMMU

2024-03-15 Thread Richard Henderson
On 3/13/24 11:33, Philippe Mathieu-Daudé wrote: Since we *might* have user emulation with softmmu, replace the system emulation check by !user emulation one. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/internal-target.h | 6 +++--- accel/tcg/tb-hash.h | 4 ++--

Re: [PATCH-for-9.1 07/12] plugins/api: Check for USER_ONLY definition instead of SOFTMMU one

2024-03-15 Thread Richard Henderson
On 3/13/24 11:33, Philippe Mathieu-Daudé wrote: Since we*might* have user emulation with softmmu, replace the system emulation check by !user emulation one. Signed-off-by: Philippe Mathieu-Daudé --- plugins/api.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-)

Re: [PATCH-for-9.1 06/12] tcg/sparc64: Check for USER_ONLY definition instead of SOFTMMU one

2024-03-15 Thread Richard Henderson
On 3/13/24 11:33, Philippe Mathieu-Daudé wrote: Since we *might* have user emulation with softmmu, replace the system emulation check by !user emulation one. Signed-off-by: Philippe Mathieu-Daudé --- tcg/sparc64/tcg-target.c.inc | 8 1 file changed, 4 insertions(+), 4 deletions(-)

Re: [PATCH-for-9.0? 03/12] gdbstub: Correct invalid mentions of 'softmmu' by 'system'

2024-03-15 Thread Richard Henderson
On 3/13/24 11:33, Philippe Mathieu-Daudé wrote: Signed-off-by: Philippe Mathieu-Daudé --- gdbstub/internals.h | 20 ++-- gdbstub/system.c| 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) Reviewed-by: Richard Henderson r~

Re: [PATCH-for-9.0? 04/12] gdbstub/system: Rename 'user_ctx' argument as 'ctx'

2024-03-15 Thread Richard Henderson
On 3/13/24 11:33, Philippe Mathieu-Daudé wrote: Signed-off-by: Philippe Mathieu-Daudé --- gdbstub/internals.h | 8 gdbstub/system.c| 8 2 files changed, 8 insertions(+), 8 deletions(-) Reviewed-by: Richard Henderson r~

Re: [RFC PATCH v3 3/3] migration: Add fd to FileMigrationArgs

2024-03-15 Thread Peter Xu
On Fri, Mar 15, 2024 at 03:01:09PM -0300, Fabiano Rosas wrote: > Peter Xu writes: > > > [I queued patch 1-2 into -stable, leaving this patch for further > > discussions] > > > > On Fri, Mar 15, 2024 at 08:55:42AM +, Daniel P. Berrangé wrote: > >> The 'file:' protocol eventually calls into

Re: [PATCH v7 3/8] tests/qtest/migration: Replace migrate_get_connect_uri inplace of migrate_get_socket_address

2024-03-15 Thread Het Gala
On 15/03/24 6:28 pm, Fabiano Rosas wrote: Het Gala writes: Refactor migrate_get_socket_address to internally utilize 'socket-address' parameter, reducing redundancy in the function definition. migrate_get_socket_address implicitly converts SocketAddress into str. Move

Re: [PATCH v4 2/2] vhost: Perform memory section dirty scans once per iteration

2024-03-15 Thread Si-Wei Liu
On 3/14/2024 9:03 PM, Jason Wang wrote: On Fri, Mar 15, 2024 at 5:39 AM Si-Wei Liu wrote: On setups with one or more virtio-net devices with vhost on, dirty tracking iteration increases cost the bigger the number amount of queues are set up e.g. on idle guests migration the following is

Re: [PATCH v4 1/2] vhost: dirty log should be per backend type

2024-03-15 Thread Si-Wei Liu
On 3/14/2024 8:50 PM, Jason Wang wrote: On Fri, Mar 15, 2024 at 5:39 AM Si-Wei Liu wrote: There could be a mix of both vhost-user and vhost-kernel clients in the same QEMU process, where separate vhost loggers for the specific vhost type have to be used. Make the vhost logger per backend

Re: [PATCH v3 for 9.1 1/6] virtio/virtio-pci: Handle extra notification data

2024-03-15 Thread Eugenio Perez Martin
On Fri, Mar 15, 2024 at 5:57 PM Jonah Palmer wrote: > > Add support to virtio-pci devices for handling the extra data sent > from the driver to the device when the VIRTIO_F_NOTIFICATION_DATA > transport feature has been negotiated. > > The extra data that's passed to the virtio-pci device when

Re: [RFC PATCH v3 3/3] migration: Add fd to FileMigrationArgs

2024-03-15 Thread Fabiano Rosas
Peter Xu writes: > [I queued patch 1-2 into -stable, leaving this patch for further > discussions] > > On Fri, Mar 15, 2024 at 08:55:42AM +, Daniel P. Berrangé wrote: >> The 'file:' protocol eventually calls into qemu_open, and this >> transparently allows for FD passing using

Re: [PATCH v2] vfio/pci: migration: Skip config space check for vendor specific capability during restore/load

2024-03-15 Thread Vinayak Kale
On 11/03/24 8:32 pm, Alex Williamson wrote: External email: Use caution opening links or attachments On Mon, 11 Mar 2024 17:45:19 +0530 Vinayak Kale wrote: In case of migration, during restore operation, qemu checks config space of the pci device with the config space in the migration

Re: [PATCH 1/1] cxl/mem: Fix for the index of Clear Event Record Handle

2024-03-15 Thread Dan Williams
Yuquan Wang wrote: > The dev_dbg info for Clear Event Records mailbox command would report > the handle of the next record to clear not the current one. > > This was because the index 'i' had incremented before printing the > current handle value. > > This fix also adjusts the index variable

Re: [PATCH v4 21/23] qapi/schema: add type hints

2024-03-15 Thread John Snow
On Fri, Mar 15, 2024, 10:03 AM Markus Armbruster wrote: > John Snow writes: > > > This patch only adds type hints, which aren't utilized at runtime and > > don't change the behavior of this module in any way. > > > > In a scant few locations, type hints are removed where no longer > > necessary

Re: [PATCH v2] target/s390x: improve cpu compatibility check error message

2024-03-15 Thread Claudio Fontana
On 3/15/24 17:59, Nina Schoetterl-Glausch wrote: > On Thu, 2024-03-14 at 22:37 +0100, Claudio Fontana wrote: >> some users were confused by this message showing under TCG: >> >> Selected CPU generation is too new. Maximum supported model >> in the configuration: 'xyz' >> >> Clarify that the

Re: [PATCH V4 1/1] target/loongarch: Fixed tlb huge page loading issue

2024-03-15 Thread Richard Henderson
On 3/14/24 23:01, lixianglai wrote: Hi Richard : On 3/14/24 20:22, lixianglai wrote: Hi Richard: On 3/13/24 15:33, Xianglai Li wrote: +    if (unlikely((level == 0) || (level > 4))) { +    return base; +    } ... Perhaps it would be worthwhile to add another for the level==0 or > 4

Re: [PATCH for-9.0 v3] vdpa-dev: Fix initialisation order to restore VDUSE compatibility

2024-03-15 Thread Stefano Garzarella
On Fri, Mar 15, 2024 at 04:59:49PM +0100, Kevin Wolf wrote: VDUSE requires that virtqueues are first enabled before the DRIVER_OK status flag is set; with the current API of the kernel module, it is impossible to enable the opposite order in our block export code because userspace is not

Re: [PATCH v2] target/s390x: improve cpu compatibility check error message

2024-03-15 Thread Nina Schoetterl-Glausch
On Thu, 2024-03-14 at 22:37 +0100, Claudio Fontana wrote: > some users were confused by this message showing under TCG: > > Selected CPU generation is too new. Maximum supported model > in the configuration: 'xyz' > > Clarify that the maximum can depend on the accel, and add a > hint to try a

[PATCH v3 for 9.1 6/6] virtio: Add VIRTIO_F_NOTIFICATION_DATA property definition

2024-03-15 Thread Jonah Palmer
Extend the virtio device property definitions to include the VIRTIO_F_NOTIFICATION_DATA feature. The default state of this feature is disabled, allowing it to be explicitly enabled where it's supported. Tested-by: Lei Yang Reviewed-by: Eugenio Pérez Signed-off-by: Jonah Palmer ---

[PATCH v3 for 9.1 5/6] vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits

2024-03-15 Thread Jonah Palmer
Add support for the VIRTIO_F_NOTIFICATION_DATA feature across a variety of vhost devices. The inclusion of VIRTIO_F_NOTIFICATION_DATA in the feature bits arrays for these devices ensures that the backend is capable of offering and providing support for this feature, and that it can be disabled if

[PATCH v3 for 9.1 0/6] virtio, vhost: Add VIRTIO_F_NOTIFICATION_DATA support

2024-03-15 Thread Jonah Palmer
The goal of these patches are to add support to a variety of virtio and vhost devices for the VIRTIO_F_NOTIFICATION_DATA transport feature. This feature indicates that a driver will pass extra data (instead of just a virtqueue's index) when notifying the corresponding device. The data passed in

[PATCH v3 for 9.1 4/6] virtio-ccw: Handle extra notification data

2024-03-15 Thread Jonah Palmer
Add support to virtio-ccw devices for handling the extra data sent from the driver to the device when the VIRTIO_F_NOTIFICATION_DATA transport feature has been negotiated. The extra data that's passed to the virtio-ccw device when this feature is enabled varies depending on the device's virtqueue

[PATCH v3 for 9.1 1/6] virtio/virtio-pci: Handle extra notification data

2024-03-15 Thread Jonah Palmer
Add support to virtio-pci devices for handling the extra data sent from the driver to the device when the VIRTIO_F_NOTIFICATION_DATA transport feature has been negotiated. The extra data that's passed to the virtio-pci device when this feature is enabled varies depending on the device's virtqueue

[PATCH v3 for 9.1 2/6] virtio: Prevent creation of device using notification-data with ioeventfd

2024-03-15 Thread Jonah Palmer
Prevent the realization of a virtio device that attempts to use the VIRTIO_F_NOTIFICATION_DATA transport feature without disabling ioeventfd. Due to ioeventfd not being able to carry the extra data associated with this feature, having both enabled is a functional mismatch and therefore Qemu

[PATCH v3 for 9.1 3/6] virtio-mmio: Handle extra notification data

2024-03-15 Thread Jonah Palmer
Add support to virtio-mmio devices for handling the extra data sent from the driver to the device when the VIRTIO_F_NOTIFICATION_DATA transport feature has been negotiated. The extra data that's passed to the virtio-mmio device when this feature is enabled varies depending on the device's

Re: [PATCH] scsi-generic: fix io_timeout property not applying

2024-03-15 Thread Alex Bennée
Lorenz Brun writes: > The io_timeout property, introduced in c9b6609 (part of 6.0) is > silently overwritten by the hardcoded default value of 30 seconds > (DEFAULT_IO_TIMEOUT) in scsi_generic_realize because that function is > being called after the properties have already been applied. > > The

Re: [PATCH v5 24/25] qapi: Tighten check whether implicit object type already exists

2024-03-15 Thread Philippe Mathieu-Daudé
On 15/3/24 16:23, Markus Armbruster wrote: Entities with names starting with q_obj_ are implicit object types. Therefore, QAPISchema._make_implicit_object_type()'s .lookup_entity() can only return a QAPISchemaObjectType. Assert that. Signed-off-by: Markus Armbruster ---

[PATCH] scsi-generic: fix io_timeout property not applying

2024-03-15 Thread Lorenz Brun
The io_timeout property, introduced in c9b6609 (part of 6.0) is silently overwritten by the hardcoded default value of 30 seconds (DEFAULT_IO_TIMEOUT) in scsi_generic_realize because that function is being called after the properties have already been applied. The property definition already has

Re: [RFC PATCH v3 3/3] migration: Add fd to FileMigrationArgs

2024-03-15 Thread Peter Xu
[I queued patch 1-2 into -stable, leaving this patch for further discussions] On Fri, Mar 15, 2024 at 08:55:42AM +, Daniel P. Berrangé wrote: > The 'file:' protocol eventually calls into qemu_open, and this > transparently allows for FD passing using /dev/fdset/NNN syntax > to pass in FDs.

[PATCH for-9.0 v3] vdpa-dev: Fix initialisation order to restore VDUSE compatibility

2024-03-15 Thread Kevin Wolf
VDUSE requires that virtqueues are first enabled before the DRIVER_OK status flag is set; with the current API of the kernel module, it is impossible to enable the opposite order in our block export code because userspace is not notified when a virtqueue is enabled. This requirement also mathces

Re: [PATCH for-9.0 v2] vdpa-dev: Fix initialisation order to restore VDUSE compatibility

2024-03-15 Thread Kevin Wolf
Am 15.03.2024 um 16:07 hat Stefano Garzarella geschrieben: > On Fri, Mar 15, 2024 at 03:03:31PM +0100, Kevin Wolf wrote: > > VDUSE requires that virtqueues are first enabled before the DRIVER_OK > > status flag is set; with the current API of the kernel module, it is > > impossible to enable the

[PATCH v5 11/25] qapi/schema: assert resolve_type has 'info' and 'what' args on error

2024-03-15 Thread Markus Armbruster
From: John Snow resolve_type() is generally used to resolve configuration-provided type names into type objects, and generally requires valid 'info' and 'what' parameters. In some cases, such as with QAPISchemaArrayType.check(), resolve_type may be used to resolve built-in types and as such

[PATCH v5 05/25] qapi: create QAPISchemaDefinition

2024-03-15 Thread Markus Armbruster
From: John Snow Include entities don't have names, but we generally expect "entities" to have names. Reclassify all entities with names as *definitions*, leaving the nameless include entities as QAPISchemaEntity instances. This is primarily to help simplify typing around expectations of what

[PATCH v5 23/25] qapi/schema: remove unnecessary asserts

2024-03-15 Thread Markus Armbruster
From: John Snow With strict typing enabled, these runtime statements aren't necessary anymore; we can prove them statically. Signed-off-by: John Snow Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 25 - 1 file changed, 25

[PATCH v5 20/25] qapi/parser.py: assert member.info is present in connect_member

2024-03-15 Thread Markus Armbruster
From: John Snow Signed-off-by: John Snow Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- scripts/qapi/parser.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 2f3c704fa2..7b13a583ac 100644 ---

[PATCH v5 17/25] qapi/schema: fix typing for QAPISchemaVariants.tag_member

2024-03-15 Thread Markus Armbruster
From: John Snow There are two related changes here: (1) We need to perform type narrowing for resolving the type of tag_member during check(), and (2) tag_member is a delayed initialization field, but we can hide it behind a property that raises an Exception if it's called too

[PATCH v5 22/25] qapi/schema: turn on mypy strictness

2024-03-15 Thread Markus Armbruster
From: John Snow This patch can be rolled in with the previous one once the series is ready for merge, but for work-in-progress' sake, it's separate here. Signed-off-by: John Snow Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- scripts/qapi/mypy.ini | 5 - 1 file

[PATCH v5 08/25] qapi/schema: make c_type() and json_type() abstract methods

2024-03-15 Thread Markus Armbruster
From: John Snow These methods should always return a str, it's only the default abstract implementation that doesn't. They can be marked "abstract", which requires subclasses to override the method with the proper return type. Signed-off-by: John Snow Reviewed-by: Markus Armbruster

[PATCH v5 03/25] qapi: sort pylint suppressions

2024-03-15 Thread Markus Armbruster
From: John Snow Suggested-by: Markus Armbruster Signed-off-by: John Snow Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- scripts/qapi/pylintrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc index

[PATCH v5 21/25] qapi/schema: add type hints

2024-03-15 Thread Markus Armbruster
From: John Snow This patch only adds type hints, which aren't utilized at runtime and don't change the behavior of this module in any way. In a scant few locations, type hints are removed where no longer necessary due to inference power from typing all of the rest of creation; and any type

[PATCH v5 25/25] qapi: Dumb down QAPISchema.lookup_entity()

2024-03-15 Thread Markus Armbruster
QAPISchema.lookup_entity() takes an optional type argument, a subtype of QAPISchemaDefinition, and returns that type or None. Callers can use this to save themselves an isinstance() test. The only remaining user of this convenience feature is .lookup_type(). But we don't actually save anything

[PATCH v5 14/25] qapi/schema: assert info is present when necessary

2024-03-15 Thread Markus Armbruster
From: John Snow QAPISchemaInfo arguments can often be None because built-in definitions don't have such information. The type hint can only be Optional[QAPISchemaInfo] then. But, mypy gets upset about all the places where we exploit that it can't actually be None there. Add assertions that

[PATCH v5 07/25] qapi/schema: declare type for QAPISchemaArrayType.element_type

2024-03-15 Thread Markus Armbruster
From: John Snow A QAPISchemaArrayType's element type gets resolved only during .check(). We have QAPISchemaArrayType.__init__() initialize self.element_type = None, and .check() assign the actual type. Using .element_type before .check() is wrong, and hopefully crashes due to the value being

[PATCH v5 09/25] qapi/schema: adjust type narrowing for mypy's benefit

2024-03-15 Thread Markus Armbruster
From: John Snow We already take care to perform some type narrowing for arg_type and ret_type, but not in a way where mypy can utilize the result once we add type hints, e.g.: qapi/schema.py:833: error: Incompatible types in assignment (expression has type "QAPISchemaType", variable has type

[PATCH v5 13/25] qapi/schema: fix QAPISchemaArrayType.check's call to resolve_type

2024-03-15 Thread Markus Armbruster
From: John Snow Adjust the expression at the callsite to work around mypy's weak type introspection that believes this expression can resolve to QAPISourceInfo; it cannot. (Fundamentally: self.info only resolves to false in a boolean expression when it is None; therefore this expression may

[PATCH v5 00/25] qapi: statically type schema.py

2024-03-15 Thread Markus Armbruster
v5: * PATCH 05: Move QAPISchemaDefinition.check()'s super().check() back to where it was in v3 * PATCH 12: Replaced, necessitating minor adjustments in PATCH 17+22 * PATCH 16: Tweak comment * PATCH 22: Tighten QAPISchema.lookup_entity()'s type hint * PATCH 24+25: New John Snow (22):

[PATCH v5 18/25] qapi/schema: assert inner type of QAPISchemaVariants in check_clash()

2024-03-15 Thread Markus Armbruster
From: John Snow QAPISchemaVariant's "variants" field is typed as List[QAPISchemaVariant], where the typing for QAPISchemaVariant allows its type field to be any QAPISchemaType. However, QAPISchemaVariant expects that all of its variants contain the narrower QAPISchemaObjectType. This

[PATCH v5 01/25] qapi/parser: fix typo - self.returns.info => self.errors.info

2024-03-15 Thread Markus Armbruster
From: John Snow Small copy-pasto. The correct info field to use in this conditional block is self.errors.info. Fixes: 3a025d3d1ffa Signed-off-by: John Snow Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- scripts/qapi/parser.py | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH v5 15/25] qapi/schema: add _check_complete flag

2024-03-15 Thread Markus Armbruster
From: John Snow Instead of using the None value for the members field, use a dedicated flag to detect recursive misconfigurations. This is intended to assist with subsequent patches that seek to remove the "None" value from the members field (which can never hold that value after the final call

[PATCH v5 06/25] qapi/schema: declare type for QAPISchemaObjectTypeMember.type

2024-03-15 Thread Markus Armbruster
From: John Snow A QAPISchemaObjectTypeMember's type gets resolved only during .check(). We have QAPISchemaObjectTypeMember.__init__() initialize self.type = None, and .check() assign the actual type. Using .type before .check() is wrong, and hopefully crashes due to the value being None.

[PATCH v5 19/25] qapi/parser: demote QAPIExpression to Dict[str, Any]

2024-03-15 Thread Markus Armbruster
From: John Snow Dict[str, object] is a stricter type, but with the way that code is currently arranged, it is infeasible to enforce this strictness. In particular, although expr.py's entire raison d'être is normalization and type-checking of QAPI Expressions, that type information is not

[PATCH v5 02/25] qapi/parser: shush up pylint

2024-03-15 Thread Markus Armbruster
From: John Snow Shhh! Signed-off-by: John Snow Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- scripts/qapi/parser.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index fed88e9074..ec4ebef4e3 100644 ---

[PATCH v5 16/25] qapi/schema: Don't initialize "members" with `None`

2024-03-15 Thread Markus Armbruster
From: John Snow Declare, but don't initialize the "members" field with type List[QAPISchemaObjectTypeMember]. This simplifies the typing from what would otherwise be Optional[List[T]] to merely List[T]. This removes the need to add assertions to several callsites that this value is not None -

[PATCH v5 24/25] qapi: Tighten check whether implicit object type already exists

2024-03-15 Thread Markus Armbruster
Entities with names starting with q_obj_ are implicit object types. Therefore, QAPISchema._make_implicit_object_type()'s .lookup_entity() can only return a QAPISchemaObjectType. Assert that. Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 3 ++- 1 file changed, 2 insertions(+), 1

[PATCH v5 04/25] qapi/schema: add pylint suppressions

2024-03-15 Thread Markus Armbruster
From: John Snow With this patch, pylint is happy with the file, so enable it in the configuration. Signed-off-by: John Snow Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- scripts/qapi/pylintrc | 5 - scripts/qapi/schema.py | 5 + 2 files changed, 5

[PATCH v5 12/25] qapi: Assert built-in types exist

2024-03-15 Thread Markus Armbruster
QAPISchema.lookup_type('FOO') returns a QAPISchemaType when type 'FOO' exists, else None. It won't return None for built-in types like 'int'. Since mypy can't see that, it'll complain that we assign the Optional[QAPISchemaType] returned by .lookup_type() to QAPISchemaType variables. Add

[PATCH v5 10/25] qapi/schema: add type narrowing to lookup_type()

2024-03-15 Thread Markus Armbruster
From: John Snow This function is a bit hard to type as-is; mypy needs some assertions to assist with the type narrowing. Signed-off-by: John Snow Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 4 +++- 1 file changed, 3 insertions(+), 1

Re: [PATCH for-9.0 v2] vdpa-dev: Fix initialisation order to restore VDUSE compatibility

2024-03-15 Thread Stefano Garzarella
On Fri, Mar 15, 2024 at 03:03:31PM +0100, Kevin Wolf wrote: VDUSE requires that virtqueues are first enabled before the DRIVER_OK status flag is set; with the current API of the kernel module, it is impossible to enable the opposite order in our block export code because userspace is not

Re: [PATCH v4 22/25] memory: Add Error** argument to memory_get_xlat_addr()

2024-03-15 Thread Peter Xu
On Wed, Mar 06, 2024 at 02:34:37PM +0100, Cédric Le Goater wrote: > Let the callers do the reporting. This will be useful in > vfio_iommu_map_dirty_notify(). > > Cc: "Michael S. Tsirkin" > Cc: Paolo Bonzini > Cc: David Hildenbrand > Signed-off-by: Cédric Le Goater Reviewed-by: Peter Xu --

Re: Another CXL/MMIO tcg tlb corner case

2024-03-15 Thread Jørgen Hansen
> On 15 Mar 2024, at 13.25, Alex Bennée wrote: > > Jørgen Hansen writes: > >> Hi, >> >> While doing some testing using numactl-based interleaving of application >> memory >> across regular memory and CXL-based memory using QEMU with tcg, I ran into an >> issue similar to what we saw a while

Re: [PATCH v4 10/25] migration: Add Error** argument to qemu_savevm_state_setup()

2024-03-15 Thread Peter Xu
On Fri, Mar 15, 2024 at 03:31:28PM +0100, Cédric Le Goater wrote: > On 3/15/24 14:11, Peter Xu wrote: > > On Fri, Mar 15, 2024 at 01:20:49PM +0100, Cédric Le Goater wrote: > > > +static void qemu_savevm_wait_unplug(MigrationState *s, int state) > > > > One more trivial comment: I'd even consider

Re: [PATCH v4 10/25] migration: Add Error** argument to qemu_savevm_state_setup()

2024-03-15 Thread Peter Xu
On Fri, Mar 15, 2024 at 03:21:27PM +0100, Cédric Le Goater wrote: > On 3/15/24 13:20, Cédric Le Goater wrote: > > On 3/15/24 12:01, Peter Xu wrote: > > > On Fri, Mar 15, 2024 at 11:17:45AM +0100, Cédric Le Goater wrote: > > > > > migrate_set_state is also unintuitive because it ignores invalid

[RFC] Is there a bug in pause_all_vcpus()

2024-03-15 Thread zhukeqian via
During we waited on qemu_pause_cond the bql was unlocked, the vcpu's state may has been changed by other thread, so we must request the pause state on all vcpus again. For example: Both main loop thread and vCPU thread are allowed to call pause_all_vcpus(), and in general resume_all_vcpus() is

Re: [PATCH v4 10/25] migration: Add Error** argument to qemu_savevm_state_setup()

2024-03-15 Thread Cédric Le Goater
On 3/15/24 14:11, Peter Xu wrote: On Fri, Mar 15, 2024 at 01:20:49PM +0100, Cédric Le Goater wrote: +static void qemu_savevm_wait_unplug(MigrationState *s, int state) One more trivial comment: I'd even consider dropping "state" altogether, as this should be the only state this function should

Re: [PATCH v4 10/25] migration: Add Error** argument to qemu_savevm_state_setup()

2024-03-15 Thread Cédric Le Goater
On 3/15/24 14:09, Peter Xu wrote: On Fri, Mar 15, 2024 at 01:20:49PM +0100, Cédric Le Goater wrote: On 3/15/24 12:01, Peter Xu wrote: On Fri, Mar 15, 2024 at 11:17:45AM +0100, Cédric Le Goater wrote: migrate_set_state is also unintuitive because it ignores invalid state transitions and we've

Re: [PATCH v3 1/7] qga: guest-get-fsinfo: add optional 'total-bytes-root' field

2024-03-15 Thread Andrey Drobyshev
On 3/15/24 15:44, Markus Armbruster wrote: > [?? ??? ? ?? ?? arm...@redhat.com. ???, ?? ??? ?, > ?? ?? https://aka.ms/LearnAboutSenderIdentification ] > > Andrey Drobyshev writes: > >> Since the commit 25b5ff1a86 ("qga: add mountpoint usage info to >>

Re: [PATCH v4 10/25] migration: Add Error** argument to qemu_savevm_state_setup()

2024-03-15 Thread Cédric Le Goater
On 3/15/24 13:20, Cédric Le Goater wrote: On 3/15/24 12:01, Peter Xu wrote: On Fri, Mar 15, 2024 at 11:17:45AM +0100, Cédric Le Goater wrote: migrate_set_state is also unintuitive because it ignores invalid state transitions and we've been using that property to deal with special states such

Re: [PATCH 03/12] uefi-test-tools: Add support for python based build script

2024-03-15 Thread Gerd Hoffmann
> +Build/bios-tables-test.%.efi: > + $(PYTHON) ../../roms/edk2-build.py --config uefi-test-build.config Adding '--match $*' will build one arch instead of all.

Re: [PATCH 02/12] uefi-test-tools/UefiTestToolsPkg: Add RISC-V support

2024-03-15 Thread Gerd Hoffmann
On Fri, Mar 15, 2024 at 06:35:09PM +0530, Sunil V L wrote: > Enable building the test application for RISC-V with appropriate > dependencies updated. > > Signed-off-by: Sunil V L > --- > tests/uefi-test-tools/UefiTestToolsPkg/UefiTestToolsPkg.dsc | 6 +- > 1 file changed, 5 insertions(+), 1

Re: [PATCH 01/12] roms/edk2-build.py: Add --module support

2024-03-15 Thread Gerd Hoffmann
On Fri, Mar 15, 2024 at 06:35:08PM +0530, Sunil V L wrote: > UefiTestToolsPkg which should use edk2-build.py needs --module parameter > support. Add this optional parameter handling. I don't think this is needed. By default everything listed in [Components] should be built, which is just that

[PATCH for-9.0 v2] vdpa-dev: Fix initialisation order to restore VDUSE compatibility

2024-03-15 Thread Kevin Wolf
VDUSE requires that virtqueues are first enabled before the DRIVER_OK status flag is set; with the current API of the kernel module, it is impossible to enable the opposite order in our block export code because userspace is not notified when a virtqueue is enabled. This requirement also mathces

  1   2   3   >