[PATCH 2/4] reset: Add RESET_TYPE_WAKEUP

2024-08-06 Thread Juraj Marcin
Some devices need to distinguish cold start reset from waking up from a suspended state. This patch adds new value to the enum, and updates the i386 wakeup method to use this new reset type. Signed-off-by: Juraj Marcin --- docs/devel/reset.rst| 7 +++ hw/i386/pc.c| 2

[PATCH 0/4] virtio-mem: Implement support for suspend+wake-up with plugged memory

2024-08-06 Thread Juraj Marcin
device can access the reset type in the hold phase. The last patch of the series implements the final support in the hold phase of the virtio-mem reset callback and exposes VIRTIO_MEM_F_PERSISTENT_SUSPEND to the kernel. [1]: https://lore.kernel.org/all/20240318120645.105664-1-da...@redhat.com/ Juraj

[PATCH 1/4] reset: Use ResetType for qemu_devices_reset() and MachineClass->reset()

2024-08-06 Thread Juraj Marcin
ype instead. Signed-off-by: Juraj Marcin --- hw/arm/aspeed.c| 4 ++-- hw/arm/mps2-tz.c | 4 ++-- hw/core/reset.c| 7 ++- hw/hppa/machine.c | 4 ++-- hw/i386/microvm.c | 4 ++-- hw/i386/pc.c | 6 +++--- hw/ppc/pegasos

[PATCH 4/4] virtio-mem: Add support for suspend+wake-up with plugged memory

2024-08-06 Thread Juraj Marcin
feature is not exposed by QEMU. This patch adds the code to skip the reset on wake-up and exposes theVIRTIO_MEM_F_PERSISTENT_SUSPEND feature to the guest kernel driver when suspending is possible in QEMU (currently only x86). Signed-off-by: Juraj Marcin --- hw/virtio/virtio-mem.c | 10

[PATCH 3/4] virtio-mem: Implement Resettable interface instead of using LegacyReset

2024-08-06 Thread Juraj Marcin
list, implements the necessary methods and replaces qemu_[un]register_reset() calls with qemu_[un]register_resettable(). Signed-off-by: Juraj Marcin --- hw/virtio/virtio-mem.c | 39 ++ include/hw/virtio/virtio-mem.h | 4 2 files changed, 29 insertions

Re: [PATCH 1/4] reset: Use ResetType for qemu_devices_reset() and MachineClass->reset()

2024-08-07 Thread Juraj Marcin
On Tue, Aug 6, 2024 at 6:40 PM David Hildenbrand wrote: > > On 06.08.24 18:07, Juraj Marcin wrote: > > Currently, both qemu_devices_reset() and MachineClass->reset() use > > ShutdownCause for the reason of the reset. However, the Resettable > > interface uses ResetState

Re: [PATCH 2/4] reset: Add RESET_TYPE_WAKEUP

2024-08-08 Thread Juraj Marcin
On Thu, Aug 8, 2024 at 2:18 PM Peter Maydell wrote: > > On Tue, 6 Aug 2024 at 17:08, Juraj Marcin wrote: > > > > Some devices need to distinguish cold start reset from waking up from a > > suspended state. This patch adds new value to the enum, and updates the > >

Re: [PATCH 3/4] virtio-mem: Implement Resettable interface instead of using LegacyReset

2024-08-09 Thread Juraj Marcin
On Thu, Aug 8, 2024 at 5:47 PM Peter Maydell wrote: > > On Thu, 8 Aug 2024 at 13:37, David Hildenbrand wrote: > > > > On 08.08.24 14:25, Peter Maydell wrote: > > > On Tue, 6 Aug 2024 at 17:08, Juraj Marcin wrote: > > >> > > >> LegacyReset d

[PATCH v2 1/4] reset: Use ResetType for qemu_devices_reset() and MachineClass::reset()

2024-08-13 Thread Juraj Marcin
instead. Signed-off-by: Juraj Marcin Reviewed-by: David Hildenbrand Reviewed-by: Peter Maydell --- hw/arm/aspeed.c| 4 ++-- hw/arm/mps2-tz.c | 4 ++-- hw/core/reset.c| 5 + hw/hppa/machine.c | 4 ++-- hw/i386/microvm.c | 4 ++-- hw/i386

[PATCH v2 4/4] virtio-mem: Add support for suspend+wake-up with plugged memory

2024-08-13 Thread Juraj Marcin
feature is not exposed by QEMU. This patch adds the code to skip the reset on wake-up and exposes theVIRTIO_MEM_F_PERSISTENT_SUSPEND feature to the guest kernel driver when suspending is possible in QEMU (currently only x86). Signed-off-by: Juraj Marcin Reviewed-by: David Hildenbrand --- hw

[PATCH v2 0/4] virtio-mem: Implement support for suspend+wake-up with plugged memory

2024-08-13 Thread Juraj Marcin
: - Removed unnecessary include directives changes - Updated RESET_TYPE_WAKEUP documentation - Removed unnecessary interface from VirtIOMEMClass type info Juraj Marcin (4): reset: Use ResetType for qemu_devices_reset() and MachineClass::reset() reset: Add RESET_TYPE_WAKEUP virtio-mem: Use new

