From patchwork Fri Feb 2 21:00:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13543401 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 C5C00C48291 for ; Fri, 2 Feb 2024 21:00:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3EA196B0083; Fri, 2 Feb 2024 16:00:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 399DE6B0085; Fri, 2 Feb 2024 16:00:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 23FE96B0087; Fri, 2 Feb 2024 16:00:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id DBD256B0085 for ; Fri, 2 Feb 2024 16:00:30 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 78E2B14101F for ; Fri, 2 Feb 2024 21:00:30 +0000 (UTC) X-FDA: 81748082220.13.8BD8D45 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf14.hostedemail.com (Postfix) with ESMTP id EC691100029 for ; Fri, 2 Feb 2024 21:00:28 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=n4HkiezO; spf=pass (imf14.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com; dmarc=pass (policy=none) header.from=efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706907629; 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=xK83i6t7USeocITc70y4DYr6De00Kwc5YNFwgYpfZGM=; b=x05fLdGSvymvYX9L2oV2NroYpCXiYGZnszD1Vl0ZlS5sMDeWNTG7bsix5PYUtANkwbNvsi 3xQYffw9nKiheO50/zmcxemuvMTd19JM1sX4inxFjyVfcBF8URDnFzU2hMQaN1wbZ/F5bH 9uZx3HLTgXSV0YWooG7QXsHJgasEVGc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706907629; a=rsa-sha256; cv=none; b=ivzgXt3Ub0oxxPuWLOd7KRUZcxyPIn+gyqZOC2fpYV17KIJUAELLFmTaUBqLnbwQAJBJ4S ioB5jLwlN5Z33U0/fmTem+XCwREEL0Y8jj+zkpHuRyCExhuFnZoIyLYKDpKXAy15Rtvp8t oxraSl5/Y8c7EoDr2k0sHucZCPKmEfI= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=n4HkiezO; spf=pass (imf14.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com; dmarc=pass (policy=none) header.from=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706907628; bh=Cw819/KonN7FOZNMfLR1Ivonx2xW8T4iDPwkWkOj91U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n4HkiezOBThhr+L9DyyXZNtQ3AYY+KR7/dDOpldNT1ICN9K/vq3hURiBfP3xjrM1p OiPZ/R7PyOXUgy+yZquxsBjeck+wbRSmQ3FvrpnUSNOb42bHSDKgFQFfZNXM7fZtl+ Ja8yhxmPfFMLTJPyiUNHimX0PAZY+I0Ga4qkzZvU/SoxsvOF4UCbzLwcMsoZOwniLF kyD8uDpxesxBAC801OxUQlPOCQSAQ96tAYfxVFNjmJmPTOEk2N7nyZovgqjYV+lsrz VMrdnB2pvEWd/t6vwTYj41rnS9ymkzrXokyLekwB22A9AkKI5X+WUX2IxomFfmazUt vrYQOPhPSgdIQ== 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 4TRSpg6fNpzX4R; Fri, 2 Feb 2024 16:00:27 -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: [RFC PATCH v4 03/12] dm: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Fri, 2 Feb 2024 16:00:10 -0500 Message-Id: <20240202210019.88022-4-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240202210019.88022-1-mathieu.desnoyers@efficios.com> References: <20240202210019.88022-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Stat-Signature: 673estd8dmyj84ex4gpogcyqhnw6xj98 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: EC691100029 X-Rspam-User: X-HE-Tag: 1706907628-403978 X-HE-Meta: U2FsdGVkX19WQy/3Lp6PQ3iAYXflojmCdfkDj7q5m6ks6wH5/xVziWxjV9yq/66GA85OaROTcoUtOvrXjFQyW7bzP8NYhbTWp9RkV1ZDRW4IvOpiwr9nGOyou5nXg+CG7i87Tqm++Q9p2sZlQm1lQ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y0S+rBaSA5x0Z1LAKCU2QdcyyBRasnkJUMm1GzjJ7R4dNBR5j9pbCSkRXtaGGdee+IEiLTm14MS54HqCDl7cuLW0kLIAG9eEkKysjzLkdWzykqRF6355QA9bE54XP1vgxgbkIFrxeAkZ5dfZiIVTYV4NA+uGEfkMDu5tMyd0JtVYLrPzmZ6dT2fr+HbqhCiDq82inPCfticj8+iS7ut2nrCRyfFFDQIg9F7LSDW/8PpYtWfp5b+0C0OoJ2NSYQ7+zJxy1/ikOMO4fMA/m9kmhvWragXoa1Goix419DP6ZnwbPGJfuj0tk7bR0D9pqjD3JBqygJLXSo5zwJBvWY1jBHFpijviiJeearSFrXw6lbha5GwbxbU6dbSkLjOgpbyG0aR5AcjvN4DzfzTTeOU7V9txnmi5qEPBuY= 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 dm alloc_dev() 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") Suggested-by: Dan Williams 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/md/dm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 23c32cd1f1d8..2fc22cae9089 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2054,6 +2054,7 @@ static void cleanup_mapped_device(struct mapped_device *md) static struct mapped_device *alloc_dev(int minor) { int r, numa_node_id = dm_get_numa_node(); + struct dax_device *dax_dev; struct mapped_device *md; void *old_md; @@ -2122,15 +2123,15 @@ static struct mapped_device *alloc_dev(int minor) md->disk->private_data = md; sprintf(md->disk->disk_name, "dm-%d", minor); - if (IS_ENABLED(CONFIG_FS_DAX)) { - md->dax_dev = alloc_dax(md, &dm_dax_ops); - if (IS_ERR(md->dax_dev)) { - md->dax_dev = NULL; + dax_dev = alloc_dax(md, &dm_dax_ops); + if (IS_ERR_OR_NULL(dax_dev)) { + if (IS_ERR(dax_dev) && PTR_ERR(dax_dev) != -EOPNOTSUPP) goto bad; - } - set_dax_nocache(md->dax_dev); - set_dax_nomc(md->dax_dev); - if (dax_add_host(md->dax_dev, md->disk)) + } else { + set_dax_nocache(dax_dev); + set_dax_nomc(dax_dev); + md->dax_dev = dax_dev; + if (dax_add_host(dax_dev, md->disk)) goto bad; }