From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 AF4424119F3 for ; Mon, 10 Aug 2026 14:59:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786373963; cv=none; b=e2bPLP49V1hkH1v50cJZZ6pmHUnReyPMUbZYWoM4I4v6XUkLP1FRbzAXJzgzfqXvJMm9VIuH8Shi8ANhp22KocSHLPUuOePG5NKfrR6RM1XMhrCzpmyXXvQ8ulALUpf/19NxLevZnhAc09BNEbqtuM2zpRT9xQlb0cLkrkxMr24= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786373963; c=relaxed/simple; bh=vWxAbHHJRkYkwm1s2uludu0sI2Qe5U4coPzZKhVXPVo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eCDuBECcMvYPspvgU3ssuyk0TpnvkHLR58XWzJo2MgD3+by6OQdP1iQIUsfMNlMHkSScSeibLjBUUrZzGVDu8wRcnXZBPS6I7FCJvcIzRISnrsRd9DIK+NGVjJBAFyPw622Y56x1RNzGi1R5/vIw7OB3i8XgEt0Pz2pBqqjHhJk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ed1az6VB; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ed1az6VB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8836D1F00A3F; Mon, 10 Aug 2026 14:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786373958; bh=G8qxlsQGfocAVe55+yk0uJ2BiMt4CEd3bRCiLyYXCik=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ed1az6VBryFOclUxePVQXHfbm8EkIKq0m531FGOOi35ufllzQL/hX7jG+ggcsnPNw odnCpPptXhxfAUXYiDM4bJFRdmPtWX11Mx8NacoRw8aXN8wdedn0ckdcGF2KtBmKTp rHNDR/ragt/P4AYm7YyNELZpN+Rp5s0uzsCPTTIAu66x52FeueOZr4vFSqIA6F4liV JM5B9JhtCf88sJ8xHqB6Bxy5Bydi4NvKwbXcl1RY3NkPXzHemZ/2VIWN9YkBntSF0K UvjXhV6zx9S5wL983zDyho3eMrwObwWVV2f96xXQ4GLfK5DXYcgAGVDqQg1uunv+Pr HMjsJxhIympJQ== Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfauth.ams.internal (Postfix) with ESMTP id EC9F9198003A; Mon, 10 Aug 2026 10:59:12 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Mon, 10 Aug 2026 10:59:16 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGLf/eoBsdkF5Bcv4i7XrYQoeSrK3kmL+XPu4kKdoH/000048y7ntGF27Bp8G86zJ 61kFC93E0uHN1m8C0YxhAmgbvmZVRocMALRmYBeYMPOD1xgiHiinUgvyLh7d2AZ3Q5s93r URRyzhEjgZoCXP1+mEzRrrpgm2DtGIp1ZL6f0s1WZK8X5TYxrP+S3AkjBJcT0aQ3IgR0Td v/a4rW/kNt1q5C5wgy8OTpNWoHkcat9Qw++32800rNwaVCTlroIiVyydmZ+ZpUQ5KpFVZM KYCDYortVruTL+CpAbfIFB8R5NjDJ6U0KzbTk0B8VAgarQtGQqfjLQ8kqllbd+yTpVdseo KvpPzjwxGlsZW60IR2yM418qTAMpqFhNEg/tuy0Dn+XmEbRVMP6/+ZB3GuFfVvW++PbibM JOUkAnt18GAyHFmdEHjN2lMD6Frxz+kRwWuXhvFxrl9CqKYyCR4ca7LWvx9FVxRKr7IHgW vIPE90fcOUe6BQregpLdSkGMmHGRgUjR88QTSHZDZFw20ggV8Fmfh+K1iLvH6K5M06z5ZI Z/fHFkQMgVLtogPE8JyJS6geTi+w3zxwFP5YePeB3O/9wKpEyWWs8uIUIICrvEBMy8q2vC rMM/uDBA7WXR73QDimpl3mnzuLIexgWC5n96u/rOTsu0LryWZR++4rBxDdqw X-ME-Proxy: Feedback-ID: i10464835:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 10 Aug 2026 10:59:10 -0400 (EDT) Date: Mon, 10 Aug 2026 15:59:00 +0100 From: Kiryl Shutsemau To: Breno Leitao 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 v5] kexec: keep the next kernel off hardware-poisoned pages Message-ID: References: <20260810-kexec_posioned-v5-1-95e1b5e2e656@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: <20260810-kexec_posioned-v5-1-95e1b5e2e656@debian.org> On Mon, Aug 10, 2026 at 06:32:04AM -0700, Breno Leitao wrote: > Memory failures (such as unrecoverable ECCs errors) are getting more and > more common. The kernel knows how to handle it while running, marking it > as poisoned (and SIGBUS user tasks). > > Poisoned memory is removed from the buddy allocator, but, not from > other places. A current problem is that kexec will load new kernel > on top of a bad/poisoned memory, which is undesirable. > > If the next kernel's image, initrd or purgatory lands on poisoned frame, > the relocation copy writes to the bad memory and the machine checks > during the kexec. > > Skip hardware-poisoned frames when placing segments: check them in the > kexec_file hole finder so it lays the next kernel down on good memory, > and reject a poisoned destination in sanity_check_segment_list() for > the kexec_load path, which cannot relocate. > > The two hole finders walk in opposite directions, so each asks for the > end of the poison it has to clear: the top-down walk for the first > poisoned page in the window, the bottom-up walk for the last. A poisoned > hugetlb folio counts in full, as hugetlb keeps the flag on the folio and > the poisoned subpages on its raw hwpoison list. > > Suggested-by: Kiryl Shutsemau > Signed-off-by: Breno Leitao Reviewed-by: Kiryl Shutsemau (Meta) -- Kiryl Shutsemau / Kirill A. Shutemov