Re: [PATCH v2 1/2] qemu: Fix bug in nbdkit-backed backing chains

2024-01-24 Thread Peter Krempa
On Tue, Jan 23, 2024 at 15:25:05 -0600, Jonathon Jongsma wrote: > When trying to start nbdkit-backed disks in backing chains, we were > accidentally always checking the private data of the top of the chain > instead of using the loop variable. > > Signed-off-by: Jonathon Jongsma > --- > src/qemu

Re: [PATCH] conf: make virNetDevVPortProfileFormat() void

2024-01-24 Thread Martin Kletzander
On Wed, Jan 17, 2024 at 07:04:58PM +0300, Alexandra Diupina wrote: In commit 4af3cbafdd0e31c5c5b20d57c4aaeb19efcb98bc (Laine Stump , Tue Jul 31 14:36:51 2012 -0400) the return -1 was removed and since then virNetDevVPortProfileFormat() always returns 0, so it is possible to make this function voi

Re: [PATCH 2/2] remoteDispatchAuthPolkit: Fix lock ordering deadlock if client closes connection during auth

2024-01-24 Thread Martin Kletzander
On Wed, Jan 17, 2024 at 04:13:30PM +0100, Peter Krempa wrote: Locks in following text: A: virNetServer B: virNetServerClient C: daemonClientPrivate 'virNetServerSetClientAuthenticated' locks A then B 'remoteDispatchAuthPolkit' calls 'virNetServerSetClientAuthenticated' while holding C. If a cl

Re: [PATCH] Explicitly convert type to double to avoid losing precision

2024-01-24 Thread Martin Kletzander
On Tue, Jan 23, 2024 at 12:28:34PM +0300, Egor Makrushin wrote: Division between integers will also be integer. Thus, to preserve fractional part explicitly convert first operand to double. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 28d54aab05 ("examples: Introduce

Re: [PATCH 0/3] Allow reserving more memory for PCI controllers

2024-01-24 Thread Michal Prívozník
On 12/8/23 11:38, Michal Privoznik wrote: > Polite ping. ___ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-le...@lists.libvirt.org

Re: [PATCH 1/3] conf: Introduce @memReserve to

2024-01-24 Thread Ján Tomko
On a Friday in 2023, Michal Privoznik wrote: There are PCI devices with pretty large non-prefetchable memory, for instance: Memory at 9d80 (64-bit, non-prefetchable) [size=8M] Memory at a680 (64-bit, non-prefetchable) [size=16K] For cold plugged devices this is not a problem, because

[PATCH 01/33] tests: Add usb-controller-automatic-unavailable-q35

2024-01-24 Thread Andrea Bolognani
For q35 guests, we normally add a USB controller by default, but there's a scenario in which we can decide to skip it. Add test coverage for it. Signed-off-by: Andrea Bolognani --- ...tomatic-unavailable-q35.x86_64-latest.args | 33 +++ ...utomatic-unavailable-q35.x86_64-latest.x

[PATCH 00/33] qemu: Improve handling of architecture-specific defaults

2024-01-24 Thread Andrea Bolognani
This is a significantly expanded upon follow up to [1], and specifically the last 5 patches in that series. While looking at implementing the improvements suggested by Peter, I realized that there were many additional areas in which our handling of defaults was suboptimal, with the relevant code s

[PATCH 02/33] tests: Add aarch64-panic-no-model

2024-01-24 Thread Andrea Bolognani
This demonstrates that on aarch64, where a native panic device doesn't exist, it's necessary for the user to specify the model explicitly. Signed-off-by: Andrea Bolognani --- .../aarch64-panic-no-model.aarch64-latest.err | 1 + tests/qemuxmlconfdata/aarch64-panic-no-model.xml| 13

[PATCH 03/33] tests: Add title-and-description

2024-01-24 Thread Andrea Bolognani
We have a few test cases that cover the ability to set and for a guest as a side effect. Introduce an explicit test case for the functionality. Signed-off-by: Andrea Bolognani --- .../title-and-description.x86_64-latest.args | 31 ++ .../title-and-description.x86_64-latest.xml

[PATCH 04/33] tests: Drop existing and tags

2024-01-24 Thread Andrea Bolognani
Now that we have an explicit test case for the feature, we can drop a bunch of duplicated accidental coverage. Signed-off-by: Andrea Bolognani --- tests/qemuxmlconfdata/440fx-wrong-root.xml | 5 - .../cpu-host-model-features.x86_64-latest.xml| 5 - tests

[PATCH 05/33] tests: Rename and minimize no-memory

2024-01-24 Thread Andrea Bolognani
Signed-off-by: Andrea Bolognani --- tests/qemuxmlconfdata/minimal-no-memory.xml | 25 --- ...latest.err => no-memory.x86_64-latest.err} | 0 tests/qemuxmlconfdata/no-memory.xml | 11 tests/qemuxmlconftest.c | 2 +- 4 files changed, 12 i

