From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55C6EC33CB6 for ; Fri, 17 Jan 2020 11:31:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 354EE2073A for ; Fri, 17 Jan 2020 11:31:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726917AbgAQLbn (ORCPT ); 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