- 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>
57 lines
1.6 KiB
Diff
57 lines
1.6 KiB
Diff
From d568dc527cd3098df2460d3e991efe3ad8b80410 Mon Sep 17 00:00:00 2001
|
|
From: Michal Privoznik <mprivozn@redhat.com>
|
|
Date: Wed, 4 Nov 2020 19:41:27 +0100
|
|
Subject: [PATCH] internal.h: Introduce and use VIR_IS_POW2()
|
|
|
|
This macro checks whether given number is an integer power of
|
|
two. At the same time, I've identified two places where we check
|
|
for pow2 and I'm replacing them with the macro.
|
|
|
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
|
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
|
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
|
Tested-by: Han Han <hhan@redhat.com>
|
|
Reviewed-by: Shaokun Wei <weishaokun@kylinos.cn>
|
|
---
|
|
src/internal.h | 9 +++++++++
|
|
src/util/virrandom.c | 2 +-
|
|
2 files changed, 10 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/internal.h b/src/internal.h
|
|
index 440f01d370..40c993977a 100644
|
|
--- a/src/internal.h
|
|
+++ b/src/internal.h
|
|
@@ -216,6 +216,15 @@
|
|
(a) = (a) ^ (b); \
|
|
} while (0)
|
|
|
|
+/**
|
|
+ * VIR_IS_POW2:
|
|
+ *
|
|
+ * Returns true if given number is a power of two
|
|
+ */
|
|
+#define VIR_IS_POW2(x) \
|
|
+ ((x) && !((x) & ((x) - 1)))
|
|
+
|
|
+
|
|
/**
|
|
* virCheckFlags:
|
|
* @supported: an OR'ed set of supported flags
|
|
diff --git a/src/util/virrandom.c b/src/util/virrandom.c
|
|
index 1b4102cf58..500f55c956 100644
|
|
--- a/src/util/virrandom.c
|
|
+++ b/src/util/virrandom.c
|
|
@@ -89,7 +89,7 @@ double virRandom(void)
|
|
*/
|
|
uint32_t virRandomInt(uint32_t max)
|
|
{
|
|
- if ((max & (max - 1)) == 0)
|
|
+ if (VIR_IS_POW2(max))
|
|
return virRandomBits(__builtin_ffs(max) - 1);
|
|
|
|
double val = virRandom();
|
|
--
|
|
2.27.0
|
|
|