From patchwork Wed Jan 27 13:24:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 8133481 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DE86F9F96D for ; Wed, 27 Jan 2016 13:25:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F67620172 for ; Wed, 27 Jan 2016 13:25:13 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 9CEDA201CD for ; Wed, 27 Jan 2016 13:25:10 +0000 (UTC) Received: from localhost ([::1]:50521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOQ5t-0005iW-V5 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 27 Jan 2016 08:25:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOQ5f-0005gb-8n for qemu-devel@nongnu.org; Wed, 27 Jan 2016 08:24:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOQ5c-0004ED-10 for qemu-devel@nongnu.org; Wed, 27 Jan 2016 08:24:55 -0500 Received: from mailhub.sw.ru ([195.214.232.25]:1041 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOQ5b-0004Cg-JV for qemu-devel@nongnu.org; Wed, 27 Jan 2016 08:24:51 -0500 Received: from hades.sw.ru ([10.30.8.132]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id u0QKaMcI009225; Tue, 26 Jan 2016 23:36:32 +0300 (MSK) From: "Denis V. Lunev" To: Date: Wed, 27 Jan 2016 16:24:29 +0300 Message-Id: <1453901069-18091-3-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1453901069-18091-1-git-send-email-den@openvz.org> References: <1453901069-18091-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Cc: Vladimir Sementsov-Ogievskiy , Xiao Guangrong , "Michael S. Tsirkin" , qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi , Igor Mammedov , "Denis V. Lunev" Subject: [Qemu-devel] [PATCH 2/2] nvdimm: disable balloon X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vladimir Sementsov-Ogievskiy NVDIMM for now is planned to use as a backing store for DAX filesystem in the guest and thus this memory is excluded from guest memory management and LRUs. In this case libvirt running QEMU along with configured balloon almost immediately inflates balloon and effectively kill the guest as qemu counts nvdimm as part of the ram. Counting dimm devices as part of the ram for ballooning was started from commit 463756d03: virtio-balloon: Fix balloon not working correctly when hotplug memory Signed-off-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Denis V. Lunev CC: Stefan Hajnoczi CC: Xiao Guangrong CC: "Michael S. Tsirkin" CC: Igor Mammedov CC: Eric Blake CC: Markus Armbruster --- hw/mem/pc-dimm.c | 2 ++ hw/virtio/virtio-balloon.c | 4 +++- qapi-schema.json | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 4f30950..2ff9f95 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -19,6 +19,7 @@ */ #include "hw/mem/pc-dimm.h" +#include "hw/mem/nvdimm.h" #include "qemu/config-file.h" #include "qapi/visitor.h" #include "qemu/range.h" @@ -178,6 +179,7 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque) di->size = object_property_get_int(OBJECT(dimm), PC_DIMM_SIZE_PROP, NULL); di->memdev = object_get_canonical_path(OBJECT(dimm->hostmem)); + di->balloonable = (object_dynamic_cast(obj, TYPE_NVDIMM) == NULL); info->u.dimm = di; elem->value = info; diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 6a4c4d2..0a3de75 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -308,7 +308,9 @@ static ram_addr_t get_current_ram_size(void) if (value) { switch (value->type) { case MEMORY_DEVICE_INFO_KIND_DIMM: - size += value->u.dimm->size; + if (value->u.dimm->balloonable) { + size += value->u.dimm->size; + } break; default: break; diff --git a/qapi-schema.json b/qapi-schema.json index 8d04897..5934f81 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3924,6 +3924,8 @@ # # @hotpluggable: true if device if could be added/removed while machine is running # +# @balloonable: true if device take part in ballooning (since 2.6) +# # Since: 2.1 ## { 'struct': 'PCDIMMDeviceInfo', @@ -3934,7 +3936,8 @@ 'node': 'int', 'memdev': 'str', 'hotplugged': 'bool', - 'hotpluggable': 'bool' + 'hotpluggable': 'bool', + 'balloonable': 'bool' } }