Re: [PATCH] migration/postcopy: Add latency distribution report for blocktime

2025-06-09 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote: > Add the latency distribution too for blocktime, using order-of-two buckets. > It accounts for all the faults, from either vCPU or non-vCPU threads. With > prior rework, it's very easy to achieve by adding an array to account for > faults in each buckets. >

Re: [PATCH 0/2] hw/loongarch/virt: Small enhancement about big endian host

2025-06-09 Thread gaosong
在 2025/6/4 下午5:05, Alireza Sanaee 写道: On Wed, 4 Jun 2025 14:55:00 +0800 Bibo Mao wrote: On big endian host machine such as S390, bios-table-test fails to run. And also linux kernel fails to boot. This patches solves these two issues. Bibo Mao (2): hw/loongarch/virt: Fix big endian support

[PATCH] hw/arm/npcm7xx_boards: Add support for specifying SPI flash model

2025-06-09 Thread Guenter Roeck
In some situations it is desirable to be able to specify the flash type connected to a board. For example, the target operating system may not support the default flash type, its support may be broken, or the qemu emulation is insufficient and the default flash is not detected. On top of that, the

[PATCH 3/3] vhost-user-blk: add an option to skip GET_VRING_BASE for force shutdown

2025-06-09 Thread Daniil Tatianin
If we have a server running disk requests that is for whatever reason hanging or not able to process any more IO requests but still has some in-flight requests previously issued by the guest OS, QEMU will still try to drain the vring before shutting down even if it was explicitly asked to do a "for

Re: [PATCH v2 08/13] migration/postcopy: Report fault latencies in blocktime

