From patchwork Thu Nov 11 14:13:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Peng X-Patchwork-Id: 12614887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B364C433EF for ; Thu, 11 Nov 2021 14:16:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EF16561152 for ; Thu, 11 Nov 2021 14:16:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EF16561152 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 8B4F06B0082; Thu, 11 Nov 2021 09:16:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 864A26B0083; Thu, 11 Nov 2021 09:16:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70A2E6B0085; Thu, 11 Nov 2021 09:16:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0183.hostedemail.com [216.40.44.183]) by kanga.kvack.org (Postfix) with ESMTP id 613FF6B0082 for ; Thu, 11 Nov 2021 09:16:32 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1BAB54DA3 for ; Thu, 11 Nov 2021 14:16:32 +0000 (UTC) X-FDA: 78796849824.04.C139069 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf03.hostedemail.com (Postfix) with ESMTP id B9DD830000B9 for ; Thu, 11 Nov 2021 14:16:22 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10164"; a="231640078" X-IronPort-AV: E=Sophos;i="5.87,226,1631602800"; d="scan'208";a="231640078" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2021 06:16:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,226,1631602800"; d="scan'208";a="492556049" Received: from chaop.bj.intel.com ([10.240.192.101]) by orsmga007.jf.intel.com with ESMTP; 11 Nov 2021 06:16:18 -0800 From: Chao Peng To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, qemu-devel@nongnu.org Cc: Paolo Bonzini , Jonathan Corbet , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Yu Zhang , Chao Peng , "Kirill A . Shutemov" , luto@kernel.org, john.ji@intel.com, susie.li@intel.com, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, david@redhat.com Subject: [RFC PATCH 09/13] qmp: Include "guest-private" property for memory backends Date: Thu, 11 Nov 2021 22:13:48 +0800 Message-Id: <20211111141352.26311-10-chao.p.peng@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211111141352.26311-1-chao.p.peng@linux.intel.com> References: <20211111141352.26311-1-chao.p.peng@linux.intel.com> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B9DD830000B9 X-Stat-Signature: 5k18bdypfkudfuxfxc51nzg7kmp9yo33 Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none); spf=none (imf03.hostedemail.com: domain of chao.p.peng@linux.intel.com has no SPF policy when checking 192.55.52.120) smtp.mailfrom=chao.p.peng@linux.intel.com X-HE-Tag: 1636640182-339332 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Signed-off-by: Chao Peng --- hw/core/machine-hmp-cmds.c | 3 +++ hw/core/machine-qmp-cmds.c | 1 + qapi/machine.json | 3 +++ qapi/qom.json | 3 +++ 4 files changed, 10 insertions(+) diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 76b22b00d6..6bd66c25b7 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -112,6 +112,9 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict) m->value->prealloc ? "true" : "false"); monitor_printf(mon, " share: %s\n", m->value->share ? "true" : "false"); + monitor_printf(mon, " guest private: %s\n", + m->value->guest_private ? "true" : "false"); + if (m->value->has_reserve) { monitor_printf(mon, " reserve: %s\n", m->value->reserve ? "true" : "false"); diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 216fdfaf3a..2c1c1de73f 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -174,6 +174,7 @@ static int query_memdev(Object *obj, void *opaque) m->dump = object_property_get_bool(obj, "dump", &error_abort); m->prealloc = object_property_get_bool(obj, "prealloc", &error_abort); m->share = object_property_get_bool(obj, "share", &error_abort); + m->guest_private = object_property_get_bool(obj, "guest-private", &error_abort); m->reserve = object_property_get_bool(obj, "reserve", &err); if (err) { error_free_or_abort(&err); diff --git a/qapi/machine.json b/qapi/machine.json index 157712f006..f568a6a0bf 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -798,6 +798,8 @@ # # @share: whether memory is private to QEMU or shared (since 6.1) # +# @guest-private: whether memory is private to guest (since X.X) +# # @reserve: whether swap space (or huge pages) was reserved if applicable. # This corresponds to the user configuration and not the actual # behavior implemented in the OS to perform the reservation. @@ -818,6 +820,7 @@ 'dump': 'bool', 'prealloc': 'bool', 'share': 'bool', + 'guest-private': 'bool', '*reserve': 'bool', 'host-nodes': ['uint16'], 'policy': 'HostMemPolicy' }} diff --git a/qapi/qom.json b/qapi/qom.json index a25616bc7a..93af9b106e 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -550,6 +550,8 @@ # @share: if false, the memory is private to QEMU; if true, it is shared # (default: false) # +# @guest-private: if true, the memory is guest private memory (default: false) +# # @reserve: if true, reserve swap space (or huge pages) if applicable # (default: true) (since 6.1) # @@ -580,6 +582,7 @@ '*prealloc': 'bool', '*prealloc-threads': 'uint32', '*share': 'bool', + '*guest-private': 'bool', '*reserve': 'bool', 'size': 'size', '*x-use-canonical-path-for-ramblock-id': 'bool' } }