Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8926392ybl; Fri, 17 Jan 2020 03:33:00 -0800 (PST) X-Google-Smtp-Source: APXvYqw69vzOJRZGEMDLrKupx9OBv0NSoi8K7vJ2MCg42iuDll7unhnjfJfWcizJaF1CKo2JFuSA X-Received: by 2002:a9d:2dca:: with SMTP id g68mr5318177otb.150.1579260779781; Fri, 17 Jan 2020 03:32:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579260779; cv=none; d=google.com; s=arc-20160816; b=Lct6wnNtWT1zCXTWROIeepmANWKqSktdIv6azij2PSMcdtHLp4NhVsaLAUkTzUMXMO LrmIlLyGIIZzNO5asYLIOkZnpz2+ApSiDBl8VrqQGMMqoF4K1B7CwGT1gI43oAQ+aUWS RCRIgo9TLKSyyWfwo8+bVi3/0pPU1qOx5wi9Unw/vnV1A65xbE4Oq5Cz9J9+or4lr0c8 wtbdHEDfKXNJgFbwNxUqSTQsQSgaWuGuFeo7u8nqZ+Ao4t67M9RuXZFagxsJfopsexXm 5tE3x82Vco0EviVyl8nLd0uJDJqcX2/QkadDlN4SB3PJ6XvRrxDtIcMfpdmH2SpqDPbZ h7Cw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=+VRtEQmdNYqk7nfti85Fr1rZ5xeTquGMy/ahf2BOJbI=; b=vsScFLjsMXuV91nYMD5POCU4/2mAa4v8WtsEgYCefJ4OTGb4wzJkma2ZZBZrXKgwD7 egrX/rdmMzBsNgZLKyzXAHZk9i7q+yNT2a0SFloQg75acqVAQG8OjQoryW9hSOomj/81 z9vlgrmXcAY5sL2XSsEtdBQRB8/WI+yivsoAf/l3wx9jiHwoZWNrZ4VwnrbTov7xD9b3 a8s1p4zF6bSpjZNAwhyaKXyf2i6V/kPiK1O0pNJX3JPvsZIFH5CZyAdfsSjhKIx5PZau FK4Tli3y/DfSkhmrxl2O9pD4AkLlvX98kQuizicTwoL5vJbmKklwkEbaJGGTvhbsvSjo Kh+w== 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 c21si15465527oto.176.2020.01.17.03.32.44; Fri, 17 Jan 2020 03:32:59 -0800 (PST) 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 S1726892AbgAQLbn (ORCPT + 99 others); Fri, 17 Jan 2020 06:31:43 -0500 Received: from mx2.suse.de ([195.135.220.15]:52110 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726371AbgAQLbm (ORCPT ); Fri, 17 Jan 2020 06:31:42 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BAE58B1B9; Fri, 17 Jan 2020 11:31:40 +0000 (UTC) Subject: Re: [PATCH] xen/balloon: Support xend-based toolstack take two To: Jan Beulich Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Stefano Stabellini , Boris Ostrovsky , stable@vger.kernel.org References: <20200116170004.14373-1-jgross@suse.com> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: Date: Fri, 17 Jan 2020 12:31:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17.01.20 12:01, Jan Beulich wrote: > On 16.01.2020 18:00, Juergen Gross wrote: >> Commit 3aa6c19d2f38be ("xen/balloon: Support xend-based toolstack") >> tried to fix a regression with running on rather ancient Xen versions. >> Unfortunately the fix was based on the assumption that xend would >> just use another Xenstore node, but in reality only some downstream >> versions of xend are doing that. The upstream xend does not write >> that Xenstore node at all, so the problem must be fixed in another >> way. >> >> The easiest way to achieve that is to fall back to the behavior before >> commit 5266b8e4445c ("xen: fix booting ballooned down hvm guest") >> in case the static memory maximum can't be read. > > I could use some help here: Prior to said commit there was > > target_diff = new_target - balloon_stats.target_pages; > > > Which is, afaict, ... > >> --- a/drivers/xen/xen-balloon.c >> +++ b/drivers/xen/xen-balloon.c >> @@ -94,7 +94,7 @@ static void watch_target(struct xenbus_watch *watch, >> "%llu", &static_max) == 1)) >> static_max >>= PAGE_SHIFT - 10; >> else >> - static_max = new_target; >> + static_max = balloon_stats.current_pages; >> >> target_diff = (xen_pv_domain() || xen_initial_domain()) ? 0 >> : static_max - balloon_stats.target_pages; > > ... what the code does before your change. Afaict there was > never a use of balloon_stats.current_pages in this function. That is a little bit indirect, yes. In the end I want static_max to be either the maximum reported by Xen, or if not available, the current assumed memory size, which can be found in balloon_stats.current_pages. The main idea is to avoid a negative target_diff which would result in not ballooning down. Juergen