2025-06-09 Thread Peter Xu
On Mon, Jun 09, 2025 at 03:12:54PM -0400, Peter Xu wrote: > +static void migration_dump_blocktime(Monitor *mon, MigrationInfo *info) > +{ > +if (info->has_postcopy_blocktime) { > +monitor_printf(mon, "Postcopy Blocktime (ms): %" PRIu32 "\n", > + info->postcopy_bloc

[PATCH v2 10/13] migration/postcopy: Cache the tid->vcpu mapping for blocktime

2025-06-09 Thread Peter Xu
Looking up the vCPU index for each fault can be expensive when there're hundreds of vCPUs. Provide a cache for tid->vcpu instead with a hash table, then lookup from there. When at it, add another counter to record how many non-vCPU faults it gets. For example, the main thread can also access a gu

Re: [PATCH] hw/intc/loongarch_extioi: Fix typo issue about register EXTIOI_COREISR_END

2025-06-09 Thread gaosong
在 2025/6/5 下午5:28, Bibo Mao 写道: Interrupt controller extioi supports 256 vectors, register EXTIOI_COREISR records pending interrupt status with bitmap method. Size of EXTIOI_COREISR is 256 / 8 = 0x20 bytes, EXTIOI_COREISR_END should be EXTIOI_COREISR_START + 0x20 rather than 0xB20. Signed-off-by

Re: [PATCH v14 2/5] hw/cxl: Make the CXL fixed memory windows devices.

2025-06-09 Thread Itaru Kitayama
On Thu, May 29, 2025 at 04:08:01PM +0100, Jonathan Cameron wrote: > On Wed, 28 May 2025 12:07:23 +0100 > Jonathan Cameron wrote: > > > Previously these somewhat device like structures were tracked using a list > > in the CXLState in each machine. This is proving restrictive in a few > > cases wh

Re: [PATCH v2 08/13] migration/postcopy: Report fault latencies in blocktime

2025-06-09 Thread Peter Xu
On Mon, Jun 09, 2025 at 06:05:16PM -0400, Peter Xu wrote: > On Mon, Jun 09, 2025 at 03:12:54PM -0400, Peter Xu wrote: > > +static void migration_dump_blocktime(Monitor *mon, MigrationInfo *info) > > +{ > > +if (info->has_postcopy_blocktime) { > > +monitor_printf(mon, "Postcopy Blocktime

[PATCH] migration/postcopy: Add latency distribution report for blocktime

2025-06-09 Thread Peter Xu
Add the latency distribution too for blocktime, using order-of-two buckets. It accounts for all the faults, from either vCPU or non-vCPU threads. With prior rework, it's very easy to achieve by adding an array to account for faults in each buckets. Sample output for HMP (while for QMP it's simply

Re: [PATCH v2 08/13] migration/postcopy: Report fault latencies in blocktime

2025-06-09 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote: > Blocktime so far only cares about the time one vcpu (or the whole system) > got blocked. It would be also be helpful if it can also report the latency > of page requests, which could be very sensitive during postcopy. > > Blocktime itself is sometimes not v

Re: [PATCH v3 1/3] hw/riscv: add CVA6 machine

2025-06-09 Thread Alistair Francis
On Mon, Jun 9, 2025 at 11:19 PM Ben Dooks wrote: > > Add a (currently Genesy2 based) CVA6 machine. > > Has SPI and UART, the GPIO and Ethernet are currently black-holed > as there is no hardware model for them (lowRISC ethernet and Xilinx > GPIO) > > Signed-off-by: Ben Dooks > --- > v3: > - fix m

Re: [PATCH v3 2/3] target/riscv: add cva6 core type

2025-06-09 Thread Alistair Francis
On Mon, Jun 9, 2025 at 11:18 PM Ben Dooks wrote: > > Add TYPE_RISCV_CPU_CVA6 for the CVA6 core > > Signed-off-by: Ben Dooks Acked-by: Alistair Francis Alistair > --- > target/riscv/cpu-qom.h | 1 + > target/riscv/cpu.c | 11 +++ > 2 files changed, 12 insertions(+) > > diff --git

Re: [PATCH v3 3/3] hw/riscv: set cva6 to use TYPE_RISCV_CPU_CVA6

2025-06-09 Thread Alistair Francis
On Mon, Jun 9, 2025 at 11:20 PM Ben Dooks wrote: > > Change to using TYPE_RISCV_CPU_CVA6 once this is merged. You can also just change the patch order to not require this patch > > Signed-off-by: Ben Dooks Reviewed-by: Alistair Francis Alistair > --- > hw/riscv/cva6.c | 3 +-- > 1 file cha

[PATCH 0/3] vhost-user-blk: add an option to skip GET_VRING_BASE for force shutdown

2025-06-09 Thread Daniil Tatianin
This series aims to address SIGTERM/QMP quit() being a bit too graceful in respect to devices. Both of the aforementioned ways to stop QEMU completely bypass the guest OS so in that sense they're basically equal to pulling the power plug on a computer, yet the device shutdown code still tries to do

[PATCH 2/3] vhost: add a helper for force stopping a device

2025-06-09 Thread Daniil Tatianin
This adds an ability to skip GET_VRING_BASE during device stop entirely, and thus the expensive drain operation that this call entails as well, which may be useful during a non-graceful shutdown in case the guest operating system hangs or refuses to react to a previously requested ACPI shutdown for

[PATCH 1/3] softmmu/runstate: add a way to detect force shutdowns

2025-06-09 Thread Daniil Tatianin
This can be useful for devices that might take too long to shut down gracefully, but may have a way to shutdown quickly otherwise if needed or explicitly requested by a force shutdown. For now we only consider SIGTERM or the QMP quit() command a force shutdown, since those bypass the guest entirel

[PATCH] MAINTAINERS: Update the paths to the testing documentation files

2025-06-09 Thread Thomas Huth
From: Thomas Huth When the testing docs were moved to a separate subfolder, the entries in the MAINTAINERS file were missed. Update them now. Fixes: ff41da50308 ("docs/devel: Split testing docs from the build docs and move to separate folder") Signed-off-by: Thomas Huth --- MAINTAINERS | 15 +

Re: [PATCH] tests/vm/README: fix documentation path in tests/vm/README

2025-06-09 Thread Thomas Huth
On 07/06/2025 08.04, Haseung Bong wrote: From: "haseung.bong" The README file in tests/vm/ points to a non-existent file, docs/devel/testing.rst. Update the README to point to docs/devel/testing/main.rst, which now contains information about VM testing. Signed-off-by: Haseung Bong --- tests

Re: [PATCH V4 32/43] vfio/iommufd: invariant device name

2025-06-09 Thread Cédric Le Goater
On 5/29/25 21:24, Steve Sistare wrote: cpr-transfer will use the device name as a key to find the value of the device descriptor in new QEMU. However, if the descriptor number is specified by a command-line fd parameter, then vfio_device_get_name creates a name that includes the fd number. This

Re: [PATCH V4 35/43] vfio/iommufd: register container for cpr

2025-06-09 Thread Cédric Le Goater
On 6/9/25 22:47, Steven Sistare wrote: On 6/9/2025 4:30 PM, Cédric Le Goater wrote: On 5/29/25 21:24, Steve Sistare wrote: Register a vfio iommufd container and device for CPR, replacing the generic CPR register call with a more specific iommufd register call.  Add a blocker if the kernel does

Re: [PATCH V4 33/43] vfio/iommufd: add vfio_device_free_name

2025-06-09 Thread Cédric Le Goater
On 5/29/25 21:24, Steve Sistare wrote: Define vfio_device_free_name to free the name created by vfio_device_get_name. A subsequent patch will do more there. No functional change. Signed-off-by: Steve Sistare --- include/hw/vfio/vfio-device.h | 1 + hw/vfio/ap.c | 2 +- hw/

Re: [PATCH V4 36/43] migration: vfio cpr state hook

2025-06-09 Thread Cédric Le Goater
On 5/29/25 21:24, Steve Sistare wrote: Define a list of vfio devices in CPR state, in a subsection so that older QEMU can be live updated to this version. However, new QEMU will not be live updateable to old QEMU. This is acceptable because CPR is not yet commonly used, and updates to older ver

Re: [RFC PATCH v13 3/4] hw/vfio/ap: Storing event information for an AP configuration change event

2025-06-09 Thread Cédric Le Goater
On 6/9/25 18:44, Rorie Reyes wrote: These functions can be invoked by the function that handles interception of the CHSC SEI instruction for requests indicating the accessibility of one or more adjunct processors has changed. Signed-off-by: Rorie Reyes Reviewed-by: Anthony Krowiak --- hw/vfi

Re: [PATCH v2 3/4] block/copy-before-write: inverse access bitmap

2025-06-09 Thread Vladimir Sementsov-Ogievskiy
On 28.05.25 15:07, Andrey Zhadchenko wrote: HBitmaps allow us to search set bits pretty fast. On the contrary, when searching zeroes, we may be forced to fully traverse the lower level. When we run blockdev-backup with mode=full on top of snapshot filter + cbw filter, the job fills copy bitmap by

Re: [PATCH] hw/arm/smmuv3: Fix incorrect reserved mask for SMMU CR0 register

2025-06-09 Thread Peter Maydell
On Thu, 5 Jun 2025 at 03:26, wrote: > > From: Tao Tang > > The current definition of the SMMU_CR0_RESERVED mask is incorrect. > It mistakenly treats bit 10 (DPT_WALK_EN) as a reserved bit This is because our implementation pre-dates the revision of the SMMUv3 spec which adds the DPT and this DPT

Re: [PATCH v2 11/21] fuse: Rename length to blk_len in fuse_write()

2025-06-09 Thread Stefan Hajnoczi
On Wed, Jun 04, 2025 at 03:28:03PM +0200, Hanna Czenczek wrote: > The term "length" is ambiguous, use "blk_len" instead to be clear. > > Signed-off-by: Hanna Czenczek > --- > block/export/fuse.c | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) Reviewed-by: Stefan Hajnoczi

[PATCH 4/5] rust: qom: make ParentInit lifetime-invariant

2025-06-09 Thread Paolo Bonzini
This is the trick that allows the parent-field initializer to be used only for the object that it's meant to be initialized. This way, the owner of a MemoryRegion must be the object that embeds it. More information is in the comments; it's best explained with a simplified example. Signed-off-by:

Re: [PATCH 19/21] migration: Allow migrate commands to provide the migration config

2025-06-09 Thread Daniel P . Berrangé
On Mon, Jun 09, 2025 at 11:33:14AM -0400, Peter Xu wrote: > > Now I think I know part of what I've missed: I used to think the "config" > of per-QMP-migrate-command can be totally temporary for a specific > migration request, but then we need another MigrationState.parameters_2 to > cache the old

[PATCH 0/5] rust: make instance_init implementations use safe Rust

2025-06-09 Thread Paolo Bonzini
This is a step towards safe bindings to instance_init: making the implementation safe, though ensuring that *all* fields as initialized is still up to the implementor. This helps making it clear what we want from crates like pinned-init (the Linux one) or its inspiration pin-init. This series has

[PATCH 2/5] rust: hpet: fully initialize object after instance_init

2025-06-09 Thread Paolo Bonzini
The array of BqlRefCell is not initialized yet at the end of instance_init. In particular, the "state" field is NonNull and therefore it is invalid to have it as zero bytes. Note that MaybeUninit is necessary because assigning to self.timers[index] would trigger Drop of the old value. Signed-off

[PATCH 5/5] rust: qom: change instance_init to take a ParentInit<>

2025-06-09 Thread Paolo Bonzini
This removes undefined behavior associated to writing to uninitialized fields, and makes it possible to remove "unsafe" from the instance_init implementation. However, the init function itself is still unsafe, because it must promise (as a sort as MaybeUninit::assume_init) that all fields have bee

[PATCH 3/5] rust: qom: introduce ParentInit

2025-06-09 Thread Paolo Bonzini
This is a smart pointer for MaybeUninit; it can be upcasted to the already-initialized parent classes, or dereferenced to a MaybeUninit for the class that is being initialized. Signed-off-by: Paolo Bonzini --- rust/qemu-api/src/qom.rs | 86 +++- 1 file changed

[PATCH 1/5] rust: qemu_api: introduce MaybeUninit field projection

2025-06-09 Thread Paolo Bonzini
Add a macro that makes it possible to convert a MaybeUninit<> into another MaybeUninit<> for a single field within it. Furthermore, it is possible to use the resulting MaybeUninitField<> in APIs that take the parent object, such as memory_region_init_io(). This allows removing some of the undefin

Re: [PATCH] target/i386: KVM: add hack for Windows vCPU hotplug with SGX

2025-06-09 Thread Paolo Bonzini
On 6/9/25 15:23, Andrey Zhadchenko wrote: When hotplugging vCPUs to the Windows vms, we observed strange instance crash on Intel(R) Xeon(R) CPU E3-1230 v6: panic hyper-v: arg1='0x3e', arg2='0x46d359bbdff', arg3='0x56d359bbdff', arg4='0x0', arg5='0x0' Presumably, Windows thinks that hotplugged C

Re: [PATCH 19/21] migration: Allow migrate commands to provide the migration config

2025-06-09 Thread Daniel P . Berrangé
On Mon, Jun 09, 2025 at 11:51:17AM -0400, Peter Xu wrote: > On Mon, Jun 09, 2025 at 11:37:02AM -0300, Fabiano Rosas wrote: > > Peter Xu writes: > > > > > On Fri, Jun 06, 2025 at 05:23:18PM -0300, Fabiano Rosas wrote: > > >> Peter Xu writes: > > >> > > >> > On Mon, Jun 02, 2025 at 10:38:08PM -03

Re: [PATCH 0/2] docs: Avoid duplicate labels with a sphinx extn

2025-06-09 Thread Peter Maydell
Ping^2 on this one? -- PMM On Mon, 19 May 2025 at 15:32, Peter Maydell wrote: > > Ping? Any opinions on this? > > In the interim we've applied commit 82707dd4f0 to drop > the specific duplicate-label that is causing problems > right now, so patch 2 here will need the obvious trivial > update. Bu

[PATCH v2 10/11] migration: Rewrite the migration complete detect logic

2025-06-09 Thread Peter Xu
There're a few things off here in that logic, rewrite it. When at it, add rich comment to explain each of the decisions. Since this is very sensitive path for migration, below are the list of things changed with their reasonings. (1) Exact pending size is only needed for precopy not postcopy

[PATCH v2 01/11] migration/hmp: Reorg "info migrate" once more

2025-06-09 Thread Peter Xu
Dave suggested the HMP output for "info migrate" can not only leverage the lines but also better grouping: https://lore.kernel.org/r/aC4_-nMc7FwsMf9p@gallifrey I followed Dave's suggestion, and some more modifications on top: - Added all elements into the picture - Use size_to_str() and d

[PATCH v2 06/11] migration: Rename save_live_complete_precopy to save_complete

2025-06-09 Thread Peter Xu
Now after merging the precopy and postcopy version of complete() hook, rename the precopy version from save_live_complete_precopy() to save_complete(). Dropping the "live" when at it, because it's in most cases not live when happening (in precopy). No functional change intended. Signed-off-by: P

[PATCH v2 08/11] migration/ram: One less indent for ram_find_and_save_block()

2025-06-09 Thread Peter Xu
The check over PAGE_DIRTY_FOUND isn't necessary. We could indent one less and assert that instead. Reviewed-by: Juraj Marcin Signed-off-by: Peter Xu --- migration/ram.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/migration/ram.c b/migration/ram.c in

[PATCH v2 09/11] migration/ram: Add tracepoints for ram_save_complete()

2025-06-09 Thread Peter Xu
Take notes on start/end state of dirty pages for the whole system. Reviewed-by: Juraj Marcin Signed-off-by: Peter Xu --- migration/ram.c| 5 + migration/trace-events | 1 + 2 files changed, 6 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index c66ad3cf8b..a1d0e8ada2

[PATCH v2 04/11] migration/bg-snapshot: Do not check for SKIP in iterator

2025-06-09 Thread Peter Xu
It's not possible to happen in bg-snapshot case. Reviewed-by: Juraj Marcin Signed-off-by: Peter Xu --- migration/migration.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4098870bce..e33e39ac74 100644 --- a/migration

Re: [PATCH 19/21] migration: Allow migrate commands to provide the migration config

2025-06-09 Thread Daniel P . Berrangé
On Mon, Jun 09, 2025 at 11:53:47AM -0400, Peter Xu wrote: > On Mon, Jun 09, 2025 at 04:43:40PM +0100, Daniel P. Berrangé wrote: > > On Mon, Jun 09, 2025 at 11:33:14AM -0400, Peter Xu wrote: > > > > > > Now I think I know part of what I've missed: I used to think the "config" > > > of per-QMP-migra

[PATCH v2 00/11] migration: Some enhancements and cleanups for 10.1

2025-06-09 Thread Peter Xu
v2: - Collected R-bs - Avoid using "\b" in HMP dumps [Markus, Dave] The series is based on a small patch from Yanfei Xu here: Based-on: <20250514115827.3216082-1-yanfei...@bytedance.com> https://lore.kernel.org/r/20250514115827.3216082-1-yanfei...@bytedance.com This is a series that collected ma

[PATCH v2 02/11] migration/hmp: Fix postcopy-blocktime per-vCPU results

2025-06-09 Thread Peter Xu
Unfortunately, it was never correctly shown.. This is only found when I started to look into making the blocktime feature more useful (so as to avoid using bpftrace, even though I'm not sure which one will be harder to use..). So the old dump would look like this: Postcopy vCPU Blocktime: 0-1,

[PATCH v2 11/11] migration/postcopy: Avoid clearing dirty bitmap for postcopy too

2025-06-09 Thread Peter Xu
This is a follow up on the other commit "migration/ram: avoid to do log clear in the last round" but for postcopy. https://lore.kernel.org/r/20250514115827.3216082-1-yanfei...@bytedance.com I can observe more than 10% reduction of average page fault latency during postcopy phase with this optimiz

[PATCH v2 05/11] migration: Drop save_live_complete_postcopy hook

2025-06-09 Thread Peter Xu
The hook is only defined in two vmstate users ("ram" and "block dirty bitmap"), meanwhile both of them define the hook exactly the same as the precopy version. Hence, this postcopy version isn't needed. No functional change intended. Signed-off-by: Peter Xu --- include/migration/register.h |

[PATCH v2 07/11] migration: qemu_savevm_complete*() helpers

2025-06-09 Thread Peter Xu
Since we use the same save_complete() hook for both precopy and postcopy, add a set of helpers to invoke the hook() to dedup the code. Signed-off-by: Peter Xu --- migration/savevm.c | 78 ++ 1 file changed, 44 insertions(+), 34 deletions(-) diff --git

[PATCH v2 03/11] migration/docs: Move docs for postcopy blocktime feature

2025-06-09 Thread Peter Xu
Move it out of vanilla postcopy session, but instead a standalone feature. When at it, removing the NOTE because it's incorrect now after introduction of max-postcopy-bandwidth, which can control the throughput even for postcopy phase. Reviewed-by: Juraj Marcin Signed-off-by: Peter Xu --- docs/

Re: [PATCH v2 18/21] fuse: Implement multi-threading

2025-06-09 Thread Stefan Hajnoczi
On Wed, Jun 04, 2025 at 03:28:10PM +0200, Hanna Czenczek wrote: > FUSE allows creating multiple request queues by "cloning" /dev/fuse FDs > (via open("/dev/fuse") + ioctl(FUSE_DEV_IOC_CLONE)). > > We can use this to implement multi-threading. > > For configuration, we don't need any more informat

Re: [PATCH v2 00/21] export/fuse: Use coroutines and multi-threading

2025-06-09 Thread Stefan Hajnoczi
On Wed, Jun 04, 2025 at 03:27:52PM +0200, Hanna Czenczek wrote: > Hi, > > This series: > - Fixes some bugs/minor inconveniences, > - Removes libfuse from the request processing path, > - Make the FUSE export use coroutines for request handling, > - Introduces multi-threading into the FUSE export.

Re: [PATCH v2 20/21] iotests/308: Add multi-threading sanity test

2025-06-09 Thread Stefan Hajnoczi
On Wed, Jun 04, 2025 at 03:28:12PM +0200, Hanna Czenczek wrote: > Run qemu-img bench on a simple multi-threaded FUSE export to test that > it works. > > Signed-off-by: Hanna Czenczek > --- > tests/qemu-iotests/308 | 51 ++ > tests/qemu-iotests/308.out | 56 +++

Re: [PATCH 19/21] migration: Allow migrate commands to provide the migration config

2025-06-09 Thread Fabiano Rosas
Peter Xu writes: > (I had a reply in the other thread, that might have covered most of the > points but maybe not this one..) > > On Mon, Jun 09, 2025 at 05:13:00PM +0100, Daniel P. Berrangé wrote: >> Even if only a single mgmt app is involved this is still beneficial >> because the migration in

[PATCH] utils/log: add qemu_log_timestamp() to encapsulate timestamp logging

2025-06-09 Thread Tanish Desai
Moved the logic for timestamped logging (~6 lines) from a_nocheck__trace_foo(header) into a new qemu_log_timestamp() function in util/log.c. This avoids code duplication across binaries and enables reuse as a standalone utility. Encapsulation helps reduce build size significantly, particularly w

Re: [PATCH] utils/log: add qemu_log_timestamp() to encapsulate timestamp logging

2025-06-09 Thread Tanish Desai
Two files are attached to show the folder-wise size (in bytes) before and after the change. Each file lists the folder names along with their corresponding sizes. On Mon, Jun 9, 2025 at 11:51 PM Tanish Desai wrote: > Moved the logic for timestamped logging (~6 lines) from > a_nocheck__trace_foo(

Re: [PATCH 2/3] trace/ftrace: seperate cold paths of tracing functions

2025-06-09 Thread Stefan Hajnoczi
On Thu, Jun 5, 2025 at 2:49 PM Paolo Bonzini wrote: > > On 6/5/25 20:37, Stefan Hajnoczi wrote: > > On Thu, Jun 5, 2025 at 9:57 AM Paolo Bonzini wrote: > >>> It's easier to understand the code generator and the generated code when > >>> each trace event is implemented as a single function in the

Re: [PATCH] utils/log: add qemu_log_timestamp() to encapsulate timestamp logging

2025-06-09 Thread Stefan Hajnoczi
On Mon, Jun 9, 2025 at 2:21 PM Tanish Desai wrote: > > Moved the logic for timestamped logging (~6 lines) from > a_nocheck__trace_foo(header) into a new qemu_log_timestamp() function in > util/log.c. This avoids code duplication across binaries and enables reuse as > a standalone utility. > Enc

[PATCH v2 04/13] migration/postcopy: Make all blocktime vars 64bits

2025-06-09 Thread Peter Xu
I am guessing it was used to be 32bits because of the atomic ops. Now all the atomic ops are gone and we're protected by a mutex instead, it's ok we can switch to 64 bits. Reasons to move over: - Allow further patches to change the unit from ms to us: with postcopy preempt mode, we're really

[PATCH v2 08/13] migration/postcopy: Report fault latencies in blocktime

2025-06-09 Thread Peter Xu
Blocktime so far only cares about the time one vcpu (or the whole system) got blocked. It would be also be helpful if it can also report the latency of page requests, which could be very sensitive during postcopy. Blocktime itself is sometimes not very important, especially when one thinks about

[PATCH v2 11/13] migration/postcopy: Cleanup the total blocktime accounting

2025-06-09 Thread Peter Xu
The variable vcpu_total_blocktime isn't easy to follow. In reality, it wants to capture the case where all vCPUs are stopped, and now there will be some vCPUs starts running. The name now starts to conflict with vcpu_blocktime_total[], meanwhile it's actually not necessary to have the variable at

[PATCH v2 03/13] migration/postcopy: Drop all atomic ops in blocktime feature

2025-06-09 Thread Peter Xu
Now with the mutex protection it's not needed anymore. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu --- migration/postcopy-ram.c | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 32fa06da

[PATCH v2 05/13] migration/postcopy: Drop PostcopyBlocktimeContext.start_time

2025-06-09 Thread Peter Xu
Now with 64bits, the offseting using start_time is not needed anymore, because the array can always remember the whole timestamp. Then drop the unused parameter in get_low_time_offset() altogether. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu --- migration/postcopy-ram.c | 10 --

[PATCH v2 06/13] migration/postcopy: Bring blocktime layer to us level

2025-06-09 Thread Peter Xu
With 64-bit fields, it is trivial. The caution is when exposing any values in QMP, it was still declared with milliseconds (ms). Hence it's needed to do the convertion when exporting the values to existing QMP queries. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu --- migration/postcopy-

[PATCH v10 2/8] plugins: Add register write API

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart ---

[PATCH v10 4/8] plugins: Add memory virtual address write API

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds functions to the plugins API to allow reading and writing memory via virtual addresses. These functions only permit doing so on the current CPU, because there is no way to ensure consistency if plugins are allowed to read or write to other CPUs that aren't current

[PATCH v10 8/8] plugins: Update plugin version and add notes

2025-06-09 Thread Rowan Hart
From: novafacing This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/

[PATCH v10 7/8] plugins: Add hypercalls plugin and test

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds a plugin that implements a simple form of hypercalls from guest code to the plugin by using the register read API. It accepts only one hypercall, which writes a magic value to guest memory. Signed-off-by: Rowan Hart --- tests/tcg/Makefile.target

[PATCH v10 5/8] plugins: Add memory hardware address read/write API

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds functions to the plugins API to allow plugins to read and write memory via hardware addresses. The functions use the current address space of the current CPU in order to avoid exposing address space information to users. A later patch may want to add a function to

[PATCH v2 02/13] migration/postcopy: Push blocktime start/end into page req mutex

2025-06-09 Thread Peter Xu
The postcopy blocktime feature was tricky that it used quite some atomic operations over quite a few arrays and vars, without explaining how that would be thread safe. The thread safety here is about concurrency between the fault thread and the fault resolution threads, possible to access the same

[PATCH v2 13/13] migration/postcopy: blocktime allows track / report non-vCPU faults

2025-06-09 Thread Peter Xu
When used to report page fault latencies, the blocktime feature can be almost useless when KVM async page fault is enabled, because in most cases such remote fault will kickoff async page faults, then it's not trackable from blocktime layer. After all these recent rewrites to blocktime layer, it's

[PATCH v11 7/8] plugins: Add hypercalls plugin and test

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds a plugin that implements a simple form of hypercalls from guest code to the plugin by using the register read API. It accepts only one hypercall, which writes a magic value to guest memory. Signed-off-by: Rowan Hart --- tests/tcg/Makefile.target

[PATCH v11 5/8] plugins: Add memory hardware address read/write API

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds functions to the plugins API to allow plugins to read and write memory via hardware addresses. The functions use the current address space of the current CPU in order to avoid exposing address space information to users. A later patch may want to add a function to

[PATCH v11 0/8] Add additional plugin API functions to read and write memory and registers

2025-06-09 Thread Rowan Hart
This patch series adds several new API functions focused on enabling use cases around reading and writing guest memory from QEMU plugins. To support these new APIs, some utility functionality around retrieving information about address spaces is added as well. The new qemu_plugin_write_register ut

[PATCH v11 8/8] plugins: Update plugin version and add notes

2025-06-09 Thread Rowan Hart
From: novafacing This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/

Re: [PATCH 19/21] migration: Allow migrate commands to provide the migration config

2025-06-09 Thread Fabiano Rosas
Peter Xu writes: > On Mon, Jun 09, 2025 at 03:02:06PM -0300, Fabiano Rosas wrote: >> Peter Xu writes: >> >> > On Mon, Jun 09, 2025 at 11:37:02AM -0300, Fabiano Rosas wrote: >> >> Peter Xu writes: >> >> >> >> > On Fri, Jun 06, 2025 at 05:23:18PM -0300, Fabiano Rosas wrote: >> >> >> Peter Xu w

Re: [PATCH v9 0/9] Add additional plugin API functions to read and write memory and registers

2025-06-09 Thread Rowan Hart
I've addressed comments by Alex and Julian WRT the new restrictions on flags for calling qemu_plugin_read/write_register by relaxing those restrictions using the same system for setting and getting the current flag state, and adding a set/clear before each callback invocation. Please check htt

Re: [PATCH 19/21] migration: Allow migrate commands to provide the migration config

2025-06-09 Thread Peter Xu
On Mon, Jun 09, 2025 at 03:02:06PM -0300, Fabiano Rosas wrote: > Peter Xu writes: > > > On Mon, Jun 09, 2025 at 11:37:02AM -0300, Fabiano Rosas wrote: > >> Peter Xu writes: > >> > >> > On Fri, Jun 06, 2025 at 05:23:18PM -0300, Fabiano Rosas wrote: > >> >> Peter Xu writes: > >> >> > >> >> > On

Re: [PATCH 1/4] python: update requirements for Sphinx

2025-06-09 Thread John Snow
On Sun, Jun 8, 2025 at 1:26 AM Akihiko Odaki wrote: > On 2025/06/07 5:50, John Snow wrote: > > In advance of actually bumping the build system requirements for Sphinx, > > bump the version used for the static analysis tests. Update the minimum > > requirements accordingly. > > > > This changes th

[PATCH v2 07/13] migration/postcopy: Add blocktime fault counts per-vcpu

2025-06-09 Thread Peter Xu
Add a field to count how many remote faults one vCPU has taken. So far it's still not used, but will be soon. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu --- migration/postcopy-ram.c | 5 + 1 file changed, 5 insertions(+) diff --git a/migration/postcopy-ram.c b/migration/postcopy-r

[PATCH v10 0/8] Add additional plugin API functions to read and write memory and registers

2025-06-09 Thread Rowan Hart
This patch series adds several new API functions focused on enabling use cases around reading and writing guest memory from QEMU plugins. To support these new APIs, some utility functionality around retrieving information about address spaces is added as well. The new qemu_plugin_write_register ut

[PATCH v10 1/8] gdbstub: Expose gdb_write_register function to consumers of gdbstub

2025-06-09 Thread Rowan Hart
From: novafacing This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Reviewed-by: Alex Bennée Reviewed-by: Julian Ganz Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- g

[PATCH v10 6/8] plugins: Add patcher plugin and test

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds a plugin that exercises the virtual and hardware memory read-write API functions added in a previous patch. The plugin takes a target and patch byte sequence, and will overwrite any instruction matching the target byte sequence with the patch. Signed-off-by: Rowa

[PATCH v2 01/13] migration: Add option to set postcopy-blocktime

2025-06-09 Thread Peter Xu
Add a global property to allow enabling postcopy-blocktime feature. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu --- migration/options.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/options.c b/migration/options.c index 162c72cda4..4e923a2e07 100644 --- a/migration/opti

[PATCH v2 12/13] migration/postcopy: Optimize blocktime fault tracking with hashtable

2025-06-09 Thread Peter Xu
Currently, the postcopy blocktime feature maintains vCPU fault information using an array (vcpu_addr[]). It has two issues. Issue 1: Performance Concern The old algorithm was almost OK and fast on inserts, except that the lookup is slow and won't scale if there are a

[PATCH v10 3/8] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-09 Thread Rowan Hart
This patch adds functionality to enforce the requested QEMU_PLUGIN_CB_ flags level passed when registering a callback function using the plugins API. Each time a callback is about to be invoked, a thread-local variable will be updated with the level that callback requested. Then, called API functio

[PATCH v2 00/13] migration/postcopy: Blocktime tracking overhaul

2025-06-09 Thread Peter Xu
This series is based on the other series I posted here: Based-on: <20250609161855.6603-1-pet...@redhat.com> https://lore.kernel.org/r/20250609161855.6603-1-pet...@redhat.com v2: - Collect tags - Use two spaces always in qapi/ documentations for patch 8/13 [Markus] - English error fix (s/system-wi

[PATCH v11 2/8] plugins: Add register write API

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart ---

Embed QEMU terminal into GUI application (Cubic - Custom Ubuntu ISO Creator)

2025-06-09 Thread PJ Singh
Hello Everyone, I want to embed a QEMU window directly in my GUI application. Are Python APIs available to embed QEMU into a GNOME GUI application? I am the developer of Cubic (Custom Ubuntu ISO Creator), a tool which allows users to customize Ubuntu and Debian based Live ISOs. Screenshots & inf

[PATCH v11 1/8] gdbstub: Expose gdb_write_register function to consumers of gdbstub

2025-06-09 Thread Rowan Hart
From: novafacing This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Reviewed-by: Alex Bennée Reviewed-by: Julian Ganz Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- g

[PATCH v11 4/8] plugins: Add memory virtual address write API

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds functions to the plugins API to allow reading and writing memory via virtual addresses. These functions only permit doing so on the current CPU, because there is no way to ensure consistency if plugins are allowed to read or write to other CPUs that aren't current

[PATCH v11 6/8] plugins: Add patcher plugin and test

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds a plugin that exercises the virtual and hardware memory read-write API functions added in a previous patch. The plugin takes a target and patch byte sequence, and will overwrite any instruction matching the target byte sequence with the patch. Signed-off-by: Rowa

[PATCH v11 3/8] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-09 Thread Rowan Hart
This patch adds functionality to enforce the requested QEMU_PLUGIN_CB_ flags level passed when registering a callback function using the plugins API. Each time a callback is about to be invoked, a thread-local variable will be updated with the level that callback requested. Then, called API functio

Re: [PATCH v10 0/8] Add additional plugin API functions to read and write memory and registers

2025-06-09 Thread Rowan Hart
I forgot one additional update here that was necessary because the plugin_cb_flags getter/setters are now on the hot path and need inlining, and left a typo, both of which I fixed in v11 (https://lore.kernel.org/qemu-devel/20250609193841.348076-1-rowanbh...@gmail.com/T/#t). On 6/9/25 12:23 P

[PATCH v2 09/13] migration/postcopy: Initialize blocktime context only until listen

2025-06-09 Thread Peter Xu
Before this patch, the blocktime context can be created very early, because postcopy_ram_supported_by_host() <- migrate_caps_check() can happen during migration object init. The trick here is the blocktime context needs system vCPU information, which seems to be possible to change after that point

Re: [PATCH 2/3] trace/ftrace: seperate cold paths of tracing functions

2025-06-09 Thread Paolo Bonzini
Il lun 9 giu 2025, 20:27 Stefan Hajnoczi ha scritto: > > If you disagree with this change we can certainly live without them---I > > asked Tanish to start with this as an exercise to get familiar with > > tracetool, and he's learnt a bunch of things around git anyway so it's > > all good. > > A m

Re: [PATCH 19/21] migration: Allow migrate commands to provide the migration config

2025-06-09 Thread Peter Xu
On Mon, Jun 09, 2025 at 11:37:02AM -0300, Fabiano Rosas wrote: > Peter Xu writes: > > > On Fri, Jun 06, 2025 at 05:23:18PM -0300, Fabiano Rosas wrote: > >> Peter Xu writes: > >> > >> > On Mon, Jun 02, 2025 at 10:38:08PM -0300, Fabiano Rosas wrote: > >> >> Allow the migrate and migrate_incoming

Re: [PATCH 19/21] migration: Allow migrate commands to provide the migration config

2025-06-09 Thread Peter Xu
On Mon, Jun 09, 2025 at 04:43:40PM +0100, Daniel P. Berrangé wrote: > On Mon, Jun 09, 2025 at 11:33:14AM -0400, Peter Xu wrote: > > > > Now I think I know part of what I've missed: I used to think the "config" > > of per-QMP-migrate-command can be totally temporary for a specific > > migration req

Re: [PATCH 19/21] migration: Allow migrate commands to provide the migration config

2025-06-09 Thread Peter Xu
On Mon, Jun 09, 2025 at 11:53:47AM -0400, Peter Xu wrote: > On Mon, Jun 09, 2025 at 04:43:40PM +0100, Daniel P. Berrangé wrote: > > On Mon, Jun 09, 2025 at 11:33:14AM -0400, Peter Xu wrote: > > > > > > Now I think I know part of what I've missed: I used to think the "config" > > > of per-QMP-migra

[RFC PATCH qemu 3/5] hw/cxl/i2c_mctp_cxl: Initial device emulation

2025-06-09 Thread Jonathan Cameron via
The CCI and Fabric Manager APIs are used to configure CXL switches and devices. DMTF has defined an MCTP binding specification to carry these messages. The end goal of this work is to hook this up to emulated CXL switches and devices to allow control of the configuration. Since this relies on i2c

  1   2   3   >