From patchwork Thu Feb 8 18:49:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13550320 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 D8A7AC4829A for ; Thu, 8 Feb 2024 18:49:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A1DFC6B0082; Thu, 8 Feb 2024 13:49:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 97D1E6B0085; Thu, 8 Feb 2024 13:49:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F6B46B0082; Thu, 8 Feb 2024 13:49:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5279C6B0083 for ; Thu, 8 Feb 2024 13:49:26 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 30242160296 for ; Thu, 8 Feb 2024 18:49:26 +0000 (UTC) X-FDA: 81769524732.27.BF9DAFC Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf28.hostedemail.com (Postfix) with ESMTP id 981AEC0011 for ; Thu, 8 Feb 2024 18:49:24 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=BHv82fq4; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf28.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707418164; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=980dRtjhZ1sqASItbAJHswL4sSjsBCZ26JEnu08+RSE=; b=6uzdpSivArlIj8wa8a9G9cb0L2I6eJQJje2wTrUQsZEci7O7GTwzXzFWvwZ+bvhRp0U1+E NZSrnVx7IPAm4kPYBM5jhFPxI8Z3bRqoQJKfZOcqzAsREkmvOP4e+K4nXJSqeX+9ZlSV+4 mOs44XpUq67USY1jn+B3I8E6aXQ6UBo= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=BHv82fq4; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf28.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707418164; a=rsa-sha256; cv=none; b=PfUOZlm5/i01GqWNQvtyWtaNW/lAvz1OwZa+OPm9Ks8I3gUTTIu9dYmOFWqSftpSNm/3Rt 5McrKkBgcUu6CkA3slID/3v8EuYE0AE0zA8hY1oD+ybEqTVrvuWvz+WCbK2DkJpKO2qwQS uB0j7plDQDnZNjkiTxTFLkR27duv0rA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1707418163; bh=NdQ4OmFkV2+G2H8B4VkXTCxDeM+TIHeVIiPEQVlM7R8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BHv82fq4hO859vusQup+/Ew3E/xkDIrfZ5htPvlriwUnHkvNeARgnnZMiSWHzApqW mBUnp7NhYcFC4sHncmcbqwbZiLufbXuPZ1mmrcc2XRx2OacMg8w1iMcNtrBwOoQ7t8 tlegoMFq/Kcq54d6KDuhbA+a5CHjBM14TYr6oFPdFcRGkfXiGVluKpmPuYTt++FmPu urOv+1cJgX+X7s/GbAlJpQacEjTwJqNEmsDVAUYaXnkKjRNrV7bXs2jN1Ij2VQhEwb /6iWsYm8EPA5tPa8SlmPXLVR3oPElZBuasrhf6GDfTwyLf9CcfdtgsPjHjkxUKokLX dtG+zbC42rI5A== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5cg1khXzY5L; Thu, 8 Feb 2024 13:49:23 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Andrew Morton , Linus Torvalds , Vishal Verma , Dave Jiang , Matthew Wilcox , Russell King , linux-arch@vger.kernel.org, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, dm-devel@lists.linux.dev, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, Alasdair Kergon , Mike Snitzer , Mikulas Patocka Subject: [PATCH v4 02/12] nvdimm/pmem: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Thu, 8 Feb 2024 13:49:03 -0500 Message-Id: <20240208184913.484340-3-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 981AEC0011 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: eexhmbmahxpipp6uhk9pipnzbpkxe87j X-HE-Tag: 1707418164-966132 X-HE-Meta: U2FsdGVkX18qouNOJ7UuNgTAlGIEdQyvwCVZUSIT7xmOiid0epXTUPFX9AErFBaTZlvpxkThU1A9oBb+bLwV8wiLS2PwIzHh2lrMGkG6Ra01/hfNaeop1xMj0Cv/ZWs0JYGlu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1DfdryvYWcfjvnn4s1Ien8iL1quL44GVf2GbHMIUrtrch7s70WHj8wn5Rru5I/Q96HjMTRjTXDEjMZqllBU6N3DupdEqPUxXIp1N5Z+d3j8hvm1Du+Ncq8yFldAgvwoa/KHZsE+kDSrhThMJpRHXvps3mAwhGYYR7M/kwezZr9n+N/aN0e2ulojZ2EFjqyjThhHUCASatH4Thty32T149lGCG2bEOSJlG1P0ipHwx4dsh7zwctU9/T2q1c1n0TQLhcCSLMMStDvfRsZqRfzJrNyvGDwN0MbdfJfwzr7DZepFca/Bdrl27X1APkJ14I9wdnJud+vW14fVuWjwMVUj0PE7u8DFQDDq8w0H9FxDcpZEeB+yJjLIvnMKNuggkae2Efb5F8h8lBiKlBskG+GK89OH+xoFeXhohIqpHmhSk+yjwXU= 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: List-Subscribe: List-Unsubscribe: In preparation for checking whether the architecture has data cache aliasing within alloc_dax(), modify the error handling of nvdimm/pmem pmem_attach_disk() to treat alloc_dax() -EOPNOTSUPP failure as non-fatal. For the transition, consider that alloc_dax() returning NULL is the same as returning -EOPNOTSUPP. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Cc: Alasdair Kergon Cc: Mike Snitzer Cc: Mikulas Patocka Cc: Andrew Morton Cc: Linus Torvalds Cc: Dan Williams Cc: Vishal Verma Cc: Dave Jiang Cc: Matthew Wilcox Cc: Arnd Bergmann Cc: Russell King Cc: linux-arch@vger.kernel.org Cc: linux-cxl@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-xfs@vger.kernel.org Cc: dm-devel@lists.linux.dev Cc: nvdimm@lists.linux.dev --- drivers/nvdimm/pmem.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 9fe358090720..f1d9f5c6dbac 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -558,19 +558,21 @@ static int pmem_attach_disk(struct device *dev, disk->bb = &pmem->bb; dax_dev = alloc_dax(pmem, &pmem_dax_ops); - if (IS_ERR(dax_dev)) { - rc = PTR_ERR(dax_dev); - goto out; + if (IS_ERR_OR_NULL(dax_dev)) { + rc = IS_ERR(dax_dev) ? PTR_ERR(dax_dev) : -EOPNOTSUPP; + if (rc != -EOPNOTSUPP) + goto out; + } else { + set_dax_nocache(dax_dev); + set_dax_nomc(dax_dev); + if (is_nvdimm_sync(nd_region)) + set_dax_synchronous(dax_dev); + pmem->dax_dev = dax_dev; + rc = dax_add_host(dax_dev, disk); + if (rc) + goto out_cleanup_dax; + dax_write_cache(dax_dev, nvdimm_has_cache(nd_region)); } - set_dax_nocache(dax_dev); - set_dax_nomc(dax_dev); - if (is_nvdimm_sync(nd_region)) - set_dax_synchronous(dax_dev); - pmem->dax_dev = dax_dev; - rc = dax_add_host(dax_dev, disk); - if (rc) - goto out_cleanup_dax; - dax_write_cache(dax_dev, nvdimm_has_cache(nd_region)); rc = device_add_disk(dev, disk, pmem_attribute_groups); if (rc) goto out_remove_host;