From: David Vrabel Subject: [PATCHv1] xen/balloon: disable memory hotplug in PV guests Date: Mon, 9 Mar 2015 14:10:00 +0000 Message-ID: <1425910200-17541-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YUyPK-0007Ys-Tb for xen-devel@lists.xenproject.org; Mon, 09 Mar 2015 14:11:47 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Boris Ostrovsky , Daniel Kiper , David Vrabel List-Id: xen-devel@lists.xenproject.org Memory hotplug doesn't work with PV guests because: a) The p2m cannot be expanded to cover the new sections. b) add_memory() builds page tables for the new sections which means the new pages must have valid p2m entries (or a BUG occurs). So, in PV guests, clamp the target to the current (== maximum) number of pages and do not try to hotplug any memory. Signed-off-by: David Vrabel --- Cc: Daniel Kiper --- drivers/xen/balloon.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 0b52d92..4158196 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -225,6 +225,19 @@ static enum bp_state reserve_additional_memory(long credit) u64 hotplug_start_paddr; unsigned long balloon_hotplug = credit; + /* + * Memory hotplug doesn't work with PV guests because: + * + * a) The p2m cannot be expanded to cover the new sections. + * + * b) add_memory() builds page tables for the new sections + * which means they must be fully populated in advance. + */ + if (xen_pv_domain()) { + balloon_stats.target_pages = balloon_stats.current_pages; + return BP_DONE; + } + hotplug_start_paddr = PFN_PHYS(SECTION_ALIGN_UP(max_pfn)); balloon_hotplug = round_up(balloon_hotplug, PAGES_PER_SECTION); nid = memory_add_physaddr_to_nid(hotplug_start_paddr); -- 1.7.10.4