Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8931150ybl; Fri, 17 Jan 2020 03:37:54 -0800 (PST) X-Google-Smtp-Source: APXvYqwMNjrUJVIa7wfJJWYsUo9mejm3dt14CMlvcniRDFdmOqFdE72Nw4LscTv/Rxw6sqi3H0Do X-Received: by 2002:aca:ec4d:: with SMTP id k74mr2913669oih.64.1579261074493; Fri, 17 Jan 2020 03:37:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579261074; cv=none; d=google.com; s=arc-20160816; b=FFBbche6sIrCLLSETpGHEbQqiuozCAWD6VB7quhtBAHaITx28VLHJoPF1Z4guNWMaa gZX5gNKooQHZYjCk8qwvlpgSgjVl8931uyaW3RDOVIfd7MA/pQ8pOHnDoiubgnoarD53 kh509DnWFxtrHT+uswMTcjvO1cI03RTH8Us9zlJGgxqy6LK09gu7d3RzlgCZwJw8gbWh /44QAxps1Ge3hfdmirUyfq0ASWNVbuc5o+w3giByN/MR1fKJByGJB2HQX1Km/tuuJBww 1kF9QjC44PBIFkSmpOICrvLmTTvTCV8m4FTR2TzxT2uIhg+agT/ccgfe1dx8WCm6Jd+g 6rvA== 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=fgllc2qUjzR3hUhWv1P4MPu9l8iIhGWMUK5SsyJ5kJs=; b=TWWNu+v5ZRKA00e3NHU0v93xpCbXn0ky83w2HPxApL1I1ia43BgcJ8MY9SQAc/lXT/ RhwQzPonE2yOsZsiioQYKmd2U/aJvvGYQuoAPOcUQO4wNv9bZSSzdVWT5JgZ+3D+UT1H zur+3vMk7nTfF/eYdK9SGm7UCKt0hHTzlcyICwOUrdNXTEt3xZD02Gh2pbBM1FVScsSJ wJSv82NuYzuBSjJDh0f5/RNKmn41WAntPK2uIkrsAnt6X/OduhA6UGHHHI4UyWPAaWbT 90DhrD9VwmYo+iAXdRET6tNqv20J0vxOZ7HWJFahPHzT7HzCYnVr3XztL6hHfQt48eAT soPg== 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.37.42; Fri, 17 Jan 2020 03:37:54 -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 S1727003AbgAQLgt (ORCPT + 99 others); Fri, 17 Jan 2020 06:36:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:55076 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726371AbgAQLgs (ORCPT ); Fri, 17 Jan 2020 06:36:48 -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 D1675AE2C; Fri, 17 Jan 2020 11:36:46 +0000 (UTC) Subject: Re: [PATCH] xen/balloon: Support xend-based toolstack take two To: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= 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: Jan Beulich Message-ID: <4ddd12ae-94f7-0b16-346a-46e096d9ae6e@suse.com> Date: Fri, 17 Jan 2020 12:36:50 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17.01.2020 12:31, Jürgen Groß wrote: > 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. All understood. Yet the change is then not a restore of prior behavior (just in a limited case), but a change to behavior that we never there before. I.e. it was indeed my assumption that the code was right, but the description was misleading. Jan