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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C273FC433FE for ; Thu, 13 Oct 2022 08:33:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A49B6B0071; Thu, 13 Oct 2022 04:33:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0550C6B0073; Thu, 13 Oct 2022 04:33:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5DDC6B0074; Thu, 13 Oct 2022 04:33:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D55E26B0071 for ; Thu, 13 Oct 2022 04:33:50 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 87C3F1C5ADD for ; Thu, 13 Oct 2022 08:33:50 +0000 (UTC) X-FDA: 80015263020.18.2B1FEF0 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf16.hostedemail.com (Postfix) with ESMTP id D9B86180024 for ; Thu, 13 Oct 2022 08:33:49 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5FAF4219FD; Thu, 13 Oct 2022 08:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1665650028; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UykCCyJppeIUxswHlrvpiYaqBuU5BdEdPSbdjTJa47Q=; b=Rc9cWLzaN+2mBDp03fYhJKtCItFrzeHJFnUVYf/Chm/uom0tNUiP2Lz39xyu4OVfXQ0/FU m/XNh6OM+2z3ZbWkTTicNTczAN4rs7rls45qwp9bXENDOSNJJCPXq1W7Ba//E98zJq3Sms 5oRCjPDXxwwhVRzEqfTpczbVYTdTQzo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1665650028; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UykCCyJppeIUxswHlrvpiYaqBuU5BdEdPSbdjTJa47Q=; b=c1bxmZqV6zA4PCXwr2Duu/z5BawMYC/UfhCr+2HxsFxCuVQHps+0xYxUJN1aHhJf3Pj2Vy bPMMnH6yK4064oDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A0C2013AAA; Thu, 13 Oct 2022 08:33:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id asdNJGvNR2OrbAAAMHmgww (envelope-from ); Thu, 13 Oct 2022 08:33:47 +0000 Date: Thu, 13 Oct 2022 10:33:45 +0200 From: Oscar Salvador To: Naoya Horiguchi Cc: linux-mm@kvack.org, Andrew Morton , Miaohe Lin , David Hildenbrand , Mike Kravetz , Yang Shi , Muchun Song , Jane Chu , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 4/4] mm/hwpoison: introduce per-memory_block hwpoison counter Message-ID: References: <20221007010706.2916472-1-naoya.horiguchi@linux.dev> <20221007010706.2916472-5-naoya.horiguchi@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221007010706.2916472-5-naoya.horiguchi@linux.dev> ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Rc9cWLza; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=c1bxmZqV; spf=pass (imf16.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.28 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665650030; a=rsa-sha256; cv=none; b=ZDc8jgsYoHMLJAQN+HIVlRuV7antXta6U55Yrerq2XouFQ+qX0lq5hLhl9ZL2S+w+vLKNP 7DK4zjkOVqRLqRpx2klCHYAP6iCfkvqTPBUkIE6/UV1+mKRSp3d6kuyRQkpBsbnNvwsBVC GY5vW/x2Gv5fDi7Gdlg3QG8Dgj6DvUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665650030; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=UykCCyJppeIUxswHlrvpiYaqBuU5BdEdPSbdjTJa47Q=; b=UyG/cINoi/5N+sDbUXYoAVmAfe11VF7JcB/Wx1NjHcYsIkd6zmYXpUjkPykTXozTOkAzpp Y6KDtkGM15MsH5JIHr0KXVknEdAwGkj7m7e1IKLL2UiruNUIrXnrKm7KToGtY2/dDnlYIs ybBt5txuDlgg6DZrZASE+uNP+MlxAy8= X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Rc9cWLza; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=c1bxmZqV; spf=pass (imf16.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.28 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: D9B86180024 X-Stat-Signature: gj19xdot8o6h4uwbzda85p3w8n1ru99b X-HE-Tag: 1665650029-606721 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Oct 07, 2022 at 10:07:06AM +0900, Naoya Horiguchi wrote: > From: Naoya Horiguchi > > Currently PageHWPoison flag does not behave well when experiencing memory > hotremove/hotplug. Any data field in struct page is unreliable when the > associated memory is offlined, and the current mechanism can't tell whether > a memory block is onlined because a new memory devices is installed or > because previous failed offline operations are undone. Especially if > there's a hwpoisoned memory, it's unclear what the best option is. > > So introduce a new mechanism to make struct memory_block remember that > a memory block has hwpoisoned memory inside it. And make any online event > fail if the onlining memory block contains hwpoison. struct memory_block > is freed and reallocated over ACPI-based hotremove/hotplug, but not over > sysfs-based hotremove/hotplug. So the new counter can distinguish these > cases. > > Signed-off-by: Naoya Horiguchi > Reported-by: kernel test robot I glanzed over it and looks good overall. Have a small question though: > @@ -864,6 +878,7 @@ void remove_memory_block_devices(unsigned long start, unsigned long size) > mem = find_memory_block_by_id(block_id); > if (WARN_ON_ONCE(!mem)) > continue; > + num_poisoned_pages_sub(-1UL, memblk_nr_poison(mem)); Why does num_poisoned_pages_sub() have to make this distinction (!-1 == -1) for the hot-remove stage? -- Oscar Salvador SUSE Labs