[PATCH 0/2] Allow tweaking TCG's tb-size

Michal Privoznik posted 2 patches 2 years, 5 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1636028443.git.mprivozn@redhat.com
docs/formatdomain.rst                         | 11 +++
docs/schemas/domaincommon.rng                 | 15 +++-
src/conf/domain_conf.c                        | 90 +++++++++++++++++++
src/conf/domain_conf.h                        |  7 ++
src/qemu/qemu_command.c                       | 14 ++-
src/qemu/qemu_validate.c                      | 11 +++
...efault-cpu-tcg-features.x86_64-latest.args | 40 +++++++++
.../x86_64-default-cpu-tcg-features.xml       | 67 ++++++++++++++
tests/qemuxml2argvtest.c                      |  1 +
...default-cpu-tcg-features.x86_64-latest.xml |  1 +
tests/qemuxml2xmltest.c                       |  1 +
11 files changed, 256 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuxml2argvdata/x86_64-default-cpu-tcg-features.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/x86_64-default-cpu-tcg-features.xml
create mode 120000 tests/qemuxml2xmloutdata/x86_64-default-cpu-tcg-features.x86_64-latest.xml
[PATCH 0/2] Allow tweaking TCG's tb-size
Posted by Michal Privoznik 2 years, 5 months ago
*** BLURB HERE ***

Michal Prívozník (2):
  conf: Introduce TCG domain features
  qemu: Generate command line for tb-cache feature

 docs/formatdomain.rst                         | 11 +++
 docs/schemas/domaincommon.rng                 | 15 +++-
 src/conf/domain_conf.c                        | 90 +++++++++++++++++++
 src/conf/domain_conf.h                        |  7 ++
 src/qemu/qemu_command.c                       | 14 ++-
 src/qemu/qemu_validate.c                      | 11 +++
 ...efault-cpu-tcg-features.x86_64-latest.args | 40 +++++++++
 .../x86_64-default-cpu-tcg-features.xml       | 67 ++++++++++++++
 tests/qemuxml2argvtest.c                      |  1 +
 ...default-cpu-tcg-features.x86_64-latest.xml |  1 +
 tests/qemuxml2xmltest.c                       |  1 +
 11 files changed, 256 insertions(+), 2 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/x86_64-default-cpu-tcg-features.x86_64-latest.args
 create mode 100644 tests/qemuxml2argvdata/x86_64-default-cpu-tcg-features.xml
 create mode 120000 tests/qemuxml2xmloutdata/x86_64-default-cpu-tcg-features.x86_64-latest.xml

-- 
2.32.0

Re: [PATCH 0/2] Allow tweaking TCG's tb-size
Posted by Kashyap Chamarthy 2 years, 5 months ago
On Thu, Nov 04, 2021 at 01:22:51PM +0100, Michal Privoznik wrote:

[...]

> Michal Prívozník (2):
>   conf: Introduce TCG domain features
>   qemu: Generate command line for tb-cache feature
> 
>  docs/formatdomain.rst                         | 11 +++
>  docs/schemas/domaincommon.rng                 | 15 +++-
>  src/conf/domain_conf.c                        | 90 +++++++++++++++++++
>  src/conf/domain_conf.h                        |  7 ++
>  src/qemu/qemu_command.c                       | 14 ++-
>  src/qemu/qemu_validate.c                      | 11 +++
>  ...efault-cpu-tcg-features.x86_64-latest.args | 40 +++++++++
>  .../x86_64-default-cpu-tcg-features.xml       | 67 ++++++++++++++
>  tests/qemuxml2argvtest.c                      |  1 +
>  ...default-cpu-tcg-features.x86_64-latest.xml |  1 +
>  tests/qemuxml2xmltest.c                       |  1 +
>  11 files changed, 256 insertions(+), 2 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/x86_64-default-cpu-tcg-features.x86_64-latest.args
>  create mode 100644 tests/qemuxml2argvdata/x86_64-default-cpu-tcg-features.xml
>  create mode 120000 tests/qemuxml2xmloutdata/x86_64-default-cpu-tcg-features.x86_64-latest.xml

Thanks!  Works for me.

Tested-by: Kashyap Chamarthy <kchamart@redhat.com>  


I built your patches on top of:

    $> git describe
    v7.9.0-55-g20e64dad07

And with "tb-size" 64MiB (65536 KiB), quoting only partial libvirt XML):
	
    <domain type='qemu' id='4'>
      <name>cvm2</name>
      <uuid>835c272a-ba89-4227-b389-36f7b9d24345</uuid>
      <memory unit='KiB'>2097152</memory>
      <currentMemory unit='KiB'>2097152</currentMemory>
      <vcpu placement='static'>1</vcpu>
      <resource>
        <partition>/machine</partition>
      </resource>
      <os>
        <type arch='x86_64' machine='pc-i440fx-5.0'>hvm</type>
        <loader readonly='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>
        <nvram template='/usr/share/edk2/ovmf/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/cvm2_VARS.fd</nvram>
        <boot dev='hd'/>
      </os>
      <features>
        <acpi/>
        <apic/>
        <tcg>
          <tb-cache unit='KiB'>65536</tb-cache>
        </tcg>
      </features>
      <cpu mode='custom' match='exact' check='full'>
        <model fallback='forbid'>Nehalem</model>
        <feature policy='require' name='hypervisor'/>
      </cpu>
      [...]
    </domain>

It generates the right QEMU command-line (also partial):

    /bin/qemu-kvm \
    -name guest=cvm2,debug-threads=on \
    -S \
    -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-4-cvm2/master-key.aes"}' \
    -blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
    -blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
    -blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/cvm2_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
    -blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
    -machine pc-i440fx-5.0,usb=off,dump-guest-core=off,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,memory-backend=pc.ram \
    -accel tcg,tb-size=64 \
    -cpu Nehalem \
    -m 2048 \
    -object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":2147483648}' \ 
    [...]

-- 
/kashyap