From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR0DH-0000Zg-PK for qemu-devel@nongnu.org; Wed, 03 Feb 2016 11:23:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aR0DC-0004Wt-OJ for qemu-devel@nongnu.org; Wed, 03 Feb 2016 11:23:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR0DC-0004Wd-EL for qemu-devel@nongnu.org; Wed, 03 Feb 2016 11:23:22 -0500 Date: Wed, 3 Feb 2016 17:23:17 +0100 From: Igor Mammedov Message-ID: <20160203172317.1c53b88b@nial.brq.redhat.com> In-Reply-To: <87vb65n6le.fsf@blackfin.pond.sub.org> References: <1453963872-13549-1-git-send-email-vsementsov@virtuozzo.com> <1453963872-13549-4-git-send-email-vsementsov@virtuozzo.com> <56B12A05.4060305@redhat.com> <87vb65n6le.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] balloon: don't use NVDIMM for ballooning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Vladimir Sementsov-Ogievskiy , Xiao Guangrong , "Michael S. Tsirkin" , qemu-devel@nongnu.org, Stefan Hajnoczi , "Denis V. Lunev" On Wed, 03 Feb 2016 16:42:21 +0100 Markus Armbruster wrote: > Eric Blake writes: > > > On 01/27/2016 11:51 PM, Vladimir Sementsov-Ogievskiy wrote: > >> 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 > >> --- > > > >> @@ -308,7 +309,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 (strcmp(value->u.dimm->type, TYPE_NVDIMM)) { > > > > If you fix 2/3 to use a QAPI enum, then this will be an integer compare > > instead of a strcmp(). > > Another option is to add a flag to the subtypes of TYPE_PC_DIMM, set it > for the subtypes that should be counted here, and accumulate the sizes > of devices where the flag is set. Requires iterating directly over the > devices here (like qmp_pc_dimm_device_list() does under the hood) rather > than the MemoryDeviceInfoList returned by qmp_pc_dimm_device_list(), I'd rather not add flag to TYPE_PC_DIMM state/class as its purely balloon qemu/guest driver limit and not related to [pc-|nv]in general. Lets whitelist balloon supported type here.