[PATCH] cpu_map: Add missing feature "avx-vnni-int16"
by Tim Wiederhake
Introduced in qemu commit 138c3377a9b27accec516b2c0da90dedef98a780.
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/cpu_map/x86_features.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index 19904f2e22..08bf014604 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -463,6 +463,9 @@
<feature name='amx-complex'>
<cpuid eax_in='0x00000007' ecx_in='0x00000001' edx='0x00000100'/>
</feature>
+ <feature name='avx-vnni-int16'>
+ <cpuid eax_in='0x00000007' ecx_in='0x00000001' edx='0x00000400'/>
+ </feature>
<feature name='prefetchiti'>
<cpuid eax_in='0x00000007' ecx_in='0x00000001' edx='0x00004000'/>
</feature>
--
2.43.0
4 months
[PATCH 0/2] Add support for new hv enlightenments
by Tim Wiederhake
Both were added in qemu 7.10. Add support for libvirt.
Note that the feature names use dashes in qemu but underscores
in libvirt domain conf xml to match other hv features, e.g. "vendor_id".
Tim Wiederhake (2):
hyperv: Support hv-emsr-bitmap enlightenment
hyperv: Support hv-xmm-input enlightenment
docs/formatdomain.rst | 4 ++++
src/conf/domain_conf.c | 8 ++++++++
src/conf/domain_conf.h | 2 ++
src/conf/schemas/domaincommon.rng | 10 ++++++++++
src/cpu/cpu_x86.c | 6 ++++++
src/cpu/cpu_x86_data.h | 2 ++
src/qemu/qemu_command.c | 10 ++++++++++
src/qemu/qemu_process.c | 2 ++
tests/domaincapsdata/qemu_8.0.0-q35.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_8.0.0-tcg.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_8.0.0.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_8.1.0-q35.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_8.1.0-tcg.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_8.1.0.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_8.2.0-q35.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_8.2.0-tcg.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_8.2.0.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_9.0.0-q35.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_9.0.0-tcg.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_9.0.0.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_9.1.0-q35.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_9.1.0-tcg.x86_64.xml | 2 ++
tests/domaincapsdata/qemu_9.1.0.x86_64.xml | 2 ++
tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml | 2 ++
tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml | 2 ++
tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml | 2 ++
tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml | 2 ++
tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml | 2 ++
tests/qemuxmlconfdata/hyperv-off.x86_64-latest.xml | 2 ++
tests/qemuxmlconfdata/hyperv-off.xml | 2 ++
tests/qemuxmlconfdata/hyperv.x86_64-latest.args | 2 +-
tests/qemuxmlconfdata/hyperv.x86_64-latest.xml | 2 ++
tests/qemuxmlconfdata/hyperv.xml | 2 ++
33 files changed, 93 insertions(+), 1 deletion(-)
--
2.43.0
4 months
[PATCH RFC v3 00/16] Support throttle block filters
by wucf@linux.ibm.com
From: Chun Feng Wu <wucf(a)linux.ibm.com>
Hi,
I am thinking to leverage "throttle block filter" in QEMU to support more flexible I/O limits(e.g. tiered I/O groups), one sample provided by QEMU doc is:
https://github.com/qemu/qemu/blob/master/docs/throttle.txt
"For example, let's say that we have three different drives and we want to set I/O limits for
each one of them and an additional set of limits for the combined I/O of all three drives."
The implementation idea is to
- Define throttle groups(limit) in domain
- Define throttle filter to reference throttle group within disk
- Within domain disk, throttle filters references multiple throttle groups to form filter chain to apply multiple limits in QEMU like above sample
- Add new virsh cmds for throttle group management:
throttlegroupset Add or update a throttling group.
throttlegroupdel Delete a throttling group.
throttlegroupinfo Get a throttling group.
throttlegrouplist list all domain throttlegroups
- Update "attach-disk" to add one more option "--throttle-groups" to apply throttle filters e.g. "virsh attach-disk $VM_ID ${DISK_PATH}/vm1_disk_2.qcow2 vdd --driver qemu --subdriver qcow2 --targetbus virtio --throttle-groups limit2,limit012"
- I chose above semantics as I felt they're appropriate, if there are better ones please kindly suggest.
Note, this implementation requires flag "QEMU_CAPS_OBJECT_JSON".
From QMP perspective, the sample flow works this way:
- Throttle group creation:
virsh qemu-monitor-command 1 '{"execute":"object-add", "arguments":{"qom-type":"throttle-group","id":"limit0","limits":{"iops-total":200,"iops-read":0,"iops-total-max":200,"iops-total-max-length":1}}}'
virsh qemu-monitor-command 1 '{"execute":"object-add", "arguments":{"qom-type":"throttle-group","id":"limit1","limits":{"iops-total":250,"iops-read":0,"iops-total-max":250,"iops-total-max-length":1}}}'
virsh qemu-monitor-command 1 '{"execute":"object-add", "arguments":{"qom-type":"throttle-group","id":"limit2","limits":{"iops-total":300,"iops-read":0,"iops-total-max":300,"iops-total-max-length":1}}}'
virsh qemu-monitor-command 1 '{"execute":"object-add", "arguments":{"qom-type":"throttle-group","id":"limit012","limits":{"iops-total":400,"iops-read":0,"iops-total-max":400,"iops-total-max-length":1}}}'
- Chain up filters during attaching disk to apply two filters(limit0 and limit012):
virsh qemu-monitor-command 1 '{"execute":"blockdev-add", "arguments": {"driver":"file","filename":"/virt/disks/vm1_disk_1.qcow2","node-name":"test-3-storage","auto-read-only":true,"discard":"unmap"}}'
virsh qemu-monitor-command 1 '{"execute":"blockdev-add", "arguments":{"node-name":"test-4-format","read-only":false,"driver":"qcow2","file":"test-3-storage","backing":null}}'
virsh qemu-monitor-command 1 '{"execute":"blockdev-add", "arguments":{"driver":"throttle","node-name":"libvirt-5-filter","throttle-group": "limit0","file":"test-4-format"}}'
virsh qemu-monitor-command 1 '{"execute":"blockdev-add", "arguments": {"driver":"throttle","node-name":"libvirt-6-filter","throttle-group":"limit012","file":"libvirt-5-filter"}}'
virsh qemu-monitor-command 1 '{"execute": "device_add", "arguments": {"driver":"virtio-blk-pci","scsi":false,"bus":"pci.0","addr":"0x5","drive":"libvirt-6-filter","id":"virtio-disk1"}}'
This patchset includes:
- Throttle group XML schema definition in patch 1
- Throttle filter XML schema definition in patch 2
- Throttle group struct definition, parsing and formating in patch 3
- Throttle filter struct definition, parsing and formating in patch 4
- New QMP processing to update and get throttle group in patch 5&6
- New API definition and implementation in patch 7
- QEMU driver implementation in patch 8
- Hotplug processing for throttle filters in patch 9
- Extract common iotune validation in patch 10
- qemuProcessLaunch flow implemenation for throttle group in patch 11
- qemuProcessLaunch flow implemenation for throttle filter in patch 12
- Domain XML test for processing throttle groups and filters in patch 13
- Test new implemented driver in patch 14
- New virsh cmd implementation for group in patch 15
- Update Virsh cmd "attach_disk" to include throttle filters in patch 16
v3 changes:
- re-org commits by splitting changes containing throttle group and filters
- update commits msgs
- move schema commits to be the first ones
- refactor "diskIoTune" to extract common schema "iotune"
- add new tests for throttle groups and filters in qemuxmlconftest
- check flag "QEMU_CAPS_OBJECT_JSON" when preparing "-object"(qemu: command: Support throttle groups during qemuProcessLaunch ) or creating throttle group (qemu: Implement qemu driver for throttle API)
- when creating throttle group through "object-add" (qemu: Implement qemu driver for throttle API), reuse "qemuMonitorAddObject" to check if "objectAddNoWrap"("props") is requried
- remove "virObject parent;" in "_virDomainThrottleFilterDef" in domain_conf.h
- remove "virDomainThrottleGroupIndexByName" in both domain_conf.h and domain_conf.c
- remove "virDomainThrottleFilterDefNew" in domain_conf.c
- update "virDomainThrottleFilterDefFree" to use "g_free" rather than "VIR_FREE" in domain_conf.c
- update "virDomainDiskThrottleFilterDefParse" to remove "xmlXPathContextPtr ctx" parameter and check NULL against "filter->group_name" in domain_conf.c
- use "virBufferEscapeString" instead of "virBufferAsprintf" in "virDomainDiskDefFormatThrottleFilterChain"
- use "group->val > 0" instead of "if (group->val)" in FORMAT_THROTTLE_GROUP
- remove NULL check for "group->group_name" since virBufferEscapeString checked NULL already in "virDomainThrottleGroupFormat"
- I haven't added new conf module (src/conf/virdomainthrottle.c/h) because "virDomainThrottleGroupDef" is alias of "_virDomainBlockIoTuneInfo", try to avoid circular dependency
- remove "NULLSTR" in qemuMonitorUpdateThrottleGroup and qemuMonitorGetThrottleGroup in qemu_monitor.c
- refactor "qemuMonitorMakeThrottleGroupLimits" to use virJSONValueObjectAdd in qemu_monitor_json.c
- use "g_strdup_printf" to avoid static buffers in "qemuMonitorJSONGetThrottleGroup"
- remove virReportError after qemuMonitorJSONGetReply in "qemuMonitorJSONGetThrottleGroup" to avoid overriding error
- remove "VIR_DOMAIN_THROTTLE_GROUP" in libvirt/include/libvirt/libvirt-domain.h
- update "virDomainGetThrottleGroup" to not first query the number of parameters,
- update "remote_domain_get_throttle_group_args" and "remote_domain_get_throttle_group_ret" to remove "nparams" in src/remote_protocol-structs, also updated "remote_domain_get_throttle_group_args" and "remote_domain_get_throttle_group_ret" in src/remote/remote_protocol.x
- update parameter "virTypedParameterPtr params" to be "virTypedParameterPtr *params" in "virDrvDomainGetThrottleGroup" in driver-hypervisor.h
- update "qemuDomainSetThrottleGroup" to not query number of parameters first
- remove wrapper "qemuDomainThrottleGroupByName" and "qemuDomainSetThrottleGroupDefaults"
- refactor "qemuDomainSetThrottleGroup" and "qemuDomainSetBlockIoTune" to use common logic
- update "qemuDomainDelThrottleGroup" to use VIR_JOB_MODIFY by referencing "qemuDomainHotplugDelIOThread"
- check if group is still being used by some filter(qemuDomainCheckThrottleGroupRef) during deletion
- replace "ThrottleFilterChain" with "ThrottleFilters"
- update "qemuDomainDiskGetTopNodename" to take top throttle node name if disk has throttles, and reuse "qemuDomainDiskGetBackendAlias" in "qemuBuildDiskDeviceProps" to get top node name as "drive"
- after enabling throttlerfilter and if disk has throttlefilters, during blockcommit, the top node name is not "libvirt-x-format" anymore, instead, top node name referencies top filter like "libvirt-x-filter"
- add check "cdrom device with throttle filters isn't supported"
- delete "filternodenameindex" and reuse "nodenameindex" to generate index for throttle nodes
- refactor detaching filters by adding "qemuBuildThrottleFiltersDetachPrepareBlockdev" to just build parameters for "blockdev-del"
- refactor "testDomainSetBlockIoTune" and "testDomainSetThrottleGroup" to use common logic
Any comments/suggestions will be appriciated!
Chun Feng Wu (16):
schema: Add new domain elements to support multiple throttle groups
schema: Add new domain elements to support multiple throttle filters
config: Introduce ThrottleGroup and corresponding XML parsing
config: Introduce ThrottleFilter and corresponding XML parsing
qemu: monitor: Add support for ThrottleGroup operations
tests: Test qemuMonitorJSONGetThrottleGroup and
qemuMonitorJSONUpdateThrottleGroup
remote: New APIs for ThrottleGroup lifecycle management
qemu: Implement qemu driver for throttle API
qemu: hotplug: Support hot attach and detach block disk along with
throttle filters
config: validate: Refactor disk iotune validation for reuse
qemu: command: Support throttle groups during qemuProcessLaunch
qemu: command: Support throttle filters during qemuProcessLaunch
qemuxmlconftest: Add 'throttlefilter' tests
test_driver: Test throttle group lifecycle APIs
virsh: Add support for throttle group operations
virsh: Add option "throttle-groups" to "attach_disk"
docs/formatdomain.rst | 48 ++
include/libvirt/libvirt-domain.h | 21 +
src/conf/domain_conf.c | 376 +++++++++++
src/conf/domain_conf.h | 51 ++
src/conf/domain_validate.c | 118 +++-
src/conf/schemas/domaincommon.rng | 293 +++++----
src/conf/virconftypes.h | 4 +
src/driver-hypervisor.h | 22 +
src/libvirt-domain.c | 196 ++++++
src/libvirt_private.syms | 9 +
src/libvirt_public.syms | 7 +
src/qemu/qemu_block.c | 131 ++++
src/qemu/qemu_block.h | 53 ++
src/qemu/qemu_command.c | 182 ++++++
src/qemu/qemu_command.h | 12 +
src/qemu/qemu_domain.c | 39 +-
src/qemu/qemu_domain.h | 8 +
src/qemu/qemu_driver.c | 617 +++++++++++++++---
src/qemu/qemu_hotplug.c | 33 +
src/qemu/qemu_monitor.c | 34 +
src/qemu/qemu_monitor.h | 14 +
src/qemu/qemu_monitor_json.c | 150 +++++
src/qemu/qemu_monitor_json.h | 14 +
src/remote/remote_daemon_dispatch.c | 44 ++
src/remote/remote_driver.c | 40 ++
src/remote/remote_protocol.x | 48 +-
src/remote_protocol-structs | 28 +
src/test/test_driver.c | 452 +++++++++----
tests/qemumonitorjsontest.c | 86 +++
.../throttlefilter.x86_64-latest.args | 43 ++
.../throttlefilter.x86_64-latest.xml | 65 ++
tests/qemuxmlconfdata/throttlefilter.xml | 55 ++
tests/qemuxmlconftest.c | 1 +
tools/virsh-completer-domain.c | 64 ++
tools/virsh-completer-domain.h | 5 +
tools/virsh-domain.c | 453 ++++++++++++-
36 files changed, 3447 insertions(+), 369 deletions(-)
create mode 100644 tests/qemuxmlconfdata/throttlefilter.x86_64-latest.args
create mode 100644 tests/qemuxmlconfdata/throttlefilter.x86_64-latest.xml
create mode 100644 tests/qemuxmlconfdata/throttlefilter.xml
--
2.34.1
4 months
[libvirt PATCH RFC] ci: adapt to 'dtrace' package split
by Ján Tomko
Fedora has decided to separate dtrace out of the systemtap-sdt-devel
package: https://fedoraproject.org/wiki/Changes/Separate_dtrace_package
Similarly, these are split in OpenSUSE Tumbleweed, however in a
backward-compatbile way:
https://build.opensuse.org/package/show/openSUSE:Factory/systemtap
Require the new 'systemtap-sdt' package mapping, as well as the old
'dtrace'.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
This was generated from the libvirt-ci change from the following merge
request:
https://gitlab.com/libvirt/libvirt-ci/-/merge_requests/498
It is believed to fix the failure on Fedora Rawhide:
https://gitlab.com/janotomko/libvirt/-/pipelines/1413537405
(The failed job comes from a transient error on a cirrus builder)
I don't know what the issue with debian-sid is about
ci/buildenv/fedora-rawhide.sh | 1 +
ci/buildenv/opensuse-tumbleweed.sh | 3 ++-
ci/containers/fedora-rawhide.Dockerfile | 1 +
ci/containers/opensuse-tumbleweed.Dockerfile | 3 ++-
ci/lcitool/projects/libvirt.yml | 1 +
5 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ci/buildenv/fedora-rawhide.sh b/ci/buildenv/fedora-rawhide.sh
index f89a87ad63..1706ec27f4 100644
--- a/ci/buildenv/fedora-rawhide.sh
+++ b/ci/buildenv/fedora-rawhide.sh
@@ -82,6 +82,7 @@ function install_buildenv() {
systemd-devel \
systemd-rpm-macros \
systemtap-sdt-devel \
+ systemtap-sdt-dtrace \
wireshark-devel \
xen-devel \
yajl-devel
diff --git a/ci/buildenv/opensuse-tumbleweed.sh b/ci/buildenv/opensuse-tumbleweed.sh
index ac566d349f..5117ea4ddb 100644
--- a/ci/buildenv/opensuse-tumbleweed.sh
+++ b/ci/buildenv/opensuse-tumbleweed.sh
@@ -81,7 +81,8 @@ function install_buildenv() {
sanlock-devel \
sed \
systemd-rpm-macros \
- systemtap-sdt-devel \
+ systemtap-dtrace \
+ systemtap-headers \
wireshark-devel \
xen-devel
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED
diff --git a/ci/containers/fedora-rawhide.Dockerfile b/ci/containers/fedora-rawhide.Dockerfile
index 6f06843985..ef91b6acc7 100644
--- a/ci/containers/fedora-rawhide.Dockerfile
+++ b/ci/containers/fedora-rawhide.Dockerfile
@@ -93,6 +93,7 @@ exec "$@"\n' > /usr/bin/nosync && \
systemd-devel \
systemd-rpm-macros \
systemtap-sdt-devel \
+ systemtap-sdt-dtrace \
wireshark-devel \
xen-devel \
yajl-devel && \
diff --git a/ci/containers/opensuse-tumbleweed.Dockerfile b/ci/containers/opensuse-tumbleweed.Dockerfile
index 2b7cdb4af5..6a992e2039 100644
--- a/ci/containers/opensuse-tumbleweed.Dockerfile
+++ b/ci/containers/opensuse-tumbleweed.Dockerfile
@@ -82,7 +82,8 @@ RUN zypper dist-upgrade -y && \
sanlock-devel \
sed \
systemd-rpm-macros \
- systemtap-sdt-devel \
+ systemtap-dtrace \
+ systemtap-headers \
wireshark-devel \
xen-devel && \
zypper clean --all && \
diff --git a/ci/lcitool/projects/libvirt.yml b/ci/lcitool/projects/libvirt.yml
index 5e0bd66958..12e21893cf 100644
--- a/ci/lcitool/projects/libvirt.yml
+++ b/ci/lcitool/projects/libvirt.yml
@@ -75,6 +75,7 @@ packages:
- sed
- showmount
- systemd-rpm-macros
+ - systemtap-sdt
- tc
- wireshark
- xen
--
2.45.2
4 months
[PATCH 0/2] qemu: Don't crash on empty USB cdrom hotplug
by Peter Krempa
Fix the main crash cause and also forbid empty USB devices as qemu
doesn't accept them.
Peter Krempa (2):
qemu: block: Allow NULL 'data' in 'qemuBlockStorageSourceChainDetach'
qemu: validate: Reject empty USB disks
src/qemu/qemu_block.c | 3 ++
src/qemu/qemu_validate.c | 6 ++++
.../disk-cdrom-bus-other.x86_64-latest.args | 5 ++--
.../disk-cdrom-bus-other.x86_64-latest.xml | 5 ----
.../qemuxmlconfdata/disk-cdrom-bus-other.xml | 5 ----
.../disk-cdrom-usb-empty.x86_64-latest.err | 1 +
.../qemuxmlconfdata/disk-cdrom-usb-empty.xml | 29 +++++++++++++++++++
tests/qemuxmlconftest.c | 1 +
8 files changed, 42 insertions(+), 13 deletions(-)
create mode 100644 tests/qemuxmlconfdata/disk-cdrom-usb-empty.x86_64-latest.err
create mode 100644 tests/qemuxmlconfdata/disk-cdrom-usb-empty.xml
--
2.46.0
4 months
[PATCH] qemu: Add support for RAPL MSRs feature
by Anthony Harivel
Add the support in libvirt to activate the RAPL feature in QEMU.
This feature is activated with -accel kvm,rapl=true,path=/path/sock.sock
in QEMU.
The feature is activated in libvirt with the following XML
configuration:
<kvm>
[...]
<rapl state ='on' socket='/run/qemu-vmsr-helper.sock'/>
[...]
</kvm>
See: https://gitlab.com/qemu-project/qemu/-/commit/0418f90809aea5b375c859e744c...
Signed-off-by: Anthony Harivel <aharivel(a)redhat.com>
---
docs/formatdomain.rst | 2 ++
src/conf/domain_conf.c | 30 +++++++++++++++++++
src/conf/domain_conf.h | 2 ++
src/conf/schemas/domaincommon.rng | 10 +++++++
src/qemu/qemu_command.c | 7 +++++
tests/qemuxmlconfdata/kvm-features-off.xml | 1 +
.../kvm-features.x86_64-latest.args | 2 +-
tests/qemuxmlconfdata/kvm-features.xml | 1 +
8 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index e1e219bcb5c5..5c66e41e940f 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -1996,6 +1996,7 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off.
<poll-control state='on'/>
<pv-ipi state='off'/>
<dirty-ring state='on' size='4096'/>
+ <rapl state ='on' socket='/run/qemu-vmsr-helper.sock'/>
</kvm>
<xen>
<e820_host state='on'/>
@@ -2111,6 +2112,7 @@ are:
poll-control Decrease IO completion latency by introducing a grace period of busy waiting on, off :since:`6.10.0 (QEMU 4.2)`
pv-ipi Paravirtualized send IPIs on, off :since:`7.10.0 (QEMU 3.1)`
dirty-ring Enable dirty ring feature on, off; size - must be power of 2, range [1024,65536] :since:`8.0.0 (QEMU 6.1)`
+ rapl Enable rapl feature on, off; socket - rapl helper socket :since:`10.8.0 (QEMU 9.1)`
============== ============================================================================ ====================================================== ============================
``xen``
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d950921667a2..06fbcac4aad1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -220,6 +220,7 @@ VIR_ENUM_IMPL(virDomainKVM,
"poll-control",
"pv-ipi",
"dirty-ring",
+ "rapl"
);
VIR_ENUM_IMPL(virDomainXen,
@@ -16693,6 +16694,14 @@ virDomainFeaturesKVMDefParse(virDomainDef *def,
return -1;
}
}
+
+ /* rapl feature should parse socket property */
+ if (feature == VIR_DOMAIN_KVM_RAPL && value == VIR_TRISTATE_SWITCH_ON) {
+ kvm->socket = virXMLPropString(feat, "socket");
+ if (kvm->socket == NULL) {
+ return -1;
+ }
+ }
}
def->features[VIR_DOMAIN_FEATURE_KVM] = VIR_TRISTATE_SWITCH_ON;
@@ -21108,6 +21117,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src,
case VIR_DOMAIN_KVM_POLLCONTROL:
case VIR_DOMAIN_KVM_PVIPI:
case VIR_DOMAIN_KVM_DIRTY_RING:
+ case VIR_DOMAIN_KVM_RAPL:
if (src->kvm_features->features[i] != dst->kvm_features->features[i]) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of KVM feature '%1$s' differs: source: '%2$s', destination: '%3$s'"),
@@ -21132,6 +21142,15 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src,
dst->kvm_features->dirty_ring_size);
return false;
}
+
+ if (src->kvm_features->socket != dst->kvm_features->socket) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("rapl helper socket of KVM feature '%1$s' differs: source: '%2$s', destination: '%3$s'"),
+ virDomainKVMTypeToString(i),
+ src->kvm_features->socket,
+ dst->kvm_features->socket);
+ return false;
+ }
}
/* smm */
@@ -27840,6 +27859,17 @@ virDomainDefFormatFeatures(virBuffer *buf,
}
break;
+ case VIR_DOMAIN_KVM_RAPL:
+ if (def->kvm_features->features[j] != VIR_TRISTATE_SWITCH_ABSENT) {
+ virBufferAsprintf(&childBuf, "<%s state='%s'",
+ virDomainKVMTypeToString(j),
+ virTristateSwitchTypeToString(def->kvm_features->features[j]));
+
+ virBufferEscapeString(&childBuf, " socket='%s'", def->kvm_features->socket);
+ virBufferAddLit(&childBuf, "/>\n");
+ }
+ break;
+
case VIR_DOMAIN_KVM_LAST:
break;
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index eae621f900b9..aa777850ec72 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2213,6 +2213,7 @@ typedef enum {
VIR_DOMAIN_KVM_POLLCONTROL,
VIR_DOMAIN_KVM_PVIPI,
VIR_DOMAIN_KVM_DIRTY_RING,
+ VIR_DOMAIN_KVM_RAPL,
VIR_DOMAIN_KVM_LAST
} virDomainKVM;
@@ -2400,6 +2401,7 @@ struct _virDomainFeatureKVM {
int features[VIR_DOMAIN_KVM_LAST];
unsigned int dirty_ring_size; /* size of dirty ring for each vCPU, no units */
+ char *socket; /* rapl helper socket */
};
typedef struct _virDomainFeatureTCG virDomainFeatureTCG;
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index 05ba69792470..1883bb115ee5 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -8016,6 +8016,16 @@
</optional>
</element>
</optional>
+ <optional>
+ <element name="rapl">
+ <ref name="featurestate"/>
+ <optional>
+ <attribute name="socket">
+ <data type="string"/>
+ </attribute>
+ </optional>
+ </element>
+ </optional>
</interleave>
</element>
</define>
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 28914c9c346a..d20fb6df5e8e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6562,6 +6562,9 @@ qemuBuildCpuCommandLine(virCommand *cmd,
case VIR_DOMAIN_KVM_DIRTY_RING:
break;
+ case VIR_DOMAIN_KVM_RAPL:
+ break;
+
case VIR_DOMAIN_KVM_LAST:
break;
}
@@ -7176,6 +7179,10 @@ qemuBuildAccelCommandLine(virCommand *cmd,
def->kvm_features->features[VIR_DOMAIN_KVM_DIRTY_RING] == VIR_TRISTATE_SWITCH_ON) {
virBufferAsprintf(&buf, ",dirty-ring-size=%d", def->kvm_features->dirty_ring_size);
}
+ if (def->features[VIR_DOMAIN_FEATURE_KVM] == VIR_TRISTATE_SWITCH_ON &&
+ def->kvm_features->features[VIR_DOMAIN_KVM_RAPL] == VIR_TRISTATE_SWITCH_ON) {
+ virBufferAsprintf(&buf, ",rapl=true,rapl-helper-socket=%s", def->kvm_features->socket);
+ }
break;
case VIR_DOMAIN_VIRT_HVF:
diff --git a/tests/qemuxmlconfdata/kvm-features-off.xml b/tests/qemuxmlconfdata/kvm-features-off.xml
index 3cd4ff18f283..3e8dbea4b177 100644
--- a/tests/qemuxmlconfdata/kvm-features-off.xml
+++ b/tests/qemuxmlconfdata/kvm-features-off.xml
@@ -16,6 +16,7 @@
<poll-control state='off'/>
<pv-ipi state='off'/>
<dirty-ring state='off'/>
+ <rapl state='off'/>
</kvm>
</features>
<cpu mode='host-passthrough' check='none' migratable='off'/>
diff --git a/tests/qemuxmlconfdata/kvm-features.x86_64-latest.args b/tests/qemuxmlconfdata/kvm-features.x86_64-latest.args
index 955db67eb4b7..2dd613ab338d 100644
--- a/tests/qemuxmlconfdata/kvm-features.x86_64-latest.args
+++ b/tests/qemuxmlconfdata/kvm-features.x86_64-latest.args
@@ -11,7 +11,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=on \
--accel kvm,dirty-ring-size=4096 \
+-accel kvm,dirty-ring-size=4096,rapl=true,rapl-helper-socket=/run/qemu-vmsr-helper.sock \
-cpu host,migratable=off,kvm=off,kvm-hint-dedicated=on,kvm-poll-control=on \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
diff --git a/tests/qemuxmlconfdata/kvm-features.xml b/tests/qemuxmlconfdata/kvm-features.xml
index 78091064b109..ee601e06de75 100644
--- a/tests/qemuxmlconfdata/kvm-features.xml
+++ b/tests/qemuxmlconfdata/kvm-features.xml
@@ -16,6 +16,7 @@
<poll-control state='on'/>
<pv-ipi state='on'/>
<dirty-ring state='on' size='4096'/>
+ <rapl state='on' socket='/run/qemu-vmsr-helper.sock'/>
</kvm>
</features>
<cpu mode='host-passthrough' check='none' migratable='off'/>
--
2.46.0
4 months, 1 week
[libvirt PATCH 00/20] Switch to json-c from yajl
by Ján Tomko
As requested by:
https://gitlab.com/libvirt/libvirt/-/issues/581
The ci update depends on the following libvirt-ci MR:
https://gitlab.com/libvirt/libvirt-ci/-/merge_requests/497
targets: bump OpenSUSE Leap to 15.6
Pipeline:
https://gitlab.com/janotomko/libvirt/-/pipelines/1413887401/
Ján Tomko (20):
tests: json: relax some test cases
ci: update OpenSUSE Leap to 15.6
util: json: introduce virJSONStringPrettifyBlanks
tests: switch to compact empty JSON object formatting
meson: add option for building with json-c
meson: link libvirt with json_c if available
util: json: write a json-c implementation
ci: install json-c too
meson: nss: link with json-c if available
nss: convert findLeases to use json-c
nss: convert findMACs to use json-c
tests: depend on WITH_JSON_C instead of WITH_YAJL
meson: switch checks to depend on json-c instead of yajl
meson-options: switch to depend on json-c instead of yajl
libvirt-spec: switch to building with json-c
meson: do not link anything with yajl anymore
meson: options: drop yajl
meson: drop yajl detection
util: drop dead code
ci: drop yajl completely
ci/buildenv/almalinux-9.sh | 4 +-
ci/buildenv/alpine-319.sh | 4 +-
ci/buildenv/alpine-edge.sh | 4 +-
ci/buildenv/centos-stream-9.sh | 4 +-
ci/buildenv/debian-11-cross-aarch64.sh | 2 +-
ci/buildenv/debian-11-cross-armv6l.sh | 2 +-
ci/buildenv/debian-11-cross-armv7l.sh | 2 +-
ci/buildenv/debian-11-cross-i686.sh | 2 +-
ci/buildenv/debian-11-cross-mips64el.sh | 2 +-
ci/buildenv/debian-11-cross-mipsel.sh | 2 +-
ci/buildenv/debian-11-cross-ppc64le.sh | 2 +-
ci/buildenv/debian-11-cross-s390x.sh | 2 +-
ci/buildenv/debian-11.sh | 2 +-
ci/buildenv/debian-12-cross-aarch64.sh | 2 +-
ci/buildenv/debian-12-cross-armv6l.sh | 2 +-
ci/buildenv/debian-12-cross-armv7l.sh | 2 +-
ci/buildenv/debian-12-cross-i686.sh | 2 +-
ci/buildenv/debian-12-cross-mips64el.sh | 2 +-
ci/buildenv/debian-12-cross-mipsel.sh | 2 +-
ci/buildenv/debian-12-cross-ppc64le.sh | 2 +-
ci/buildenv/debian-12-cross-s390x.sh | 2 +-
ci/buildenv/debian-12.sh | 2 +-
ci/buildenv/debian-sid-cross-aarch64.sh | 2 +-
ci/buildenv/debian-sid-cross-armv6l.sh | 2 +-
ci/buildenv/debian-sid-cross-armv7l.sh | 2 +-
ci/buildenv/debian-sid-cross-i686.sh | 2 +-
ci/buildenv/debian-sid-cross-mips64el.sh | 2 +-
ci/buildenv/debian-sid-cross-ppc64le.sh | 2 +-
ci/buildenv/debian-sid-cross-s390x.sh | 2 +-
ci/buildenv/debian-sid.sh | 2 +-
ci/buildenv/fedora-39.sh | 4 +-
ci/buildenv/fedora-40.sh | 4 +-
ci/buildenv/fedora-rawhide.sh | 4 +-
ci/buildenv/opensuse-leap-15.sh | 2 +-
ci/buildenv/opensuse-tumbleweed.sh | 2 +-
ci/buildenv/ubuntu-2204.sh | 2 +-
ci/buildenv/ubuntu-2404.sh | 2 +-
ci/cirrus/freebsd-13.vars | 2 +-
ci/cirrus/freebsd-14.vars | 2 +-
ci/cirrus/macos-13.vars | 2 +-
ci/cirrus/macos-14.vars | 2 +-
ci/containers/almalinux-9.Dockerfile | 4 +-
ci/containers/alpine-319.Dockerfile | 4 +-
ci/containers/alpine-edge.Dockerfile | 4 +-
ci/containers/centos-stream-9.Dockerfile | 4 +-
.../debian-11-cross-aarch64.Dockerfile | 2 +-
.../debian-11-cross-armv6l.Dockerfile | 2 +-
.../debian-11-cross-armv7l.Dockerfile | 2 +-
ci/containers/debian-11-cross-i686.Dockerfile | 2 +-
.../debian-11-cross-mips64el.Dockerfile | 2 +-
.../debian-11-cross-mipsel.Dockerfile | 2 +-
.../debian-11-cross-ppc64le.Dockerfile | 2 +-
.../debian-11-cross-s390x.Dockerfile | 2 +-
ci/containers/debian-11.Dockerfile | 2 +-
.../debian-12-cross-aarch64.Dockerfile | 2 +-
.../debian-12-cross-armv6l.Dockerfile | 2 +-
.../debian-12-cross-armv7l.Dockerfile | 2 +-
ci/containers/debian-12-cross-i686.Dockerfile | 2 +-
.../debian-12-cross-mips64el.Dockerfile | 2 +-
.../debian-12-cross-mipsel.Dockerfile | 2 +-
.../debian-12-cross-ppc64le.Dockerfile | 2 +-
.../debian-12-cross-s390x.Dockerfile | 2 +-
ci/containers/debian-12.Dockerfile | 2 +-
.../debian-sid-cross-aarch64.Dockerfile | 2 +-
.../debian-sid-cross-armv6l.Dockerfile | 2 +-
.../debian-sid-cross-armv7l.Dockerfile | 2 +-
.../debian-sid-cross-i686.Dockerfile | 2 +-
.../debian-sid-cross-mips64el.Dockerfile | 2 +-
.../debian-sid-cross-ppc64le.Dockerfile | 2 +-
.../debian-sid-cross-s390x.Dockerfile | 2 +-
ci/containers/debian-sid.Dockerfile | 2 +-
ci/containers/fedora-39.Dockerfile | 4 +-
ci/containers/fedora-40.Dockerfile | 4 +-
ci/containers/fedora-rawhide.Dockerfile | 4 +-
ci/containers/opensuse-leap-15.Dockerfile | 4 +-
ci/containers/opensuse-tumbleweed.Dockerfile | 2 +-
ci/containers/ubuntu-2204.Dockerfile | 2 +-
ci/containers/ubuntu-2404.Dockerfile | 2 +-
ci/gitlab/builds.yml | 2 +-
ci/lcitool/projects/libvirt.yml | 2 +-
libvirt.spec.in | 6 +-
meson.build | 61 +--
meson_options.txt | 8 +-
src/libvirt_private.syms | 1 +
src/meson.build | 2 +-
src/util/meson.build | 2 +-
src/util/virjson.c | 481 +++++-------------
src/util/virjson.h | 2 +
tests/meson.build | 8 +-
tests/qemublocktest.c | 5 +-
.../backupmerge/empty-out.json | 4 +-
tests/qemumigparamsdata/empty.json | 4 +-
tests/qemumigparamstest.c | 5 +-
tests/virjsontest.c | 9 +-
tests/virmacmaptest.c | 5 +-
tests/virmacmaptestdata/empty.json | 4 +-
tests/virnetdaemontest.c | 2 +-
tests/virstoragetest.c | 4 +-
tools/nss/libvirt_nss_leases.c | 339 ++++--------
tools/nss/libvirt_nss_macs.c | 263 +++-------
tools/nss/meson.build | 4 +-
101 files changed, 447 insertions(+), 962 deletions(-)
--
2.45.2
4 months, 1 week
[PATCH] security: apparmor: Allow QEMU read /proc/sys/vm/max_map_count
by Michal Privoznik
In its commit v9.0.0-rc0~1^2 QEMU started to read
/proc/sys/vm/max_map_count file to set up coroutine limits better
(something about VMAs, mmap(), see the commit for more info).
Allow the file in apparmor profile.
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/660
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/security/apparmor/libvirt-qemu.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/security/apparmor/libvirt-qemu.in b/src/security/apparmor/libvirt-qemu.in
index 8b92915281..8f17256554 100644
--- a/src/security/apparmor/libvirt-qemu.in
+++ b/src/security/apparmor/libvirt-qemu.in
@@ -34,6 +34,7 @@
# only modify its comm value or those in its thread group.
owner @{PROC}/@{pid}/task/@{tid}/comm rw,
@{PROC}/sys/kernel/cap_last_cap r,
+ @{PROC}/sys/vm/max_map_count r,
@{PROC}/sys/vm/overcommit_memory r,
# detect hardware capabilities via qemu_getauxval
owner @{PROC}/*/auxv r,
--
2.44.2
4 months, 1 week
New features tests fails
by Anthony Harivel
Hi,
I'm trying to implement the libvirt part of a new feature that has
landed in QEMU staging [1].
The current draft of this implementations is the following [2].
It compiles on top of master.
But when I want to run the tests suites, I hit an issue I don't managed
to find the problem.
It runs until:
[...]
278/279 libvirt:bin / qemuxmlconftest FAIL 8.63s exit status 1
[...]
then it tells me to run the following to understand the issue:
VIR_TEST_DEBUG=1 VIR_TEST_RANGE=850-851,854-855 /home/aharivel/work/libvirt/build/tests/qemuxmlconftest
It outputs this:
[...]
850) QEMU XML def -> XML kvm-features.x86_64-latest ...
In '/home/aharivel/work/libvirt/tests/qemuxmlconfdata/kvm-features.x86_64-latest.xml':
Offset 533
Expect [ socket='/run/qemu-vmsr-helper.sock'/]
Actual [/]
... FAILED
851) QEMU XML OUT -> XML kvm-features.x86_64-latest ...
In '/home/aharivel/work/libvirt/tests/qemuxmlconfdata/kvm-features.x86_64-latest.xml':
Offset 533
Expect [ socket='/run/qemu-vmsr-helper.sock'/]
Actual [/]
... FAILED
854) QEMU XML def -> XML kvm-features-off.x86_64-latest ...
In '/home/aharivel/work/libvirt/tests/qemuxmlconfdata/kvm-features-off.x86_64-latest.xml':
Offset 527
Expect [/]
Actual [ socket='(null)'/]
... FAILED
855) QEMU XML OUT -> XML kvm-features-off.x86_64-latest ...
In '/home/aharivel/work/libvirt/tests/qemuxmlconfdata/kvm-features-off.x86_64-latest.xml':
Offset 527
Expect [/]
Actual [ socket='(null)'/]
[...] ... FAILED
I certainly did something wrong in the implementation but I don't figure
it out. I understand the Expect / Actual tests.
I'm guessing the issue is that it needs to run the QEMU version where the
feature is possible but I don't see how can tell the test to run this
particular version.
Any advise would be greatly appreciate.
Thanks
Regards,
Anthony
[1] : https://gitlab.com/qemu-project/qemu/-/commit/0418f90809aea5b375c859e744c...
[2] : https://github.com/aharivel/libvirt/commit/153a4489f095e063f3c7e0470a8f92...
4 months, 1 week