On 09/04/2012 08:12 AM, Peter Krempa wrote:
The quota and period tunables for cpu scheduler accept only a
certain
range of values. When changing the live configuration invalid values get
rejected. This check is not performed when changing persistent config.
This patch adds a separate range check, that improves error messages
when changing live config and adds the check for persistent config.
---
src/qemu/qemu_driver.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4b8b751..3d59594 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -106,6 +106,11 @@
#define QEMU_NB_TOTAL_CPU_STAT_PARAM 3
#define QEMU_NB_PER_CPU_STAT_PARAM 2
+#define QEMU_SCHED_MIN_PERIOD (long long) 1000
Under-parenthesized; if you insist on the cast, it should be:
#define QEMU_SCHED_MIN_PERIOD ((long long) 1000)
that said, it is possible to be more concise (with no parentheses
necessary):
#define QEMU_SCHED_MIN_PERIOD 1000LL
+#define QEMU_SCHED_MAX_PERIOD (long long) 1000000
+#define QEMU_SCHED_MIN_QUOTA (long long) 1000
+#define QEMU_SCHED_MAX_QUOTA (long long) 18446744073709551
Furthermore, in the case of MAX_QUOTA, your code is wrong. The C
compiler treats this as ((long long) ((int) 18446744073709551)), which
is 1271310319; here, you absolutely need the LL suffix, at which point
you no longer need the cast.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org