From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D9E33BB69F for ; Thu, 6 Aug 2026 14:59:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786028396; cv=none; b=TuE/yZ0gqvHSruk7azGbyyv1x75vG9fJc5XQtYSFUXmxljCkm+RS6zUFnDXSjtdNvJbI2v3b7EYo0nJcQAXm79Z4hsKTaSBXtPLDAWFr0ueD6bNW0SCjyDnhBmxkyXSnx9Pgi/lYZrV1gf33XJGp9CcCo9VIo+U9PPjdarOw7hI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786028396; c=relaxed/simple; bh=eSfaPGuloN7WGM5QhOJXngQ5HHVPiwIaCZrdCE6+5tA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=N8YkvGTVobc30vwTOPa01E9M+vzsfTE7745ye/JQIPBsmzChVKuFmVVCTx392VFzJ+s7IOfKSNmnjSNFYINmlpiZukAfXjzYVH88QJyWGvhsfF2yhdFShOKlpJ3Y3r7dHO2xdBNB8f+RbYQb7zX8XGsOEkAUj8tbv9CoKeBcTdI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=SufsmgqI; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="SufsmgqI" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=HpaSVlP8u6Eid71P/qQX5dIH8P+evmO5hE0RAEwaHnU=; b=SufsmgqI764RRJwteT9oL3Drw0 qswd/2rocMBe7UFvQpwBlNGHgbG5NvEq6ZkUyGGqxUW8Hsf9bIziGDlRHqVSShHMy0bec+kpWEUYg NGn3dslhLfHFI04xiGBz4phHYSay76I0irDAut5J5zg+0bgcgyuWC7ocLhnzcFwDawbA0Xdv1lhEh jQkNg13S7O+fZ4RGYIAue6tG4GTYVK85CCU5BNvZciVei7c9dVy3fb9aqyv1ZwZV5V7KWaM+W8eh7 jHTXrMB1zyyict4nmV7MTx1g+1C5emG9Nva2wQ6cBrE8xkIq8eMAOUoTfKTKlQBkPKmFsSuIurmpx kIqITZXw==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wrzZ3-00ElzJ-04; Thu, 06 Aug 2026 14:59:21 +0000 Date: Thu, 6 Aug 2026 07:59:14 -0700 From: Breno Leitao To: Kiryl Shutsemau Cc: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Baoquan He , Pasha Tatashin , Pratyush Yadav , Miaohe Lin , Naoya Horiguchi , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, rmikey@meta.com, riel@surriel.com, kernel-team@meta.com Subject: Re: [PATCH v3] kexec: keep the next kernel off hardware-poisoned pages Message-ID: References: <20260803-kexec_posioned-v3-1-83aa6ede0351@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Debian-User: leitao On Tue, Aug 04, 2026 at 03:36:47PM +0100, Kiryl Shutsemau wrote: > On Mon, Aug 03, 2026 at 05:41:10AM -0700, Breno Leitao wrote: > > @@ -504,6 +505,15 @@ static int locate_mem_hole_top_down(unsigned long start, unsigned long end, > > continue; > > } > > > > + poison = range_last_hwpoison(temp_start, kbuf->memsz); > > + if (poison != PHYS_ADDR_MAX) { > > + /* we hit a poisoned page */ > > + if (poison < kbuf->memsz) > > + return 0; > > + temp_start = poison - kbuf->memsz; > > + continue; > > + } > > + > > Hm. Don't we want range_first_hwpoison() for top-down walk? Otherwise > the end of range would land on poison. Sure, In this case would have both, range_last_hwpoison() for locate_mem_hole_bottom_up() and range_first_hwpoison() for locate_mem_hole_top_down(). > > + end_pfn = PHYS_PFN(start + size - 1); > > + for (pfn = PHYS_PFN(start); pfn <= end_pfn; pfn++) { > > + struct page *page = pfn_to_online_page(pfn); > > + > > + if (page && PageHWPoison(page)) > > + poison = PFN_PHYS(pfn); > > Oh... I think it will not work for hugetlb pages. It will give > false-negative. > > We cannot just set the bit hugetlb pages as we don't always have memory > for tail page -- look at HugeTLB Vmemmap Optimization (HVO). Hugetlb > uses a trick to encode poison page. See code that uses _hugetlb_hwpoison > in struct folio. > > I think we need special-case hugetlb here. (One more reminder why I hate > HugeTLB). Confirmed -- hugetlb_update_hwpoison() sets the flag on the folio and keeps the bad subpages on the raw_hwp_list, so a per-pfn scan only sees the head and misses the tails. Let me add this special case for our beloved hugeTLB. Thanks for the review, --breno