Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8939947ybl; Fri, 17 Jan 2020 03:47:16 -0800 (PST) X-Google-Smtp-Source: APXvYqwDs5ESvQpT9ZXqGPHf3hK0kKSsb4I8+BYaoi5n9XkLkDUyFp1DbKz77d/hjABzN6lArdYO X-Received: by 2002:a05:6830:1198:: with SMTP id u24mr5593939otq.215.1579261636328; Fri, 17 Jan 2020 03:47:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579261636; cv=none; d=google.com; s=arc-20160816; b=UNMLenPGQlGdD5DQgNUIrZ99tEv6inupqzzu6gps5161zaZj//MhGbcJJTUw3ew6vv Jg3jwvA6xw6Pp8s1rAZdMYH3gnQe1885qsdjp72y7wQPb5rkubGgnTI9LcFbjeRpfMlN YZI14onJzULNMsdCJLyRNUUsp7UI3/FR3wgZ9dp25yT+oqgYygagE0QYz7Z1l8di9NAY iAt3EREAYd+tb6Zkwgn/wFn1LVX552xaMCLsQgvSwMA6Hc1SJhUbKn87VFHZ9otlALAj b5MS+1UjM/GGiqN1XExluz0z/YajsUl8YiuJUx3cu1iiuJ3cDBkdC+upMS+rPqLc5Oix hCxg== 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=34K2zeYhB8IXW3B8EURsYa2rqvYtresdmD6nb8Y5qZ4=; b=LgCdmphcS4mak1uFofjxkf0HuFKilBgDIG0+I6oiMrMgxZadHOPNMXj6H6mdZKcEVr nVvyVrPVYFewcIlshaprjK9eWhU8NFRvrZAJz54lWcu8VfSudAKaN8uKWafrZ8IfgHgb X935/9x559uueVYu7iaz/sDktd0xFKEijs1fx+ksOviAG3MRsIZfa9+SmncGnDmPhRTU /A7s3u2AMXrQRl3bitHCMGJaEPMEyZYn5jUpAHzrPlM76ASGfBS0PgBNJCgIgsNfUaaC KeibLv+DVcb0mYZYhlOCdaNgPXrh+D8KSK3ki13LDZYcfH30EoIfI3uCgUD3Ii3HYwQu O2Fg== 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 h18si15449786otj.114.2020.01.17.03.46.55; Fri, 17 Jan 2020 03:47:16 -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 S1727022AbgAQLpv (ORCPT + 99 others); Fri, 17 Jan 2020 06:45:51 -0500 Received: from mx2.suse.de ([195.135.220.15]:60870 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726689AbgAQLpv (ORCPT ); Fri, 17 Jan 2020 06:45:51 -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 132F6AE34; Fri, 17 Jan 2020 11:45:49 +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> <4ddd12ae-94f7-0b16-346a-46e096d9ae6e@suse.com> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: Date: Fri, 17 Jan 2020 12:45:48 +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: <4ddd12ae-94f7-0b16-346a-46e096d9ae6e@suse.com> Content-Type: text/plain; charset=utf-8; format=flowed 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.20 12:36, Jan Beulich wrote: > 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. The description is misleading as it fails to mention commit 96edd61dcf44362d3e, which introduced target_diff. I'll add that to the commit message. Juergen