mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemu_conf: Introduce a knob to set SCHED_CORE
Ideally, we would just pick the best default and users wouldn't have to intervene at all. But in some cases it may be handy to not bother with SCHED_CORE at all or place helper processes into the same group as QEMU. Introduce a knob in qemu.conf to allow users control this behaviour. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
bd481a79d8
commit
6a1500b4ea
@ -110,6 +110,7 @@ module Libvirtd_qemu =
|
||||
| bool_entry "dump_guest_core"
|
||||
| str_entry "stdio_handler"
|
||||
| int_entry "max_threads_per_process"
|
||||
| str_entry "sched_core"
|
||||
|
||||
let device_entry = bool_entry "mac_filter"
|
||||
| bool_entry "relaxed_acs_check"
|
||||
|
@ -952,3 +952,19 @@
|
||||
# DO NOT use in production.
|
||||
#
|
||||
#deprecation_behavior = "none"
|
||||
|
||||
# If this is set then QEMU and its threads will run in a separate scheduling
|
||||
# group meaning no other process will share Hyper Threads of a single core with
|
||||
# QEMU. Each QEMU has its own group.
|
||||
#
|
||||
# Possible options are:
|
||||
# "none" - (default) neither QEMU or any of its helper processes are placed
|
||||
# into separate scheduling group
|
||||
# "vcpus" - only QEMU vCPU threads are placed into a separate scheduling group,
|
||||
# emulator threads and helper processes remain outside of the group
|
||||
# "emulator" - only QEMU and its threads (emulator + vCPUs) are placed into
|
||||
# separate scheduling group, helper proccesses remain outside of
|
||||
# the group
|
||||
# "full" - both QEMU and its helper processes are placed into separate
|
||||
# scheduling group
|
||||
#sched_core = "none"
|
||||
|
@ -66,6 +66,14 @@ VIR_LOG_INIT("qemu.qemu_conf");
|
||||
#define QEMU_MIGRATION_PORT_MIN 49152
|
||||
#define QEMU_MIGRATION_PORT_MAX 49215
|
||||
|
||||
VIR_ENUM_IMPL(virQEMUSchedCore,
|
||||
QEMU_SCHED_CORE_LAST,
|
||||
"none",
|
||||
"vcpus",
|
||||
"emulator",
|
||||
"full");
|
||||
|
||||
|
||||
static virClass *virQEMUDriverConfigClass;
|
||||
static void virQEMUDriverConfigDispose(void *obj);
|
||||
|
||||
@ -629,6 +637,7 @@ virQEMUDriverConfigLoadProcessEntry(virQEMUDriverConfig *cfg,
|
||||
g_auto(GStrv) hugetlbfs = NULL;
|
||||
g_autofree char *stdioHandler = NULL;
|
||||
g_autofree char *corestr = NULL;
|
||||
g_autofree char *schedCore = NULL;
|
||||
size_t i;
|
||||
|
||||
if (virConfGetValueStringList(conf, "hugetlbfs_mount", true,
|
||||
@ -706,6 +715,35 @@ virQEMUDriverConfigLoadProcessEntry(virQEMUDriverConfig *cfg,
|
||||
}
|
||||
}
|
||||
|
||||
if (virConfGetValueString(conf, "sched_core", &schedCore) < 0)
|
||||
return -1;
|
||||
if (schedCore) {
|
||||
int val = virQEMUSchedCoreTypeFromString(schedCore);
|
||||
|
||||
if (val < 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Unknown sched_core value %s"),
|
||||
schedCore);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (val != QEMU_SCHED_CORE_NONE) {
|
||||
int rv = virProcessSchedCoreAvailable();
|
||||
|
||||
if (rv < 0) {
|
||||
virReportSystemError(errno, "%s",
|
||||
_("Unable to detect SCHED_CORE"));
|
||||
return -1;
|
||||
} else if (rv == 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("SCHED_CORE not supported by kernel"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
cfg->schedCore = val;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,17 @@
|
||||
|
||||
#define QEMU_DRIVER_NAME "QEMU"
|
||||
|
||||
typedef enum {
|
||||
QEMU_SCHED_CORE_NONE = 0,
|
||||
QEMU_SCHED_CORE_VCPUS,
|
||||
QEMU_SCHED_CORE_EMULATOR,
|
||||
QEMU_SCHED_CORE_FULL,
|
||||
|
||||
QEMU_SCHED_CORE_LAST
|
||||
} virQEMUSchedCore;
|
||||
|
||||
VIR_ENUM_DECL(virQEMUSchedCore);
|
||||
|
||||
typedef struct _virQEMUDriver virQEMUDriver;
|
||||
|
||||
typedef struct _virQEMUDriverConfig virQEMUDriverConfig;
|
||||
@ -216,6 +227,8 @@ struct _virQEMUDriverConfig {
|
||||
char **capabilityfilters;
|
||||
|
||||
char *deprecationBehavior;
|
||||
|
||||
virQEMUSchedCore schedCore;
|
||||
};
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUDriverConfig, virObjectUnref);
|
||||
|
@ -116,3 +116,4 @@ module Test_libvirtd_qemu =
|
||||
{ "1" = "capname" }
|
||||
}
|
||||
{ "deprecation_behavior" = "none" }
|
||||
{ "sched_core" = "none" }
|
||||
|
Loading…
Reference in New Issue
Block a user