diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2015-10-01 10:49:38 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-10-01 10:49:38 +0100 |
commit | fa500928ad9da6dd570918e3dfca13c029af07a8 (patch) | |
tree | b341a0fab575e9ebfe308129a57ed8e34af3fe39 /include | |
parent | b2312c680084ea18cd55fa7093397cad2224ec14 (diff) | |
parent | dc3256272cf70b2152279b013a8abb16e0f6fe96 (diff) | |
download | qemu-fa500928ad9da6dd570918e3dfca13c029af07a8.zip qemu-fa500928ad9da6dd570918e3dfca13c029af07a8.tar.gz qemu-fa500928ad9da6dd570918e3dfca13c029af07a8.tar.bz2 |
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20150930' into staging
migration/next for 20150930
# gpg: Signature made Wed 30 Sep 2015 09:24:02 BST using RSA key ID 5872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg: aka "Juan Quintela <quintela@trasno.org>"
* remotes/juanquintela/tags/migration/20150930:
migration: Disambiguate MAX_THROTTLE
qmp/hmp: Add throttle ratio to query-migrate and info migrate
migration: Dynamic cpu throttling for auto-converge
migration: Parameters for auto-converge cpu throttling
cpu: Provide vcpu throttling interface
migration: yet more possible state transitions
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/qom/cpu.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 302673d..9405554 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -321,6 +321,11 @@ struct CPUState { uint32_t can_do_io; int32_t exception_index; /* used by m68k TCG */ + /* Used to keep track of an outstanding cpu throttle thread for migration + * autoconverge + */ + bool throttle_thread_scheduled; + /* Note that this is accessed at the start of every TB via a negative offset from AREG0. Leave this field at the end so as to make the (absolute value) offset as small as possible. This reduces code @@ -565,6 +570,43 @@ CPUState *qemu_get_cpu(int index); */ bool cpu_exists(int64_t id); +/** + * cpu_throttle_set: + * @new_throttle_pct: Percent of sleep time. Valid range is 1 to 99. + * + * Throttles all vcpus by forcing them to sleep for the given percentage of + * time. A throttle_percentage of 25 corresponds to a 75% duty cycle roughly. + * (example: 10ms sleep for every 30ms awake). + * + * cpu_throttle_set can be called as needed to adjust new_throttle_pct. + * Once the throttling starts, it will remain in effect until cpu_throttle_stop + * is called. + */ +void cpu_throttle_set(int new_throttle_pct); + +/** + * cpu_throttle_stop: + * + * Stops the vcpu throttling started by cpu_throttle_set. + */ +void cpu_throttle_stop(void); + +/** + * cpu_throttle_active: + * + * Returns: %true if the vcpus are currently being throttled, %false otherwise. + */ +bool cpu_throttle_active(void); + +/** + * cpu_throttle_get_percentage: + * + * Returns the vcpu throttle percentage. See cpu_throttle_set for details. + * + * Returns: The throttle percentage in range 1 to 99. + */ +int cpu_throttle_get_percentage(void); + #ifndef CONFIG_USER_ONLY typedef void (*CPUInterruptHandler)(CPUState *, int); |