Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp724335imm; Wed, 8 Aug 2018 04:48:38 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzmJk2nBKvNP4u9TmeA2YjrGNhu1mtPz+gltvopp3QglSeKcu8mfxN3RvxJNYaaA5LwgFU/ X-Received: by 2002:a65:40cd:: with SMTP id u13-v6mr2338396pgp.334.1533728917975; Wed, 08 Aug 2018 04:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533728917; cv=none; d=google.com; s=arc-20160816; b=IjGT3SfQ52DslbQjdwguXJnGG5Pk3wkMSD0MhlDIlY9VJSHwYP1YN80WlQVe6C4UmU RMAFp1Fm6RW3XCPmhvyqvL6FO0POPhRm+QjRBqf+9cOhUunb4xj/WcNUf8upfB/+c4tS 4MtJnP3ZfodvferKfpxkG80j/gxtDDFeSb/MiJKOi2BWDP4mi0A98rUxCC9nvu84oMTS GJH3GyXi1g8++g6Lfy4uXxsdVWYnL7v8pfI2iBIzqC+5RmQcv40hVN0OQAGFcXYd82JJ lEas1i444J8zDWPQ9m/zPp5oOpJwumj43PL5S4GgQ632WbY7k2mBAj9pcaALqVnihW6R r0Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:arc-authentication-results; bh=3JCA5GB9xaGQCD5F9/7TagN66RVR+FxmrgW47IuoviQ=; b=PqRpJRsfcpMzludM19IGX4/9Z6160DsLx5N2tvpZuMBsyomHCN2bqwEJxqxthkwz97 IIssfQOgO7+SqrOyTpqjZyxZgJyo8idJlKRgWsppOfB0EUpbg1joS5kGY7ur9b5gn9AK 8p2gMOdYLuvTMcTdV3oWzhWOJWjVUPLLVOFuiNCQIEWytFNW6uudDMdF4nfbKnIP2H/T 99mZmZmBww352z4QK0vP5w6NP52SvvQY2RhTnnMJbrAoJgQd4hmiKy4rABAxAI2LXrmh xoFzXyw/LfwtQ03qjKhJKIhbljwZDAwNjvPP+Db/5R5SWrwnWWUCNUOjNB24p/JBZkYr CUWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j24-v6si3769982pfn.363.2018.08.08.04.48.23; Wed, 08 Aug 2018 04:48:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727061AbeHHOGq (ORCPT + 99 others); Wed, 8 Aug 2018 10:06:46 -0400 Received: from smtp03.citrix.com ([162.221.156.55]:50032 "EHLO SMTP03.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726733AbeHHOGq (ORCPT ); Wed, 8 Aug 2018 10:06:46 -0400 X-IronPort-AV: E=Sophos;i="5.51,457,1526342400"; d="scan'208";a="62277365" From: Roger Pau Monne To: CC: Roger Pau Monne , Gabriel Ercarug , Boris Ostrovsky , Juergen Gross , Subject: [PATCH] xen/balloon: fix balloon initialization for PVH Dom0 Date: Wed, 8 Aug 2018 13:46:41 +0200 Message-ID: <20180808114641.20854-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current balloon code tries to calculate a delta factor for the balloon target when running in HVM mode in order to account for memory used by the firmware. This workaround for memory accounting doesn't work properly on a PVH Dom0, that has a static-max value different from the target value even at startup. Note that this is not a problem for DomUs because guests are started with a static-max value that matches the amount of RAM in the memory map. Fix this by forcefully setting target_diff for Dom0, regardless of it's mode. Reported-by: Gabriel Bercarug Signed-off-by: Roger Pau Monné --- Cc: Gabriel Ercarug Cc: Boris Ostrovsky Cc: Juergen Gross Cc: xen-devel@lists.xenproject.org --- drivers/xen/xen-balloon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c index b437fccd4e62..294f35ce9e46 100644 --- a/drivers/xen/xen-balloon.c +++ b/drivers/xen/xen-balloon.c @@ -81,7 +81,7 @@ static void watch_target(struct xenbus_watch *watch, static_max = new_target; else static_max >>= PAGE_SHIFT - 10; - target_diff = xen_pv_domain() ? 0 + target_diff = (xen_pv_domain() || xen_initial_domain()) ? 0 : static_max - balloon_stats.target_pages; } -- 2.18.0