From patchwork Tue Jul 31 08:35:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10550415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4EF5013BF for ; Tue, 31 Jul 2018 08:37:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3877C2A96C for ; Tue, 31 Jul 2018 08:37:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BFAA2A988; Tue, 31 Jul 2018 08:37:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DA4D82A96C for ; Tue, 31 Jul 2018 08:36:59 +0000 (UTC) Received: from localhost ([::1]:57584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkQ9L-0000C0-4T for patchwork-qemu-devel@patchwork.kernel.org; Tue, 31 Jul 2018 04:36:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkQ8B-0000A0-Vk for qemu-devel@nongnu.org; Tue, 31 Jul 2018 04:35:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fkQ8B-00006l-6u for qemu-devel@nongnu.org; Tue, 31 Jul 2018 04:35:48 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:38531) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fkQ8B-00006L-0U for qemu-devel@nongnu.org; Tue, 31 Jul 2018 04:35:47 -0400 Received: by mail-pg1-x541.google.com with SMTP id k3-v6so8725334pgq.5 for ; Tue, 31 Jul 2018 01:35:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=O0FuSzckHTa/XpGZseB2OgD4F6YK1e+d6dFXfg0grew=; b=BAPtvS3/WTwrUkANmcFKqVh5zdCrW/UIi7WapJGxYpGiIoV5FU1IJxaBkY+2rAwKFG FsrjBZ9DrFwBKV/Eq3zNqaWhlOeuoauAuJ6II+QJRmnRBDwbbAbF5xucKO+37lEbWzri VVdIRAy8zo1hyeE/TRtYbHSsWOITaIAOoZDyKDOnwmU6M5PhHltk8qDqkZK7orQuacl+ 444Tctnsu5su1E9p1qGBw/ag9VbJ72O59cQt01D/Les3saMZDuM6G4VqXmHMgJ5P46d2 xZzsByuENRMDjJTXc1XQ1XDpGSwkycHMCc+z9nDaQMOBPinQmzARD2SpDc56jLq0qQ9o SCjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=O0FuSzckHTa/XpGZseB2OgD4F6YK1e+d6dFXfg0grew=; b=aRvTpBLGavN+i4eQHwtRS+MS3746V7cGxRi3cA841nhoDk4EWM54KQtY1yvLVcYzxM vQ8RFJP6PTi33xblJqYvIAT3ww3l3K3/5LVKm7UerbjozgztSBV8nHZIU1xVq8wBRvqp FoauyzCDt3O69/xw2BJJI4DtsULVGfINyhAJUksbHpuPlnxJn0knQ5cNWCwLG/fRC3HQ Nxanht/+AmT6luMoMFsRwCYGEpxjzxxZOI2D+/wPv0fXBfbrPB9Bff3YhS81nzBb/P92 dPxOI6WCnMCqWxzXIWq29C5crZq58i5NdWYCxoYTlZKd1W1jfAUggI6PJ/q//kx8d5Aj D86w== X-Gm-Message-State: AOUpUlEn5vCjUlvnqh2VTd9hTbdS9ZZEpvaMND6sQBbr5iV9dBd5NGh2 a3BNjzFIyq4IKJFeqSc8Yv0= X-Google-Smtp-Source: AAOMgpfb/2vB89bpYyZaoeqzquUUNE1xsLZLGnfm2qqUxjwPDVys/xKlcwa0DTZlNTqGWJBMXt2gGQ== X-Received: by 2002:a62:d842:: with SMTP id e63-v6mr21487876pfg.88.1533026146205; Tue, 31 Jul 2018 01:35:46 -0700 (PDT) Received: from localhost.localdomain.localdomain ([103.65.40.100]) by smtp.gmail.com with ESMTPSA id f19-v6sm23406069pfd.147.2018.07.31.01.35.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jul 2018 01:35:45 -0700 (PDT) From: Li Qiang To: pbonzini@redhat.com, crosthwaite.peter@gmail.com, rth@twiddle.net, quintela@redhat.com, dgilbert@redhat.com, eblake@redhat.com, armbru@redhat.com Date: Tue, 31 Jul 2018 01:35:22 -0700 Message-Id: <1533026124-6740-2-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1533026124-6740-1-git-send-email-liq3ea@gmail.com> References: <1533026124-6740-1-git-send-email-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::541 Subject: [Qemu-devel] [PATCH 1/3] migrate: replace the cpu throttle percentage max with a variable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liqiang02@corp.netease.com, Li Qiang , hzliuyingdong@corp.netease.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP So we can config it using qmp. Signed-off-by: Li Qiang --- 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); From patchwork Tue Jul 31 08:35:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10550421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6166913BF for ; Tue, 31 Jul 2018 08:38:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BB902A8FB for ; Tue, 31 Jul 2018 08:38:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FBEE2A915; Tue, 31 Jul 2018 08:38:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D41882A8FB for ; Tue, 31 Jul 2018 08:38:55 +0000 (UTC) Received: from localhost ([::1]:57595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkQBD-0002FM-6P for patchwork-qemu-devel@patchwork.kernel.org; Tue, 31 Jul 2018 04:38:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkQ8G-0000DO-B6 for qemu-devel@nongnu.org; Tue, 31 Jul 2018 04:35:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fkQ8F-0000AH-65 for qemu-devel@nongnu.org; Tue, 31 Jul 2018 04:35:52 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:40076) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fkQ8F-00009Z-05 for qemu-devel@nongnu.org; Tue, 31 Jul 2018 04:35:51 -0400 Received: by mail-pg1-x542.google.com with SMTP id x5-v6so8722150pgp.7 for ; Tue, 31 Jul 2018 01:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tgPoCzVnHx+FKfFKPylUp7RhmK8Uge938yvUzvn0/g0=; b=MVeq8I77SgEMGgU+Jqx9v3MPGXcpzwMBWkO2rLiHX5FHqi7lXkIPBbmEnkRhnHsrLG vpxBVWoSRw9/zehiF6hwQoooq6eRROnuXMkRaoTYH8ys2mlI/eUT1TN0Jz0/+dVqUJNF n+5QumFR7tDLqj6zqdoOwrDMnbzVfAl9YJuJZVZiULxWfizalhFCDma/TeAmjGChHLwt qJi7pE6mEeavGwg+FIgPDm8XXb9XZAzQUDgShkXrY6WKVM1hf/xeK15v54FDQmJYhpcK 2+Y7q0WzdQD2k4E2hazW1uxUxUNmWmhbmuHpUQfNV6fqOaLaxq67PyQigdm+2y/TEHYY CkKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tgPoCzVnHx+FKfFKPylUp7RhmK8Uge938yvUzvn0/g0=; b=uORuJQLIn5mPID0cV1tBUOvVSeh/pTKy1HEwkdTgBYp3Q6euuuStWGAU7tWYt096CU biz6rgtTRH83IWRWM3kTl9OE2WZJnDKlszJAIg7OvYRriAiUKDSlx9Siq/SC6AOW5s9g beatQ/IWgOthn4SxXhGWS9aSt2oP9d5YRhiGTlFLNvg7DW8VZysyN21DiD3ICMK0kRDk z1ixmaV3FEnKifoy2VmkuBaXcJ/FSO+f1N13OYwCYYtAtfRYcQBCuL4FmPuhlUP0SFz0 Zg5iGVdqaxV2QOGHHHxX0ed6X0Yp7sPe+APzwLTBS5gOdRTpJM5160NG7E/iOBP4pAjZ nIrg== X-Gm-Message-State: AOUpUlH2Vd32tWzkYH8BJmIYNo6X061/DNs93+PLkFfc9dbdKRNcREOL wyvm/WRJFW5a2yhQQnTXitUx01ZP X-Google-Smtp-Source: AAOMgpdoTshiShQhxGHwq8w6tbyrMu1y9rCLPnTmQE+wDBlDwROOnp5yQyrP3tinbvFHNQ8YGjQo5w== X-Received: by 2002:a63:440a:: with SMTP id r10-v6mr19524717pga.27.1533026150231; Tue, 31 Jul 2018 01:35:50 -0700 (PDT) Received: from localhost.localdomain.localdomain ([103.65.40.100]) by smtp.gmail.com with ESMTPSA id f19-v6sm23406069pfd.147.2018.07.31.01.35.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jul 2018 01:35:49 -0700 (PDT) From: Li Qiang To: pbonzini@redhat.com, crosthwaite.peter@gmail.com, rth@twiddle.net, quintela@redhat.com, dgilbert@redhat.com, eblake@redhat.com, armbru@redhat.com Date: Tue, 31 Jul 2018 01:35:23 -0700 Message-Id: <1533026124-6740-3-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1533026124-6740-1-git-send-email-liq3ea@gmail.com> References: <1533026124-6740-1-git-send-email-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH 2/3] migration: Add qmp command for migrate_set_max_cpu_throttle X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liqiang02@corp.netease.com, Li Qiang , hzliuyingdong@corp.netease.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The default max cpu throttle is 99, this is too big that may influence the guest loads. Add a qmp to config it can make it more flexible. Signed-off-by: Li Qiang --- cpus.c | 5 +++++ include/qom/cpu.h | 8 ++++++++ migration/migration.c | 10 ++++++++++ qapi/migration.json | 13 +++++++++++++ 4 files changed, 36 insertions(+) diff --git a/cpus.c b/cpus.c index 6569c73d24..0505477086 100644 --- a/cpus.c +++ b/cpus.c @@ -765,6 +765,11 @@ void cpu_throttle_set(int new_throttle_pct) CPU_THROTTLE_TIMESLICE_NS); } +void set_cpu_max_throttle(int64_t max_pct) +{ + throttle_percentage_max = max_pct; +} + void cpu_throttle_stop(void) { atomic_set(&throttle_percentage, 0); diff --git a/include/qom/cpu.h b/include/qom/cpu.h index bd796579ee..4328d2e8ad 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -816,6 +816,14 @@ CPUState *cpu_by_arch_id(int64_t id); void cpu_throttle_set(int new_throttle_pct); /** + * set_cpu_max_throttle: + * @max_pct: the max percent of sleep time. Valid range is 1 to 99. + * + * Set the max throttle percentage. + */ +void set_cpu_max_throttle(int64_t max_pct); + +/** * cpu_throttle_stop: * * Stops the vcpu throttling started by cpu_throttle_set. diff --git a/migration/migration.c b/migration/migration.c index b7d9854bda..9c7a6f7477 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1774,6 +1774,16 @@ void qmp_migrate_set_speed(int64_t value, Error **errp) qmp_migrate_set_parameters(&p, errp); } +void qmp_migrate_set_max_cpu_throttle(int64_t value, Error **errp) +{ + if (value > 99 || value < 1) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, " max cpu throttle", + "not in 1 between 99"); + return; + } + set_cpu_max_throttle(value); +} + void qmp_migrate_set_downtime(double value, Error **errp) { if (value < 0 || value > MAX_MIGRATE_DOWNTIME_SECONDS) { diff --git a/qapi/migration.json b/qapi/migration.json index 186e8a7303..2ef3ddfe43 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -997,6 +997,19 @@ { 'command': 'migrate_set_speed', 'data': {'value': 'int'} } ## +# @migrate_set_max_cpu_throttle: +# +# Set maximum cpu throttle for migration. +# +# @value: maximum cpu throttle. +# +# Returns: nothing on success +# +# Since: 2.12 +## +{ 'command': 'migrate_set_max_cpu_throttle', 'data': {'value': 'int'} } + +## # @migrate-set-cache-size: # # Set cache size to be used by XBZRLE migration From patchwork Tue Jul 31 08:35:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10550417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3121314E0 for ; Tue, 31 Jul 2018 08:37:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C0FE2A988 for ; Tue, 31 Jul 2018 08:37:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 106FD2A9A0; Tue, 31 Jul 2018 08:37:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AC7CD2A14F for ; Tue, 31 Jul 2018 08:37:08 +0000 (UTC) Received: from localhost ([::1]:57589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkQ9T-00016s-TX for patchwork-qemu-devel@patchwork.kernel.org; Tue, 31 Jul 2018 04:37:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkQ8K-0000FM-HJ for qemu-devel@nongnu.org; Tue, 31 Jul 2018 04:35:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fkQ8J-0000Cc-GK for qemu-devel@nongnu.org; Tue, 31 Jul 2018 04:35:56 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:43909) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fkQ8J-0000CK-8y for qemu-devel@nongnu.org; Tue, 31 Jul 2018 04:35:55 -0400 Received: by mail-pg1-x542.google.com with SMTP id d17-v6so4284828pgv.10 for ; Tue, 31 Jul 2018 01:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aDRu1zJrITjpUnHg2g7rRuk1Li6C5/J2OBFZ4vbrF0o=; b=MG041iaEiPknMjNAVtJqV9hnDbW87SHK+gDo2lhCvI1QLCd4WlenGmqb+YLOWfI4aE Bp3NciXrvzKrhZZWOl0fLBi0kNNFgi5d8wbq5DTmPYLg/EkQM1Q89zsjEtdlu5o19olx EwoUwtX1Efvd1W0cxIiZ+Vog1Jpx2basmb8sNigctq6socQO7GloMr8HUrJ8FDyNY0qr ubz6QLaoMqyR4euV20ENw8A//iWERBSY2dAeiz1BPErf3k3nHaFrFCPdhJEbzNq3F23y /rmxmiJKA2tyLRuwnJtYLWXvWVSKMoErR4PuptnOBlUUJ4RUf5Io7T2XFayHodW2qrRw mWFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aDRu1zJrITjpUnHg2g7rRuk1Li6C5/J2OBFZ4vbrF0o=; b=rtJ7Bak3p3L7vA+c7uHZ/V/woleRqFj/CWbW7Lq30H1w+2QGQ2nj4i1lmnZncrNFuG x0LA22Yv3lHKhAKlXvwfDlq3Y/01BmA7TRlWHXAWN3ADOmK9n/+DnVMTb8Qdy/gDAMrn CIVL/wEDnNz4j67ePvmnq3ziERVto8EiJT1JDggf8XtA+ir56OLaZhkFTBaKX9ol1npl zROKZ/rrAN36c10b9mDfTOc9nnKXBnkwxAhvdDeJxOhY7fOU39qAtriLO8PaiJvjcDao 49HoPBK3GBLtoM2HkT3F5O5xyCzO53SwqhQfLW4VsMD+ZGMKosDB+L6H6LCOC3SSks9g 6nHw== X-Gm-Message-State: AOUpUlFZtyyPi2nMA6WzF3dMHyiVeSsroOhTXY6wQRxH9XjubUriyhFz HcnT+5qP4YZVKW0B1oxP2kY= X-Google-Smtp-Source: AAOMgpcUu9GqIZeOQRXJUSyJS8B1MGqbfKUVJ4mnJ4FLgIBnB/5a7EXuSZQfL3YUh7DjUJ2XydDQzA== X-Received: by 2002:a63:b504:: with SMTP id y4-v6mr19957475pge.247.1533026154466; Tue, 31 Jul 2018 01:35:54 -0700 (PDT) Received: from localhost.localdomain.localdomain ([103.65.40.100]) by smtp.gmail.com with ESMTPSA id f19-v6sm23406069pfd.147.2018.07.31.01.35.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jul 2018 01:35:53 -0700 (PDT) From: Li Qiang To: pbonzini@redhat.com, crosthwaite.peter@gmail.com, rth@twiddle.net, quintela@redhat.com, dgilbert@redhat.com, eblake@redhat.com, armbru@redhat.com Date: Tue, 31 Jul 2018 01:35:24 -0700 Message-Id: <1533026124-6740-4-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1533026124-6740-1-git-send-email-liq3ea@gmail.com> References: <1533026124-6740-1-git-send-email-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH 3/3] hmp: add hmp for migrate_set_max_cpu_throttle X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liqiang02@corp.netease.com, Li Qiang , hzliuyingdong@corp.netease.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Li Qiang --- hmp-commands.hx | 14 ++++++++++++++ hmp.c | 6 ++++++ hmp.h | 1 + 3 files changed, 21 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index 91dfe51c37..9d54ecbe4e 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1042,6 +1042,20 @@ Set maximum speed to @var{value} (in bytes) for migrations. ETEXI { + .name = "migrate_set_max_cpu_throttle", + .args_type = "value:i", + .params = "value", + .help = "set maximum cpu throttle for migrations.", + .cmd = hmp_migrate_set_max_cpu_throttle, + }, + +STEXI +@item hmp_migrate_set_max_cpu_throttle @var{value} +@findex migrate_set_max_cpu_throttle +Set maximum cpu throttle to @var{value} for migrations. +ETEXI + + { .name = "migrate_set_downtime", .args_type = "value:T", .params = "value", diff --git a/hmp.c b/hmp.c index 2aafb50e8e..4ee9af7165 100644 --- a/hmp.c +++ b/hmp.c @@ -1574,6 +1574,12 @@ void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict) qmp_migrate_set_speed(value, NULL); } +void hmp_migrate_set_max_cpu_throttle(Monitor *mon, const QDict *qdict) +{ + int64_t value = qdict_get_int(qdict, "value"); + qmp_migrate_set_max_cpu_throttle(value, NULL); +} + void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict) { const char *cap = qdict_get_str(qdict, "capability"); diff --git a/hmp.h b/hmp.h index 33354f1bdd..e57f7e4005 100644 --- a/hmp.h +++ b/hmp.h @@ -73,6 +73,7 @@ void hmp_migrate_recover(Monitor *mon, const QDict *qdict); void hmp_migrate_pause(Monitor *mon, const QDict *qdict); void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict); void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict); +void hmp_migrate_set_max_cpu_throttle(Monitor *mon, const QDict *qdict); void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict); void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict); void hmp_migrate_set_cache_size(Monitor *mon, const QDict *qdict);