From patchwork Fri Nov 25 11:53:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 25955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3957106wrr; Fri, 25 Nov 2022 03:59:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf7bFhqj7uxkly79674yIBMOZ5XcyHAMdEMBOqFA4hwYmFhMZ+d9J9tY1QzGyKL0GeMiqbhB X-Received: by 2002:a17:906:160b:b0:78d:dddb:3974 with SMTP id m11-20020a170906160b00b0078ddddb3974mr31212857ejd.411.1669377572039; Fri, 25 Nov 2022 03:59:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669377572; cv=none; d=google.com; s=arc-20160816; b=M5bhccQgr+oyC7DYclPwfl4eIgxIz3VtPnd0yJzw7P7c+ehi1jKSPfB22pisKCkIch qoEnGrdanIhd1c2pHAUsy0w7b6kkCTZHvREFe0yBkjTDLhGEEjrSALFZHED49//NCdug JdE4ZljNXtEuI/pTdOOBfXWqiOoGCNzTAxl+moppcmTAgDRLiwyvHKJCH66KS9d8hoIw ZaO30Oqt8NR/uQCThD3F8clz//iIVGPw9NeNPnNXAr3YMK16rgh57E/8FGXKcFpWD5LU QHdCPS/1kg4hsos7USs5W7QL1cl/pwTf79hkYAjPyxa3dILmaL1Ra459ZhjVEfStnHpK UJOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=CvJrYtKk7eOrYfZ9R0yPHG19W0jT7qMhw9WMxN4Srns=; b=RsNVRTISaRd7r73jF2YbhQPm+q76kotdclnxdkb74Z42HK4KVN5S/BajttAWx+ZIOU qJ1hHpE7xLb35ZCuOj6L1KHhrKbYOr1CtcoJXX658Wts3GO6+hGb5v6IFQceBbEc/Vdk lposLn5H6Izrl+QbgSTrDnFVMlW4fen1v9Cx+rk9PKCNzIbAiA4Bp6mXt3G4ZrzuSKcE ZUj2I1eYRAsIKvjIed4nCV2JbS3Ysu7EokHKW4v12kk37VEKQPecMZEgBMQg9MF/U+sL Wijv/ajQ5G0JDBRC3Gvl1xXfxCXrz7nDBW8GcVaXcMv90YPr/oT9OXuLg+KhsADlF0is BU4A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp22-20020a1709073e1600b007add8160fd9si3060290ejc.765.2022.11.25.03.59.08; Fri, 25 Nov 2022 03:59:32 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230171AbiKYLfl (ORCPT + 99 others); Fri, 25 Nov 2022 06:35:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229840AbiKYLf3 (ORCPT ); Fri, 25 Nov 2022 06:35:29 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 325A01CFC3 for ; Fri, 25 Nov 2022 03:35:23 -0800 (PST) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NJXkM72MHzbngP; Fri, 25 Nov 2022 19:31:23 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 25 Nov 2022 19:35:21 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 25 Nov 2022 19:35:20 +0800 From: Kefeng Wang To: Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Andrew Morton , CC: Kefeng Wang Subject: [PATCH] pmem: use TestClearPageHWPoison() directly Date: Fri, 25 Nov 2022 19:53:08 +0800 Message-ID: <20221125115308.104059-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750469256811725745?= X-GMAIL-MSGID: =?utf-8?q?1750469256811725745?= Add TESTSCFLAG_FALSE(HWPoison, hwpoison) for HWPoison in page flags, then drop privite test_and_clear_pmem_poison(). Signed-off-by: Kefeng Wang --- drivers/nvdimm/pmem.c | 2 +- drivers/nvdimm/pmem.h | 12 ------------ include/linux/page-flags.h | 1 + 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 3c63dc2cdc81..1fa6b3980221 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -80,7 +80,7 @@ static void pmem_mkpage_present(struct pmem_device *pmem, phys_addr_t offset, * here since we're in the driver I/O path and * outstanding I/O requests pin the dev_pagemap. */ - if (test_and_clear_pmem_poison(page)) + if (TestClearPageHWPoison(page)) clear_mce_nospec(pfn); } } diff --git a/drivers/nvdimm/pmem.h b/drivers/nvdimm/pmem.h index 392b0b38acb9..6f5c2f35b93a 100644 --- a/drivers/nvdimm/pmem.h +++ b/drivers/nvdimm/pmem.h @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __NVDIMM_PMEM_H__ #define __NVDIMM_PMEM_H__ -#include #include #include #include @@ -33,15 +32,4 @@ long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, long nr_pages, enum dax_access_mode mode, void **kaddr, pfn_t *pfn); -#ifdef CONFIG_MEMORY_FAILURE -static inline bool test_and_clear_pmem_poison(struct page *page) -{ - return TestClearPageHWPoison(page); -} -#else -static inline bool test_and_clear_pmem_poison(struct page *page) -{ - return false; -} -#endif #endif /* __NVDIMM_PMEM_H__ */ diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index e42c55a7e012..5e877b6c7b90 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -582,6 +582,7 @@ extern bool take_page_off_buddy(struct page *page); extern bool put_page_back_buddy(struct page *page); #else PAGEFLAG_FALSE(HWPoison, hwpoison) +TESTSCFLAG_FALSE(HWPoison, hwpoison) #define __PG_HWPOISON 0 #endif