[PATCH v2 2/4] reset: Add RESET_TYPE_WAKEUP

2024-08-13 Thread Juraj Marcin
Some devices need to distinguish cold start reset from waking up from a suspended state. This patch adds new value to the enum, and updates the i386 wakeup method to use this new reset type. Signed-off-by: Juraj Marcin Reviewed-by: David Hildenbrand --- docs/devel/reset.rst| 8 hw

[PATCH v2 3/4] virtio-mem: Use new Resettable framework instead of LegacyReset

2024-08-13 Thread Juraj Marcin
to use the new Resettable framework and replaces qemu_[un]register_reset() calls with qemu_[un]register_resettable(). Signed-off-by: Juraj Marcin Reviewed-by: David Hildenbrand --- hw/virtio/virtio-mem.c | 38 +- include/hw/virtio/virtio-mem.h | 4

Re: [PATCH v2 2/4] reset: Add RESET_TYPE_WAKEUP

2024-08-14 Thread Juraj Marcin
On Tue, Aug 13, 2024 at 6:37 PM Peter Maydell wrote: > > On Tue, 13 Aug 2024 at 16:39, Juraj Marcin wrote: > > > > Some devices need to distinguish cold start reset from waking up from a > > suspended state. This patch adds new value to the enum, and updates the >

Re: [PATCH v2 2/4] reset: Add RESET_TYPE_WAKEUP

2024-08-28 Thread Juraj Marcin
Hi Peter, On Tue, Aug 20, 2024 at 1:56 PM Peter Maydell wrote: > > On Tue, 20 Aug 2024 at 12:40, David Hildenbrand wrote: > > > > On 14.08.24 14:32, Juraj Marcin wrote: > > > On Tue, Aug 13, 2024 at 6:37 PM Peter Maydell > > > wrote: > > >> &

[PATCH v3 0/4] virtio-mem: Implement support for suspend+wake-up with plugged memory

2024-09-04 Thread Juraj Marcin
VirtIOMEMClass type info Juraj Marcin (4): reset: Use ResetType for qemu_devices_reset() and MachineClass::reset() reset: Add RESET_TYPE_WAKEUP virtio-mem: Use new Resettable framework instead of LegacyReset virtio-mem: Add support for suspend+wake-up with plugged memory docs/devel/reset.rst

[PATCH v3 2/4] reset: Add RESET_TYPE_WAKEUP

2024-09-04 Thread Juraj Marcin
Some devices need to distinguish cold start reset from waking up from a suspended state. This patch adds new value to the enum, and updates the i386 wakeup method to use this new reset type. Signed-off-by: Juraj Marcin Reviewed-by: David Hildenbrand --- docs/devel/reset.rst| 11

[PATCH v3 1/4] reset: Use ResetType for qemu_devices_reset() and MachineClass::reset()

2024-09-04 Thread Juraj Marcin
instead. Signed-off-by: Juraj Marcin Reviewed-by: David Hildenbrand Reviewed-by: Peter Maydell --- hw/arm/aspeed.c| 4 ++-- hw/arm/mps2-tz.c | 4 ++-- hw/core/reset.c| 5 + hw/hppa/machine.c | 4 ++-- hw/i386/microvm.c | 4 ++-- hw/i386

[PATCH v3 3/4] virtio-mem: Use new Resettable framework instead of LegacyReset

2024-09-04 Thread Juraj Marcin
to use the new Resettable framework and replaces qemu_[un]register_reset() calls with qemu_[un]register_resettable(). Signed-off-by: Juraj Marcin Reviewed-by: David Hildenbrand --- hw/virtio/virtio-mem.c | 38 +- include/hw/virtio/virtio-mem.h | 4

[PATCH v3 4/4] virtio-mem: Add support for suspend+wake-up with plugged memory

2024-09-04 Thread Juraj Marcin
feature is not exposed by QEMU. This patch adds the code to skip the reset on wake-up and exposes theVIRTIO_MEM_F_PERSISTENT_SUSPEND feature to the guest kernel driver when suspending is possible in QEMU (currently only x86). Signed-off-by: Juraj Marcin Reviewed-by: David Hildenbrand --- hw

Re: [PATCH v2 1/4] KVM: Dynamic sized kvm memslots array