[PATCH 07/33] tests: Drop minimal

2024-01-24 Thread Andrea Bolognani
We have just added a number of test cases that supersede it. Signed-off-by: Andrea Bolognani --- .../minimal.x86_64-latest.args| 36 - .../qemuxmlconfdata/minimal.x86_64-latest.xml | 40 --- tests/qemuxmlconfdata/minimal.xml | 29 --

[PATCH 09/33] qemu: Fix a few comments

2024-01-24 Thread Andrea Bolognani
They reference functions that have since been renamed. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_command.c | 6 +++--- src/qemu/qemu_domain.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b8f071ff2a..4aad70

[PATCH 10/33] qemu: Default to no USB and no memballoon for new architectures

2024-01-24 Thread Andrea Bolognani
The current defaults, that can be altered on a per-architecture basis, are derived from the historical x86 behavior. Every time support for a new architecture is added to libvirt, care must be taken to override these default: if that doesn't happen, guests will end up with additional hardware, whi

[PATCH 11/33] qemu: Clean up qemuDomainDefaultNetModel()

2024-01-24 Thread Andrea Bolognani
Group things together where it makes sense, avoid unnecessary uses of 'else if', plus other tweaks. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c i

[PATCH 12/33] qemu: Drop qemuDomainFindSCSIControllerModel()

2024-01-24 Thread Andrea Bolognani
It only has a single caller. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_alias.c | 13 +++-- src/qemu/qemu_domain_address.c | 26 -- src/qemu/qemu_domain_address.h | 3 --- 3 files changed, 11 insertions(+), 31 deletions(-) diff --git a/src/qemu/q

[PATCH 13/33] qemu: Drop qemuDomainSetSCSIControllerModel()

2024-01-24 Thread Andrea Bolognani
It only has a single caller. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 4 +++- src/qemu/qemu_domain_address.c | 25 - src/qemu/qemu_domain_address.h | 4 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/qemu/qemu_domain

[PATCH 14/33] qemu: Add missing error handling

2024-01-24 Thread Andrea Bolognani
qemuDomainGetSCSIControllerModel() can return -1 on failure, but qemuDomainFindOrCreateSCSIDiskController() didn't implement any handling for this scenario. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_hotplug.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/qemu/qemu_hotplug.

[PATCH 15/33] qemu: Simplify qemuDomainFindOrCreateSCSIDiskController()

2024-01-24 Thread Andrea Bolognani
Not a massive difference, but it will make upcoming changes nicer. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_hotplug.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index afb720fc0b..c883fef0e9 100644 --- a/sr

[PATCH 06/33] tests: Add minimal cases for many architectures

2024-01-24 Thread Andrea Bolognani
We currently have a single test case called "minimal", which suffers from two big flaws: * it's limited to the x86_64/pc machine type; * it explicitly enables a number of devices. Add several test cases, one for each of the architectures and machine types that we have good support for. Unlik

[PATCH 16/33] qemu: Move qemuDomainGetSCSIControllerModel()

2024-01-24 Thread Andrea Bolognani
It has nothing to do with assigning addresses, so it makes more sense to have it in qemu_domain. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 37 ++ src/qemu/qemu_domain.h | 3 +++ src/qemu/qemu_domain_address.c | 36 --

[PATCH 18/33] qemu: Clean up qemuDomainDefaultSCSIControllerModel()

2024-01-24 Thread Andrea Bolognani
Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 97336d5002..7475fb4f39 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4123,16

[PATCH 17/33] qemu: Rename qemuDomainDefaultSCSIControllerModel()

2024-01-24 Thread Andrea Bolognani
The function is modified to be stateless, which is more consistent with existing helpers that deal with figuring out default models for devices, and its name needs to change accordingly. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 21 +++-- src/qemu/qemu_domain.

[PATCH 19/33] qemu: Add qemuDomainDefaultUSBControllerModel()

2024-01-24 Thread Andrea Bolognani
Extract the logic from qemuDomainControllerDefPostParse(). The code is mostly unchanged, but there's a subtle difference: the piix3-uhci has been moved from the top of the chunk to the bottom. This is because the original code set cont->model directly, which made it okay to start with a suboptimal

[PATCH 08/33] tests: Add default-models cases for many architectures

2024-01-24 Thread Andrea Bolognani
These are similar to the minimal cases that we just introduced, but are intended to demonstrate what device or controller model libvirt will choose when one is not provided by the user. Signed-off-by: Andrea Bolognani --- ...64-virt-default-models.aarch64-latest.args | 44 +++ ...h64-vir

[PATCH 20/33] qemu: Enhance qemuDomainDefaultUSBControllerModel()

