From nobody Thu Feb 12 23:02:53 2026 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB35B43173; Thu, 2 Jan 2025 21:39:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735853983; cv=none; b=MMsMCu6aPMlNEu8S224u26c0prBfoDBMZocB4lolLtNXdnOLzxniDekHL/MRmDdPRRbwIIeCNzGs9k+wTK8eF7oO2Q6coAkVktnpyWefyZgS1T2eCX2oGAdmfqvT6YYdTOSPmHAmx4GHWlC+D/cYC0+sxDg4esjq/9gCRkEE85c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735853983; c=relaxed/simple; bh=NtWnK8Vpc0HnAvjnHbjLErSS+ykFC3CCfB0k45Z+spE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=AgnehBlCyoBTH1wSr5NMbtVDtb7aBcjD1W+ShqrzMRu//j6GXJKA1QkUCg3CyMo3Pti07OZ0OgPP3mP+ZFcb7reXP7WFFIzBFtqYTtG2iOn9z5TGo1M6s3Q2480TCZcoo2xENK07CKmdjxpJ6KiRkB9MXJSlQl+RD0XBgITvk84= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=qK6dFQaf; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="qK6dFQaf" Received: from DESKTOP-0403QTC.lan (unknown [20.236.10.163]) by linux.microsoft.com (Postfix) with ESMTPSA id E62A02041A87; Thu, 2 Jan 2025 13:39:40 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E62A02041A87 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1735853981; bh=1v2rM0Ln6+UpaDcZKIVhFpvHGaweAwvDkCDeeXhmWt8=; h=From:To:Cc:Subject:Date:From; b=qK6dFQafKgPmxUTUl3WpPKTYw8iCIGczSHxcZ9fFPnl1vrrWjAhNoJ5cdYssMNebo IcyJ4DLxqpkWYjpDkmHwChPnW67QkHMG6gK1cYFFRcatYt5G7+2HQc4pZnDh4E1Oiv hf3j4VFxoSKIgePNCYrlROTo8Ba7W+p3oJzrwTQg= From: Jacob Pan To: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, "K. Y. Srinivasan" , Dexuan Cui , Haiyang Zhang , Wei Liu Cc: Jacob Pan , Allen Pais , Vikram Sethi , Michael Frohlich Subject: [PATCH] hv_balloon: Fallback to generic_online_page() for non-HV hot added mem Date: Thu, 2 Jan 2025 13:39:40 -0800 Message-Id: <20250102213940.413753-1-jacob.pan@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When device memory blocks are hot-added via add_memory_driver_managed(), the HV balloon driver intercepts them but fails to online these memory blocks. This could result in device driver initialization failures. To address this, fall back to the generic online callback for memory blocks not added by the HV balloon driver. Similar cases are handled the same way in virtio-mem driver. Suggested-by: Vikram Sethi Tested-by: Michael Frohlich Signed-off-by: Jacob Pan --- drivers/hv/hv_balloon.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index a99112e6f0b8..c999daf34108 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -766,16 +766,18 @@ static void hv_online_page(struct page *pg, unsigned = int order) struct hv_hotadd_state *has; unsigned long pfn =3D page_to_pfn(pg); =20 - guard(spinlock_irqsave)(&dm_device.ha_lock); - list_for_each_entry(has, &dm_device.ha_region_list, list) { - /* The page belongs to a different HAS. */ - if (pfn < has->start_pfn || - (pfn + (1UL << order) > has->end_pfn)) - continue; + scoped_guard(spinlock_irqsave, &dm_device.ha_lock) { + list_for_each_entry(has, &dm_device.ha_region_list, list) { + /* The page belongs to a different HAS. */ + if (pfn < has->start_pfn || + (pfn + (1UL << order) > has->end_pfn)) + continue; =20 - hv_bring_pgs_online(has, pfn, 1UL << order); - break; + hv_bring_pgs_online(has, pfn, 1UL << order); + return; + } } + generic_online_page(pg, order); } =20 static int pfn_covered(unsigned long start_pfn, unsigned long pfn_cnt) --=20 2.34.1