2024-09-05 Thread Juraj Marcin
ill initially allocate. > + */ > +if (s->nr_slots < KVM_MEMSLOTS_NR_ALLOC_DEFAULT) { > +ret = -EINVAL; > +fprintf(stderr, "KVM max supported number of slots (%d) too small\n", > +s->nr_slots); > +goto err; > +} > + > s->nr_as = kvm_check_extension(s, KVM_CAP_MULTI_ADDRESS_SPACE); > if (s->nr_as <= 1) { > s->nr_as = 1; > diff --git a/accel/kvm/trace-events b/accel/kvm/trace-events > index 37626c1ac5..ad2ae6fca5 100644 > --- a/accel/kvm/trace-events > +++ b/accel/kvm/trace-events > @@ -36,3 +36,4 @@ kvm_io_window_exit(void) "" > kvm_run_exit_system_event(int cpu_index, uint32_t event_type) "cpu_index %d, > system_even_type %"PRIu32 > kvm_convert_memory(uint64_t start, uint64_t size, const char *msg) "start > 0x%" PRIx64 " size 0x%" PRIx64 " %s" > kvm_memory_fault(uint64_t start, uint64_t size, uint64_t flags) "start 0x%" > PRIx64 " size 0x%" PRIx64 " flags 0x%" PRIx64 > +kvm_slots_grow(unsigned int old, unsigned int new) "%u -> %u" > -- > 2.45.0 > -- Juraj Marcin

Re: [PATCH v2 1/4] KVM: Dynamic sized kvm memslots array

2024-09-06 Thread Juraj Marcin
Hi Peter, On Thu, Sep 5, 2024 at 6:00 PM Peter Xu wrote: > > On Thu, Sep 05, 2024 at 05:32:46PM +0200, Juraj Marcin wrote: > > Hi Peter, > > Hi, Juraj, > > [...] > > > > unsigned int kvm_get_max_memslots(void) > > > { > > > KVMS

[PATCH] tests/migration-test: Wait for cancellation sooner in multifd cancel

2024-09-20 Thread Juraj Marcin
, setting capabilities when the migration is still running leads to an error. By moving the wait before the setup, we ensure this does not happen. Cc: Peter Xu Signed-off-by: Juraj Marcin --- tests/qtest/migration-test.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff

[PATCH 1/2] tests/qtest: Introduce qtest_init_with_env_and_capabilities()

2025-01-07 Thread Juraj Marcin
This patch adds a new version of qtest_init_with_env() that allows specifying QMP capabilities that should be enabled during handshake. This is useful for example if a test needs out-of-band execution of QMP commands, it can initialize with the oob capability. Signed-off-by: Juraj Marcin

[PATCH 2/2] tests/qtest/migration: Use out-of-band execution for migrate-recover

2025-01-07 Thread Juraj Marcin
recovery. Signed-off-by: Juraj Marcin --- tests/qtest/migration/framework.c | 23 +-- tests/qtest/migration/framework.h | 2 ++ tests/qtest/migration/migration-qmp.c | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/qtest/migration

[PATCH 0/2] test/qtest/migration: Use out-of-band execution for migrate-recover

2025-01-07 Thread Juraj Marcin
series, adds a new qtest initialization function which accepts capabilities the test wants to enable. This allows a test to enable the oob capability. The second patch then enables the oob capability in migration tests and changes the execution of the migrate-recover command. Juraj Marcin (2

Re: [PATCH] migration: Add keepalive messages from dst to src during postcopy

2025-01-31 Thread Juraj Marcin
On 2025-01-30 16:04, Peter Xu wrote: > On Thu, Jan 30, 2025 at 05:11:36PM +0100, Juraj Marcin wrote: > > When there are no page requests from the destination side and the > > connection breaks, the destination might not be aware of it. This is > > the case for example with a

Re: [PATCH] migration: Add keepalive messages from dst to src during postcopy

2025-01-31 Thread Juraj Marcin
On 2025-01-31 10:03, Peter Xu wrote: > On Fri, Jan 31, 2025 at 02:42:41PM +0100, Juraj Marcin wrote: > > On 2025-01-30 16:04, Peter Xu wrote: > > > On Thu, Jan 30, 2025 at 05:11:36PM +0100, Juraj Marcin wrote: > > > > When there are no page requests fro

[PATCH] migration: Add keepalive messages from dst to src during postcopy

2025-01-30 Thread Juraj Marcin
on parameter, by default it is 6 ms. By setting this parameter to 0, sending keepalive messages can be disabled completely. Signed-off-by: Juraj Marcin --- migration/migration.c| 12 migration/migration.h| 1 + migration/options.c | 35 ++

Re: [PATCH 00/16] migration: Switchover phase refactoring

2025-01-15 Thread Juraj Marcin
| 1 + > migration/savevm.h | 6 +- > migration/migration.c | 209 +++- > migration/savevm.c | 116 > migration/vmstate.c | 6 +- > tests/qtest/libqos/libqos.c | 3 +- > migration/trace-events

Re: [PATCH v2 2/2] utils/qemu-sockets: Introduce keep-alive-idle-period inet socket option

2025-03-24 Thread Juraj Marcin
On 2025-03-24 11:12, Daniel P. Berrangé wrote: > On Wed, Mar 19, 2025 at 05:36:20PM +0100, Juraj Marcin wrote: > > From: Juraj Marcin > > > > The default idle period for TCP connection could be even 2 hours. > > However, in some cases, the application needs to be awar

[PATCH v2 1/2] util/qemu-sockets: Add support for keep-alive flag to passive sockets

2025-03-19 Thread Juraj Marcin
From: Juraj Marcin Commit aec21d3175 (qapi: Add InetSocketAddress member keep-alive) introduces the keep-alive flag, which enables the SO_KEEPALIVE socket option, but only on client-side sockets. However, this option is also useful for server-side sockets, so they can check if a client is still

[PATCH v2 0/2] util/qemu-sockets: Introduce configurable TCP keep-alive idle period

2025-03-19 Thread Juraj Marcin
tuozzo.com/ --- V2: - moved socket options setting into a common function for both server and client sockets (suggested by Vladimir) Juraj Marcin (2): util/qemu-sockets: Add support for keep-alive flag to passive sockets utils/qemu-sockets: Introduce keep-alive-idle-period inet socket optio

[PATCH v2 2/2] utils/qemu-sockets: Introduce keep-alive-idle-period inet socket option

2025-03-19 Thread Juraj Marcin
From: Juraj Marcin The default idle period for TCP connection could be even 2 hours. However, in some cases, the application needs to be aware of a connection issue much sooner. This is the case, for example, for postcopy live migration. If there is no traffic from the migration destination

Re: [PATCH v2 1/2] util/qemu-sockets: Add support for keep-alive flag to passive sockets

2025-03-26 Thread Juraj Marcin
Hi Daniel, On 2025-03-24 10:30, Daniel P. Berrangé wrote: > On Wed, Mar 19, 2025 at 05:36:19PM +0100, Juraj Marcin wrote: > > From: Juraj Marcin > > > > Commit aec21d3175 (qapi: Add InetSocketAddress member keep-alive) > > introduces the keep-alive flag, which enab

[PATCH v3 2/5] util/qemu-sockets: Refactor setting client sockopts into a separate function

2025-04-08 Thread Juraj Marcin
From: Juraj Marcin This is done in preparation for enabling the SO_KEEPALIVE support for server sockets and adding settings for more TCP keep-alive socket options. Signed-off-by: Juraj Marcin --- util/qemu-sockets.c | 29 +++-- 1 file changed, 19 insertions(+), 10

[PATCH v3 5/5] utils/qemu-sockets: Introduce inet socket options controlling TCP keep-alive

2025-04-08 Thread Juraj Marcin
From: Juraj Marcin With the default TCP stack configuration, it could be even 2 hours before the connection times out due to the other side not being reachable. However, in some cases, the application needs to be aware of a connection issue much sooner. This is the case, for example, for

[PATCH v3 0/5] util/qemu-sockets: Introduce inet socket options controlling TCP keep-alive

2025-04-08 Thread Juraj Marcin
t copy fix and the common function setting socket options into a separate commit - refactored inet_listen_saddr() V2: - moved socket options setting into a common function for both server and client sockets (suggested by Vladimir) Juraj Marcin (5): io: Fix partial stru

[PATCH v3 4/5] util/qemu-sockets: Add support for keep-alive flag to passive sockets

2025-04-08 Thread Juraj Marcin
From: Juraj Marcin Commit aec21d3175 (qapi: Add InetSocketAddress member keep-alive) introduces the keep-alive flag, which enables the SO_KEEPALIVE socket option, but only on client-side sockets. However, this option is also useful for server-side sockets, so they can check if a client is still

Re: [PATCH 1/2] util/qemu-sockets: Add support for keep-alive flag to passive sockets

2025-03-17 Thread Juraj Marcin
On 2025-03-14 20:24, Vladimir Sementsov-Ogievskiy wrote: > On 03.03.25 17:33, Juraj Marcin wrote: > > Commit aec21d3175 (qapi: Add InetSocketAddress member keep-alive) > > introduces the keep-alive flag, which enables the SO_KEEPALIVE socket > > option, but only on client-

Re: [PATCH v3 5/5] utils/qemu-sockets: Introduce inet socket options controlling TCP keep-alive

2025-04-30 Thread Juraj Marcin
Hi Daniel On 2025-04-11 16:49, Daniel P. Berrangé wrote: > On Fri, Apr 11, 2025 at 02:54:29PM +0100, Daniel P. Berrangé wrote: > > On Tue, Apr 08, 2025 at 01:25:04PM +0200, Juraj Marcin wrote: > > > From: Juraj Marcin > > > > > > With the default TCP sta

Re: [PATCH 0/2] migration: A couple of cleanups

2025-04-24 Thread Juraj Marcin
cleanups for postcopy > > migration/migration.c | 28 ++-- > migration/multifd.c| 6 +- > migration/trace-events | 4 ++-- > 3 files changed, 13 insertions(+), 25 deletions(-) > > -- > 2.35.3 > Both patches look good to me. Reviewed-by: Juraj Marcin

[PATCH v3 1/5] io: Fix partial struct copy in qio_dns_resolver_lookup_sync_inet()

2025-04-10 Thread Juraj Marcin
From: Juraj Marcin Commit aec21d3175 (qapi: Add InetSocketAddress member keep-alive) introduces the keep-alive flag, but this flag is not copied together with other options in qio_dns_resolver_lookup_sync_inet(). This patch fixes this issue and also prevents future ones by copying the entire

[PATCH v3 3/5] util/qemu-sockets: Refactor success and failure paths in inet_listen_saddr()

2025-04-10 Thread Juraj Marcin
From: Juraj Marcin To get a listening socket, we need to first create a socket, try binding it to a certain port, and lastly starting listening to it. Each of these operations can fail due to various reasons, one of them being that the requested address/port is already in use. In such case, the

Re: [PATCH] migration/postcopy: Spatial locality page hint for preempt mode

2025-04-28 Thread Juraj Marcin
ram_page_hint_collect(rs, &next_block, &next_page); > +} else { > +next_block = rs->last_seen_block; > +next_page = rs->last_page; > +} > + > +pss_init(pss, next_block, next_page); > > while (true){ > if (!get_queued_page(rs, pss)) { > @@ -2339,6 +2425,13 @@ static void ram_save_cleanup(void *opaque) > ram_state_cleanup(rsp); > } > > +static void ram_page_hint_reset(PageLocationHint *hint) > +{ > +hint->location.block = NULL; > +hint->location.offset = 0; > +hint->valid = false; > +} > + > static void ram_state_reset(RAMState *rs) > { > int i; > @@ -2351,6 +2444,8 @@ static void ram_state_reset(RAMState *rs) > rs->last_page = 0; > rs->last_version = ram_list.version; > rs->xbzrle_started = false; > + > +ram_page_hint_reset(&rs->page_hint); > } > > #define MAX_WAIT 50 /* ms, half buffered_file limit */ > -- > 2.48.1 > Reviewed-by: Juraj Marcin

Re: [PATCH v6 2/4] migration: enable multifd and postcopy together

2025-02-18 Thread Juraj Marcin
Hi Prasad, On 2025-02-15 18:01, Prasad Pandit wrote: > From: Prasad Pandit > > Enable Multifd and Postcopy migration together. > The migration_ioc_process_incoming() routine > checks magic value sent on each channel and > helps to properly setup multifd and postcopy > channels. > > The Precopy

[PATCH 0/2] util/qemu-sockets: Introduce configurable TCP keep-alive idle period

2025-03-03 Thread Juraj Marcin
tuozzo.com/ Juraj Marcin (2): util/qemu-sockets: Add support for keep-alive flag to passive sockets utils/qemu-sockets: Introduce keep-alive-idle-period inet socket option io/dns-resolver.c | 6 + meson.build | 2 ++ qapi/sockets.json | 9 +-- util/qemu-sock

[PATCH 1/2] util/qemu-sockets: Add support for keep-alive flag to passive sockets

2025-03-03 Thread Juraj Marcin
'qio_dns_resolver_lookup_sync_inet()' where the keep-alive flag is not copied together with other attributes. Signed-off-by: Juraj Marcin --- io/dns-resolver.c | 2 ++ qapi/sockets.json | 4 ++-- util/qemu-sockets.c | 19 +-- 3 files changed, 17 insertions(+), 8 deletions(-) diff

[PATCH 2/2] utils/qemu-sockets: Introduce keep-alive-idle-period inet socket option

2025-03-03 Thread Juraj Marcin
ault value is 0, which means system configuration is used, and no custom value is set. Signed-off-by: Juraj Marcin --- io/dns-resolver.c | 4 meson.build | 2 ++ qapi/sockets.json | 5 + util/qemu-sockets.c | 39 +++ 4 files changed, 50

Re: [PATCH] migration: Fix UAF for incoming migration on MigrationState

2025-02-20 Thread Juraj Marcin
On 2025-02-20 11:06, Fabiano Rosas wrote: > Peter Xu writes: > > > On the incoming migration side, QEMU uses a coroutine to load all the VM > > states. Inside, it may reference MigrationState on global states like > > migration capabilities, parameters, error state, shared mutexes and more. > >

Re: [PATCH 1/3] migration: Allow caps to be set when preempt or multifd cap enabled

2025-05-14 Thread Juraj Marcin
t > before incoming") > Signed-off-by: Peter Xu > --- > migration/options.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Juraj Marcin

Re: [PATCH 2/3] migration/hmp: Dump global in "info migrate_parameters" instead

2025-05-14 Thread Juraj Marcin
suitable for a parameter dump instead. Hence > move it over. > > Signed-off-by: Peter Xu > --- > migration/migration-hmp-cmds.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Juraj Marcin

Re: [PATCH 3/3] migration/hmp: Add "info migrate -a", reorg the dump

2025-05-14 Thread Juraj Marcin
s: [\n"); > + > +for (addr = info->socket_address; addr; addr = addr->next) { > +char *s = socket_uri(addr->value); > + monitor_printf(mon, "\t%s\n", s); > +g_free(s); > } > +monitor_pri

[PATCH v4 1/7] io: Fix partial struct copy in qio_dns_resolver_lookup_sync_inet()

2025-05-16 Thread Juraj Marcin
From: Juraj Marcin Commit aec21d3175 (qapi: Add InetSocketAddress member keep-alive) introduces the keep-alive flag, but this flag is not copied together with other options in qio_dns_resolver_lookup_sync_inet(). This patch fixes this issue and also prevents future ones by copying the entire

[PATCH v4 7/7] util/qemu-sockets: Introduce inet socket options controlling TCP keep-alive

2025-05-16 Thread Juraj Marcin
From: Juraj Marcin With the default TCP stack configuration, it could be even 2 hours before the connection times out due to the other side not being reachable. However, in some cases, the application needs to be aware of a connection issue much sooner. This is the case, for example, for

[PATCH v4 5/7] tests/unit/test-util-sockets: Add tests for inet_parse()

2025-05-16 Thread Juraj Marcin
From: Juraj Marcin Before refactoring the inet_parse() function, this patch adds tests verifying the inet address parsing works correctly. Signed-off-by: Juraj Marcin --- tests/unit/test-util-sockets.c | 161 + 1 file changed, 161 insertions(+) diff --git a

[PATCH v4 4/7] util/qemu-sockets: Add support for keep-alive flag to passive sockets

2025-05-16 Thread Juraj Marcin
From: Juraj Marcin Commit aec21d3175 (qapi: Add InetSocketAddress member keep-alive) introduces the keep-alive flag, which enables the SO_KEEPALIVE socket option, but only on client-side sockets. However, this option is also useful for server-side sockets, so they can check if a client is still

[PATCH v4 3/7] util/qemu-sockets: Refactor success and failure paths in inet_listen_saddr()

2025-05-16 Thread Juraj Marcin
From: Juraj Marcin To get a listening socket, we need to first create a socket, try binding it to a certain port, and lastly starting listening to it. Each of these operations can fail due to various reasons, one of them being that the requested address/port is already in use. In such case, the

[PATCH v4 2/7] util/qemu-sockets: Refactor setting client sockopts into a separate function

2025-05-16 Thread Juraj Marcin
From: Juraj Marcin This is done in preparation for enabling the SO_KEEPALIVE support for server sockets and adding settings for more TCP keep-alive socket options. Signed-off-by: Juraj Marcin --- util/qemu-sockets.c | 29 +++-- 1 file changed, 19 insertions(+), 10

[PATCH v4 6/7] util/qemu-sockets: Refactor inet_parse() to use QemuOpts

2025-05-16 Thread Juraj Marcin
From: Juraj Marcin Currently, the inet address parser cannot handle multiple options where one is prefixed with the name of the other. For example, with the 'keep-alive-idle' option added, the current parser cannot parse '127.0.0.1:5000,keep-alive-idle=60,keep-alive' correctl

[PATCH v4 0/7] util/qemu-sockets: Introduce inet socket options controlling TCP keep-alive

2025-05-16 Thread Juraj Marcin
uggested by Vladimir) V1: https://lore.kernel.org/all/20250303143312.640909-1-jmar...@redhat.com/ Juraj Marcin (7): io: Fix partial struct copy in qio_dns_resolver_lookup_sync_inet() util/qemu-sockets: Refactor setting client sockopts into a separate function util/qemu-sockets: Refactor

Re: [PATCH v5 1/6] io: Fix partial struct copy in qio_dns_resolver_lookup_sync_inet()

2025-05-27 Thread Juraj Marcin
Hi Michael, On 2025-05-25 20:15, Michael Tokarev wrote: > On 21.05.2025 16:52, Juraj Marcin wrote: > > From: Juraj Marcin > > > > Commit aec21d3175 (qapi: Add InetSocketAddress member keep-alive) > > introduces the keep-alive flag, but this flag is not copied togethe

Re: [PATCH] tests/unit/test-util-sockets: fix mem-leak on error object

2025-05-27 Thread Juraj Marcin
catch. Thanks! Reviewed-by: Juraj Marcin > > Fixes 316e8ee8d6 ("util/qemu-sockets: Refactor inet_parse() to use QemuOpts") > Signed-off-by: Matheus Tavares Bernardino > > --- > tests/unit/test-util-sockets.c | 4 > 1 file changed, 4 insertions(+) >

[PATCH v5 5/6] util/qemu-sockets: Refactor inet_parse() to use QemuOpts

2025-05-21 Thread Juraj Marcin
From: Juraj Marcin Currently, the inet address parser cannot handle multiple options where one is prefixed with the name of the other. For example, with the 'keep-alive-idle' option added, the current parser cannot parse '127.0.0.1:5000,keep-alive-idle=60,keep-alive' correctl

[PATCH v5 6/6] util/qemu-sockets: Introduce inet socket options controlling TCP keep-alive

2025-05-21 Thread Juraj Marcin
From: Juraj Marcin With the default TCP stack configuration, it could be even 2 hours before the connection times out due to the other side not being reachable. However, in some cases, the application needs to be aware of a connection issue much sooner. This is the case, for example, for

[PATCH v5 3/6] util/qemu-sockets: Refactor success and failure paths in inet_listen_saddr()

2025-05-21 Thread Juraj Marcin
From: Juraj Marcin To get a listening socket, we need to first create a socket, try binding it to a certain port, and lastly starting listening to it. Each of these operations can fail due to various reasons, one of them being that the requested address/port is already in use. In such case, the

[PATCH v5 1/6] io: Fix partial struct copy in qio_dns_resolver_lookup_sync_inet()

2025-05-21 Thread Juraj Marcin
From: Juraj Marcin Commit aec21d3175 (qapi: Add InetSocketAddress member keep-alive) introduces the keep-alive flag, but this flag is not copied together with other options in qio_dns_resolver_lookup_sync_inet(). This patch fixes this issue and also prevents future ones by copying the entire

[PATCH v5 2/6] util/qemu-sockets: Refactor setting client sockopts into a separate function

2025-05-21 Thread Juraj Marcin
From: Juraj Marcin This is done in preparation for enabling the SO_KEEPALIVE support for server sockets and adding settings for more TCP keep-alive socket options. Signed-off-by: Juraj Marcin Reviewed-by: Daniel P. Berrangé --- util/qemu-sockets.c | 29 +++-- 1 file

[PATCH v5 4/6] util/qemu-sockets: Add support for keep-alive flag to passive sockets

2025-05-21 Thread Juraj Marcin
From: Juraj Marcin Commit aec21d3175 (qapi: Add InetSocketAddress member keep-alive) introduces the keep-alive flag, which enables the SO_KEEPALIVE socket option, but only on client-side sockets. However, this option is also useful for server-side sockets, so they can check if a client is still

[PATCH v5 0/6] util/qemu-sockets: Introduce inet socket options controlling TCP keep-alive

2025-05-21 Thread Juraj Marcin
tions setting into a common function for both server and client sockets (suggested by Vladimir) V1: https://lore.kernel.org/all/20250303143312.640909-1-jmar...@redhat.com/ Juraj Marcin (6): io: Fix partial struct copy in qio_dns_resolver_lookup_sync_inet() util/qemu-sockets: Refactor

Re: [PATCH] ui/vnc: Update display update interval when VM state changes to RUNNING

2025-05-22 Thread Juraj Marcin
Hi Peter On 2025-05-21 12:04, Peter Xu wrote: > On Wed, May 21, 2025 at 05:16:13PM +0200, Juraj Marcin wrote: > > From: Juraj Marcin > > > > If a virtual machine is paused for an extended period time, for example, > > due to an incoming migration, there are al

[PATCH] ui/vnc: Update display update interval when VM state changes to RUNNING

2025-05-21 Thread Juraj Marcin
From: Juraj Marcin If a virtual machine is paused for an extended period time, for example, due to an incoming migration, there are also no changes on the screen. VNC in such case increases the display update interval by VNC_REFRESH_INTERVAL_INC (50 ms). The update interval can then grow up to

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

2025-05-29 Thread Juraj Marcin
On 2025-05-29 16:42, Juraj Marcin wrote: > Hi Peter > > On 2025-05-27 17:58, Peter Xu wrote: > > 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 > >

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

2025-05-29 Thread Juraj Marcin
On 2025-05-27 17:58, Peter Xu wrote: > It's not possible to happen in bg-snapshot case. > > Signed-off-by: Peter Xu > --- > migration/migration.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) Reviewed-by: Juraj Marcin

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

2025-05-29 Thread Juraj Marcin
> > No functional change intended. Could be some future users, that would benefit from separate hooks for precopy and postcopy? In case we are going to drop it, I think the '_precopy' suffix could be dropped too, as the handler would be used for postcopy too. Best regards Juraj Marc

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

2025-05-29 Thread Juraj Marcin
On 2025-05-27 17:58, Peter Xu wrote: > The check over PAGE_DIRTY_FOUND isn't necessary. We could indent one less > and assert that instead. > > Signed-off-by: Peter Xu > --- > migration/ram.c | 20 +++- > 1 file changed, 11 insertions(+), 9 deleti

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

2025-05-29 Thread Juraj Marcin
On 2025-05-27 17:58, Peter Xu wrote: > Take notes on start/end state of dirty pages for the whole system. > > Signed-off-by: Peter Xu > --- > migration/ram.c| 5 + > migration/trace-events | 1 + > 2 files changed, 6 insertions(+) Reviewed-by: Juraj Marcin

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

2025-05-29 Thread Juraj Marcin
the > two completely differnt use cases (precopy v.s. postcopy). > > (4) Trivial touch up on threshold_size comparision > > Which changes: > > "(!pending_size || pending_size < s->threshold_size)" > > into: > > "(pending_size <= s->threshold_size)" > > Signed-off-by: Peter Xu > --- > migration/migration.c | 56 +++ > 1 file changed, 41 insertions(+), 15 deletions(-) Reviewed-by: Juraj Marcin

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

2025-05-29 Thread Juraj Marcin
age Types: normal=367713, zero=41195 > Page Rates (pps): transfer=40900, dirty=4 > Others: dirty_syncs=2, postcopy_req=57503 > > Cc: Zhijian Li (Fujitsu) > Suggested-by: Dr. David Alan Gilbert > Signed-off-by: Peter Xu > --- > migration/migration-hmp-cmds.c | 59 ++ > 1 file changed, 31 insertions(+), 28 deletions(-) Reviewed-by: Juraj Marcin

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

2025-05-29 Thread Juraj Marcin
. > > Signed-off-by: Peter Xu > --- > docs/devel/migration/postcopy.rst | 36 +++ > 1 file changed, 17 insertions(+), 19 deletions(-) Reviewed-by: Juraj Marcin

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

2025-06-24 Thread Juraj Marcin
erevalov > Cc: Markus Armbruster > Tested-by: Mario Casquero > Signed-off-by: Peter Xu > --- Reviewed-by: Juraj Marcin

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

2025-06-24 Thread Juraj Marcin
save_section_footer(f, se); > if (ret < 0) { > -- > 2.49.0 > There are still mentions of 'save_live_complete_precopy' in: include/migration/register.h:100 * parallel with @save_live_complete_precopy handlers. docs/devel/migration/vfio.rst:78 * A ``save_live_complete_precopy`` function that sets the VFIO device in docs/devel/migration/vfio.rst:198 .save_live_complete_precopy() is called for each active device docs/devel/migration/vfio.rst:200 .save_live_complete_precopy() until docs/devel/migration/main.rst:511 - A ``save_live_complete_precopy`` function that must transmit the Also, should we also drop "live" from 'save_live_complete_precopy_thread' as well? IIUC they are called together with (now) 'save_complete()' during precopy. Best regards Juraj Marcin

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

2025-06-24 Thread Juraj Marcin
On 2025-06-13 10:07, Peter Xu wrote: > 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 > --- Reviewed-by: Juraj Marcin

Re: [PATCH v3 05/11] migration: Drop save_live_complete_postcopy hook

2025-06-24 Thread Juraj Marcin
ctional change intended. > > Signed-off-by: Peter Xu > --- Reviewed-by: Juraj Marcin

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

2025-06-25 Thread Juraj Marcin
On 2025-06-24 11:41, Peter Xu wrote: > On Tue, Jun 24, 2025 at 04:36:39PM +0200, Juraj Marcin wrote: > > [...] > > > There are still mentions of 'save_live_complete_precopy' in: > > > > include/migration/register.h:100 > > * para

[PATCH] migration: Rename save_live_complete_precopy_thread to save_complete_precopy_thread

2025-06-26 Thread Juraj Marcin
From: Juraj Marcin Recent patch [1] renames the save_live_complete_precopy handler to save_complete, as the machine is not live in most cases when this handler is executed. The same is true also for save_live_complete_precopy_thread, therefore this patch removes the "live" keywor

Re: [PULL 19/23] util/qemu-sockets: Refactor success and failure paths in inet_listen_saddr()

2025-07-10 Thread Juraj Marcin
On 2025-07-10 13:17, Peter Maydell wrote: > On Thu, 22 May 2025 at 11:33, Daniel P. Berrangé wrote: > > > > From: Juraj Marcin > > > > To get a listening socket, we need to first create a socket, try binding > > it to a certain port, and lastly starti

Re: [PATCH for-10.1 0/2] migration: actually make gnutls workaround functional

2025-08-04 Thread Juraj Marcin
Hi Daniel, On 2025-08-01 18:02, Daniel P. Berrangé wrote: > This is a followup to previously merged patches that claimed to > workaround the gnutls bug impacting migration, but in fact were > essentially non-functional. Juraj Marcin pointed this out, and > this new patch tweaks the w

Re: [PATCH for-10.1 0/2] migration: actually make gnutls workaround functional

2025-08-05 Thread Juraj Marcin
Hi all! On 2025-08-05 10:44, Fabiano Rosas wrote: > Daniel P. Berrangé writes: > > > On Mon, Aug 04, 2025 at 04:27:45PM -0300, Fabiano Rosas wrote: > >> Juraj Marcin writes: > >> > >> > Hi Daniel, > >> > > >> > On 2025-08

[RFC PATCH 0/4] migration: Introduce postcopy-setup capability and state

2025-08-07 Thread Juraj Marcin
py-run command is actually sent (in this series boundary of "postcopy-setup" and "postcopy-active"), however, I am not sure if such change would not have any unwanted implications. Juraj Marcin (4): qemu-thread: Introduce qemu_thread_detach() migration: Fix state transition in pos

[RFC PATCH 4/4] migration: Introduce postcopy-setup capability and state

2025-08-07 Thread Juraj Marcin
From: Juraj Marcin During switchover at the start of postcopy the source side sends a package containing all non-postcopiable device state and a postcopy-run command and transitions to a "postcopy-active" state. However, if the destination side fails to load the device states or cras

[RFC PATCH 1/4] qemu-thread: Introduce qemu_thread_detach()

2025-08-07 Thread Juraj Marcin
From: Juraj Marcin Currently, QEMU threads abstraction supports both joinable and detached threads, but once a thread is marked as joinable it must be joined using qemu_thread_join() and cannot be detached later. For POSIX implementation, pthread_detach() is used. For Windows, marking the

[RFC PATCH 2/4] migration: Fix state transition in postcopy_start() error handling

2025-08-07 Thread Juraj Marcin
From: Juraj Marcin Depending on where an error during postcopy_start() happens, the state can be either "active", "device" or "cancelling", but never "postcopy-active". Migration state is transitioned to "postcopy-active" only just before a succ

[RFC PATCH 3/4] migration: Make listen thread joinable

2025-08-07 Thread Juraj Marcin
From: Juraj Marcin This patch allows joining the migration listen thread. This is done in preparation for the introduction of "postcopy-setup" state at the beginning of a postcopy migration, when destination can fail gracefully and source side then resume to a running state. In ca

Re: [RFC PATCH 3/4] migration: Make listen thread joinable

2025-08-08 Thread Juraj Marcin
Hi Peter, On 2025-08-07 16:57, Peter Xu wrote: > On Thu, Aug 07, 2025 at 01:49:11PM +0200, Juraj Marcin wrote: > > From: Juraj Marcin > > > > This patch allows joining the migration listen thread. This is done in > > preparation for the introduction of &q

Re: [RFC PATCH 2/4] migration: Fix state transition in postcopy_start() error handling

2025-08-08 Thread Juraj Marcin
Hi Peter, On 2025-08-07 16:54, Peter Xu wrote: > On Thu, Aug 07, 2025 at 01:49:10PM +0200, Juraj Marcin wrote: > > From: Juraj Marcin > > > > Depending on where an error during postcopy_start() happens, the state > > can be either "active", "device