Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6239940rwp; Mon, 17 Jul 2023 18:16:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlH99uk0XcC1p9LkRGkZh3ovBMAvYI31U8WC5ofxhyKtG8J/1gWUGpSeJr7vwTJmHI9aoZUW X-Received: by 2002:aa7:df08:0:b0:51e:d4b:3c9d with SMTP id c8-20020aa7df08000000b0051e0d4b3c9dmr12871783edy.23.1689643005940; Mon, 17 Jul 2023 18:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689643005; cv=none; d=google.com; s=arc-20160816; b=y9V9GyN9BhDcn24NEGV2sGH7QclIvTEmYsJx8fiRy95G2zzeiHZywWc1TZpQYYKnn/ 4156ZwEBGsC3WFO68ou+EHFKcOjiDPVgjvw8vd8GmIb7tW5eTzsmCx8kAGQIl38Kp+YR gpmIc6zHb4/NK7bmz8IKDwJt9Ae5mW1DrRAUG56SVIy2tmONNuAXHQrn4V1Q6scSULGO OXs1oR+Pv7Cv5hLOfs39I2P4mFcoGEbFjMdk3kwZvJUKndAsSRYcw7fHaOtZDmrCsJZW EJPx/Kq8T5TtCyAxaPb8mlh8wfM1HZ2rsHW6RBNQx0o5nH2ax7v6bFHH1AtTNSoBMrte X8rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=oonA44LaLRDvTS4ilicUH+ynavGd842K8wUpEpyQ9nY=; fh=zg2j5kVBvfZ6enSJwXyTaWRSsngNH4bQvVjbUnBIcaQ=; b=07v7CQKqmm5E8GsFjy+pcRjbtrg2KZn/Z8ewLwjG+h2s4q6Sj0gNlWqGbxTZ2hZnJ4 DEO8HFXzTUhMjb8IeJ0Q2ORh/fZwABVlzFf/2Jx8jWI8kXLKdODQuBC8gdhzADGsPsLq kjhjtUG1QAnd1X1CTTNLO6uuK1FQOzhCbVTf/hCtkZr0L0nPmCaBwMrYdZPXJQJaXAgb He25OnjIKKSR4RV6R26QSVrczgEopwbsh0R3HxIwv/G7tGqFsJmcfBsX3KtGYtRkXVEz cDFkG5XYBqVmmxEivV7ymUX+zgg0NTNSh3WOQa3nK/ffAs2YP2o9bp4DYk8e1uXkEHPY O5XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=uJhuq25p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d25-20020a056402079900b005189fadd2e6si425271edy.413.2023.07.17.18.16.21; Mon, 17 Jul 2023 18:16:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=uJhuq25p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230090AbjGRAkI (ORCPT + 99 others); Mon, 17 Jul 2023 20:40:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbjGRAkH (ORCPT ); Mon, 17 Jul 2023 20:40:07 -0400 Received: from out-44.mta0.migadu.com (out-44.mta0.migadu.com [IPv6:2001:41d0:1004:224b::2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5067310C4 for ; Mon, 17 Jul 2023 17:40:05 -0700 (PDT) Date: Tue, 18 Jul 2023 09:39:56 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1689640803; h=from:from:reply-to:subject:subject: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=oonA44LaLRDvTS4ilicUH+ynavGd842K8wUpEpyQ9nY=; b=uJhuq25pmPIWf9+nQBunG34GUcm2YO3yXpUUZySwv8PUp2VHGgYNbrhc61Pj6wvxsr/JB3 cAy0lKeQ/hu6AwzcyS2Xw3YOEOMf4nZDY6TleIkctNKg/1hXfBMBLd+LR1z993gIf2Jvnn ne01sp7k5V1Lw4/vzW888W888o6mqVo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Naoya Horiguchi To: Sidhartha Kumar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, willy@infradead.org, linmiaohe@huawei.com, naoya.horiguchi@nec.com, stable@vger.kernel.org Subject: Re: [PATCH] mm/memory-failure: fix hardware poison check in unpoison_memory() Message-ID: <20230718003956.GA762147@ik1-406-35019.vs.sakura.ne.jp> References: <20230717181812.167757-1-sidhartha.kumar@oracle.com> <20230718001409.GA751192@ik1-406-35019.vs.sakura.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230718001409.GA751192@ik1-406-35019.vs.sakura.ne.jp> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 18, 2023 at 09:14:09AM +0900, Naoya Horiguchi wrote: > On Mon, Jul 17, 2023 at 11:18:12AM -0700, Sidhartha Kumar wrote: > > It was pointed out[1] that using folio_test_hwpoison() is wrong > > as we need to check the indiviual page that has poison. > > folio_test_hwpoison() only checks the head page so go back to using > > PageHWPoison(). > > > > Reported-by: Matthew Wilcox (Oracle) > > Fixes: a6fddef49eef ("mm/memory-failure: convert unpoison_memory() to folios") > > Cc: stable@vger.kernel.org #v6.4 > > Signed-off-by: Sidhartha Kumar > > > > [1]: https://lore.kernel.org/lkml/ZLIbZygG7LqSI9xe@casper.infradead.org/ > > --- > > mm/memory-failure.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > > index 02b1d8f104d51..a114c8c3039cd 100644 > > --- a/mm/memory-failure.c > > +++ b/mm/memory-failure.c > > @@ -2523,7 +2523,7 @@ int unpoison_memory(unsigned long pfn) > > goto unlock_mutex; > > } > > > > - if (!folio_test_hwpoison(folio)) { > > + if (!PageHWPoison(p)) { > > > I don't think this works for hwpoisoned hugetlb pages that have PageHWPoison > set on the head page, rather than on the raw subpage. In the case of > hwpoisoned thps, PageHWPoison is set on the raw subpage, not on the head > pages. (I believe this is not detected because no one considers the > scenario of unpoisoning hwpoisoned thps, which is a rare case). Perhaps the > function is_page_hwpoison() would be useful for this purpose? Sorry, I was wrong. Checking PageHWPoison() is fine because the users of unpoison should know where the PageHWPoison is set via /proc/kpageflags. So this patch is OK to me after comments from other reviewers are resolved. Acked-by: Naoya Horiguchi Thanks, Naoya Horiguchi