From patchwork Mon Jan 18 11:42:01 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: 8054321 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 4D7D19F6FA for ; Mon, 18 Jan 2016 11:42:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F6D5203AE for ; Mon, 18 Jan 2016 11:42:28 +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 93C49203A9 for ; Mon, 18 Jan 2016 11:42:27 +0000 (UTC) Received: from localhost ([::1]:58912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL8CY-0002HG-IH for patchwork-qemu-devel@patchwork.kernel.org; Mon, 18 Jan 2016 06:42:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL8CR-0002Gz-G8 for qemu-devel@nongnu.org; Mon, 18 Jan 2016 06:42:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aL8CO-0004Wt-9a for qemu-devel@nongnu.org; Mon, 18 Jan 2016 06:42:19 -0500 Received: from mailhub.sw.ru ([195.214.232.25]:35676 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL8CN-0004W0-Sv for qemu-devel@nongnu.org; Mon, 18 Jan 2016 06:42:16 -0500 Received: from hades.sw.ru ([10.30.8.132]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id u0HABOIT001929; Sun, 17 Jan 2016 13:11:25 +0300 (MSK) From: "Denis V. Lunev" To: Date: Mon, 18 Jan 2016 14:42:01 +0300 Message-Id: <1453117322-30191-1-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.5.0 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 1/1] 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 ballon 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 patch 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 --- The patch is submitted start a discussion. It may be technically correct, but for us the situation is a bit shady. hw/mem/nvdimm.c | 4 ++++ hw/mem/pc-dimm.c | 7 ++++++- include/hw/mem/pc-dimm.h | 1 + qapi-schema.json | 5 ++++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c index 4fd397f..4f4d29a 100644 --- a/hw/mem/nvdimm.c +++ b/hw/mem/nvdimm.c @@ -27,9 +27,13 @@ static void nvdimm_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); + PCDIMMDeviceClass *ddc = PC_DIMM_CLASS(oc); /* nvdimm hotplug has not been supported yet. */ dc->hotpluggable = false; + + /* ballooning is not supported */ + ddc->in_ram = false; } static TypeInfo nvdimm_info = { diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index d5cdab2..e0f869d 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -164,6 +164,7 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque) MemoryDeviceInfo *info = g_new0(MemoryDeviceInfo, 1); PCDIMMDeviceInfo *di = g_new0(PCDIMMDeviceInfo, 1); DeviceClass *dc = DEVICE_GET_CLASS(obj); + PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(obj); PCDIMMDevice *dimm = PC_DIMM(obj); if (dev->id) { @@ -172,6 +173,7 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque) } di->hotplugged = dev->hotplugged; di->hotpluggable = dc->hotpluggable; + di->in_ram = ddc->in_ram; di->addr = dimm->addr; di->slot = dimm->slot; di->node = dimm->node; @@ -205,7 +207,9 @@ 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->in_ram) { + size += value->u.dimm->size; + } break; default: break; @@ -444,6 +448,7 @@ static void pc_dimm_class_init(ObjectClass *oc, void *data) dc->props = pc_dimm_properties; dc->desc = "DIMM memory module"; + ddc->in_ram = true; ddc->get_memory_region = pc_dimm_get_memory_region; } diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h index d83bf30..3bcb505 100644 --- a/include/hw/mem/pc-dimm.h +++ b/include/hw/mem/pc-dimm.h @@ -65,6 +65,7 @@ typedef struct PCDIMMDevice { typedef struct PCDIMMDeviceClass { /* private */ DeviceClass parent_class; + bool in_ram; /* public */ MemoryRegion *(*get_memory_region)(PCDIMMDevice *dimm); diff --git a/qapi-schema.json b/qapi-schema.json index b3038b2..613b4d5 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3922,6 +3922,8 @@ # # @hotpluggable: true if device if could be added/removed while machine is running # +# @in-ram: true if device if should be counted in current ram size (since 2.6) +# # Since: 2.1 ## { 'struct': 'PCDIMMDeviceInfo', @@ -3932,7 +3934,8 @@ 'node': 'int', 'memdev': 'str', 'hotplugged': 'bool', - 'hotpluggable': 'bool' + 'hotpluggable': 'bool', + 'in-ram': 'bool' } }