[libvirt] QEMU soundcards vulnerable to jack retasking?
by bancfc@openmailbox.org
Recent security research shows that soundcards support surreptitiously
switching line-out jacks into line-in by modifying the software stack.
The way modern speakers and headphones are designed makes them readily
usable as microphones. The Intel High Definition (HD) Audio standards
which all modern consumer soundcards are based mandates this stupidity.
https://arxiv.org/ftp/arxiv/papers/1611/1611.07350.pdf
Does anyone know if QEMU's emulated sound devices follow this standard?
If yes then a malicious guest that can modify the virt sound hardware
can turn PC speakers into surveillance devices even if the microphone is
disabled on the host. The only solution is completely denying untrusted
VMs access to a virtual sound device.
/CC'd the respective researchers for input on this too.
8 years
[libvirt] [PATCH] Pass GPG_TTY env var to the ssh binary
by Guido Günther
This came in via the Debian BTS:
http://bugs.debian.org/43863
and it looks good to me.
>From 7eeec0664ed2c4986172b67815d2ecf5432d0a40 Mon Sep 17 00:00:00 2001
Message-Id: <7eeec0664ed2c4986172b67815d2ecf5432d0a40.1478956627.git.agx(a)sigxcpu.org>
From: Guilhem Moulin <guilhem(a)guilhem.org>
Date: Thu, 10 Nov 2016 11:17:05 +0100
Subject: [PATCH] Pass GPG_TTY env var to the ssh binary
To: libvir-list(a)redhat.com
Status: O
Content-Length: 694
Lines: 18
---
src/rpc/virnetsocket.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 405f5ba..95cda86 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -839,6 +839,7 @@ int virNetSocketNewConnectSSH(const char *nodename,
virCommandAddEnvPassBlockSUID(cmd, "KRB5CCNAME", NULL);
virCommandAddEnvPassBlockSUID(cmd, "SSH_AUTH_SOCK", NULL);
virCommandAddEnvPassBlockSUID(cmd, "SSH_ASKPASS", NULL);
+ virCommandAddEnvPassBlockSUID(cmd, "GPG_TTY", NULL);
virCommandAddEnvPassBlockSUID(cmd, "DISPLAY", NULL);
virCommandAddEnvPassBlockSUID(cmd, "XAUTHORITY", NULL);
virCommandClearCaps(cmd);
--
2.10.2
8 years
[libvirt] [PATCH] Revert "vz: fixed race in vzDomainAttach/DettachDevice"
by Maxim Nestratov
This reverts commit 3a6cf6fc16.
Mistakenly this commit was pushed because I thought I missed the
corret one b880ff42ddb while in fact I didn't.
Signed-off-by: Maxim Nestratov <mnestratov(a)virtuozzo.com>
---
src/vz/vz_sdk.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index d61bccf..f63b9a3 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -3552,12 +3552,6 @@ prlsdkAttachDevice(vzDriverPtr driver,
return -1;
}
- if (prlsdkUpdateDomain(driver, dom) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Failed to save new config"));
- return -1;
- }
-
job = PrlVm_CommitEx(privdom->sdkdom, PVCF_DETACH_HDD_BUNDLE);
if (PRL_FAILED(waitDomainJob(job, dom)))
return -1;
@@ -3623,12 +3617,6 @@ prlsdkDetachDevice(vzDriverPtr driver ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (prlsdkUpdateDomain(driver, dom) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Failed to save new config"));
- goto cleanup;
- }
-
job = PrlVm_CommitEx(privdom->sdkdom, PVCF_DETACH_HDD_BUNDLE);
if (PRL_FAILED(waitDomainJob(job, dom)))
goto cleanup;
--
2.4.11
8 years
[libvirt] [PATCH 0/3] Add support for preallocated fd memory
by Jaroslav Safka
Hi,
we would like to introduce 3 new elements source,access and allocation in memoryBacking element.
<memoryBacking>
<source type="file|anonymous"/>
<access Mode="shared|private"/>
<allocation mode="immediate|ondemand"/> </memoryBacking>
If allocation is immediate then -mem-prealloc should be added to the qemu commanline.
If source is file then
-object memory-backend-file,id=mem,size=1024M,mem-path=/var/lib/libvirt/qemu -numa node,memdev=mem Should be added to the qemu commandline
If access is shared then the share=on parameter should be added to the memory-backend-file e.g.
-object memory-backend-file,id=mem,size=1024M,mem-path=/var/lib/libvirt/qemu,share=on
Also token memAccess in numa cell is used (if not present, default value from memoryBacking is used)
Jaroslav Safka (3):
Add support for preallocated fd memory
Add support for preallocated fd memory
Add support for preallocated fd memory - doc
docs/formatdomain.html.in | 10 ++
docs/schemas/domaincommon.rng | 30 ++++
src/conf/domain_conf.c | 138 +++++++++++++-----
src/conf/domain_conf.h | 33 +++++
src/qemu/qemu_command.c | 156 ++++++++++++++++-----
src/qemu/qemu_command.h | 4 +
.../qemuxml2argv-fd-memory-no-numa-topology.args | 33 +++++
.../qemuxml2argv-fd-memory-no-numa-topology.xml | 91 ++++++++++++
.../qemuxml2argv-fd-memory-numa-topology.args | 33 +++++
.../qemuxml2argv-fd-memory-numa-topology.xml | 94 +++++++++++++
.../qemuxml2argv-fd-memory-numa-topology2.args | 36 +++++
.../qemuxml2argv-fd-memory-numa-topology2.xml | 95 +++++++++++++
.../qemuxml2argv-fd-memory-numa-topology3.args | 39 ++++++
.../qemuxml2argv-fd-memory-numa-topology3.xml | 96 +++++++++++++
.../qemuxml2argv-memorybacking-set.xml | 32 +++++
.../qemuxml2argv-memorybacking-unset.xml | 32 +++++
tests/qemuxml2argvtest.c | 42 ++++++
.../qemuxml2xmlout-memorybacking-set.xml | 40 ++++++
.../qemuxml2xmlout-memorybacking-unset.xml | 40 ++++++
tests/qemuxml2xmltest.c | 3 +
20 files changed, 1011 insertions(+), 66 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-no-numa-topology.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-no-numa-topology.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology3.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memorybacking-set.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memorybacking-unset.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-memorybacking-set.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-memorybacking-unset.xml
--
2.7.4
--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263
This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.
8 years
[libvirt] [PATCH] libvirt: qemu: Fix domain termination caused by query-hotpluggable-cpus not enabled
by Boris Fiuczynski
(Re-)Starting libvirt on a system with running qemu domains which earlier
had been successfully started by libvirt results in the error
internal error: unable to execute QEMU command 'query-hotpluggable-cpus':
The feature 'query-hotpluggable-cpus' is not enabled
if the qemu binary does not support the qmp command 'query-hotpluggable-cpus'.
As libvirt tries to reconnect to the running qemu domains it reads in the
capabilities but in qemuProcessReconnect misses to run
virQEMUCapsCacheLookupCopy and not clearing the query-hotpluggable-cpus
capability in virQEMUCapsFilterByMachineType which was introduced with
commit 920bbe5c.
Libvirt therefore issues the qmp command and qemu responds with the error
'The feature 'query-hotpluggable-cpus' is not enabled'.
As a consequence libvirt terminates the running qemu process since it
determines that it cannot reconnect to the domain.
Signed-off-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>
---
Due to the severity of this issue I recommend to backport this fix
into all maintenance releases up to v2.2.0.
src/qemu/qemu_process.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f8f379a..675f5b5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3349,8 +3349,7 @@ qemuProcessReconnect(void *opaque)
/* If upgrading from old libvirtd we won't have found any
* caps in the domain status, so re-query them
*/
- if (!priv->qemuCaps &&
- !(priv->qemuCaps = virQEMUCapsCacheLookupCopy(caps,
+ if (!(priv->qemuCaps = virQEMUCapsCacheLookupCopy(caps,
driver->qemuCapsCache,
obj->def->emulator,
obj->def->os.machine)))
--
2.5.5
8 years
[libvirt] [PATCH v5 00/12] Add runnability info to query-cpu-definitions
by Eduardo Habkost
This series extends query-cpu-definitions to include an extra
field: "unavailable-features". The new field can be used to find
out reasons that prevent the CPU model from running in the
current host.
This will return information based on the current machine and
accelerator only. In the future we may extend these mechanisms to
allow querying other machines and other accelerators without
restarting QEMU, but it will require some reorganization of
QEMU's main code.
To be able to implement this more cleanly, the series rework some
of the feature/property name code.
This series can be seen in the git branch at:
https://github.com/ehabkost/qemu-hacks.git work/query-cpu-definitions-runnable-info
The series is based on my x86-next branch:
https://github.com/ehabkost/qemu.git x86-next
Changes v4 -> v5:
* New patch: "target-i386: Register aliases for feature names with underscores"
* On patch: "tests: Add test case for x86 feature parsing compatibility":
* Fix typo on commit message
Reported-by: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
* Add comment noting that the "[+-]feature" compatibility mode
will be removed soon
* On patch: "target-i386: Make plus_features/minus_features QOM-based":
* Removed feat2prop() call on , as we now have property aliases
for the old names containing underscores
* On patch: "target-i386: Remove underscores from feat_names arrays":
* Remove the feat2prop() call from the alias registration
loop, too
* Commit message update to enumerate all code that uses
feat_names
* On patch: "target-i386: x86_cpu_load_features() function":
* Fix typo on x86_cpu_load_features() comment
Reported-by: Paolo Bonzini <pbonzini(a)redhat.com>
Diff v4 ->v5:
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 4dd3aee..620889f 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2002,12 +2002,10 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features,
/* Compatibility syntax: */
if (featurestr[0] == '+') {
- feat2prop(featurestr + 1);
plus_features = g_list_append(plus_features,
g_strdup(featurestr + 1));
continue;
} else if (featurestr[0] == '-') {
- feat2prop(featurestr + 1);
minus_features = g_list_append(minus_features,
g_strdup(featurestr + 1));
continue;
@@ -3066,8 +3064,7 @@ static void x86_cpu_enable_xsave_components(X86CPU *cpu)
env->features[FEAT_XSAVE_COMP_HI] = mask >> 32;
}
-/* Load CPUID data based on configureured features
- */
+/* Load CPUID data based on configured features */
static void x86_cpu_load_features(X86CPU *cpu, Error **errp)
{
CPUX86State *env = &cpu->env;
@@ -3443,7 +3440,10 @@ static void x86_cpu_register_feature_bit_props(X86CPU *cpu,
return;
}
- /* Property names should use "-" instead of "_" */
+ /* Property names should use "-" instead of "_".
+ * Old names containing underscores are registered as aliases
+ * using object_property_add_alias()
+ */
assert(!strchr(name, '_'));
/* aliases don't use "|" delimiters anymore, they are registered
* manually using object_property_add_alias() */
@@ -3496,7 +3496,6 @@ static void x86_cpu_initfn(Object *obj)
}
}
- /* Alias for feature properties: */
object_property_add_alias(obj, "sse3", obj, "pni", &error_abort);
object_property_add_alias(obj, "pclmuldq", obj, "pclmulqdq", &error_abort);
object_property_add_alias(obj, "sse4-1", obj, "sse4.1", &error_abort);
@@ -3505,6 +3504,28 @@ static void x86_cpu_initfn(Object *obj)
object_property_add_alias(obj, "ffxsr", obj, "fxsr-opt", &error_abort);
object_property_add_alias(obj, "i64", obj, "lm", &error_abort);
+ object_property_add_alias(obj, "ds_cpl", obj, "ds-cpl", &error_abort);
+ object_property_add_alias(obj, "tsc_adjust", obj, "tsc-adjust", &error_abort);
+ object_property_add_alias(obj, "fxsr_opt", obj, "fxsr-opt", &error_abort);
+ object_property_add_alias(obj, "lahf_lm", obj, "lahf-lm", &error_abort);
+ object_property_add_alias(obj, "cmp_legacy", obj, "cmp-legacy", &error_abort);
+ object_property_add_alias(obj, "nodeid_msr", obj, "nodeid-msr", &error_abort);
+ object_property_add_alias(obj, "perfctr_core", obj, "perfctr-core", &error_abort);
+ object_property_add_alias(obj, "perfctr_nb", obj, "perfctr-nb", &error_abort);
+ object_property_add_alias(obj, "kvm_nopiodelay", obj, "kvm-nopiodelay", &error_abort);
+ object_property_add_alias(obj, "kvm_mmu", obj, "kvm-mmu", &error_abort);
+ object_property_add_alias(obj, "kvm_asyncpf", obj, "kvm-asyncpf", &error_abort);
+ object_property_add_alias(obj, "kvm_steal_time", obj, "kvm-steal-time", &error_abort);
+ object_property_add_alias(obj, "kvm_pv_eoi", obj, "kvm-pv-eoi", &error_abort);
+ object_property_add_alias(obj, "kvm_pv_unhalt", obj, "kvm-pv-unhalt", &error_abort);
+ object_property_add_alias(obj, "svm_lock", obj, "svm-lock", &error_abort);
+ object_property_add_alias(obj, "nrip_save", obj, "nrip-save", &error_abort);
+ object_property_add_alias(obj, "tsc_scale", obj, "tsc-scale", &error_abort);
+ object_property_add_alias(obj, "vmcb_clean", obj, "vmcb-clean", &error_abort);
+ object_property_add_alias(obj, "pause_filter", obj, "pause-filter", &error_abort);
+ object_property_add_alias(obj, "sse4_1", obj, "sse4.1", &error_abort);
+ object_property_add_alias(obj, "sse4_2", obj, "sse4.2", &error_abort);
+
x86_cpu_load_def(cpu, xcc->cpu_def, &error_abort);
}
diff --git a/tests/test-x86-cpuid-compat.c b/tests/test-x86-cpuid-compat.c
index 7cff2b5..260dd27 100644
--- a/tests/test-x86-cpuid-compat.c
+++ b/tests/test-x86-cpuid-compat.c
@@ -81,9 +81,14 @@ static void test_plus_minus(void)
char *path;
/* Rules:
- * "-foo" overrides "+foo"
- * "[+-]foo" overrides "foo=..."
- * "foo_bar" should be translated to "foo-bar"
+ * 1)"-foo" overrides "+foo"
+ * 2) "[+-]foo" overrides "foo=..."
+ * 3) Old feature names with underscores (e.g. "sse4_2")
+ * should keep working
+ *
+ * Note: rules 1 and 2 are planned to be removed soon, but we
+ * need to keep compatibility for a while until we start
+ * warning users about it.
*/
qtest_start("-cpu pentium,-fpu,+fpu,-mce,mce=on,+cx8,cx8=off,+sse4_1,sse4_2=on");
path = get_cpu0_qom_path();
Changes v3 -> v4:
* Removed patch "Define CPUID filtering functions before x86_cpu_list"
* New patch: "tests: Add test case for x86 feature parsing compatibility"
* New patch: "target-i386: Disable VME by default with TCG"
* Disable VME by default on TCG to avoid returning bogus
results for all CPU models in TCG mode
* New patch: "target-i386: Make plus_features/minus_features QOM-based"
* New patch: "target-i386: Remove underscores from property names"
* New patch: "target-i386: Register properties for feature aliases manually"
* New patch: "target-i386: xsave: Add FP and SSE bits to x86_ext_save_areas"
* New patch: "target-i386: x86_cpu_load_features() function"
* On patch: "target-i386: Return runnability information on query-cpu-definitions"
* Added code to handle unsupported XSAVE components cleanly
* Use x86_cpu_load_features() function
Changes v2 -> v3:
* Small documentation reword
* Suggested-by: Markus Armbruster <armbru(a)redhat.com>
* Create a x86_cpu_feature_name() function, to
isolate the code that returns the property name
Changes v1 -> v2:
* Fixed documentation to say "(since 2.7)"
* Removed @runnable field, improved documentation
Example command output:
{ "return": [
{
"unavailable-features": [],
"static": false,
"name": "host"
},
{
"unavailable-features": [],
"static": false,
"name": "qemu64"
},
{
"unavailable-features": [],
"static": false,
"name": "qemu32"
},
{
"unavailable-features": ["npt", "sse4a", "3dnow", "3dnowext", "fxsr-opt", "mmxext"],
"static": false,
"name": "phenom"
},
{
"unavailable-features": [],
"static": false,
"name": "pentium3"
},
{
"unavailable-features": [],
"static": false,
"name": "pentium2"
},
{
"unavailable-features": [],
"static": false,
"name": "pentium"
},
{
"unavailable-features": [],
"static": false,
"name": "n270"
},
{
"unavailable-features": [],
"static": false,
"name": "kvm64"
},
{
"unavailable-features": [],
"static": false,
"name": "kvm32"
},
{
"unavailable-features": [],
"static": false,
"name": "coreduo"
},
{
"unavailable-features": [],
"static": false,
"name": "core2duo"
},
{
"unavailable-features": ["3dnow", "3dnowext", "mmxext"],
"static": false,
"name": "athlon"
},
{
"unavailable-features": [],
"static": false,
"name": "Westmere"
},
{
"unavailable-features": ["xgetbv1", "xsavec", "3dnowprefetch", "smap", "adx", "rdseed", "mpx", "rtm", "hle"],
"static": false,
"name": "Skylake-Client"
},
{
"unavailable-features": [],
"static": false,
"name": "SandyBridge"
},
{
"unavailable-features": [],
"static": false,
"name": "Penryn"
},
{
"unavailable-features": ["tbm", "fma4", "xop", "3dnowprefetch", "misalignsse", "sse4a"],
"static": false,
"name": "Opteron_G5"
},
{
"unavailable-features": ["fma4", "xop", "3dnowprefetch", "misalignsse", "sse4a"],
"static": false,
"name": "Opteron_G4"
},
{
"unavailable-features": ["misalignsse", "sse4a"],
"static": false,
"name": "Opteron_G3"
},
{
"unavailable-features": [],
"static": false,
"name": "Opteron_G2"
},
{
"unavailable-features": [],
"static": false,
"name": "Opteron_G1"
},
{
"unavailable-features": [],
"static": false,
"name": "Nehalem"
},
{
"unavailable-features": [],
"static": false,
"name": "IvyBridge"
},
{
"unavailable-features": ["rtm", "hle"],
"static": false,
"name": "Haswell"
},
{
"unavailable-features": [],
"static": false,
"name": "Haswell-noTSX"
},
{
"unavailable-features": [],
"static": false,
"name": "Conroe"
},
{
"unavailable-features": ["3dnowprefetch", "smap", "adx", "rdseed", "rtm", "hle"],
"static": false,
"name": "Broadwell"
},
{
"unavailable-features": ["3dnowprefetch", "smap", "adx", "rdseed"],
"static": false,
"name": "Broadwell-noTSX"
},
{
"unavailable-features": [],
"static": false,
"name": "486"
}
]}
Cc: David Hildenbrand <dahi(a)linux.vnet.ibm.com>
Cc: Michael Mueller <mimu(a)linux.vnet.ibm.com>
Cc: Christian Borntraeger <borntraeger(a)de.ibm.com>
Cc: Cornelia Huck <cornelia.huck(a)de.ibm.com>
Cc: Jiri Denemark <jdenemar(a)redhat.com>
Cc: libvir-list(a)redhat.com
Eduardo Habkost (12):
tests: Add test case for x86 feature parsing compatibility
target-i386: List CPU models using subclass list
target-i386: Disable VME by default with TCG
target-i386: Register aliases for feature names with underscores
target-i386: Make plus_features/minus_features QOM-based
target-i386: Remove underscores from feat_names arrays
target-i386: Register properties for feature aliases manually
target-i386: xsave: Add FP and SSE bits to x86_ext_save_areas
target-i386: Move warning code outside x86_cpu_filter_features()
target-i386: x86_cpu_load_features() function
qmp: Add runnability information to query-cpu-definitions
target-i386: Return runnability information on query-cpu-definitions
qapi-schema.json | 23 +-
target-i386/cpu-qom.h | 4 +
target-i386/cpu.c | 510 ++++++++++++++++++++++++++----------------
tests/test-x86-cpuid-compat.c | 44 ++++
4 files changed, 388 insertions(+), 193 deletions(-)
--
2.7.4
8 years
[libvirt] [PATCH] Qemu : Do not distinguish a 'hangup' from an 'eof'
by Prerna Saxena
An errno=ECONNRESET received on a monitor socket reflects that the
guest may have closed the socket.
Today, we just mark it as a 'hangup' and do not trigger
the eof callback.
I've been looking at a slew of such messages in libvirt logs. If
the monitor socket indicated an ECONNRESET, it would possibly make sense
to mark the socket closed so that the "eof" callback may
then be invoked.
Is there a subtle corner case I'm missing here ?
Signed-off-by: Prerna Saxena <saxenap.ltc(a)gmail.com>
---
src/qemu/qemu_monitor.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index a5e14b2..dcafa5a 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -690,10 +690,11 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque)
if (events & VIR_EVENT_HANDLE_HANGUP) {
hangup = true;
+ eof = true;
if (!error) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("End of file from qemu monitor"));
- eof = true;
+
events &= ~VIR_EVENT_HANDLE_HANGUP;
}
}
--
1.8.1.2
8 years
[libvirt] [PATCH 1/1] reset vcpu pin info from config for zero mask
by Konstantin Neumoin
The option for removing vcpu pinning information from config was added
in:
'7ea9778 vcpupin: add vcpupin resetting feature to qemu driver'
and removed in:
'a02a161 qemu: libxl: vcpupin: Don't reset pinning when pinning to all pcpus'
by some reasons.
So, for now there is no way to remove vcpu pinning from config.
This patch returns options for remove vcpu/emulator pinning settings
from both configs if zero mask(mask filled by zeros) was specified.
Signed-off-by: Konstantin Neumoin <kneumoin(a)virtuozzo.com>
---
src/qemu/qemu_driver.c | 74 +++++++++++++++++++++++++++++++++++---------------
1 file changed, 52 insertions(+), 22 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bec7a38..7aa64a4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4969,7 +4969,8 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
virQEMUDriverConfigPtr cfg,
virBitmapPtr cpumap)
{
- virBitmapPtr tmpmap = NULL;
+ virBitmapPtr effective_cpumap = NULL;
+ virBitmapPtr allcpu_map = NULL;
virDomainVcpuInfoPtr vcpuinfo;
qemuDomainObjPrivatePtr priv = vm->privateData;
virCgroupPtr cgroup_vcpu = NULL;
@@ -4980,6 +4981,7 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
int eventNparams = 0;
int eventMaxparams = 0;
int ret = -1;
+ int hostcpus = 0;
if (!qemuDomainHasVcpuPids(vm)) {
virReportError(VIR_ERR_OPERATION_INVALID,
@@ -4994,29 +4996,38 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
goto cleanup;
}
- if (!(tmpmap = virBitmapNewCopy(cpumap)))
- goto cleanup;
+ if (vcpuinfo->online) {
+ if (cpumap) {
+ effective_cpumap = cpumap;
+ } else if (def->cpumask) {
+ effective_cpumap = def->cpumask;
+ } else {
+ if ((hostcpus = nodeGetCPUCount(NULL)) < 0)
+ goto cleanup;
- if (!(str = virBitmapFormat(cpumap)))
- goto cleanup;
+ if (!(allcpu_map = virBitmapNew(hostcpus)))
+ goto cleanup;
+ virBitmapSetAll(allcpu_map);
+ effective_cpumap = allcpu_map;
+ }
- if (vcpuinfo->online) {
/* Configure the corresponding cpuset cgroup before set affinity. */
if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) {
if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_VCPU, vcpu,
false, &cgroup_vcpu) < 0)
goto cleanup;
- if (qemuSetupCgroupCpusetCpus(cgroup_vcpu, cpumap) < 0)
+ if (qemuSetupCgroupCpusetCpus(cgroup_vcpu, effective_cpumap) < 0)
goto cleanup;
}
- if (virProcessSetAffinity(qemuDomainGetVcpuPid(vm, vcpu), cpumap) < 0)
+ if (virProcessSetAffinity(qemuDomainGetVcpuPid(vm, vcpu), effective_cpumap) < 0)
goto cleanup;
}
virBitmapFree(vcpuinfo->cpumask);
- vcpuinfo->cpumask = tmpmap;
- tmpmap = NULL;
+ vcpuinfo->cpumask = NULL;
+ if (cpumap && !(vcpuinfo->cpumask = virBitmapNewCopy(cpumap)))
+ goto cleanup;
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto cleanup;
@@ -5026,6 +5037,9 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
goto cleanup;
}
+ if (!(str = virBitmapFormat(effective_cpumap)))
+ goto cleanup;
+
if (virTypedParamsAddString(&eventParams, &eventNparams,
&eventMaxparams, paramField, str) < 0)
goto cleanup;
@@ -5035,7 +5049,7 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
ret = 0;
cleanup:
- virBitmapFree(tmpmap);
+ virBitmapFree(allcpu_map);
virCgroupFree(&cgroup_vcpu);
VIR_FREE(str);
qemuDomainEventQueue(driver, event);
@@ -5089,9 +5103,8 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
goto endjob;
if (virBitmapIsAllClear(pcpumap)) {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("Empty cpu list for pinning"));
- goto endjob;
+ virBitmapFree(pcpumap);
+ pcpumap = NULL;
}
if (def &&
@@ -5177,12 +5190,15 @@ qemuDomainPinEmulator(virDomainPtr dom,
int ret = -1;
qemuDomainObjPrivatePtr priv;
virBitmapPtr pcpumap = NULL;
+ virBitmapPtr allcpu_map = NULL;
+ virBitmapPtr effective_pcpumap = NULL;
virQEMUDriverConfigPtr cfg = NULL;
virObjectEventPtr event = NULL;
char *str = NULL;
virTypedParameterPtr eventParams = NULL;
int eventNparams = 0;
int eventMaxparams = 0;
+ int hostcpus = 0;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
VIR_DOMAIN_AFFECT_CONFIG, -1);
@@ -5207,18 +5223,31 @@ qemuDomainPinEmulator(virDomainPtr dom,
goto endjob;
if (virBitmapIsAllClear(pcpumap)) {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("Empty cpu list for pinning"));
- goto endjob;
+ virBitmapFree(pcpumap);
+ pcpumap = NULL;
}
if (def) {
+ if (pcpumap) {
+ effective_pcpumap = pcpumap;
+ } else if (def->cpumask) {
+ effective_pcpumap = def->cpumask;
+ } else {
+ if ((hostcpus = nodeGetCPUCount(NULL)) < 0)
+ goto cleanup;
+
+ if (!(allcpu_map = virBitmapNew(hostcpus)))
+ goto cleanup;
+ virBitmapSetAll(allcpu_map);
+ effective_pcpumap = allcpu_map;
+ }
+
if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) {
if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_EMULATOR,
0, false, &cgroup_emulator) < 0)
goto endjob;
- if (qemuSetupCgroupCpusetCpus(cgroup_emulator, pcpumap) < 0) {
+ if (qemuSetupCgroupCpusetCpus(cgroup_emulator, effective_pcpumap) < 0) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("failed to set cpuset.cpus in cgroup"
" for emulator threads"));
@@ -5226,19 +5255,19 @@ qemuDomainPinEmulator(virDomainPtr dom,
}
}
- if (virProcessSetAffinity(vm->pid, pcpumap) < 0)
+ if (virProcessSetAffinity(vm->pid, effective_pcpumap) < 0)
goto endjob;
virBitmapFree(def->cputune.emulatorpin);
def->cputune.emulatorpin = NULL;
- if (!(def->cputune.emulatorpin = virBitmapNewCopy(pcpumap)))
+ if (pcpumap && !(def->cputune.emulatorpin = virBitmapNewCopy(pcpumap)))
goto endjob;
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
- str = virBitmapFormat(pcpumap);
+ str = virBitmapFormat(effective_pcpumap);
if (virTypedParamsAddString(&eventParams, &eventNparams,
&eventMaxparams,
VIR_DOMAIN_TUNABLE_CPU_EMULATORPIN,
@@ -5252,7 +5281,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
virBitmapFree(persistentDef->cputune.emulatorpin);
persistentDef->cputune.emulatorpin = NULL;
- if (!(persistentDef->cputune.emulatorpin = virBitmapNewCopy(pcpumap)))
+ if (pcpumap && !(persistentDef->cputune.emulatorpin = virBitmapNewCopy(pcpumap)))
goto endjob;
ret = virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef);
@@ -5270,6 +5299,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
qemuDomainEventQueue(driver, event);
VIR_FREE(str);
virBitmapFree(pcpumap);
+ virBitmapFree(allcpu_map);
virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
--
2.5.5
8 years
[libvirt] [PATCH 0/2] NEWS updates for my recent changes
by Peter Krempa
Peter Krempa (2):
docs: NEWS: Mention 'gluster_debug_level' qemu.conf option in the news
docs: news: Mention changes in memory slot number allocation
docs/news.html.in | 7 +++++++
1 file changed, 7 insertions(+)
--
2.10.2
8 years
[libvirt] virsh domjobinfo during storage migration
by Ruben Kerkhof
Hi all,
Running virsh domjobinfo on my CentOS 6 systems during a migration
with --copy-storage-all, the output used to look like this:
Job type: Unbounded
Time elapsed: 1830632 ms
Data processed: 37.212 GiB
Data remaining: 1.025 GiB
Data total: 16.016 GiB
Memory processed: 37.212 GiB
Memory remaining: 1.025 GiB
Memory total: 16.016 GiB
Memory bandwidth: 100.018 MiB/s
Constant pages: 618279
Normal pages: 9734623
Normal data: 37.135 GiB
Expected downtime: 1118 ms
Setup time: 61 ms
But when I run the same command on CentOS 7, libvirt-1.2.17-13 and
qemu-kvm-1.5.3-105, I just get this:
$ sudo virsh domjobinfo 58358fec-c35c-4a7a-a4dd-18ec2e1327bf
Job type: Unbounded
Time elapsed: 209616 ms
I tried to debug this myself, but I'm a bit stuck. I'd expected
libvirt to send query-migrate commands to qemu every 50 ms or so. To
verify I attached gdb and put a breakpoint at
qemuMonitorJSONGetMigrationStatus, but the breakpoint only hits after
the complete disk is mirrored.
Is this a regression, or am I doing something wrong?
Kind regards,
Ruben Kerkhof
8 years