From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73AB41E9B3D for ; Wed, 5 Aug 2026 04:46:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785905175; cv=none; b=isO56hsjhY+EVAmOF0n2TiC6RXT4jqAtnFHW1Duh1jdwi9XtjpEqf6MU3GojZX5yYX+FYa/ZLIFpS/Y4tDKJpYVRZiXfoBkgahQ2Z/ACeLFsFNySTum5g/G9jaDC3JrII1QWEaN+I4UlN3FEZW+mE5rxiqeekchPuW3zFtVf6Ik= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785905175; c=relaxed/simple; bh=bpT9AptL/3WqdVpJ56sgnJZqpO7QH9AJPm3ZZbxrfLg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VoQ6Qr0ANSUdV72LnlmRPggJ8PBBYBN0XAVZjYtmvNsYCPaEtm2IEeP0DSQa5SUR9D0jO0Cej0KTbbq302TNEkQD8lu13Yu1dFG3n6ZWg+6jqM+mGFy9e9pooZIcSypXng0c+yY2BkQhpD2Gh8KSsxOCUFF1fQW7/7CrfLluG3Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QttGL44j; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QttGL44j" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-84a652535dcso369421b3a.3 for ; Tue, 04 Aug 2026 21:46:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785905174; x=1786509974; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=pf+KaQef3aLdqIRGS+SN0ScWkjmFB+xo03zP2W7SUl4=; b=QttGL44j1xSJ2rgBBxILpU/pGLKbUqpOITPHSjnn7GhEn0H96CS4SVu650DXSDEvUm tg6eKozFyaIzALpp9sjNRjA8l/lbtwYZatG+qSliTvaIB3yR9bc9zJD8KUhJYqII0F2y Bk8kTfTs9u6BG4RTPaFh0xUl0OmRrMFfOOPYj8GUZXD2GZQT/VwjhULlkFUIzHjRtL4e vdHggGKG+awNWBp+Zei3H44Gd8yoHhqRvgPbPpRqnhLdDELdT/3fjBPl5z30wA6u/udP bQLKq0zkfUSAAajuLfFxoVP8+wbaFQxw0d6iy5M0sAQTahYgv8JVNZTkMZUtIhg/cEpF 6G8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785905174; x=1786509974; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=pf+KaQef3aLdqIRGS+SN0ScWkjmFB+xo03zP2W7SUl4=; b=QtYZWSZ0JjQEDIMVQgL97IBDejl5QprgHt3WZfBQJ4j0x4XACkPPOB9pva2fI1LCTd tjzuZU2ANwGQdvpkan6yIGz97Dkkapv40pbC4d+6K2Gc+a/G6m5yEFug3zvW7fjI4iwl 4wBTle67mvwVSHH24PzhcZ+Mizu46TBSyBNngPR+9vujI1i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X-Received: by 2002:a05:6a00:2d8b:b0:848:3e74:85eb with SMTP id d2e1a72fcca58-84f2e014749mr4032775b3a.1.1785905173552; Tue, 04 Aug 2026 21:46:13 -0700 (PDT) Received: from spider.bream-herring.ts.net ([103.252.203.158]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cbe707e577bsm617891a12.9.2026.08.04.21.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Aug 2026 21:46:13 -0700 (PDT) From: Matthias Goergens To: Roger Pau Monne Cc: Matthias Goergens , Juergen Gross , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Yannick Martin , Thorsten Leemhuis , Stefano Stabellini , Oleksandr Tyshchenko Subject: Re: [PATCH] x86/xen: fix init of balloon stats for PV guests with memory != maxmem Date: Wed, 5 Aug 2026 12:46:07 +0800 Message-ID: <20260805044607.2564210-1-matthias.goergens@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730143548.39320-1-roger@xenproject.org> References: <20260730143548.39320-1-roger@xenproject.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Roger, thanks for picking this up, and Juergen, thanks for the quick review. Two things I believe are still worth addressing; the Fixes: tag can of course also be fixed up on application. I think the Fixes: tag should point to 0949c646d646 ("Partial revert \"x86/xen: fix balloon target initialization for PVH dom0\""). Commit 87af633689ce changed the initial-page calculation and the extra-region subtraction together, so those two operations were coherent: the PV initial count then came from get_num_physpages(), which includes the extra regions. 0949c646d646 restored the PV start_info->nr_pages calculation, which excludes the extra regions, but retained the subtraction. Its 6.12.y backport is also the reporter's identified regression, first seen in 6.12.75. Applying this patch in a tree that has 87af633689ce but not 0949c646d646 (for example a 6.17-based distro tree) would double-account the extra region. This likely also wants Cc: stable@vger.kernel.org, since both 6.12.y and 6.18.y carry the 0949c646d646 regression. Separately, and not something this patch introduces: PVH dom0 has the same shape of problem on mainline since b13cd24c15d7. A successful XENMEM_current_reservation supplies current_pages for both PV and PVH dom0, and that count excludes the unpopulated xen_extra_mem, so the xen_pv_domain()-only branch leaves PVH dom0 subtracting those pages again (-ERANGE, or a silently wrong target, when CONFIG_XEN_UNPOPULATED_ALLOC=n leaves the regions for the balloon driver). I am happy to pursue that as its own thread once this one lands. Would it be safer to pass balloon_add_regions() an explicit indication of whether the chosen initial-page count includes the extra physmap regions? That would cover PV, PVH dom0, and the XENMEM_current_reservation fallback without deriving the accounting rule solely from the domain type. On hypercall failure PVH dom0 falls back to get_num_physpages(), which includes the extra regions, so keying the accounting on the source of the count keeps the fallback correct as well. Thanks, Matthias