2024-01-24 Thread Andrea Bolognani
In addition to the code in qemuDomainControllerDefPostParse(), which we have just factored into its own function, we also have some code in qemuDomainDefAddDefaultDevices() that deals with choosing the model for a USB controller, specifically for q35 guests. Integrate it into the newly-created func

[PATCH 21/33] qemu: Clean up qemuDomainDefaultUSBControllerModel()

2024-01-24 Thread Andrea Bolognani
Mostly reduce the number of 'else if' and improve comments. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 62 -- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d992b51877

[PATCH 22/33] qemu: Move qemuDomainForbidLegacyUSBController()

2024-01-24 Thread Andrea Bolognani
This function is tightly coupled with qemuDomainDefaultUSBControllerModel(), as whether or not the legacy '-usb' option is going to be used depends on the return value of both. As such, it makes sense for them to be close to one another. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_command.

[PATCH 23/33] qemu: Enhance qemuDomainForbidLegacyUSBController()

2024-01-24 Thread Andrea Bolognani
Currently, we have special handling for USB controllers of s390x guests hardcoded into the command line generator. This is not great from a layering point of view and, given the complex interactions between the various parts, just makes things very confusing. In order to make things easier to reas

[PATCH 24/33] qemu: Add qemuDomainDefaultSerialType()

2024-01-24 Thread Andrea Bolognani
Factor out the existing code. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 30 +- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 5b93529655..b3e63b3648 100644 --- a/src/qemu/qemu_dom

[PATCH 25/33] qemu: Add qemuDomainDefaultSerialModel()

2024-01-24 Thread Andrea Bolognani
Factor out the existing code. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 66 ++ 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b3e63b3648..c9d213dd7b 100644 --- a/src/

[PATCH 26/33] qemu: Add qemuDomainDefaultPanicModel()

2024-01-24 Thread Andrea Bolognani
Factor out the existing code. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c9d213dd7b..8a37cda464 100644 --- a/src/qemu/qemu_domain.c +

[PATCH 27/33] qemu: Use qemuDomainDefaultPanicModel() more

2024-01-24 Thread Andrea Bolognani
qemuDomainDefAddDefaultDevices() contained what is essentialy an open-coded implementation of the helper. Get rid of it. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_do

[PATCH 28/33] qemu: Rename qemuDomainDefaultVideoModel()

2024-01-24 Thread Andrea Bolognani
Follow the established naming convention for consistency. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 62a847d47f..22980c25a9 100644 --- a/src/qemu/qem

[PATCH 29/33] qemu: Move qemuDomainDefault*() functions together

2024-01-24 Thread Andrea Bolognani
Most of the functions responsible for choosing architecture and machine specific defaults are already close to one another, with just a couple of strays. Having everything in one place will hopefully make it harder to miss updating any of the functions when new architectures are being introduced.

[PATCH 30/33] qemu: Only default to on x86

2024-01-24 Thread Andrea Bolognani
Other architectures generally don't have an ISA bus, so this default never worked for them. Since it's now possible for a specific model not to be chosen during postparse, something that couldn't happen until now, we need to handle the scenario by presenting the user with a reasonable error messag

[PATCH 32/33] qemu: Use qemu-xhci by default on RISC-V

2024-01-24 Thread Andrea Bolognani
Currently we fall back to the x86-derived default of piix3-uhci, which is a USB1 controller that's not virtualization-friendly and overall a terrible choice for a modern architecture. The fact that we didn't choose a better default when RISC-V support was introduced was an oversight which is now ad

[PATCH 31/33] qemu: Don't add memballoon by default on RISC-V

2024-01-24 Thread Andrea Bolognani
The idea of adding devices such as USB controllers or memory balloons by default comes from attempting to match QEMU's own defaults at a time when x86 was the only game in town. The unfortunate consequence of this is that, if the user does NOT want the device in question to be present, they have t

[PATCH 33/33] qemu: Use virtio-scsi by default on RISC-V

2024-01-24 Thread Andrea Bolognani
Just like piix3-uhci for USB, the choice of lsilogic for SCSI was dictated entirely by that being the default for legacy x86 guests. Use virtio-scsi instead. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c| 3 ++- ...64-virt-default-models.riscv64-latest.args

Re: [libvirt PATCH 00/12] Add vmx-* features from qemu

2024-01-24 Thread Sergio Durigan Junior
On Monday, January 22 2024, I wrote: > On Wednesday, November 22 2023, Jiri Denemark wrote: > >> On Thu, Nov 09, 2023 at 15:30:46 +0100, Tim Wiederhake wrote: >>> For rationale, see patch 3 (cpu_map: No longer ignore vmx- features in >>> sync_qemu_features_i386.py). >>> >>> Adding features in bun