From patchwork Mon Feb 12 16:30:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13553523 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 51E5EC4829C for ; Mon, 12 Feb 2024 16:31:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B6EE36B0089; Mon, 12 Feb 2024 11:31:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AF5C86B008A; Mon, 12 Feb 2024 11:31:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 920C66B008C; Mon, 12 Feb 2024 11:31:08 -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 74D166B0089 for ; Mon, 12 Feb 2024 11:31:08 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 296E280A94 for ; Mon, 12 Feb 2024 16:31:08 +0000 (UTC) X-FDA: 81783691416.28.131DC04 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf07.hostedemail.com (Postfix) with ESMTP id 7082440006 for ; Mon, 12 Feb 2024 16:31:06 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b="B/pnnO95"; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf07.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=1707755466; 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=LrfbZ9w6kDnIojd6eWFMBZSElaByAfgavWve+3WLmSw=; b=GO/NYbTKcNojnG/ktdDvu0bB34w9PJTcjC1XgrHKyfXlOAuBeMLtt1TLNiTiGi+BdTj/6a fS8IwYAUQOgyAjbtAqlLWp8hEbzRQCv6hcdP5AYh+UrLZwqUN5QcRRiZ60g4MA+yv8tISh 2EdDAYlUjrCgIpeypL7Kt6jvA7IR0fE= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b="B/pnnO95"; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf07.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=1707755466; a=rsa-sha256; cv=none; b=Q9COp2QhQqPzu+2iuavR90QszUpg8mNkekwv+uHXgIDd1IVOY79U+IK0pQEOssNU2h2NEi xwvFMcj2PNvMjMV4UlumIQi0Jzh6HMePZGXlAbM4FTn+BdPBYh/81IpUcHeAIrIt/QxpFb XzCRRqjk/a+AV87L0xYk6fJzeLUGAhU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1707755465; bh=/grdS8Lpv8iOI39Sws5KokxIBSxOa0HOFRuTqUntpHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B/pnnO95L1htB3hWWCF4AF8YB2ZjXV07XWuDFRuNTVg9v/lCje1jgMnLoFbNO/rkr l83/diGRpiByxq3cGzsx1L01iER9LPjT73JHfiI9hLUTgB8++idtYRY1VGF0vKZYbG MQXDKfayzT9Nb7t2SUnoFVE3ci4tnEMHm2bcA57ycTxSieBqyrz3tpFzi8TjsMfGxQ O3lr2cR3pWBPK4+6Eb+d/efb8ER8prBbyRRucJ5UkXiULs6b6sshscN9zB/HkWGm8a cEJbx86f7+QkM3fNR2e1Whfi3EPzdnGG8qLQaVs6kZD7GvN1u9pfj5r7L/QWqQp25H k9nmoHUHNr+kw== 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 4TYVMF1V3MzXxh; Mon, 12 Feb 2024 11:31:05 -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 v5 5/8] virtio: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Mon, 12 Feb 2024 11:30:58 -0500 Message-Id: <20240212163101.19614-6-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240212163101.19614-1-mathieu.desnoyers@efficios.com> References: <20240212163101.19614-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 7082440006 X-Stat-Signature: of8nqkgjaxbcaxn3em6u9qkwpkx9zy3x X-HE-Tag: 1707755466-714840 X-HE-Meta: U2FsdGVkX1+4wf4dW9HHA315gG+u/uAaSNknK6QFQcrPfGCaVUKvGsxkCb3DvxkyZhVuy1biUX7IJjTle7zimmPccW9olFcl+4+3S6RFTAcWrkT2rHbJ23dMgi9BR385LLXrhbXp1IhSNGavcJ1v5wXsQ4fY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P33h+7LrNUOYMpUXdstXPCJuQ4QueewAJmrg0unkFnFj6dLYUABNl/ET/HPU2IT1qYHhPjj04MF+wnr+OT82BPNehThKk/Nj4nMsyfzv3C3OyKeQzcnT5L+Zyf1MOUdEyHCzJb0Pqeq4zx71nSIF87odnDgV/ZnjaIs9t25LzSksUIrC4/PT4/uTp8D5Fi2ULxixugQYD4EKJ2sS2ZKp8gPVXnzbZs0sWolQUwCwGe3o+7a3PbnYMIe8WXXe1xHiFxQoTvpcIyW3bjOcncBZIVMD2MtkIg0spuaqcpnvzDzC4kuHua6C9u8UrquwIf93AC/mVXc0b55epsqSd8rnO3N6o9DNLiOWxRMAOyJmd0IXSrjXwIsm6c+rAP3ZqBS+bmIMAxMwb+V2wRnqW3WPdxGgA/O4JKv1Pk= 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 Reviewed-by: Lukas Wunner --- 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..f9acd9972af2 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(_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) = ERR_PTR(-EOPNOTSUPP); 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); }