qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Li Qiang <liq3ea@gmail.com>
To: pbonzini@redhat.com, crosthwaite.peter@gmail.com,
	rth@twiddle.net, quintela@redhat.com, dgilbert@redhat.com,
	eblake@redhat.com, armbru@redhat.com
Cc: liqiang02@corp.netease.com, hzliuyingdong@corp.netease.com,
	qemu-devel@nongnu.org, Li Qiang <liq3ea@gmail.com>
Subject: [Qemu-devel] [PATCH 1/3] migrate: replace the cpu throttle percentage max with a variable
Date: Tue, 31 Jul 2018 01:35:22 -0700	[thread overview]
Message-ID: <1533026124-6740-2-git-send-email-liq3ea@gmail.com> (raw)
In-Reply-To: <1533026124-6740-1-git-send-email-liq3ea@gmail.com>

So we can config it using qmp.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
 cpus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cpus.c b/cpus.c
index b5844b7103..6569c73d24 100644
--- a/cpus.c
+++ b/cpus.c
@@ -83,6 +83,8 @@ static unsigned int throttle_percentage;
 #define CPU_THROTTLE_PCT_MAX 99
 #define CPU_THROTTLE_TIMESLICE_NS 10000000
 
+static unsigned int throttle_percentage_max = CPU_THROTTLE_PCT_MAX;
+
 bool cpu_is_stopped(CPUState *cpu)
 {
     return cpu->stopped || !runstate_is_running();
@@ -754,7 +756,7 @@ static void cpu_throttle_timer_tick(void *opaque)
 void cpu_throttle_set(int new_throttle_pct)
 {
     /* Ensure throttle percentage is within valid range */
-    new_throttle_pct = MIN(new_throttle_pct, CPU_THROTTLE_PCT_MAX);
+    new_throttle_pct = MIN(new_throttle_pct, throttle_percentage_max);
     new_throttle_pct = MAX(new_throttle_pct, CPU_THROTTLE_PCT_MIN);
 
     atomic_set(&throttle_percentage, new_throttle_pct);
-- 
2.11.0

  reply	other threads:[~2018-07-31  8:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31  8:35 [Qemu-devel] [PATCH 0/3] Add a new migrate_set_max_cpu_throttle qmp command Li Qiang
2018-07-31  8:35 ` Li Qiang [this message]
2018-07-31  8:35 ` [Qemu-devel] [PATCH 2/3] migration: Add qmp command for migrate_set_max_cpu_throttle Li Qiang
2018-07-31 11:29   ` Dr. David Alan Gilbert
2018-07-31 12:22     ` Eric Blake
2018-07-31 14:48     ` Juan Quintela
2018-07-31 15:38       ` Dr. David Alan Gilbert
2018-07-31 15:50       ` Daniel P. Berrangé
2018-08-01  1:14         ` Li Qiang
2018-08-01  8:01         ` Juan Quintela
2018-07-31  8:35 ` [Qemu-devel] [PATCH 3/3] hmp: add hmp " Li Qiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1533026124-6740-2-git-send-email-liq3ea@gmail.com \
    --to=liq3ea@gmail.com \
    --cc=armbru@redhat.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=hzliuyingdong@corp.netease.com \
    --cc=liqiang02@corp.netease.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).