From patchwork Thu Feb 15 14:46:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13558536 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 B3BF0C4829E for ; Thu, 15 Feb 2024 14:46:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 995918D001D; Thu, 15 Feb 2024 09:46:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 91EB78D001B; Thu, 15 Feb 2024 09:46:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 770B58D001D; Thu, 15 Feb 2024 09:46:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 629B78D001B for ; Thu, 15 Feb 2024 09:46:44 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 15966A1072 for ; Thu, 15 Feb 2024 14:46:44 +0000 (UTC) X-FDA: 81794314728.26.8CD906C Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf17.hostedemail.com (Postfix) with ESMTP id 5BE284000F for ; Thu, 15 Feb 2024 14:46:42 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=dwDnURMs; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf17.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=1708008402; 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=JykYcfv7Mzdwlbzj2ZQRAHwkWbMzk5SbkQQkUJQcWEE=; b=Hm68g0XXVOta1T9tglCD/VRYEeAwwfVHWORMl5JLUVzvJEDEJufXCqYinVmpqHf8h3SZ6+ NT+s7s+IcOM3M2dqVsYE+SAqw2ardNfTpwcZO0EwfDP3jZty7IuRk8hXVatK1Ns+9o3ss5 kg1bkQiclCsKrb2KwNgBVk1wiUG+zLc= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=dwDnURMs; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf17.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=1708008402; a=rsa-sha256; cv=none; b=3FJwARGrf7lKXBLcM2+jqQcYyuSCS1JQAFwVwXQ/Jqfx0NYWR3ubCxEUD6Mei+G86DFI/u nCGdye37L0wX0yFBCN1IwvmIrPorO61SlVIFLHn7fkkXneUGgDk2b8D8nh86a5KQX/dCbW vaRXSbtEXTea7XpCQILwTlrV3qv167Y= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1708008401; bh=2UjvX1mPA15gxdiokNXtijzapjvmSFS/ZT8DpOJxoxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dwDnURMsq/o0lx0Luqzr1eCWXZ6boSyn/PfHtqDhE9di0Yaeh5hFvXFEVnscxnwfB HdULKMvpUjxPrHcBrTSGCxUwc/6SKwFKs6LIT6fdL/3ftEXXPNiekWJr8nj/gR/q9c QcJBv7vckhsKbvWsfM+JqX/J6Slwnjxs8oF1mRxEaLbXjTzM69QiXhCzPziHI7SjRZ bfQ2k8dVK3JMDOxaloIr8P2vxfpEjYX+4JMzi/nhiXnedDHYNxMyX9plrBx81pB+lk 4J5KT5pg0LUHw7A5CJ4FjkzPPBOeznzJE4IHyW1ws0jLeHOWwAUQUPnQw3UWpBbAKv XmDk4Tq5SBp/A== 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 4TbHvP2F7YzZKl; Thu, 15 Feb 2024 09:46:41 -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 v6 6/9] virtio: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Thu, 15 Feb 2024 09:46:30 -0500 Message-Id: <20240215144633.96437-7-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215144633.96437-1-mathieu.desnoyers@efficios.com> References: <20240215144633.96437-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 5BE284000F X-Stat-Signature: b1ux9gnnjbydo9yf4us3zra7ofntt1gj X-HE-Tag: 1708008402-979410 X-HE-Meta: U2FsdGVkX1+OsXsSAL7pquzAgafxY4mmg8d6BXfJORjENxqh0vjlJM0bhxCTobUQU40r1BWqZFN0DidGcSD/5QD36ckME+96iel1Jnm8DvRAf9b01EaeXTzQu6UHTWm2Jyma+7aJ7yUjVFp8XEiVa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jsIHovAEBs6dDtom/KvNVSF/JlCUYXPAGj1tlr5bLyYjpGO07EKiY2TNezVofDGW0VDd/GLTdhC8DsaO0dSXDZiGF/3lWJvcytLZBrwjt5KDd0jKBJdF6T+ecS0Xqgrt+pGGbmLR9+G4Oa/YWweEtezzQLj5mebqYph8AMOeYbBdJln0jDbf44ZfzJ7DHfi7NSZax0FUniuLXNlyVMom0eRB6MMJGW80jXqBfnSeQ8bgNNQcTsjhZpH6uCsZRIDobCjG7Y8LNoQE7nPlSTHwuAMQiIiTLa6hpGf6d9TG2SzG7z/ok4qElQ/C8pqIul4grPa/vWUFt5jSmIhhhvFEQtH8zn6Vk1+5JEZ9Yw4sZFWZK8nkKz0izjkl+Ur3CKJtj6+veXrK6XEtq3raud8LCnmtQ08Am9H4JxPcaQ8+7no= 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 virtio virtio_fs_setup_dax() to treat alloc_dax() -EOPNOTSUPP failure as non-fatal. Co-developed-by: Dan Williams Signed-off-by: Dan Williams 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 --- fs/fuse/virtio_fs.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 5f1be1da92ce..a28466c2da71 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "fuse_i.h" @@ -795,8 +796,11 @@ static void virtio_fs_cleanup_dax(void *data) put_dax(dax_dev); } +DEFINE_FREE(cleanup_dax, struct dax_dev *, if (!IS_ERR_OR_NULL(_T)) virtio_fs_cleanup_dax(_T)) + static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) { + struct dax_device *dax_dev __free(cleanup_dax) = NULL; struct virtio_shm_region cache_reg; struct dev_pagemap *pgmap; bool have_cache; @@ -804,6 +808,12 @@ static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) if (!IS_ENABLED(CONFIG_FUSE_DAX)) return 0; + dax_dev = alloc_dax(fs, &virtio_fs_dax_ops); + if (IS_ERR(dax_dev)) { + int rc = PTR_ERR(dax_dev); + return rc == -EOPNOTSUPP ? 0 : rc; + } + /* Get cache region */ have_cache = virtio_get_shm_region(vdev, &cache_reg, (u8)VIRTIO_FS_SHMCAP_ID_CACHE); @@ -849,10 +859,7 @@ static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) dev_dbg(&vdev->dev, "%s: window kaddr 0x%px phys_addr 0x%llx len 0x%llx\n", __func__, fs->window_kaddr, cache_reg.addr, cache_reg.len); - fs->dax_dev = alloc_dax(fs, &virtio_fs_dax_ops); - if (IS_ERR(fs->dax_dev)) - return PTR_ERR(fs->dax_dev); - + fs->dax_dev = no_free_ptr(dax_dev); return devm_add_action_or_reset(&vdev->dev, virtio_fs_cleanup_dax, fs->dax_dev); }