From patchwork Tue Sep 14 23:31:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jane Chu X-Patchwork-Id: 12495157 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FA36C433F5 for ; Tue, 14 Sep 2021 23:32:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2743561175 for ; Tue, 14 Sep 2021 23:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235956AbhINXds (ORCPT ); Tue, 14 Sep 2021 19:33:48 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:5534 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235834AbhINXdr (ORCPT ); Tue, 14 Sep 2021 19:33:47 -0400 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18EL04wx011635; Tue, 14 Sep 2021 23:32:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2021-07-09; bh=2tBXA9Uh3lTdHXRUc61H0CY1PM/tJaanzmGHlrAge/U=; b=kxgb+xTtutmrEIJ9IKY4Xs2MaZScf+NlN2tqlFNflQgZavYpmVY4ALIH4CLMei14YXRq YcZM5wDETY6h3l18kRMukyXGrLl2wnxKFoL72+ji/rGUiv94AcC2IDQRVnjT/tbJxdGY KtnhTnYSwLBDQ82N2fk/GY/+CZCQ43bvLUPXqLc64R8cIWudeDcTKfIE+qQFKJVh1vCo uWca5uLsDy3IZ2WLia3jWk7JQmoMJ53n03u+H4oYwWgFX37qbRYX0nSkpEcWRVlBdxfA Ai2rgSABnorKXjxf5IvMoVWTX3AN5uDB5Dn9kv0dcFFi/oQ3zrnpkutrD3DzzxnLbzmZ tg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=2tBXA9Uh3lTdHXRUc61H0CY1PM/tJaanzmGHlrAge/U=; b=tq2qB00kCO99kPUZTCvQQgBdBy1ZStYmxtj/jLoNpw/MBED+u+Bkz8wBidUdpYLdcY0t U67fmpO2OHq/kIfayc64eDIkYyPIhChVo9WD/ILA+Fj74T4dRZkW71no+JDVxUYxYg2f sTsWOBU54n54sOkBcg8J9/l0qjIHRfT0s42xkwsgB9veX1L1qvHv7ydb7/b441ttlbb6 9U0jrbXJOFHI1B+qq/ryNRvE0MjlXT/wXTu9cwS+53yM9XVDTR7Z9ed8WXvo57DZRXIX //yiIuGP4y4l9wJdGQWBevpaF6j9NJQSm55j91aqSkNwR0TVatxXyoUSZIxc5FTs1yQu ag== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3b2pygavgq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Sep 2021 23:32:04 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 18ENUnOh024949; Tue, 14 Sep 2021 23:32:03 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2172.outbound.protection.outlook.com [104.47.57.172]) by aserp3030.oracle.com with ESMTP id 3b0jgdt4kj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Sep 2021 23:32:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rn+fJytbPCD9/Sywf2QiZk1EqzS9ToKaqhXwvMt0ltOgO+rJ0VCo8I5/vaq7g2F9y2FU18jFSEvw5jFnLm+HbLtsc5dwlgrAPst5wBaFtBAzJlIvMTAG0qTzLLKjEMHHDq4m7PySpFF29lnMEtl8bv+cxgfj9zTFe8fj4byABho/Hsxn8XtPvEZMS6zJUD+RTvw908kcIBoq0npsIYk+I7Ol4luYn4bcv0CFobw/pTQI9o5Jd8UteF8KH6aTKXBTOg+7oSZj6p51L8m8ou8VQP4wJAcadohcyU6/DPjEjWFZ02jXd9KLGL/44NA8pwG5sYx1GopjOtLibv+wgDp27A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=2tBXA9Uh3lTdHXRUc61H0CY1PM/tJaanzmGHlrAge/U=; b=iPDDWShnA0rM6vKEwkLVl6+7hMftJMF55xIKy+9p80A8jq5NGZogZ+dpkQv4S6/hFLTt4ELXf+W0hmecGm9j9u4/e1l5FMw6Y05coRuQ6TRH6VNeX29wKFCfpQy5mVg0aguw6mctyjeTjhqvRomZMv3QFWrVg1wRg/iylaRHBYdtT+1S0HDRXxkY6Hnm3xebviQ7k1KXTFfy6yxHx/sqBqrSAGXgeoXtD6N0id2b2MNf84pqeTHveiv65fl9hnzw6EeCyhwObpZHzLwE8Urt3hJrbTPkZUh2lekRWv5FiqgdfrtMyqk7T0i+DHGtArQPXaQIltAgls7BdfklTE2LkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2tBXA9Uh3lTdHXRUc61H0CY1PM/tJaanzmGHlrAge/U=; b=Rc8iY5zhCFLf0vEoiAqtl3+RssWXe2vK+6zif1T79JR8a5rAfDp2D2T/xrmbUiX9CYlNGKqR1qkfhHuzlkNOpXH+Oi0syOMSUaz4DlJDzseKPlKKZ7OtO6rWUbGvg77k3QDDKz8EoF5yi8ofkUxc/c8GUdKMTIRF83pxiWXrLmQ= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=oracle.com; Received: from SJ0PR10MB4429.namprd10.prod.outlook.com (2603:10b6:a03:2d1::14) by BY5PR10MB4035.namprd10.prod.outlook.com (2603:10b6:a03:1f8::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Tue, 14 Sep 2021 23:32:02 +0000 Received: from SJ0PR10MB4429.namprd10.prod.outlook.com ([fe80::401:1df2:3e9a:66c]) by SJ0PR10MB4429.namprd10.prod.outlook.com ([fe80::401:1df2:3e9a:66c%5]) with mapi id 15.20.4500.019; Tue, 14 Sep 2021 23:32:02 +0000 From: Jane Chu To: dan.j.williams@intel.com, vishal.l.verma@intel.com, dave.jiang@intel.com, ira.weiny@intel.com, viro@zeniv.linux.org.uk, willy@infradead.org, jack@suse.cz, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 1/3] dax: introduce dax_operation dax_clear_poison Date: Tue, 14 Sep 2021 17:31:29 -0600 Message-Id: <20210914233132.3680546-2-jane.chu@oracle.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20210914233132.3680546-1-jane.chu@oracle.com> References: <20210914233132.3680546-1-jane.chu@oracle.com> X-ClientProxiedBy: SN4PR0601CA0008.namprd06.prod.outlook.com (2603:10b6:803:2f::18) To SJ0PR10MB4429.namprd10.prod.outlook.com (2603:10b6:a03:2d1::14) MIME-Version: 1.0 Received: from brm-x62-16.us.oracle.com (2606:b400:8004:44::1b) by SN4PR0601CA0008.namprd06.prod.outlook.com (2603:10b6:803:2f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15 via Frontend Transport; Tue, 14 Sep 2021 23:32:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 50597918-d137-4a9e-c65a-08d977d7da89 X-MS-TrafficTypeDiagnostic: BY5PR10MB4035: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hQ0hzQYDIQkpCyPyu8nUwfu7dNe2kgmKf0lueY93ePgrmLqlmaAFnL/LtjB31DhHtSjahKGUthGAxJC95cTxui1V4lhCGPlyWa4xEBFUXrMHu4uTNwX1kjxA0jUKVdk9xGKPnCjrII989XSfHd1+CINJOEZ24CmdeJmrR0wz2VcTiXO0gE0JPdBm8Uw9bESQgVXuqOpbcPYBHm+ibp1xA1Cg7K+zNlLorxDu8nF4O2UAFBe65vDNgLy4f2LEWuSDHeUSDkAAPWv8Bfb6MiW8SZfFuhqaFeyA2G4UySz194LJMVMDdhPGK5tu2osL0aWtEbCsywQ7JpihkrXFroNeX7FK/jUgH9xya83Bhzun9IaxEk/u3fFHUkrP5+jAa64B2oXg1cmoXAHP+5Wr9T/Ge0XJA6jJGV6FcIIOQnRp3TNTSBrqsUoznZQDeg6GKtIrqcx7imUW+puSfWRjXHDzAfah0FNyYx1vDx1og6YHE9vxgJQITwNnRAB6enmk4Zp542Hd+BCn0mZydITVrJAGGIxegJ6JD+1YfFPMiXdxXpIEZSX3IfXlZqS2DQbvkuRi+LYUuZqFAriP8m24N1YU7epfsfUx8qGHz7jwfgFW8WJPsycqccL3fit3vMut+gERD5STw3PDKdFyQB/pqagXzIAzVQ4VNGZOXqNuedPyM7Wvn30Y+3rPQlzkxQArnr8y X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB4429.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(396003)(366004)(136003)(39850400004)(346002)(66946007)(66476007)(921005)(1076003)(7416002)(66556008)(52116002)(7696005)(36756003)(316002)(5660300002)(186003)(8676002)(38100700002)(8936002)(2906002)(83380400001)(2616005)(6666004)(44832011)(478600001)(86362001)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0trnjnlgmfEoRwINUmGWJGEGFRHsRVf7lAKjCW1ITJl/iR6U4kRpnaG5/vQXLzYnlS55ZyXlAzS1iOdLpiWuGyvsERo8oUyEtIlfhbK8EfGjURfW5zFXt1F/NrMYY+v5X6sTRPlr8sYEchBshsYf9eNM2vwV1SmAdzROqDFiBYH8c5Zv2Zs93FX2ZCuZaxpcVMGmO7uRvqP9VsrwP7KAeKB0x9p9dMraJRUzmh8AZBHPTexbhHKe5g49rih5DJQnCuwAsBUApuk1WCrKQxBy2hg3L3D131dyoHYVSs9x83ezqXyuT2O3DtD+OqwhY7o3BvDW3XiXEnmKj1zoLQGP/GIGX56CBTd25YOw/5CdzwxkHlKNsYEEFHWoPbHypMMUMmH4wZtMEf5+ibQ5QR9fAx83q3Wpuozov0Xu+fsLgFEROZv1JAipzhlsMB3mYTNZ5Mw9lw0wE6YRHKUJPgjMVuIfiHgNYxNB/v/NHbbHu8ohTd2aCoKfb2LycBUtKF9Xqhvt7qBzrF7Xg2mUWiA7suBpsldpD2OUtPu3AxlvJyZ7W06pzofkp0/y1PSFEP7DBxbbDvGU9ZFO8Zhc6RuFPGX4L5NqK+dXcrFYobBIyJyGdNtE9x9rpVhnv1l5BnMIboUydV9IXzIqVCkfVfmBaHT0eVhu6j3OqaJEOHm0MdZO2G8cD8f8A1GKyGVRoPvp/hEucl1Q1Y5XPShl0IGynqJ1CErUq5O9IGbadFjeainIJYXnklbO9/1Fzkx5bqH2VKAsT+8Jm3Dm5ga/8wxbOffwemcgFkj7GwvyxpR048mvBU4iUzuevWktisEcus8En0bJpLCEq4s0GzGxCIH45PHqydJ9uQS62xmzUJ3ax+JNLJM0Hdp2pI+8mjtHye0w71053CLvG4gQs8gc+Yng9ZXIoJ4kfnkQX47uJpt6+kKoolKb0ZenCOMUQ77cV2u4IwTwEzW/rJxzErAyYwUcIS/v25Ni3N1msH7dq8PczIt93afB6dl4xxkz/M3LJmF7Or9k0Z92s6hwNFwI9AhzYO0YGy1F6agjlheA6r8SpuaLJnQ+bCKjrfedi4KaG9hKWwFDF70+yVeFnOjFGGV3DjdigWEc0mic+VlbJblvHeOsGTSvbPcCX1GGb5gmRyJ/3W9zHyWjZUTSF+5SuRe6BxEd/4OzenjYvvk0y8kjwAmUKTRrYU9nRNBObN+KdWv8/h7KKMhQcQeFqgXnKhpDyXxVskaNXaafzYTfcyIFFXpWxAcXkaYEkXSzwe1MPqq89ZTCyqaOICX0puq0B2zEHzTcEMw56dlOlhhpH4znWkm9hd9d+7Egb+w+i9CrBfaWasL453TpXOmLD0FfsfLTZA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50597918-d137-4a9e-c65a-08d977d7da89 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB4429.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2021 23:32:01.9494 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: q2XulIQv9v2bYQktZei17w0bsK5wgeAmRmUmI0+dj7DJhnjMIkDj6nyJgH3Gzol9wO2zJKJOUvU2u3xqO5QHJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4035 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10107 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109140134 X-Proofpoint-GUID: qWFLTsIyJOG2QaOVWQ2WLTG53j12M2nX X-Proofpoint-ORIG-GUID: qWFLTsIyJOG2QaOVWQ2WLTG53j12M2nX Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Though not all dax backend hardware has the capability of clearing poison on the fly, but dax backed by Intel DCPMEM has such capability, and it's desirable to, first, speed up repairing by means of it; second, maintain backend continuity instead of fragmenting it in search for clean blocks. Signed-off-by: Jane Chu Reviewed-by: Christoph Hellwig --- drivers/dax/super.c | 13 +++++++++++++ include/linux/dax.h | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 44736cbd446e..935d496fa7db 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -373,6 +373,19 @@ int dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff, } EXPORT_SYMBOL_GPL(dax_zero_page_range); +int dax_clear_poison(struct dax_device *dax_dev, pgoff_t pgoff, + size_t nr_pages) +{ + if (!dax_alive(dax_dev)) + return -ENXIO; + + if (!dax_dev->ops->clear_poison) + return -EOPNOTSUPP; + + return dax_dev->ops->clear_poison(dax_dev, pgoff, nr_pages); +} +EXPORT_SYMBOL_GPL(dax_clear_poison); + #ifdef CONFIG_ARCH_HAS_PMEM_API void arch_wb_cache_pmem(void *addr, size_t size); void dax_flush(struct dax_device *dax_dev, void *addr, size_t size) diff --git a/include/linux/dax.h b/include/linux/dax.h index b52f084aa643..c54c1087ece1 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -36,6 +36,11 @@ struct dax_operations { struct iov_iter *); /* zero_page_range: required operation. Zero page range */ int (*zero_page_range)(struct dax_device *, pgoff_t, size_t); + /* + * clear_poison: clear media error in the given page aligned range via + * vendor appropriate method. Optional operation. + */ + int (*clear_poison)(struct dax_device *, pgoff_t, size_t); }; extern struct attribute_group dax_attribute_group; @@ -226,6 +231,7 @@ size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, size_t bytes, struct iov_iter *i); int dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff, size_t nr_pages); +int dax_clear_poison(struct dax_device *dax_dev, pgoff_t pgoff, size_t nr_pages); void dax_flush(struct dax_device *dax_dev, void *addr, size_t size); ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, From patchwork Tue Sep 14 23:31:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jane Chu X-Patchwork-Id: 12495155 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00B38C433EF for ; Tue, 14 Sep 2021 23:32:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D331C61165 for ; Tue, 14 Sep 2021 23:32:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235683AbhINXdq (ORCPT ); Tue, 14 Sep 2021 19:33:46 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:4030 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231435AbhINXdq (ORCPT ); Tue, 14 Sep 2021 19:33:46 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18EKxh3W032058; Tue, 14 Sep 2021 23:32:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2021-07-09; bh=72n7PFMsPXdD0BofaQTPMKat9hrrYyPXpzXND92RkZY=; b=ztEIN/iyXb74rBlX8+cyidEgj043NVtk7PYZRVUiF73bnDjMWlRvIF0lfIjM9oazwchQ 3Q6Vm0ft2ZnbaGKDZ0jqTO8qENoyv1BhvuLtRDQJaQ8miDGUULl9sxs+6e7RjPLsNnzF 9q/r85zpceKrd5jIEX31NaYpUzvrQCxucMdqvKPygxYs1XINOhhG/Cq7Q7GnINRQwkIQ qxL1RVrmU4SUccYFaU3LOIoyq5PC+4blHi7sxr5ek34OBa4A2O8bbAupwWvQ7swCe1Cb ZIolMZYknJQZ0nt2zwZCt52i4sBi8KEdbHoPhNMNbMBpd0fmHAZvRhw8yYUIk+0e2HkE Ow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=72n7PFMsPXdD0BofaQTPMKat9hrrYyPXpzXND92RkZY=; b=ZJFWcVxRz206IexIa0Wzzh2zp9yyO+IbzhGnIlVllrq+mI9UtWff1ZS//NPNg8w3ascf sJUJZ7oqU05CNWx+icdYzNTUaFmhU1i1APNfk+Egng5R0X33bjfylF8bJBdWvtu1VReb a2S0O3vUuMVlT3N/i2b+PMQxAa7WURYnrkoAi5vqNnmJZz/K77PgqN8sTPUv9ER3FMJn t4yV5OQyZ7yVDAmDtR+P0vApxUgpt73+Z81oOm+yeBhSDYnW38x606cuaH4x8vWaTDWD xg3yxs/39/tPvOI5GoYcZ9xUO2hmvO/Nd4soULPABEsELzvvh8DcNc264zX0z2lsjg6E pw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3b2p3mk8am-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Sep 2021 23:32:18 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 18ENTj3c169901; Tue, 14 Sep 2021 23:32:17 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by userp3020.oracle.com with ESMTP id 3b167ssv58-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Sep 2021 23:32:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IPZnHnKsV7wmBk7RT1fVoWSiB+T8TQQxjufvQnQlrAm4pWlLkvamaNPLkeV5e/Ev1dZ+HAzXd+5XezaryBviHZ8C2D3mE4g2K8AnoN11hm+OSXISswFqttkYr+O0zY/taNLVUPqvjzFJgmpbJgLkrQ7fYyDZC5UWS1DXrn7xF3vIy0FNyFEx9eO9b+Bt2WHm/z+bXvsGaTcAaWtbrTQJbh2JfAToJB+5gBDzPFXCcACQ2lHiJCrpgELTOSkuR8qvK8ouAUb13eHcLvwCWFJs35ceerHFnD0yZHkSGobZEtMHes+4shkKQwJnu7NE49h1TYmJlI5dqNBQHusqzVmqIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=72n7PFMsPXdD0BofaQTPMKat9hrrYyPXpzXND92RkZY=; b=VSTsNgyTQgim5YRd8ijtELv3SthuOmLkydl3f9K4Z0xeNtKggI7ficp9i7Kcxy6Ab0FTmTHKY2LFKMHLwImYQQESaJYBQDi6rOqSsXFB1F6gmA7sNv8gowSiag8DS1gpYHNP0g/JoldMCMu5nqwMx7rXs+lFHYKoVFEIVEvk5iDiP0pLIt4ma10g+GJDk+yR/idjWtnM+pcvZKLn/JpxJ/EVMKDtrBsrpb4R48wf5cJrbD4U/Nq5v+Ayn6u++55WomkQbjd4qXuxsVIJS8zwFi9juiGLWPyy3sBLp5grRgRRWp37KCdBy2UET6yZedvniEHFyuVg4LtMNNn2ncJN1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=72n7PFMsPXdD0BofaQTPMKat9hrrYyPXpzXND92RkZY=; b=moBAtBGMzT7tEU8gobn1NIrNIsGl/lvPnfqOB3SXJOh5fCHFDIT2WC29o3wlQvv/lYNxfLUm/6aAcHO8yq+twBqHiT8acB7S6GusPxR2OUARZPBCfcKw5Wbdi2rgtIPYI0O5xa87AWJcMsuuzfTTmMno2JJM9Y89lYqswOA7a9c= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=oracle.com; Received: from SJ0PR10MB4429.namprd10.prod.outlook.com (2603:10b6:a03:2d1::14) by BY5PR10MB4035.namprd10.prod.outlook.com (2603:10b6:a03:1f8::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Tue, 14 Sep 2021 23:32:15 +0000 Received: from SJ0PR10MB4429.namprd10.prod.outlook.com ([fe80::401:1df2:3e9a:66c]) by SJ0PR10MB4429.namprd10.prod.outlook.com ([fe80::401:1df2:3e9a:66c%5]) with mapi id 15.20.4500.019; Tue, 14 Sep 2021 23:32:15 +0000 From: Jane Chu To: dan.j.williams@intel.com, vishal.l.verma@intel.com, dave.jiang@intel.com, ira.weiny@intel.com, viro@zeniv.linux.org.uk, willy@infradead.org, jack@suse.cz, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 2/3] dax: introduce dax clear poison to page aligned dax pwrite operation Date: Tue, 14 Sep 2021 17:31:31 -0600 Message-Id: <20210914233132.3680546-4-jane.chu@oracle.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20210914233132.3680546-1-jane.chu@oracle.com> References: <20210914233132.3680546-1-jane.chu@oracle.com> X-ClientProxiedBy: SN4PR0601CA0008.namprd06.prod.outlook.com (2603:10b6:803:2f::18) To SJ0PR10MB4429.namprd10.prod.outlook.com (2603:10b6:a03:2d1::14) MIME-Version: 1.0 Received: from brm-x62-16.us.oracle.com (2606:b400:8004:44::1b) by SN4PR0601CA0008.namprd06.prod.outlook.com (2603:10b6:803:2f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15 via Frontend Transport; Tue, 14 Sep 2021 23:32:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6004b30b-3bf6-424e-14ac-08d977d7e268 X-MS-TrafficTypeDiagnostic: BY5PR10MB4035: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0Kg+dytoBivXWlpmjMjzDrVjbsU4E3pSRYZCL4NSWDSMjIHszQcMGDgaXCdspvH2Cpi1Q8/1HSkIW/z+MxMcHt7ykX4w58qTa2iX3vaMXMSIbELpbP2CLrEbkkdaIC8w8ahDaKD1xSw6EW0lw1/cKonkTiIA3BdHFn1a5+JobpvF89dwggNjazY7l1B3a+mZrVM75ejKb1SjqEo2SAQcasNmcnGp513XkKMXLvT4qL478cls5RE6+iqbWZqb09NeD4wvMH0IbUrsyGBj/3PovrJuOyY7myytYv4RYG9ZpdknOB6BQPlgGZxepiG+t1fY/CzjJKuxmf8SaUp3Qq7taeNl0npAcf4p68OzXvBaI/bJiAUlrArFS/C1YPhqxM+x8N6jd6hZoA+GdxpmXzDAWv2WhYmODXhiy9PIopmHo0Vk4CqMnyjJong6x+yiqDcQhHDPxxfgjE1q5Zv5dhjHjHhpmO6k07hGz6aDWS18+jzHfmynefkkk17UkhUEcISKGzFR1F24YSAtCK+UemIBGCW63YWbuDdTr7InDCYKgpWbczqT9BcI/pv/ERa6GXdLfBUs2Fd+pwrTsvz614w8Cvw908DNRQnq7sIVrStfw0gIe9IUiHwzxAcE8tjRryliiuBzrf6bUgV52fB1kSnYluYwPd1ewS/wqgKzIshHew4HyfDkNF+5bAq/1Y+ImqOq X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB4429.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(396003)(366004)(136003)(39850400004)(346002)(66946007)(66476007)(921005)(1076003)(7416002)(66556008)(52116002)(7696005)(36756003)(316002)(5660300002)(186003)(8676002)(38100700002)(8936002)(2906002)(83380400001)(2616005)(6666004)(44832011)(478600001)(4744005)(86362001)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9IaH4SklUzmNB36Fo63nBdf7sj0QxQMkfXO6mLffgd2yBvOtspB86yHpcus5o+ALLdel/7d8siwI4LezO2FBo3JXz4iTQUwa/0CWDlx2PI4etlwvxnJdE1mvtcDbxNOj2z6YjoHKY1t8HKrcOHHAUyznxuKW3LSolqSOAmLh5Hu4gjKkQMTE0yzvuj7JhCo8qndYSgduwfFYWqDVp8EXzZXRF14p7bPGolLg2D4/aRR5icU0ZWQIgz4UHiKVpMIpl/lpPSgUsLy924NZn5wIG6OKT6BhEq26Nrq8wJypTr9Z6ov2aUwSZX65+IaobPK+wa+Kj43BxGjUGd7t3MSqRqX0Q4OIlFMgw6cDkWfccFmI9Luud3kODYe+0qMngZO3tmxplkOC0fAkL5V9QvRIpMy7uutIvfqFkLk5FDMZxD2i6a5JWGfGJDsTxvm6ivu4XqmPfBKfdlNadxzTZm2CMp1mp0n1f3Ygq6CAq5wQZXjKD2cq7b4JWTZMJPPqlEyObRL2ZTwY+mnmU/qFncPtu5wKvUbvu7MFnSCHqHi76rZ+uPzRo97Hsf7OxCIKy0SUU1xbutqW6uAXXuf5mslrTWSDx/64A+czcNDlzlQcpBUaXLz3JdxY+a/+KrKJ2XteKjywwvdktVx74Pw3xkK8wrX1kjwxM07OcEx9aEzS8Be5OyZJQqu0OB27wAtcXsLQ1+tV6x+/TKWNBmIbfCehzW1hi3YEhGiDFpSeCUN8aTWGd61m9iTRhm6pe4PV7xfVWs8ansmoSH3O8mODKpF+mEFc0ufwitYS16tKALdCK3YNX/2YKnANTdhTWQJvIJR0Ed7dP7vw5GWQfD/XOkjTbVuQkkFqBOMVvmY7dfxttOCixzPCGIeBivu6nuMA1Q1i07mez6FjdkaKg1kkW036q+zVzbh/oVhH94VM+qvRsHb2nCYEYW0yzPKWf2C3SI+c79AkVj+YRp1uKV98ttzk0nT3RBY9kWwbLkw66hXKCv/IhQfTrY6XRB1EfKApfgrvX0zea2QERqVWbemRS+aoxdK/s9VGRpkjxTB+CCRfa7dXm1i5aSPrXm1EXyFJQFgUDzaNaofRaOTDY51+V0Lwf4SIrvCq1+3ApNx34W2mG7d575cN1/QF/mfsnldc+v8TPnyJTFeFYn9J4T7bDICrb3INtBNeJ2kSuzePJtV++7D1zOk9HyB5HRb7czFQ8/uE/yyV/fj42Exjavra/gDn3uqAt6P8p0lf7PsY91KUVWSdIhZC6ytnOFcm3VKfRCCJxsUjaOGuRp34cYwmGBwO4BkV9UY6y/UQ/omco6dJeJ0Z9++J1SkAHR/h9kehB5yKf/IHOhBkdVFWOWbTjpnQ+g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6004b30b-3bf6-424e-14ac-08d977d7e268 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB4429.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2021 23:32:15.2131 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dsKyt6CEn1yONeEy6HNyMD5zU5Ul4lj7Mna0wX2KdglDUwMPH68RqGUrikOkdOfbJVw6h+fICt7dO28hhl4R9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4035 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10107 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109140134 X-Proofpoint-GUID: wfRP3o3CMOIRref6XiIHUMONmec1UuI3 X-Proofpoint-ORIG-GUID: wfRP3o3CMOIRref6XiIHUMONmec1UuI3 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Currenty, when pwrite(2) s issued to a dax range that contains poison, the pwrite(2) fails with EIO. Well, if the hardware backend of the dax device is capable of clearing poison, try that and resume the write. Signed-off-by: Jane Chu --- fs/dax.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/dax.c b/fs/dax.c index 99b4e78d888f..592a156abbf2 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -1156,8 +1156,17 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, if (ret) break; + /* + * If WRITE operation encounters media error in a page aligned + * range, try to clear the error, then resume, for just once. + */ map_len = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size), &kaddr, NULL); + if ((map_len == -EIO) && (iov_iter_rw(iter) == WRITE)) { + if (dax_clear_poison(dax_dev, pgoff, PHYS_PFN(size)) == 0) + map_len = dax_direct_access(dax_dev, pgoff, + PHYS_PFN(size), &kaddr, NULL); + } if (map_len < 0) { ret = map_len; break; From patchwork Tue Sep 14 23:31:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jane Chu X-Patchwork-Id: 12495159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1053C433EF for ; Tue, 14 Sep 2021 23:32:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B02D61157 for ; Tue, 14 Sep 2021 23:32:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235993AbhINXdu (ORCPT ); Tue, 14 Sep 2021 19:33:50 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:4868 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231435AbhINXds (ORCPT ); Tue, 14 Sep 2021 19:33:48 -0400 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18EKxRSR007088; Tue, 14 Sep 2021 23:32:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2021-07-09; bh=X4AZ6r9vOmPEEJsgaTOlVuG6WEl8FHwySaWrePQXINY=; b=Dg9nXsGJAvu0cw143n3YmNFqjjTYjTNtL7Ds5+3faEcUOmSuZF2vUhmObY8pts7RqU3U qdh8rnuF/lGH2YfuvGwc6NX9EiuMzqolNotJKHmM1kRBm6YGrNSj8MZrHq+Ih4hmNbnR v4osWpZeeJyraWU5iftnE6LANE7vv9CNXyju2+73Q+stVVLwrPUvA2XH+xD1jEXH0i98 /l3s59KKGWYzDd3vutDzGRRGYhLjoSOGTBHkYQ9DV64bIjGczi62ga53q8bLQqjYg7XS XZOyavBUAhrkl9WRQSjXE7c+DJNzkhBtk2uwlix0H9FUnDTD5YBUYHvEd1AJYvpyQXDn TA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=X4AZ6r9vOmPEEJsgaTOlVuG6WEl8FHwySaWrePQXINY=; b=TdCb9Rk31DA9um7wKdJzJpi0c56aotUFDPRvvuMFJEzLm5q3fbO9ObiQTTpOaC7XtS7E MvMxem9d0G2Dyk4vwXAlVEoVWw/7dUoC1JA4F2mbOwHbGJxb03fBjgm8gMcMbZtqWcoe L1RJDS61tC7k78qhABWSfBXQqKDh2twsx84fNAgdpXjaF/V4hFdZ/1nwuecTHHsAO3YU FvEar3+l5FXO2RbjLscTyJpOINXm3pBgQpgzww3umD12aEAqFJO05nKPua9MMRNFn9KP zNx6XqI9YIroPDPMaPTjYS3BAF2RCc26RCJzkBuK+8aMO5cwg2ts3da8ERXiiZZx25vi aw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3b2p4f35n7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Sep 2021 23:32:22 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 18ENTjwm169855; Tue, 14 Sep 2021 23:32:21 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam07lp2048.outbound.protection.outlook.com [104.47.56.48]) by userp3020.oracle.com with ESMTP id 3b167ssv6k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Sep 2021 23:32:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BTS2DF55kpGEoCzhDbZsRsv1lihkDHx92tV8xcbN+vGgYfJ8icA2T7CslICJSdEsuOufLVO0uyZXUHcxNxet9/aeyiUpV2s1Q6848qGlS+FHT7dxTaAdJ5PD5p4K2d4haPm7EVTgVzzAtep52i8rR4zFuVwogxafWEUyZNeJbRac5HtowMW3wyTe9nvb16SPcIAbtsVFDxhCHZ16uxFGJmuaekMkkPz9NT6uOtPO6k3YDte29VDGlQ1ub/CHz6ihSSUlXQsXuRDAngA/XujQeg9b5NMpf7gzb6FnBd/5MtXQ7+7tj6sHt93UrnkQyodqwRcvQqjU9kw/vJrr8RkFoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=X4AZ6r9vOmPEEJsgaTOlVuG6WEl8FHwySaWrePQXINY=; b=akfENGD8jGvIa8Kb+soE96Nv96rad6Byrec54dSQIvBwGHaZ+9QOZL+ZIaeNMc4tJC4Ozmb8It2787prfesW4o215zpzGysukScAdwNaMHJngAm6aBRrIJBroWWDPElNeUWGsJ9AHIPBOtAJ84RZtXgg+d3ZvQb//xonqv6AST9/4/SNJM7YEDQc8zGd8vi1RDiVHFjaw+1IuJa5FY8jFptYcwokScJ61EwThBaJ/rn22ufgzqVXicum9P+cTH4cIVhw1PuorqEi2AlnMTogPU6lu5viJnaBiQlhk2GZ+bVC+aOaehOrf5oK18RU4ufJnEdHT6nizEcR5URK819Gjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X4AZ6r9vOmPEEJsgaTOlVuG6WEl8FHwySaWrePQXINY=; b=cdSTdj5OIhywpZEEllPSKIbzJE/UhJasrbmtVCwnW6oLSUbCZv92xY4KNwK7o/ofDOBPKb+bdIP+5d5jyGnDn7Q2fMNvRP51o0kYVhShjLuhH8hR7Q7KO1I0pWgFEO89MxOX5Ep3WelKIiUhrwD+VtGMujlKdE0aPNswrzDWKHk= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=oracle.com; Received: from SJ0PR10MB4429.namprd10.prod.outlook.com (2603:10b6:a03:2d1::14) by BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Tue, 14 Sep 2021 23:32:19 +0000 Received: from SJ0PR10MB4429.namprd10.prod.outlook.com ([fe80::401:1df2:3e9a:66c]) by SJ0PR10MB4429.namprd10.prod.outlook.com ([fe80::401:1df2:3e9a:66c%5]) with mapi id 15.20.4500.019; Tue, 14 Sep 2021 23:32:19 +0000 From: Jane Chu To: dan.j.williams@intel.com, vishal.l.verma@intel.com, dave.jiang@intel.com, ira.weiny@intel.com, viro@zeniv.linux.org.uk, willy@infradead.org, jack@suse.cz, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 3/3] libnvdimm/pmem: Provide pmem_dax_clear_poison for dax operation Date: Tue, 14 Sep 2021 17:31:32 -0600 Message-Id: <20210914233132.3680546-5-jane.chu@oracle.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20210914233132.3680546-1-jane.chu@oracle.com> References: <20210914233132.3680546-1-jane.chu@oracle.com> X-ClientProxiedBy: SN4PR0601CA0008.namprd06.prod.outlook.com (2603:10b6:803:2f::18) To SJ0PR10MB4429.namprd10.prod.outlook.com (2603:10b6:a03:2d1::14) MIME-Version: 1.0 Received: from brm-x62-16.us.oracle.com (2606:b400:8004:44::1b) by SN4PR0601CA0008.namprd06.prod.outlook.com (2603:10b6:803:2f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15 via Frontend Transport; Tue, 14 Sep 2021 23:32:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7701a6cf-9a0d-4ee2-b26c-08d977d7e4c6 X-MS-TrafficTypeDiagnostic: BY5PR10MB4306: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:590; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n+R3ZZIjf8PiPcBIlhhoodUkoSsNYr9iwRgAm+0d9vS5oW7BoYr0S1C9niszfZek1yEGoem2iQtt2Z/Y+6H1UxFFtu9GzbFcwkiuZd7NGzbmvw34i6ZlE/V2D1Xi9weX0t4O//nSc/Gm7WNLRvr2njwK36rplfZUe3KLeyp+hgQUI/SisT8u7kifqzfxvNVqlXe0xJaaQWrPhpAmAsE5/WigdBGKpMDMqEiBDCANuIcfFSoJqHLYiOnifV/hq1AEKJK6q2cOHi/cCUGzoc2N0TfabwTeCOIANiXVDLqpthmKzNfQ2i2BChsHani2iXuxlzt7YdIPLA28mN1w6mMRgS/ZHpPhwRiGUQTZRJiyFKNIxumma12cH+6rgiLLe7fZo1O8oLCHT9d4N8mSJPeMO1O4B4lBzEsGqkOznE1lVvzJu1XQBIg9A354iVvcF4m63G8bZmNLHo6VqnquDZ+6E9jUGLhDINjgqvEiQaNCXtwZ2iD9/5sXxtbdKpRRhHnV3oTqU6i4/+cx+oxyfAoOtn3N57uv0DJzRMEQH+ByYpcEUdY31xBkSw04yN+0NifJt8Zfq3E9ZnKa94xK2++xd1I6Uu0+jH9mXA3Drzfm5JDpchfhfK3Jv/DMml5FHjI8WIpg/0FaEacbDpIyiNdMYK8slkNje6kWbVUrnrvGAKum8tcCjKxJAckFChzTUhMa X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB4429.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(136003)(376002)(366004)(396003)(346002)(39850400004)(66946007)(66476007)(7416002)(1076003)(921005)(66556008)(36756003)(7696005)(52116002)(316002)(5660300002)(186003)(8676002)(38100700002)(8936002)(2616005)(2906002)(83380400001)(6666004)(478600001)(44832011)(86362001)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IWUQNaeiLu93hHcWM0QFUSQRSn/hpo476K1xxi8Z7PQ4PuN/e1VJTcniVL5okOS/NXjRZJIg4fc8kcpHl5EJMYst4yBu1I3XUum1/lxNZ20V/Pmjk0bhjXF9a+T1M41vDcF5QwOCpS9LFLWKrpTCCxHznD+2gK6r9avqH+oX+G227587r2nY4x1Tn8ojhug+tDmrr7TjylGHdETH6aYv5Dl5sC6c/MghP4LC5dsKOg91yQrO+EY2OiYwWfsyJgUoUJlqbq1n9szf3ip7IuY21CEMKqCLs2SwGOEBxcIlKBf4APWNzI4+683Nt9MlSLIFz2jJiiCiegih9AzK9TBUhim8oqEeBe+GVXqRpcOB8YKHJr7WkPK0iwae9dlwMTYa6GzOXikccUEc/tirLHj9reHdOg8slI8PzX/I4lcZ99menVRKpVJO1nO1Q2hF9pvEAjEvhckmyA22ZLk8SRMlMUdzWZHkdxcF766UJEfcm/mwJNkX5k778UtQhyYfkmEzkNE4jVL5fvaeGeFNDsGgVcnaFRTQBZCTbKRji2zcB9206SoEmAbLWF9/WkwfqgMNerVC15XP9xb1sRTTGThy5gqO/JFnpZWZB/ovvp4jJLzO0Mpm+BxAtdqTqjw3HYQmlsl9p2I06H5FSK2u24vzqN7wK0AhCQLmevycyagjpP9BMJPvXhZlXpRuJdGcFOrdI+zQEOdDOAdRXZdaer9Wx/V5PbmarFiIfFjx9cMxZPOLjSzsDPrUSnFit2jV+tZK3qyVsa53FzB0rDppYWkt+MRx0SC8UUEd5TpX1cktBsiJBcz54u5ITBes80gUGOYqHZZp6aZuRmkV7c/fYsSpoSKQdrOyK0jhG3v89mVd3vQA2YcLW1YE07MFI7zZCigVTry+9n26VAecP0AYcMxkgKnB7f9k9oh6EqQ1g/lPkiMZyHh3iRaXUXoIFiwumMrZmYGk5gBdzlPy56WgyIUJS5V6IX+L4r5nrfH7lPe0oY2e5n1P0siyLYVydY/gCyUYZ1h+c58b9UVUR2BcCo6Z3NX1rj5O7vCVv3l1YJ7FC7KHvIWdUDPI8Ws9UNHrU77tEOry8SigBjCcKUFkPiSEENkBEUMPWyYZZYdAlczTXMcHJubTeVHUPNprmO7QJbkXcCOzoM8AwLEXrtflFTSp20h0/jJdJ30ud+OwKv5swphL291INfUD8wLegLAnX3VCjn9+rcO3ORRIs4RcdbjpFh2mCehr9MjmVfgOcKfSMlf7M8+dqWwnKsh+UxmCRTpg8Diydq8Wmks2wLPdNhityM1Fa18LmqTAAlseiR6wlX5xI6wdj0Cpe4mNPEawbRrxjEDTA0SmhPqqmk5tdaPI9g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7701a6cf-9a0d-4ee2-b26c-08d977d7e4c6 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB4429.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2021 23:32:19.1657 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: w0LjDv1Zp3yHJntoYYpMbUot87kgsZE7cRutA2/PiKiQYyx/3Z63fM//L0/oUhhNCjDE0xn69JqYE8C+MpQLiw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4306 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10107 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109140134 X-Proofpoint-GUID: 1hnDXXc4LumVARAo4mVeQ59E60TF0jb6 X-Proofpoint-ORIG-GUID: 1hnDXXc4LumVARAo4mVeQ59E60TF0jb6 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Provide pmem_dax_clear_poison() to struct dax_operations.clear_poison. Signed-off-by: Jane Chu Reviewed-by: Christoph Hellwig --- drivers/nvdimm/pmem.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 1e0615b8565e..307a53aa3432 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -294,6 +294,22 @@ static int pmem_dax_zero_page_range(struct dax_device *dax_dev, pgoff_t pgoff, PAGE_SIZE)); } +static int pmem_dax_clear_poison(struct dax_device *dax_dev, pgoff_t pgoff, + size_t nr_pages) +{ + unsigned int len = PFN_PHYS(nr_pages); + sector_t sector = PFN_PHYS(pgoff) >> SECTOR_SHIFT; + struct pmem_device *pmem = dax_get_private(dax_dev); + phys_addr_t pmem_off = sector * 512 + pmem->data_offset; + blk_status_t ret; + + if (!is_bad_pmem(&pmem->bb, sector, len)) + return 0; + + ret = pmem_clear_poison(pmem, pmem_off, len); + return (ret == BLK_STS_OK) ? 0 : -EIO; +} + static long pmem_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages, void **kaddr, pfn_t *pfn) { @@ -326,6 +342,7 @@ static const struct dax_operations pmem_dax_ops = { .copy_from_iter = pmem_copy_from_iter, .copy_to_iter = pmem_copy_to_iter, .zero_page_range = pmem_dax_zero_page_range, + .clear_poison = pmem_dax_clear_poison, }; static const struct attribute_group *pmem_attribute_groups[] = {