Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756694AbdLOOrX (ORCPT ); Fri, 15 Dec 2017 09:47:23 -0500 Received: from mx2.suse.de ([195.135.220.15]:34260 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756503AbdLOOrW (ORCPT ); Fri, 15 Dec 2017 09:47:22 -0500 Subject: Re: [PATCH] xen/balloon: Mark unallocated host memory as UNUSABLE To: Boris Ostrovsky , xen-devel@lists.xen.org, linux-kernel@vger.kernel.org Cc: helgaas@kernel.org, christian.koenig@amd.com References: <1513119066-10748-1-git-send-email-boris.ostrovsky@oracle.com> <14852f9f-f234-3226-f32b-3080ca114332@suse.com> From: Juergen Gross Message-ID: <1385e130-7300-66a4-3995-838244600746@suse.com> Date: Fri, 15 Dec 2017 15:47:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 899 Lines: 25 On 15/12/17 15:24, Boris Ostrovsky wrote: > >>> + >>> + hostmem_resource->start = max_addr; >>> + hostmem_resource->end = entry->addr + entry->size; >>> + for (; i < memmap.nr_entries; i++) { >>> + entry = &xen_e820_table->entries[i]; >>> + if (entry->type == E820_TYPE_RAM) >> Shouldn't that be != ? > > No, the idea here is to populate hostmem_resource with ranges already > taken by things other than RAM, leaving memory regions as available for > the balloon hotplug. This will allow us to use allocate_resource(), > which searches for a free range, in the balloon driver. But why says the comment "Host memory not allocated to dom0" then? And why are you trying to allocate from this resource in case of hotplugging memory (and fall back to iomem_resource in case of failure)? Either the comment is completely wrong and I don't understand the logic here, or your code is wrong. Juergen