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

Andrea Bolognani posted 33 patches 8 months, 2 weeks ago
There is a newer version of this series
[PATCH 31/33] qemu: Don't add memballoon by default on RISC-V
Posted by Andrea Bolognani 8 months, 2 weeks ago
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 to
create a special XML element with model=none to stop libvirt.
This is counter-intuitive.

For architectures for which we've added support more recently,
such as aarch64, we've generally chosen to do the sensible thing
and create very minimal guests by default. The user is of course
still able to ask for additional hardware if they so desire.

When adding RISC-V support, we accidentally forgot to skip the
creation of the default memory balloon. Address that oversight.

This is technically a breaking change, but it's fairly safe to
apply it because:

  * it doesn't affect existing guests;
  * virt-manager will automatically add the memballoon device
    by default anyway;
  * RISC-V is still not widely used.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/qemu/qemu_domain.c                              |  1 -
 .../riscv64-virt-minimal.riscv64-latest.args        |  3 ---
 .../riscv64-virt-minimal.riscv64-latest.xml         | 13 -------------
 3 files changed, 17 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 506f03831c..bf45198c09 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4517,7 +4517,6 @@ qemuDomainDefAddDefaultDevices(virQEMUDriver *driver,
 
     case VIR_ARCH_RISCV32:
     case VIR_ARCH_RISCV64:
-        addDefaultMemballoon = true;
         if (qemuDomainIsRISCVVirt(def))
             addPCIeRoot = true;
         break;
diff --git a/tests/qemuxmlconfdata/riscv64-virt-minimal.riscv64-latest.args b/tests/qemuxmlconfdata/riscv64-virt-minimal.riscv64-latest.args
index fcb80b009e..c38dddb5fa 100644
--- a/tests/qemuxmlconfdata/riscv64-virt-minimal.riscv64-latest.args
+++ b/tests/qemuxmlconfdata/riscv64-virt-minimal.riscv64-latest.args
@@ -25,9 +25,6 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}' \
--device '{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
--device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.1","addr":"0x0"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxmlconfdata/riscv64-virt-minimal.riscv64-latest.xml b/tests/qemuxmlconfdata/riscv64-virt-minimal.riscv64-latest.xml
index 54363bb426..a96af29587 100644
--- a/tests/qemuxmlconfdata/riscv64-virt-minimal.riscv64-latest.xml
+++ b/tests/qemuxmlconfdata/riscv64-virt-minimal.riscv64-latest.xml
@@ -15,19 +15,6 @@
   <devices>
     <emulator>/usr/bin/qemu-system-riscv64</emulator>
     <controller type='pci' index='0' model='pcie-root'/>
-    <controller type='pci' index='1' model='pcie-root-port'>
-      <model name='pcie-root-port'/>
-      <target chassis='1' port='0x8'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
-    </controller>
-    <controller type='pci' index='2' model='pcie-root-port'>
-      <model name='pcie-root-port'/>
-      <target chassis='2' port='0x9'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
-    </controller>
     <audio id='1' type='none'/>
-    <memballoon model='virtio'>
-      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
-    </memballoon>
   </devices>
 </domain>
-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH 31/33] qemu: Don't add memballoon by default on RISC-V
Posted by Peter Krempa 8 months, 2 weeks ago
On Wed, Jan 24, 2024 at 20:37:51 +0100, Andrea Bolognani wrote:
> 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 to
> create a special XML element with model=none to stop libvirt.
> This is counter-intuitive.
> 
> For architectures for which we've added support more recently,
> such as aarch64, we've generally chosen to do the sensible thing
> and create very minimal guests by default. The user is of course
> still able to ask for additional hardware if they so desire.
> 
> When adding RISC-V support, we accidentally forgot to skip the
> creation of the default memory balloon. Address that oversight.
> 
> This is technically a breaking change, but it's fairly safe to
> apply it because:
> 
>   * it doesn't affect existing guests;
>   * virt-manager will automatically add the memballoon device
>     by default anyway;
>   * RISC-V is still not widely used.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  src/qemu/qemu_domain.c                              |  1 -
>  .../riscv64-virt-minimal.riscv64-latest.args        |  3 ---
>  .../riscv64-virt-minimal.riscv64-latest.xml         | 13 -------------
>  3 files changed, 17 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org