From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEA0CC47082 for ; Mon, 31 May 2021 17:15:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BCC57610C9 for ; Mon, 31 May 2021 17:15:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233276AbhEaRQ4 (ORCPT ); Mon, 31 May 2021 13:16:56 -0400 Received: from prt-mail.chinatelecom.cn ([42.123.76.228]:57597 "EHLO chinatelecom.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234697AbhEaRPQ (ORCPT ); Mon, 31 May 2021 13:15:16 -0400 HMM_SOURCE_IP: 172.18.0.218:53114.1639123736 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-202.80.192.38?logid-ed481103dcf04c7799310e542c3cbd82 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id ED4F72800FA; Tue, 1 Jun 2021 01:05:57 +0800 (CST) X-189-SAVE-TO-SEND: +huangy81@chinatelecom.cn Received: from ([172.18.0.218]) by app0025 with ESMTP id ed481103dcf04c7799310e542c3cbd82 for qemu-devel@nongnu.org; Tue Jun 1 01:05:58 2021 X-Transaction-ID: ed481103dcf04c7799310e542c3cbd82 X-filter-score: filter<0> X-Real-From: huangy81@chinatelecom.cn X-Receive-IP: 172.18.0.218 X-MEDUSA-Status: 0 Sender: huangy81@chinatelecom.cn From: huangy81@chinatelecom.cn To: Cc: Paolo Bonzini , , Juan Quintela , "Dr. David Alan Gilbert" , Peter Xu , Hyman Subject: [PATCH v1 5/6] migration/dirtyrate: check support of calculation for vcpu Date: Tue, 1 Jun 2021 01:05:58 +0800 Message-Id: <8c48e41e38c31827f305806704e6e23faef848c3.1622479162.git.huangy81@chinatelecom.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Hyman Huang(黄勇) vcpu method only works when kvm dirty ring is enabled, use kvm_dirty_ring_enabled to probe if dirty ring is enabled. Signed-off-by: Hyman Huang(黄勇) --- migration/dirtyrate.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 7952eb6117..da6500c8ec 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -16,6 +16,7 @@ #include "cpu.h" #include "exec/ramblock.h" #include "qemu/rcu_queue.h" +#include "sysemu/kvm.h" #include "qapi/qapi-commands-migration.h" #include "ram.h" #include "trace.h" @@ -415,6 +416,14 @@ void qmp_calc_dirty_rate(int64_t calc_time, return; } + /* + * Vcpu method only works when kvm dirty ring is enabled. + */ + if (has_vcpu && vcpu && !kvm_dirty_ring_enabled()) { + error_setg(errp, "kvm dirty ring is disabled, use sample method."); + return; + } + /* * Init calculation state as unstarted. */ @@ -427,6 +436,7 @@ void qmp_calc_dirty_rate(int64_t calc_time, config.sample_period_seconds = calc_time; config.sample_pages_per_gigabytes = DIRTYRATE_DEFAULT_SAMPLE_PAGES; + config.vcpu = has_vcpu ? vcpu : false; qemu_thread_create(&thread, "get_dirtyrate", get_dirtyrate_thread, (void *)&config, QEMU_THREAD_DETACHED); } -- 2.24.3 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 120CFC47082 for ; Mon, 31 May 2021 17:11:18 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B5B8A61042 for ; Mon, 31 May 2021 17:11:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5B8A61042 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chinatelecom.cn Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnlRc-00065D-MS for qemu-devel@archiver.kernel.org; Mon, 31 May 2021 13:11:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnlMc-0000gI-4R for qemu-devel@nongnu.org; Mon, 31 May 2021 13:06:06 -0400 Received: from prt-mail.chinatelecom.cn ([42.123.76.228]:33244 helo=chinatelecom.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnlMX-0005aC-Mk for qemu-devel@nongnu.org; Mon, 31 May 2021 13:06:05 -0400 HMM_SOURCE_IP: 172.18.0.218:53114.1639123736 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-202.80.192.38?logid-ed481103dcf04c7799310e542c3cbd82 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id ED4F72800FA; Tue, 1 Jun 2021 01:05:57 +0800 (CST) X-189-SAVE-TO-SEND: +huangy81@chinatelecom.cn Received: from ([172.18.0.218]) by app0025 with ESMTP id ed481103dcf04c7799310e542c3cbd82 for qemu-devel@nongnu.org; Tue Jun 1 01:05:58 2021 X-Transaction-ID: ed481103dcf04c7799310e542c3cbd82 X-filter-score: filter<0> X-Real-From: huangy81@chinatelecom.cn X-Receive-IP: 172.18.0.218 X-MEDUSA-Status: 0 From: huangy81@chinatelecom.cn To: Subject: [PATCH v1 5/6] migration/dirtyrate: check support of calculation for vcpu Date: Tue, 1 Jun 2021 01:05:58 +0800 Message-Id: <8c48e41e38c31827f305806704e6e23faef848c3.1622479162.git.huangy81@chinatelecom.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=42.123.76.228; envelope-from=huangy81@chinatelecom.cn; helo=chinatelecom.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Juan Quintela , Hyman , "Dr. David Alan Gilbert" , Peter Xu , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Hyman Huang(黄勇) vcpu method only works when kvm dirty ring is enabled, use kvm_dirty_ring_enabled to probe if dirty ring is enabled. Signed-off-by: Hyman Huang(黄勇) --- migration/dirtyrate.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 7952eb6117..da6500c8ec 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -16,6 +16,7 @@ #include "cpu.h" #include "exec/ramblock.h" #include "qemu/rcu_queue.h" +#include "sysemu/kvm.h" #include "qapi/qapi-commands-migration.h" #include "ram.h" #include "trace.h" @@ -415,6 +416,14 @@ void qmp_calc_dirty_rate(int64_t calc_time, return; } + /* + * Vcpu method only works when kvm dirty ring is enabled. + */ + if (has_vcpu && vcpu && !kvm_dirty_ring_enabled()) { + error_setg(errp, "kvm dirty ring is disabled, use sample method."); + return; + } + /* * Init calculation state as unstarted. */ @@ -427,6 +436,7 @@ void qmp_calc_dirty_rate(int64_t calc_time, config.sample_period_seconds = calc_time; config.sample_pages_per_gigabytes = DIRTYRATE_DEFAULT_SAMPLE_PAGES; + config.vcpu = has_vcpu ? vcpu : false; qemu_thread_create(&thread, "get_dirtyrate", get_dirtyrate_thread, (void *)&config, QEMU_THREAD_DETACHED); } -- 2.24.3