Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp733413imm; Thu, 13 Sep 2018 07:00:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYFCP8+KhlfpD6aBsXHh34Nya5q9r4XHdr1yuDtSb1id5AtR1m6giLdmrmm+Qek3pUp+9zg X-Received: by 2002:a17:902:2804:: with SMTP id e4-v6mr7339664plb.327.1536847242588; Thu, 13 Sep 2018 07:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847242; cv=none; d=google.com; s=arc-20160816; b=1ChXYRGThyENnAXbJL7vS01M+b/799RajACUoMVIVPLG2ekY+xEie1pGEotTgssaHY S2qo4dtXLx3ufup6pejLYgp4bX5767gaO2JF/45JYvjNsTkECi0Do7NQe17dxl96LHMw 9VIo8M5LQVj+h7GQ5sGCaOTz0bnjZVsAhHAlWeWF+5a5Nugd7OjQqUA3yKIyiqa4Rkbm 72zs21t5adktKXHQwFe/3VGawyo0aXvXb6JHMaetOC4wenWtVNdTwcJtcGiQkEPCfVQa ftPiJVJxIVZacG44cI9fxFFG8im3ED3d5Loki6DSiaG3FnmE5366f1VpS4uh+NBp3o+Z trSQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=jbSk9FxtES0t5CHO4+ix/doKiz85XgfGn5UHHZWxZ3o=; b=AJmRvA4Sr7YORT2brMOfy0wh9EV11W2r0yl3lSudlVEX81Otc1gHjB35Nhe+g1LhX1 Eyfgy3MSQNhIP1KTyktr4nue6x3rEE9iDtSlDau2ctA+KaGIFveYIIHzne/+wyW683og Fp6t4mr3nNpmZtw1LPpGzT1u0/xQbD6o0XkrFRZ8KOu487QCGc5lNNf10kh3WlDWBiva dcABs9JecN7g7CKcJLlVwyJ516rL1mLTtavvcpkCBtMJO/n2Dfn0+hQaAFzfUdJyM/AP b1fhtbfmlhdkPuaIeoiGHYw6BAKiPIDwpBI0REKSJCDyM9g5akFIt8DwcPQ5VGzouVIM QWqQ== 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 o20-v6si4528378pgb.608.2018.09.13.07.00.27; Thu, 13 Sep 2018 07:00:42 -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 S1731660AbeIMTIj (ORCPT + 99 others); Thu, 13 Sep 2018 15:08:39 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34762 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729011AbeIMTIi (ORCPT ); Thu, 13 Sep 2018 15:08:38 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E7A39D15; Thu, 13 Sep 2018 13:59:00 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gabriel Bercarug , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Juergen Gross , Boris Ostrovsky , Sasha Levin Subject: [PATCH 4.18 110/197] xen/balloon: fix balloon initialization for PVH Dom0 Date: Thu, 13 Sep 2018 15:30:59 +0200 Message-Id: <20180913131845.947930771@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Roger Pau Monne [ Upstream commit 3596924a233e45aa918c961a902170fc4916461b ] 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é Reviewed-by: Juergen Gross Signed-off-by: Boris Ostrovsky Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/xen/xen-balloon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/xen/xen-balloon.c +++ b/drivers/xen/xen-balloon.c @@ -81,7 +81,7 @@ static void watch_target(struct xenbus_w 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; }