Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6219756rwp; Mon, 17 Jul 2023 17:47:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlEhhpJxdvmg5dn0KimIjRRFwlT3PDdU/hauSsdQtyOA1gHVF8mPbq+MKKS5vM82o/wQ3e9f X-Received: by 2002:a17:906:5354:b0:988:9621:d855 with SMTP id j20-20020a170906535400b009889621d855mr11627263ejo.61.1689641279200; Mon, 17 Jul 2023 17:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689641279; cv=none; d=google.com; s=arc-20160816; b=fl/sZuRd1aJ2iu2GoGCKcK0Tyt3LNUS3qqME9VBXP/lL6edFvW/LOLKxcnqbg5BpLS jrsBhTA3w+UK4Yk9rRrres9YhGZFFuRJZSq2WDh8onPYzGz8QVCHmxu1fkK/Gi4YCUUz Rd1JqPn/oIBO3tCvqXEG8Ebqt8GXUv7iMo9G/5vpAT5d5pYuFWm7KcdxHAeeAU678Toa HhhSr3AXi/ngK+ojA57abyNuk6b/F3Bp3fvp1sf8ZtOCWevL8HM26/h+6gmKkCjVNS+/ W94htCdq9+NPnzvNFlFuAY8C5yKTJ242QQDLRajw3Qb3Yl3X1MI8h7XgBxTJ+ag1zUm3 LD1A== 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=xWgRronsTbYYMQPOpLCjsPDsGzmMvsazH/ZV2Qlt798=; fh=zg2j5kVBvfZ6enSJwXyTaWRSsngNH4bQvVjbUnBIcaQ=; b=FKtyEu7Ks9/TY/nhElTfM0lkHM6bezR4ChZSnA0elR64eC33EEVAGpIbBnfrrAPvmF Oa5WfV9+WNz6YDO6nudMVsVhO9h8PFWI8c199aVRUaVFDDWI+7hZMTN7xdgBC2AunwwT DVCp9btcdOIPlLpyvMBp1aUyhI2/YFGy4MVX8LqQSXzwAUALUZaEXC+nRQFCyBt2BRZD 0koRhj/QdllZ6v3Wcl89DxwRM/IQjX/3LzUFNqKuSRbIfO+xKPfWq2ZOs4isGYfmIZYb 5qZDnXDsYM7yDpVcH3yoLmXGqv72NGNuFGiR823Qm/GWcLf8J0JlrE6ObtQfmqEtqewg nFwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=c0ZYaIyp; 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 r7-20020a170906280700b00993b3881ed2si349890ejc.686.2023.07.17.17.47.35; Mon, 17 Jul 2023 17:47:59 -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=c0ZYaIyp; 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 S230367AbjGRAOV (ORCPT + 99 others); Mon, 17 Jul 2023 20:14:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229852AbjGRAOV (ORCPT ); Mon, 17 Jul 2023 20:14:21 -0400 Received: from out-58.mta1.migadu.com (out-58.mta1.migadu.com [95.215.58.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B5EC188 for ; Mon, 17 Jul 2023 17:14:19 -0700 (PDT) Date: Tue, 18 Jul 2023 09:14:09 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1689639257; 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=xWgRronsTbYYMQPOpLCjsPDsGzmMvsazH/ZV2Qlt798=; b=c0ZYaIypddAyTOb1ArTgvLjqg0xxoMJvlC8vgqMR1XZLhWx98ZrAFX4YunXguc55jv7Njk /kgzmzSCIkT0WK5WkBLvDeiB9douPncBVXt5oA5nRKPbsUV1urJ0rw94aEXxmTpDOB+lYA L5LouM0DuiAPDZ1PoVCd4KVSxWXm8FM= 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: <20230718001409.GA751192@ik1-406-35019.vs.sakura.ne.jp> References: <20230717181812.167757-1-sidhartha.kumar@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230717181812.167757-1-sidhartha.kumar@oracle.com> 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 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? Thanks, Naoya Horiguchi > unpoison_pr_info("Unpoison: Page was already unpoisoned %#lx\n", > pfn, &unpoison_rs); > goto unlock_mutex; > -- > 2.41.0 > > >