- remote: fix double free of migration params on error - qemu: avoid deadlock in qemuDomainObjStopWorker We are dropping the only reference here so that the event loop thread is going to be exited synchronously. In order to avoid deadlocks we need to unlock the VM so that any handler being called can finish execution and thus even loop thread be finished too. - virsh: add tmm main command word Add tmm command word into virsh tool to call get tmm memory info API. It makes virsh can use tmm main commmand to show tmm memory info on console. This command requires specific kernel and a kernel driver to make sure its regular function. If runnning environment missing the above reliance, this command will show error result on console. - libvirt: add get tmm memory info API and libvirtd RPC Add the get tmm memory info API into libvirt-host. Also should add the RPC calls into libvirtd for API calling. - libvirt: support the virtCCA feature Add cvm parameter into the type of LaunchSecurity which is a optional filed for libvirt xml. Its purpose is to pass the cvm parameter through to qemu. Also this patch support virsh edit to save cvm parameter into libvirt temporary xml. - qemu_driver: Add calc_mode for dirtyrate statistics - virsh: Add mode option to domdirtyrate-calc virsh api - qemu: Generate command line for dirty-ring-size - qemu: support dirty ring feature - conf: Turn virDomainDef.kvm_features into a struct - qemu_validate: Allow kvm hint-dedicated on non-passthrough VMs - virDomainFeaturesKVMDefParse: Remove tautological "if" - virDomainFeaturesKVMDefParse: Remove tautological "switch" - virxml: Add virXMLPropUInt - virxml: Add virXMLPropInt - virxml: Add virXMLPropTristateSwitch - virxml: Add virXMLPropTristateBool - virDomainFeaturesKVMDefParse: Remove ctxt - virDomainFeaturesDefParse: Factor out KVM parsing into separate function - internal.h: Introduce and use VIR_IS_POW2() - hotpatch: if hotpatch_path not in qemu.conf,the hotpatch doesn't antoload Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
140 lines
5.5 KiB
Diff
140 lines
5.5 KiB
Diff
From 715288515d2c6eb2c6d036b8068e3a6b15d1adf3 Mon Sep 17 00:00:00 2001
|
|
From: Michal Privoznik <mprivozn@redhat.com>
|
|
Date: Tue, 14 Dec 2021 10:24:30 +0100
|
|
Subject: [PATCH] conf: Turn virDomainDef.kvm_features into a struct
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
In future commits we will need to store not just an array of
|
|
VIR_TRISTATE_SWITCH_* but also an additional integer. Follow the
|
|
example of TCG and introduce a structure where both the array an
|
|
integer can live.
|
|
|
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
Reviewed-by: J谩n Tomko <jtomko@redhat.com>
|
|
Signed-off-by: Shaokun Wei <weishaokun@kylinos.cn>
|
|
---
|
|
src/conf/domain_conf.c | 20 +++++++++++++-------
|
|
src/conf/domain_conf.h | 7 ++++++-
|
|
src/qemu/qemu_command.c | 4 ++--
|
|
3 files changed, 21 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
index e884d94ef7..e94ae4ea17 100644
|
|
--- a/src/conf/domain_conf.c
|
|
+++ b/src/conf/domain_conf.c
|
|
@@ -3476,6 +3476,7 @@ void virDomainDefFree(virDomainDefPtr def)
|
|
VIR_FREE(def->emulator);
|
|
VIR_FREE(def->description);
|
|
VIR_FREE(def->title);
|
|
+ VIR_FREE(def->kvm_features);
|
|
VIR_FREE(def->hyperv_vendor_id);
|
|
|
|
virBlkioDeviceArrayClear(def->blkio.devices,
|
|
@@ -20596,7 +20597,9 @@ static int
|
|
virDomainFeaturesKVMDefParse(virDomainDef *def,
|
|
xmlNodePtr node)
|
|
{
|
|
- def->features[VIR_DOMAIN_FEATURE_KVM] = VIR_TRISTATE_SWITCH_ON;
|
|
+ g_autofree virDomainFeatureKVM *kvm = NULL;
|
|
+
|
|
+ kvm = g_new0(virDomainFeatureKVM, 1);
|
|
|
|
node = xmlFirstElementChild(node);
|
|
while (node) {
|
|
@@ -20615,11 +20618,14 @@ virDomainFeaturesKVMDefParse(virDomainDef *def,
|
|
&value) < 0)
|
|
return -1;
|
|
|
|
- def->kvm_features[feature] = value;
|
|
+ kvm->features[feature] = value;
|
|
|
|
node = xmlNextElementSibling(node);
|
|
}
|
|
|
|
+ def->features[VIR_DOMAIN_FEATURE_KVM] = VIR_TRISTATE_SWITCH_ON;
|
|
+ def->kvm_features = g_steal_pointer(&kvm);
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
@@ -23584,13 +23590,13 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
|
switch ((virDomainKVM) i) {
|
|
case VIR_DOMAIN_KVM_HIDDEN:
|
|
case VIR_DOMAIN_KVM_DEDICATED:
|
|
- if (src->kvm_features[i] != dst->kvm_features[i]) {
|
|
+ if (src->kvm_features->features[i] != dst->kvm_features->features[i]) {
|
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
_("State of KVM feature '%s' differs: "
|
|
"source: '%s', destination: '%s'"),
|
|
virDomainKVMTypeToString(i),
|
|
- virTristateSwitchTypeToString(src->kvm_features[i]),
|
|
- virTristateSwitchTypeToString(dst->kvm_features[i]));
|
|
+ virTristateSwitchTypeToString(src->kvm_features->features[i]),
|
|
+ virTristateSwitchTypeToString(dst->kvm_features->features[i]));
|
|
return false;
|
|
}
|
|
|
|
@@ -29201,11 +29207,11 @@ virDomainDefFormatFeatures(virBufferPtr buf,
|
|
switch ((virDomainKVM) j) {
|
|
case VIR_DOMAIN_KVM_HIDDEN:
|
|
case VIR_DOMAIN_KVM_DEDICATED:
|
|
- if (def->kvm_features[j])
|
|
+ if (def->kvm_features->features[j])
|
|
virBufferAsprintf(&childBuf, "<%s state='%s'/>\n",
|
|
virDomainKVMTypeToString(j),
|
|
virTristateSwitchTypeToString(
|
|
- def->kvm_features[j]));
|
|
+ def->kvm_features->features[j]));
|
|
break;
|
|
|
|
/* coverity[dead_error_begin] */
|
|
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
index 6d56ef0282..d75d06d7b8 100644
|
|
--- a/src/conf/domain_conf.h
|
|
+++ b/src/conf/domain_conf.h
|
|
@@ -2297,6 +2297,11 @@ struct _virDomainResctrlDef {
|
|
size_t nmonitors;
|
|
};
|
|
|
|
+typedef struct _virDomainFeatureKVM virDomainFeatureKVM;
|
|
+struct _virDomainFeatureKVM {
|
|
+ int features[VIR_DOMAIN_KVM_LAST];
|
|
+};
|
|
+
|
|
|
|
struct _virDomainVcpuDef {
|
|
bool online;
|
|
@@ -2479,7 +2484,7 @@ struct _virDomainDef {
|
|
int features[VIR_DOMAIN_FEATURE_LAST];
|
|
int caps_features[VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST];
|
|
int hyperv_features[VIR_DOMAIN_HYPERV_LAST];
|
|
- int kvm_features[VIR_DOMAIN_KVM_LAST];
|
|
+ virDomainFeatureKVM *kvm_features;
|
|
int msrs_features[VIR_DOMAIN_MSRS_LAST];
|
|
unsigned int hyperv_spinlocks;
|
|
int hyperv_stimer_direct;
|
|
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
index d7db30d19b..ed843315dc 100644
|
|
--- a/src/qemu/qemu_command.c
|
|
+++ b/src/qemu/qemu_command.c
|
|
@@ -6911,12 +6911,12 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
|
for (i = 0; i < VIR_DOMAIN_KVM_LAST; i++) {
|
|
switch ((virDomainKVM) i) {
|
|
case VIR_DOMAIN_KVM_HIDDEN:
|
|
- if (def->kvm_features[i] == VIR_TRISTATE_SWITCH_ON)
|
|
+ if (def->kvm_features->features[i] == VIR_TRISTATE_SWITCH_ON)
|
|
virBufferAddLit(&buf, ",kvm=off");
|
|
break;
|
|
|
|
case VIR_DOMAIN_KVM_DEDICATED:
|
|
- if (def->kvm_features[i] == VIR_TRISTATE_SWITCH_ON)
|
|
+ if (def->kvm_features->features[i] == VIR_TRISTATE_SWITCH_ON)
|
|
virBufferAddLit(&buf, ",kvm-hint-dedicated=on");
|
|
break;
|
|
|
|
--
|
|
2.27.0
|
|
|