From patchwork Thu Feb 15 14:46:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13558531 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 0A5F3C48BF0 for ; Thu, 15 Feb 2024 14:46:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6AEE48D0001; Thu, 15 Feb 2024 09:46:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 610968D0017; Thu, 15 Feb 2024 09:46:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AFAE8D0001; Thu, 15 Feb 2024 09:46:42 -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 22C888D0014 for ; Thu, 15 Feb 2024 09:46:42 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BF851A28F7 for ; Thu, 15 Feb 2024 14:46:41 +0000 (UTC) X-FDA: 81794314602.21.0C9C81F Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf01.hostedemail.com (Postfix) with ESMTP id 5086C40009 for ; Thu, 15 Feb 2024 14:46:40 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=MNMKriyf; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf01.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=1708008400; 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=sXyQnh4V6vljCr0eBKJhzrPs1ta3SCTR3hmityCHwGw=; b=h41tGWwTzDAGeKqN07bQdXD4AkykC5RUXp8mH2qJ4uFWGzOabjOJV6ZeYxXeGGkSFxidWW dPbqNei1ovJwkRrbz72trnxA1WpNOFHQ9uZpJgNUAxV1PgE343CvGavIYpU0YW3Ilvic52 KdjA6nH4Y6wgwELGrOg4evGHyZ4UrtA= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=MNMKriyf; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf01.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=1708008400; a=rsa-sha256; cv=none; b=bN9UZR1vbaYDxVwo6BFDy0C42/r2Amh77kdyVnMIRFJUHeuQmq6CHrRhu7DXKtdG+2tcMq ghzrtDXagW7IXFlCGh+4uN2HnmTmbbX9g9OL9NeFRszTdjFCR1MAUyvF63BL+e39948v0M f4WjrPwaG3cNJ7rPsL8D+Di2uybt3/c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1708008399; bh=f6KZPJbWgKyyz0b6bsXitRwjRbgNq1j+uFNk2EI6GFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MNMKriyfcEhRm3Te0E403P2pXoUgE6mM/5Pp6kXzsoZglAnPXNbbPg16ZVmSau0ur reW5SfChm8Z0470OkoRns543xWrIs3en3Il/nnNDyiWEhHDMLbnNNjcxq4LgSOxrhI mXTAeAf44m6ePTpHEwbZ8zApxSVmjU4mK6q5ngf9/4TWEVjKo8Lxm0jXC7BWIceNWZ sAKMnrvZ1jrWUgaJsMpZ7Ju8+Y91gxRxapWNLNNW2Nhr9seT1OfvYZvlM1tdd+VYUB tn+cV4j3qI2QqFdOah9ub9xIKOK1W79zDjPl5rd69ShO+twx+08NeOjS5tHOGjbcEK nuqG3RHuBrRXQ== 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 4TbHvM1tL3zZS4; Thu, 15 Feb 2024 09:46:39 -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, kernel test robot , Christoph Hellwig Subject: [PATCH v6 1/9] dax: add empty static inline for CONFIG_DAX=n Date: Thu, 15 Feb 2024 09:46:25 -0500 Message-Id: <20240215144633.96437-2-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-Stat-Signature: swcd8bhrcwgjd91pz9zggou3tz4ygngf X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 5086C40009 X-HE-Tag: 1708008400-235356 X-HE-Meta: U2FsdGVkX19B5dPkfdBxKbgWf/PYfRGO9ZRit1/pQYZpZe7Y739afK/5Dkdyc6HUMNXBX6I2N5GZCZ4IFRDIzVDLc3ElHEzftRrxUwIIIOXL44rw7wNguG6Fz5Y+6NM+TIyRgIqVmD8lKgKSuOhkl25ZtGXxHRe6FufqQDDFbcCMgnUH3QLOmXsd9slxWYyNM4VoMOipT5LPBKvT/nErpw8zMgApl5NMNhTEtyAwvUw5BNOnZiYtTY52X2VdpBIYrJvt+xveUAd7z8qPwvMqoVqLw5hbrWqs2I5Vk3queuLyXZOic+wefgSf3NLYIcRtuWHIhTb4J6Sxw2xX4eyssV/MBzKTjzSttEG/GASGcJo+GWxac3kfp6J7Pw1CFK5cDr6PJSe7ivwq4CkO/axNMDcQYHeS3hgkFRg4JjYDReX/5d9yiZCKn5rIU18dYAhQbQ53FJiEimecPTZViaxFv7NJcCYoChtUMU13OER8HQ9F9LPxcg521N8EMR0/UVw3tDymZt5U7evt2ty4dRWT9IzQoel6RjzmFda+L0g6q7zvOshm31RnKQEfXGazWutwTHYnBu1a2vb4ssROKwdXrRJmu7Oz20UnA/aLkFAVQStO60JFw48jjzXv935G5wQMQmDF3GLf/6HxQ3y+Izp9aOoGecFLLIuMmKkemSLWzTQOu7EcxCk3aC9lzAMmyYct6O3f8j8tWWymtvIRykzNaLTZU+FRwISM+P1Q28i2uxf8otX8L7Dsg1BhGzOU0yOBtXz/vxemleHGLUjDt83l7eC2NSKXEC2bDkGj41bJEk8Da9qKDnZ7DpUwQwJJsScfL4etvpXlFHpvROb1rdT0PGhEa4nQX97KL4/NyQ5Hgc8yJ4tl82ErhZbYuSZX5Ea4LkdtEf3J5NmVZ6otSPihpfTJEHE56/drbz70Kg43k/lOM0Wsr9Xf8j2BfmWT8DAM7Sl8dNaA22Ev8MFzDmE b1ipsH4d RhW1xyT03wTjjKKU= 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: When building a kernel with CONFIG_DAX=n, all uses of set_dax_nocache() and set_dax_nomc() need to be either within regions of code or compile units which are explicitly not compiled, or they need to rely on compiler optimizations to eliminate calls to those undefined symbols. It appears that at least the openrisc and loongarch architectures don't end up eliminating those undefined symbols even if they are provably within code which is eliminated due to conditional branches depending on constants. Implement empty static inline functions for set_dax_nocache() and set_dax_nomc() in CONFIG_DAX=n to ensure those undefined references are removed. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202402140037.wGfA1kqX-lkp@intel.com/ Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202402131351.a0FZOgEG-lkp@intel.com/ Fixes: 7ac5360cd4d0 ("dax: remove the copy_from_iter and copy_to_iter methods") Signed-off-by: Mathieu Desnoyers Cc: Christoph Hellwig 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 --- include/linux/dax.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/linux/dax.h b/include/linux/dax.h index b463502b16e1..e3ffe7c7f01d 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -63,6 +63,8 @@ void kill_dax(struct dax_device *dax_dev); void dax_write_cache(struct dax_device *dax_dev, bool wc); bool dax_write_cache_enabled(struct dax_device *dax_dev); bool dax_synchronous(struct dax_device *dax_dev); +void set_dax_nocache(struct dax_device *dax_dev); +void set_dax_nomc(struct dax_device *dax_dev); void set_dax_synchronous(struct dax_device *dax_dev); size_t dax_recovery_write(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, size_t bytes, struct iov_iter *i); @@ -109,6 +111,12 @@ static inline bool dax_synchronous(struct dax_device *dax_dev) { return true; } +static inline void set_dax_nocache(struct dax_device *dax_dev) +{ +} +static inline void set_dax_nomc(struct dax_device *dax_dev) +{ +} static inline void set_dax_synchronous(struct dax_device *dax_dev) { } @@ -124,9 +132,6 @@ static inline size_t dax_recovery_write(struct dax_device *dax_dev, } #endif -void set_dax_nocache(struct dax_device *dax_dev); -void set_dax_nomc(struct dax_device *dax_dev); - struct writeback_control; #if defined(CONFIG_BLOCK) && defined(CONFIG_FS_DAX) int dax_add_host(struct dax_device *dax_dev, struct gendisk *disk); From patchwork Thu Feb 15 14:46:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13558532 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 14EFCC48BC4 for ; Thu, 15 Feb 2024 14:46:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A7FED8D0017; Thu, 15 Feb 2024 09:46:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A07D68D0014; Thu, 15 Feb 2024 09:46:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 85E338D0019; Thu, 15 Feb 2024 09:46:42 -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 60D0E8D0014 for ; Thu, 15 Feb 2024 09:46:42 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 31A88411A6 for ; Thu, 15 Feb 2024 14:46:42 +0000 (UTC) X-FDA: 81794314644.16.D64DC54 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf03.hostedemail.com (Postfix) with ESMTP id 9138020003 for ; Thu, 15 Feb 2024 14:46:40 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=lJxsuurM; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf03.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=1708008400; 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=ym/AjxA3dY8nkclBW72WeTbsbmhWxX4/rRcYhBuexkc=; b=Y8Ws4hZKZRuDajefisT156BjlKPvDA59xRyaz4KFVxCFYF+lDX8dnJVUleEJfw1ZjEO9+a m0vxioN7XLcv/vlEGIzLPzbUzWdMk5Jn+/euxLmXwkO3qmIRyMv1bX+WIiRWjogytVu7sb rno0D703QOBaBQnmDN9v8ZyQPT8EZnc= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=lJxsuurM; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf03.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=1708008400; a=rsa-sha256; cv=none; b=1lMvtDQbI+Ho4lWe+FfBG7u9EUlqWGcyXnxoTvn5uwg1vz06WPfcvFQyJAAEr4hFKT52AY oiiYwKYPiVaCyvt/MkXhHlnSaYK2B4mQKzBexyPo67aWmbEYvl6ymirB7Jrax3nHLp/dRA H+hNLsoPbXrszTdWkOUO3jOzSca5eaw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1708008399; bh=JafNy954LGAswGK3M3iYUpQrWP3IyrMlG3pf6B1HRm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lJxsuurMOJq5+e74ZxcF+tIqPH0Qs+YhXRuSmvFSmLIGw0LXLL9OmA1TEc/hvC2zZ o91WMEukwLB1u4oCCHlgydXVguhQi11fEI6Vi8Ku08OyjSoiO2W2yeKDFGbjlSybRo grKnwo+y78PBVFCkNYKO8rAp12NTsmM88gHsKGJN+nzU5BYHEfglGxTm+PNhXBm4WX 1SH+QbvBu0shB1ITutjbBN/RvzwOVym/BdBANG0CF8gzUqRhhDPi+s7F1/D+ZD8taq b/ma0zxd+t86Hak1i/GDe5SYOKqW2uCqPPPfo+rNAEbyPVhQvm8B6Y94EIVbT9v+oc 6t/MP5Z/oCexQ== 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 4TbHvM4gxZzZS5; Thu, 15 Feb 2024 09:46:39 -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 Subject: [PATCH v6 2/9] dax: alloc_dax() return ERR_PTR(-EOPNOTSUPP) for CONFIG_DAX=n Date: Thu, 15 Feb 2024 09:46:26 -0500 Message-Id: <20240215144633.96437-3-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-Rspamd-Queue-Id: 9138020003 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: ayagz8a49iznag5zzk6mc3mj8smfit6p X-HE-Tag: 1708008400-535367 X-HE-Meta: U2FsdGVkX1/fPhvcR6MSiWlWAvQZHdGrKHYlYr9AkYBg1ihJddgY5aEw93GLkxliZbZ1V6rNExb1W9sYkOTb8IGzezvo3YN3nZloEMcSnnZ7KdDoOHTHA6dOyEE9kp0EVPSK+fz6D2jA+lyAiEsmd8CQGxPwY+izsjA3G/abhsYmbP/SEXPgr5KYtbARO6M94csB48FiEHBvsMS71Vm6uPHKVFSGeMQMXb7i/Bk2PkEycWwFAH8t/JhdmR1aN2jKpVW0wRdo5zQew9blpZow5fHV/SMrLr/JiXpeOP6P4SJNcvjvPrZu6fFLZHJIIQg/I7AcB+2kL+LjngShHWP2TjkLtDS0EK+KeLw0Tlyvdmplrw6n2KBI+qW9aSj173E9SyKprEs1agIUYQ72YxXVZOEOxpYw7fpcA/oaloBEqBoY3AOMsgW16CdGgCiRixVeoKOQvP6JN1+xQzMM8+GTIqPpPS+a356gajiqJ/VOkcQA18hRN5TENAcCp4Ud1RrT6uTuX5J/o//MratrVQHx3Cg+rDD8ELSUy/BdaBiHFPMVkw96//KPHON4MeSYzoR0pLSf2oPBz4TKnYWKnprSiuGjYFH5Vw9sO2IXl2WVKuVK7aFW1N12YI9vJYw/H+5kUo8hlkVLlmTsKlCHSfOwkTEoPg4U8+OcznCUVjrMRrMaSkYfFV5C+CgL89ABHCxIHImHm9jJWgoAqSkKIOLe2t1E1EVCovJXtm5UkCRQVDMMcgRNpjbA2EvBoMt9vjikClX8T21zDDNfLJtfX5tV12HbChUi/gXbQm4x3n+jdZI6cuB/y4wQb1KfdMsfRnY6lx00Vy7bTg/L0CDf6lmr198UkL1PqkELgWjMY15HnQNrcanA5yt+l4gTWkr13XklNly5Tq6x06Y61SJD/LprI2eAXl8y6jV9NOFM/NIWV9bm2XROAI5ZxfrE8b9xQa953/wUHaAAdJ4uK74WfYH YhpwqhHs hmd85PFsspOY8UJKP7pKl/Bskuw/lQm/RvKPDlILF4bmbm5y/c658XW/Sb/C1A8c20Hh9pgf9FABAoaJa/tks1v/LqA/1TWbMRFUXqxSrHgk3HSmMcJrteBYXUj/CJDumG02mRenH2TDUl9ZbxvXT/EfmpwGr/qVyTnfO0vMqFUjLmE1+y4IxtQzLn5s3LmZVrUUhvyvi9Twbrb/F9aInqCvc1exbzyzPDlJnuR9MknMVyXMjA3UA2HYsVm6c6ok57BTeoD6H1S9BOz01nCWHaMtsVhPqeSStsI79lUiz/U+FmIdseeAo8C62DFa3SHilaBoLxhvm0bth+dPBXGBzpzvDzITgzMOH5eKBO5It1ZhH144EsW2lM26qOvCGVwfYz1+1/rxSXYp7GXRt+Dxi61aGjw84Gvy2TxxRVWvpU5XBu6t28fTUsVTJuMfHR3Z2qDNUoRI7YvtmPzUnkxdCyXvhQ8h9Y6ZspHbW+QZ7g+ZyBeNkjeYd/5aqgZUy2gUpuWAOQWF/FF8rXZlXCU2PbgOB+HUefPBtnhkGI7GR7lOPAnAyGS/e0b1fJ/GInyEeB/XPkky7GOAhUXqzqxuFLatT5t2VbKFbMMHgsnQkW4fiHPA77BF9Ug/PSw== 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: Change the return value from NULL to PTR_ERR(-EOPNOTSUPP) for CONFIG_DAX=n to be consistent with the fact that CONFIG_DAX=y never returns NULL. This is done in preparation for using cpu_dcache_is_aliasing() in a following change which will properly support architectures which detect data cache aliasing at runtime. Fixes: 4e4ced93794a ("dax: Move mandatory ->zero_page_range() check in alloc_dax()") Signed-off-by: Mathieu Desnoyers Reviewed-by: Dan Williams 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/dax/super.c | 5 +++++ include/linux/dax.h | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 0da9232ea175..205b888d45bf 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -319,6 +319,11 @@ EXPORT_SYMBOL_GPL(dax_alive); * that any fault handlers or operations that might have seen * dax_alive(), have completed. Any operations that start after * synchronize_srcu() has run will abort upon seeing !dax_alive(). + * + * Note, because alloc_dax() returns an ERR_PTR() on error, callers + * typically store its result into a local variable in order to check + * the result. Therefore, care must be taken to populate the struct + * device dax_dev field make sure the dax_dev is not leaked. */ void kill_dax(struct dax_device *dax_dev) { diff --git a/include/linux/dax.h b/include/linux/dax.h index e3ffe7c7f01d..9d3e3327af4c 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -88,11 +88,7 @@ static inline void *dax_holder(struct dax_device *dax_dev) static inline struct dax_device *alloc_dax(void *private, const struct dax_operations *ops) { - /* - * Callers should check IS_ENABLED(CONFIG_DAX) to know if this - * NULL is an error or expected. - */ - return NULL; + return ERR_PTR(-EOPNOTSUPP); } static inline void put_dax(struct dax_device *dax_dev) { From patchwork Thu Feb 15 14:46:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13558533 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 2E073C48BC4 for ; Thu, 15 Feb 2024 14:46:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E3908D0019; Thu, 15 Feb 2024 09:46:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 06AEC8D0014; Thu, 15 Feb 2024 09:46:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFF128D0019; Thu, 15 Feb 2024 09:46:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id CD7618D0014 for ; Thu, 15 Feb 2024 09:46:42 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8BE0D160A14 for ; Thu, 15 Feb 2024 14:46:42 +0000 (UTC) X-FDA: 81794314644.12.E4B0634 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf04.hostedemail.com (Postfix) with ESMTP id 0FAD440017 for ; Thu, 15 Feb 2024 14:46:40 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=BnQ8gALW; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf04.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=1708008401; 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=B4ilFMr2eFF794YdWWw0DjFvkMffunaWzt7kSkCawqA=; b=tZoNjEIydGKRvVTfi6GJImaJiOLmbstiNl0RM3pHluvnaRov49arJbuPFowvQDPY21Bycb saMhdMSVncM72qbzIlZTLjgP8bDf/YqroPVsA5FjtMjxVZqo8KJ241O/oRXTj6qnGjF/zM rv93ajp9fma5Fxtka30JCtWUw2JXMAo= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=BnQ8gALW; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf04.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=1708008401; a=rsa-sha256; cv=none; b=1yzz1RafBcmozWBD1b4M7oZUzqDUmf7LF75pNrxS9f6KP+NGSAP/y7o/vqbHOc527uJ0KO 6IqEnR4l/G94IreTnHI3jwKRhA1caOuIF5+D+l5/nXMyz5GSpAOXVs2MSFWDhROvamNfvO j9n9N8YPmNr5NpxjiJolMYLaO6Z3U6w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1708008400; bh=ecUyvilxXmAuEa6CVYKrKIA8K8l2tVUUJHjpsI0Te00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BnQ8gALWRG0w08WHE18FXz/gmkcBs+yrQ55MT0cKd97EICKIovqMo4kVDLrKcH8bh YQI6fZljO24zHkyqsBzPTcvX20Vmg1ap8c8Tut+BU0Ci57M0gEpwtLnH+URQUAtmmg 76+jmRJI3BJZlPVr+gtSamRkZubkS4p6ZAiRoPVMrfSWx4HichoBiZJGLDkgrUvm+H 3BOlrHqxHEUVhYGYgEgu5uP0I6z8XFlAkekIdXkSRk81RBemq+K4JJyRUPbB2q5zqA kStS73njuquarYVVqiJKuZr+R21XtlJhj0W1tdwj08C9j7a2ZkXN80Oc/GHeo+rxH5 /2vMn1vOE7jHg== 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 4TbHvN0F0TzZS6; Thu, 15 Feb 2024 09:46:40 -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 3/9] nvdimm/pmem: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Thu, 15 Feb 2024 09:46:27 -0500 Message-Id: <20240215144633.96437-4-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: 0FAD440017 X-Stat-Signature: 48snsm7qpdauy6ah9pnacxp4d71jni6b X-HE-Tag: 1708008400-757329 X-HE-Meta: U2FsdGVkX19pdx7O7J5DH2qqg97Al4xtRYFT8i0OOeg1whnWVGZ18DfGBcG7mlG5QOWOGYRyvmb9eC82BUaMDNGi9WYO4j9NSF2N2S99+m5QcanYU1IganMR74PSXynfTRlEe775KwK73pbB+ncIB+ZAxDmuoFYq8frPQ+S7TV7qvdGfPgCCaAwpVlRbWo4J18GdoIGvEVpIjlDvSc528RFjvhs3FSnxZ1XhD6hBy+kCmiA0brvZexdJnw8TjhvxlPmhxXHAhNzBxzuZmhkF0GXY8AUiv2Tob/l0RbdIs5and2UpgyySGMbKvLHygt+tBPyIZFJ/yJp3hInxDCJFVyGGE46V0YWmpjEi+hcjmTSd7l0FKb7cWqfQMa8HVsLvO1rVO7ks16Nt4cDY1dDKBpaCO1n4KB/mMu+g7Wf/5ONeQb52wzRmsNGHD521mf7MJi7yzOCho2gwjJIL6CuckJ35WMBn2i0F/TcX7AlO2xNv5KTPr26lO89ryFygyO4Wd6e0LBVX4g45roLd1jO0hHRYq7a2zccdUnKFRkKxENIJ9+rPqR+kLjS7IYVG9Tm7LEkRoDsMcYuKKfOVBUW6sGKWBIqJhJeVUfvmeLqH/StZ4eIRIqgfUkyHysywfKFgdnzV6k3AveSNYTL0X3AVWDyXf0Xw49OzhZDvv56hVTIwrHfTSErDc1eTkOdWwwO1dVV6zqDY4d8jil70GpsCNoWXNdVFFt0wrxwZSlPipH/KheOhAsFybHMMWufavheyLZIbPArLeizCGxSZDY9MuQN/C35CH1CnRRClQ9XCtLTD9+zLlXHdJaAyfi9VQR0eQ5w4p5fOi1zjsFDEDSG2jeiid2unbmCijg4COn5R121GXcJNKD8t73rjZYZHNGM/sRYsrPoARhRwPlTIjXY3CVX7uXOILTx0/01NZg5R1cU67CyQNHUMo8YfS/vNaY5h9s5+HaDebfUMfM/BdMI VAEns7Nx TLysHQNVETzfyBVU= 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. [ Based on commit "nvdimm/pmem: Fix leak on dax_add_host() failure". ] Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Reviewed-by: Dan Williams 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 | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 9fe358090720..e9898457a7bd 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -560,17 +560,19 @@ static int pmem_attach_disk(struct device *dev, dax_dev = alloc_dax(pmem, &pmem_dax_ops); if (IS_ERR(dax_dev)) { rc = PTR_ERR(dax_dev); - goto out; + 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; From patchwork Thu Feb 15 14:46:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13558534 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 621A4C48BC4 for ; Thu, 15 Feb 2024 14:46:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A09D48D001A; Thu, 15 Feb 2024 09:46:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 945518D0014; Thu, 15 Feb 2024 09:46:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74A128D001A; Thu, 15 Feb 2024 09:46:43 -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 6155B8D0014 for ; Thu, 15 Feb 2024 09:46:43 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 35B151A03B0 for ; Thu, 15 Feb 2024 14:46:43 +0000 (UTC) X-FDA: 81794314686.05.F132141 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf21.hostedemail.com (Postfix) with ESMTP id 7EA281C0019 for ; Thu, 15 Feb 2024 14:46:41 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b="XTpVv1l/"; spf=pass (imf21.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=1708008401; 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=99RRntZfkjnZKNO4IHwslOkSnOz+slrjRxiaktTh4zQ=; b=Qdff8OH7fGYsnTE1h+86GoTHCFoiXxKQhB3alAzD7c2SKZou+JdJPd3tYR2Vvw8r5d51Ve MHWL4wTJrgsfkZkJGJ3vObiZKlVf0Fw4fAtjtPGtZqiLV58GhQlroXnbmiuRa8UPzr03rO qO4xoD5oCZnQb9w5YJNISB2toEjgbnk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008401; a=rsa-sha256; cv=none; b=lztlG4RSRPsNZR3397p12wrRX2oPPofuWpbbY184wjKO2OvA+HCWOspZm94MRyMDuSldsl EWHxhsx+tT6vxu/wAZ2caV1f6YrTlWYR54uQ71hmJxBHYrc5FZBefa1+3OIC2koafDxH9S O+cji6tomRCaImDInC4yqFRZfNijWWg= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b="XTpVv1l/"; spf=pass (imf21.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=1708008400; bh=CbAyr+xbx+4Y3FlaBdF7mHOoD3AcNitxApGii8uR9rc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XTpVv1l/pjHHNr/U9lGiMvjnyzdscOhWEb6ykHzU4BnNVVGkTiYLd4Tx5bn9wJpuY 1xnc3pkwfg+M3BljN/02HFFNaMUAyD6Boz06M9Rh8HV2mNyDQisIGkcZVpbJ0IzpdR dXrC+dgmbqmUM7NRnW85PlvvKT1jYCmr001F7dcL7aw9qiFtxBRP+16AAaISFw2SnV lYhbueW3D0I3zXcZNv6tl6dVUeIRfK7mpePFkwjLo5kJySt2w5nujyfKoofo705W08 GXlnb6d0rF+7PrW3/qID36u/xvDuI+DfEUxSj3H4A1AShvd5J30FnvinHMurIpGs+m hhRboYpCWg3VA== 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 4TbHvN3GlZzZS7; Thu, 15 Feb 2024 09:46:40 -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 4/9] dm: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Thu, 15 Feb 2024 09:46:28 -0500 Message-Id: <20240215144633.96437-5-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-Stat-Signature: wosg7w9qjke99igutfq5m19sx8fxew3j X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 7EA281C0019 X-Rspam-User: X-HE-Tag: 1708008401-190325 X-HE-Meta: U2FsdGVkX1+fyz6/GIjxMrdUNUmLZhQxFRBvTFlHOI8OcZhIW7Mulo0wMCka8Magd36sxmAGfJX4YBC6QQjkb2HwgwGt+ldQeHslmWgCRXEg47AWxGPcBdMyqUthj0uh1oEDp6vDSA8KyAdu/zi1uoRip1gurIMHr1AS5hP99W2cczEi5Ok52Pe8m8V7477TyQ5+C/Wm9wuo8spS7wzJmGobv+uqdE4oOPvcIsnKyKTzMxNw2lgkoN5E/W7O/t2XC9JeLiGfq3xgeCWvk/YyDcoib044Dr0QqmElla4zRLeqKQxMqNRSCWdA3kIjX6hGWmVeMndP/jcFsAqoXBHTbO6ppbiSk8QQ6Vzja0DOQ4hP0rgAypHl06TZyUnouupBEc13qbQ2FE3hd434gZx/SJuO/J++pMYVTuq2TXTP40jpQOmZO0LBUQvyJNij4RMP8P3IwHF+6c/seftXcxA4XIOXXTfg2tP7z2658En77wUpNDPHnw+xYnCTUqjbpILWMHW6NFAZm55xwKBcQGkqGPWM5vq3QWwtLtDQi/MFeCK/h6V7X7xZfyg302dZn3nuKUEeLV4llmLh/ry3PL9fx5DlhBbv3m3LbKuXpcCJ1Qn7t2pJWiI+1iFLq3YFI3pDJZCcmBLNq1M8UeVQh7xEJreas8apOB01cGF2tppoAHaehyJFkCvuFwfuCmyfr4hLjG/vu+j2dSU6HqmVpztNirCrBN6UrwUmLbj/A5hPMN3eyuLdhq0V9NcM9qVWEGMprjblaK8yxpxUnz+Ql+ldiNwe6WF8V2UOIRiv94Uj4CTYkM3bQifMGC/j2dBXBNO+GStH7hEP0wpw7Ye9FfAYpdhTwFvXTgZ+0+Oux2FnHpwKF5MsDV2qCl8XVQZ8muttME7kHkdWBbH+f3gve4ZfqVNLSwEwexc0i/W+uBaf3BUCn+iUxGGEscO3AXZ7TXKpsZZyaCC7k9EqIcMX5Xl 4+icFpRZ JEzUYaCcfrM5GWviXP0vgkErRMcq9a36cKpyAD0fL3lLOXIpQv1xpk5EImjWLpH/4Bqg9W0ihFw1C953KAyV/mj8evn5hj4herw1x25lPzK8zb+OPtavyVqaIBLbElyEAyJ0mN3wZeXQ/+e+K58hAXHDXOc2zW0Kv/qeZOfX2pV3CS38pTUcDISPft7Le3+i4Qg+WC1NiIKDmeQgmyCYg81hkQUds11fdmcQcRjPm2JGhqnr9oPTpsFTqrL1CZRGuFZpgkwh/5JIy9dRUK5OA8du9ASgVvVJhOkqWGGW2UnxecwHxbMpiqqoFwmItBebYMYMSO2u47f4MTz2geaJ6stghvtg9WCQGZpOchdg91PvxQPw7b66j8FqYxr+TRqKrdu01xX8BtMCsiySON+IqGYQXp+brP1LDcH3v4mq/soAGMNtJAZx3yqzC24Hoy4/FqgEiE317Ghc5lk/E5o8MZis0f06K5aNUVrWHSWZ73jacCWv08NqoM+LaVHGPwaOloVoflvkcVhgJcRKmLbZb+JY3r7Geq0JIa/eQ51WxsbJPEo8+uHnhSOYZ5hlgGmBy1tMsFcUZY0bp8UMVGTEinE4esm8leAaNulsO0wxxKzw0l2oopj92RO46gpnVIqXTLC6eHDH0czhwd0A= 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. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Suggested-by: Dan Williams Signed-off-by: Mathieu Desnoyers Reviewed-by: Dan Williams 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..acdc00bc05be 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(dax_dev)) { + if (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; } From patchwork Thu Feb 15 14:46:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13558535 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 B32A0C48BC4 for ; Thu, 15 Feb 2024 14:46:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A6BE8D0014; Thu, 15 Feb 2024 09:46:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 155748D001B; 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 EC7B08D0014; Thu, 15 Feb 2024 09:46:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B48088D001B for ; Thu, 15 Feb 2024 09:46:43 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 855B8A2812 for ; Thu, 15 Feb 2024 14:46:43 +0000 (UTC) X-FDA: 81794314686.03.93C1AA0 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf27.hostedemail.com (Postfix) with ESMTP id 13A5540018 for ; Thu, 15 Feb 2024 14:46:41 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=vDjxseM3; spf=pass (imf27.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=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=XtEDenX6YiEP4kkH9Hkr0ysHEfO7Lt7SdkKLxJS+nHI=; b=JFZui9Sigt8vXiWkfAEfDa9bXYdH1UT3iCu3wmVlGXnohkZGbpxc21EIPDvzV24ErcBEnx MO1sNRdifI6GLlJ0vgMxdm/BUZohdpUjuNM+jfyG+zD4DA94/2cdP3aFh5UAAC4fAY3prz e7HIK/JnFVahMvAuRquihKWT3UEecbU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008402; a=rsa-sha256; cv=none; b=kOmLC77oSCiP7sqzV54MLr8rGSgprtADgDyKbTMY6FjeuDLR85QW9JBbujXNCQBnAQTJyY jXQn6/E0XgMysluihoga3U7kThvBrv+8I0VN/kk54sQJUJQWY6DKppSu22yL/ItAGzB8UF wtLYRkESppaQY//DUacln+OMOCET5Vg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=vDjxseM3; spf=pass (imf27.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=1708008401; bh=xPtmgWiHU56eIOTTAS+sj/oIA68ksqZ/i5VE/RwV8cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vDjxseM3uGoNZMHp7D3FWbwVNMSAeAHOAkwaIfhUFXeFVtAl7YV0zsfJqedaxBmDF HghiT/IcBK1PufFC4feeduBoLz3Gp/8+aCkduAWpCMuH6F5jrejmF7Yp4EmaKhhPkl 9pSgL1Hoe/1ufK5c+NUXcvwSCQpEvArM7OhGazL/cnqD32qDqsfp/xlaytSQHIAH6e 0p6b0AtWXgLOH1Aj0000Jk7R+51JOUBfKQXKvzzNkvQ8aKQknVyur2HPUJUtJVdE4r Xxz4siQNkEmiX0+78ojo8dlyKb0loVQa96kddJLDm9aaErHKKPMSEeWOuWwPtv+x3v dfur/tcl6otfQ== 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 4TbHvN67LPzZS8; Thu, 15 Feb 2024 09:46:40 -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, Heiko Carstens , Alasdair Kergon , Mike Snitzer , Mikulas Patocka Subject: [PATCH v6 5/9] dcssblk: Handle alloc_dax() -EOPNOTSUPP failure Date: Thu, 15 Feb 2024 09:46:29 -0500 Message-Id: <20240215144633.96437-6-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-Rspamd-Queue-Id: 13A5540018 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: fdi559mdhqob98939pfsu9me8o1mmjz7 X-HE-Tag: 1708008401-392317 X-HE-Meta: U2FsdGVkX1+3JhnWDsJ4ilp3Pctw/AXaRkDLvWKxad33mplcHZQ5G/o1D5HQzoSe59p+PiCifXQVQZamI04m7w79tra5w5EeIgclpWB/YghjAlHgjJD7xVQshMPeRMzeSxUGIEn1WtdQ6qDHp4/FxJPjy8iDrRuXozV+oB/NP1ZncJ0BCTVPUmHBPPWb1gj2+hITQiRNdnrT2Yaz0CgUnQyM3mogPbpbf5FvfxyEU4vsqjNVQrAILcNr7GDe3jgcKzCQGBjiex2EI45HscaJvcx6iSDJs/WNMXTRnt0SVs16GqJBEDRDZ8NkPRMEOtMvEGFG68XMcFx2PhMOS/SBx9LXiYy6HJspbk+GyLmnm3YPr53nR17qohDnXVgLczD297/eaGlNlUugjUfMI79t6jkC9AI1gOcgdJYIxwmf8ltYS9JeV3uWI4vj/582H5CO9qrHExEMAZNx198a6cesIePxUhBIlEUXsc4/oBBtg8chVs4Ngxg1KLJBgRWJepRV+nFSJZ0v22LpqJa9+NdKLNTQPkMWkaOW0u3d5IWXLSUeSaTBWVD/r1UdNBdpZAvFwFHa51QHufl7V/glaX6hPiWFx/26W+XETVn8fWyfnPazJRU5JLDBU6wd1ywwYYYL40opiqInKqOYkkgl9xGC53NP11nq4gU2uqBbnRjjHhGEfeghVKnYLda0XXxhCHj9mXN3ptfT4tkPt9LDDWq8m8cEdvoDLfWMWp7UF2lkiklrjs7LkYxce5eUXDkEQ5eCGwqwusMZB5JrHBq+7hGZozqmrzHzKGPsF0UYMJY8tNqsMHJVhsiDsu+jfjpQPsj8sSnwpMLa7QGlAK4g88roQpnPgJVKnKnRN8u/gZlbY3bFYkWAdkGYCGeEe+uqLCEKS8LcPxM3nN6OU/zyTloy4Ex5KSWKJP824FOiKjh6vANzB0c+AnUgWd6kvmNP6KU7qYS0OEo/wEWqv4Fs1rv lmZayaql uamCTKivb9aTR0tk= 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 dcssblk dcssblk_add_store() to handle alloc_dax() -EOPNOTSUPP failures. Considering that s390 is not a data cache aliasing architecture, and considering that DCSSBLK selects DAX, a return value of -EOPNOTSUPP from alloc_dax() should make dcssblk_add_store() fail. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Reviewed-by: Dan Williams Acked-by: Heiko Carstens 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 Cc: linux-s390@vger.kernel.org --- drivers/s390/block/dcssblk.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 4b7ecd4fd431..f363c1d51d9a 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -549,6 +549,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char int rc, i, j, num_of_segments; struct dcssblk_dev_info *dev_info; struct segment_info *seg_info, *temp; + struct dax_device *dax_dev; char *local_buf; unsigned long seg_byte_size; @@ -677,13 +678,13 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char if (rc) goto put_dev; - dev_info->dax_dev = alloc_dax(dev_info, &dcssblk_dax_ops); - if (IS_ERR(dev_info->dax_dev)) { - rc = PTR_ERR(dev_info->dax_dev); - dev_info->dax_dev = NULL; + dax_dev = alloc_dax(dev_info, &dcssblk_dax_ops); + if (IS_ERR(dax_dev)) { + rc = PTR_ERR(dax_dev); goto put_dev; } - set_dax_synchronous(dev_info->dax_dev); + set_dax_synchronous(dax_dev); + dev_info->dax_dev = dax_dev; rc = dax_add_host(dev_info->dax_dev, dev_info->gd); if (rc) goto out_dax; 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+7aJ7yUjVFp8XEiVaWb2wEmsJAZN1FP6l/ndBFU4SXWbSGGMpXfwJ4stSH2zXSGxCcDTeHscQHsHuA93A/LWBZdh0T0jt0sU6SkJCqHELyGoY/HXbXJ1npTLcV96l9Hpp3XUiVCZ9UfceiIvJ8JZaZPkXQHK0S4Uf/+u9T3Ud+mj8eBuO5ienVTGTKVdHYeW38d1trB5JiOGg9T0QRsyqy6wm2LpqbgqBIykOTQVZ7saEweHk7Jjvkqgpdb3h8949lQdRSovW5LqzMmAxZpbM0i+muCV2ks8DWPazS93afXR5w8kjTHd9011DPPXxzecb5TIl4KXGMiI5TWZhOrWBi61FR5X4Rv62fLrjYDh2d9iVsYVpkleNdBbcOUQnEEL/+mItMBD6FvHsgC+rhlYnQx4tuuKxmAax7GKB3q6JudA5jlKm6opeMw1ZgfIh8Ut01+aaXmEMLxfgouKy5sSuFmnG95ZxyZ7VHVvRvezNTcv04HCLtjL4xby5CdWN5ODjheefTRJBA7ZykeFaKEYF2fQ+TEQ2xYxLHzGpB4/eR1ZN3e599k2+WKpIR9u9qDT4WfG/0a1kkPs3BvqRrrpEQZd0jdUo3elKa3fuBD5N8i21HxLh3eObbIh0Dmcw2bFO2n68G3ZW7dAdmZmkr9prXRfvyLLQ9g2ClZKLP4YVLHkCarqqQdwPfRrn7syjvb3gRnjeTHZTqmwJrCcoLeHz3m2dpEGvN4mZ0FyaMEdNALv+1njixBFWGNHhQdJu76XuC/4HVPrpT78eyaKM8TaL7qbm0wDEZi6+Y5LedXQzeYPiy7BP7JwOEkH+ryGyuSYUI1BbzB9L+SLbWN Z3pubfeh pV1qhoHFtT7DNDWKWiEd4fVNRwd+ZUV4tPZGFWubJV55njwVT6oIJQgYBgHTITKAtSLR+CCdXZt3oV350urAvMg8W7AmtzX3EOdOymfT0FRbHh0zR/zBDdT15dSvPnVtiR4XBa+XDYgs42U7dV8B+qhlLPtQ+kTJgQ3mY5uCLnk+hlhybcgD/+mdw/Kkl323bZpq2vo9QBV3+FX46xHH7FU1NCpVfo51WecgvjsIHovAEBs6dDtom/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); } From patchwork Thu Feb 15 14:46:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13558537 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 0FBEAC4829E for ; Thu, 15 Feb 2024 14:47:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D49418D001B; Thu, 15 Feb 2024 09:46:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CA7C58D001F; 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 993A78D001C; Thu, 15 Feb 2024 09:46:44 -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 731A48D001C for ; Thu, 15 Feb 2024 09:46:44 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 48CB78098E for ; Thu, 15 Feb 2024 14:46:44 +0000 (UTC) X-FDA: 81794314728.23.A901A0D Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf23.hostedemail.com (Postfix) with ESMTP id A547914000A for ; Thu, 15 Feb 2024 14:46:42 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=YtP1iOrG; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf23.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=DiR8Y8BcAApseqLmR1NIjCNKO2TAlkOcpgvPUADAU9RtjEwpcoellXYY8bWtD2/iND4k3u uVf+YBaX9rp46Yi1lR8Y8XH5gY3OWjNe41oBLdEaW0+ShARSK6Z8IqM3xjG6VqjYA2xksU gOoA/hDhLiNUGur4Ugbdrgbd7LIA/EU= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=YtP1iOrG; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf23.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=OG/CzkI43SfX6xCzBBAMjDKIpbYgr3KZ11AqPANjUKI=; b=WUTLE2NVXH+O9ruV2km3ERwIlHdnLjPGfTiSBCZsPNjxEkI4i1vfNUzlXoNzw6bwF5OEiy qoJrqjlA6OOEtcbrG/1oXL45on4FTfsn220yZp54iaBMKiKXvVWROC34GRkl/bbfLAH01V KcVSW+6fwXBgVNzYlUN4Ni3ty43MHv8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1708008401; bh=+A5CzyStXl3uuRu7VAvAaofgyGw3Ro+0xr6rIKIjCf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YtP1iOrGBZ2DFcfkMrFn0KrohYHueOZWWxnb1yMeBkD/1lvsW2xGteSYalPZKSM84 dPZuexmp1ywRE4ZTQOjFAgKyIAvz+xWNg3zjhDySnvi/5JJ+HqV6yNHbJnIgA2V+Cz LrEIdoTvdqClLxE1CDwMu7BvH4kU+HynYTL8FGvWqQVF+ZUtTFmBtps3Fll4hy5iYb VWfnhivvj+Lue04BRQYIzFUyJj/QJixaTtTpM98rtcdyFCecmfELtoqdx9qmJ4d3Cn Wpo8Zfth0EElxlDfWMpTqDJD6h2d2p2Z/MvkLxve0QsVGqva4CwWkicSMaV5TpJXl8 BS4uFSpfm9ZuQ== 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 4TbHvP59RfzZKm; 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 Subject: [PATCH v6 7/9] dax: Check for data cache aliasing at runtime Date: Thu, 15 Feb 2024 09:46:31 -0500 Message-Id: <20240215144633.96437-8-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: rspam06 X-Rspamd-Queue-Id: A547914000A X-Stat-Signature: k63qu7qbt4eb1xbook4paswshodpd1tk X-HE-Tag: 1708008402-910630 X-HE-Meta: U2FsdGVkX19Wf2LdCCpJ0oluPXFhlWefueD7tXnhHJ23wa1Lq6uZ/u4/K5Kq9a4FMEkCEaGulXKxnq7lp3LJ04I3cT07Gl4y8tJX73LaJMmhl4sFufpIbzv8iLe1N2BDvFRrWeyMpucP3ygKrs2EMw8afYfzpa5ZJM9CZmCbwLqRRTuyvpkzAGswU7ITyYpWhNgO5yavWw2EZgI+OJtk2tWeKigZrGMqggaOWRwy0gnB8izbpM+0hd+0ZJPfgiVen0LTfBrtl/Kt+otL+Z19ck0SoShqXiw+W8+otw5Qee1vz1fs1UlUEaHxU3dkJc0jnhQERhqv7+mgFs0+tO+KxBBGwaREvNZP+3dztIUvvkeQYhkWNdW+i8Tj4d2t5D9+8K4auHmjlZnOEj9ze2jgTQQ0ogeMUuSkty05/OeKSLCmnxHQy0eP0f9S8hiixBkAmEAYmwDZ7IRrjq9ajw7DPmgXQOo7x0lpQXprErpmeSjJVBT0T46Me78MMoRAaDbJtzlKKluwHYVeCydA6ghk4v7KzxwQwgDYUlq28/gtN0rsq+iVXFJhr8AFaFby89oAs1cfylEzbjDgkX7KUjrEiG1U3z3QIwKOqpdxu4v+pl6TPTaqv5CSX1qW4OrjEY/Bl0KFJQSnsIjKKy9chQrESJUzjXKnHMoTgtRSSZas5tWfaZsKjpmqzBCLK3kwI+zA8+fybEgfJBjYbNFd/rJig+GimznAGbeukL2tOX2Gir4zaYo2OeAAPO2vfJJReUTYNDw6muiAP4jrkW0uYGboCG2TOFs0w79EPMkFGVbLp2RpxPmb7TtZPq8mySRN4v9rIFZ7zPGxOEE3tbK9PRoXMarDnDRANHx4d8/QU3e3fVAEEZWSYj5Cf7mXG3RuNq0Rhhp5+l9eMLPA2MV/EyL2kpZnW1KPB/OX08XV5gkDecOt/MZO71IEeH5YiTcRfr5eFDa3gzl1Fj4dtynUHsg CFRQESRD qC6tSuDbM5DsdO7Jhi0UrhvwnmtAEYkcLRk0mxOWonvvsg9GxROP5q+DZBzIk/sPa6vqXWrTCL1lNys08qeQINd8k0C2edmWdPXyP0IYBCRhdUN+gJjCdVoaTVnbox48L6yp8SkATcukyRMOkc5bWVGJ7iGYCk2Mcm4sZ3nB9q2Rjlg0bM5RhzA/9kWgJFJZYT0aHKqNP3aGIDKxc5LuHreyTsAxrQG1+l1dtTNf7BavMWkW3UzD3W4fGnd6ehg5QJcyGcxmtN2TJY07gz87P67ZHNaVo+5HQJXik+XgrjREuMalLdloGO/odGOTj5JcGKN4FxwCAw+XsF55as+VMM3Qf8lCBQGmEv45iq6Il7o+bIcIkOLiXRnBvscW5YTQr1GXbktoyynlBDWMkUpPLa4wwsmg0aMO6njwqmU6/QsI++8uMJMm/VB7McGPVMrXpBCVANoK8gjBpRoOew1OPzg2bsE6NF8QBU4Z92/mml2d5pVpldkdQ9I2zaWryg9RgegyDLckGgTNVO9RCNeWNi/fQwwRbuOsPTk6a6V/+v8bJRXpdQnlLmf5WZ5TOa8+0DfmW 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: Replace the following fs/Kconfig:FS_DAX dependency: depends on !(ARM || MIPS || SPARC) By a runtime check within alloc_dax(). This runtime check returns ERR_PTR(-EOPNOTSUPP) if the @ops parameter is non-NULL (which means the kernel is using an aliased mapping) on an architecture which has data cache aliasing. Change the return value from NULL to PTR_ERR(-EOPNOTSUPP) for CONFIG_DAX=n for consistency. This is done in preparation for using cpu_dcache_is_aliasing() in a following change which will properly support architectures which detect data cache aliasing at runtime. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Reviewed-by: Dan Williams 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/dax/super.c | 10 ++++++++++ fs/Kconfig | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 205b888d45bf..ce5bffa86bba 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -450,6 +450,16 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops) dev_t devt; int minor; + /* + * Unavailable on architectures with virtually aliased data caches, + * except for device-dax (NULL operations pointer), which does + * not use aliased mappings from the kernel. + */ + if (ops && (IS_ENABLED(CONFIG_ARM) || + IS_ENABLED(CONFIG_MIPS) || + IS_ENABLED(CONFIG_SPARC))) + return ERR_PTR(-EOPNOTSUPP); + if (WARN_ON_ONCE(ops && !ops->zero_page_range)) return ERR_PTR(-EINVAL); diff --git a/fs/Kconfig b/fs/Kconfig index 42837617a55b..e5efdb3b276b 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -56,7 +56,6 @@ endif # BLOCK config FS_DAX bool "File system based Direct Access (DAX) support" depends on MMU - depends on !(ARM || MIPS || SPARC) depends on ZONE_DEVICE || FS_DAX_LIMITED select FS_IOMAP select DAX From patchwork Thu Feb 15 14:46:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13558538 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 88C1DC4829E for ; Thu, 15 Feb 2024 14:47:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2423B8D001C; Thu, 15 Feb 2024 09:46:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CBCC8D001E; Thu, 15 Feb 2024 09:46:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F17D48D001C; Thu, 15 Feb 2024 09:46:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C51778D001E for ; Thu, 15 Feb 2024 09:46:44 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9F4F88114D for ; Thu, 15 Feb 2024 14:46:44 +0000 (UTC) X-FDA: 81794314728.19.051DEDB Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf07.hostedemail.com (Postfix) with ESMTP id 1B7674001B for ; Thu, 15 Feb 2024 14:46:42 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=x7mgTe8y; 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=1708008403; 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=b3aliyJPOObhqkmOR4T6hnfMq2lmmTNJLVfgfu2Sl68=; b=7zvKYqeyvJdHkZlydMxj/g6GpZtr4siWLE5JYKzY95aWEEKbWyzLO3Yepfv6R/ix6VmZSe h7QgTRmM0Dw5y8A+5e92fpTfQEnM9gdPF0lSF6DHB5rBNg9ovXrIYxxdwlcadol/5VsF/I Kw1JCXRMz1U3CABOxOH911QcQtZrs1Y= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=x7mgTe8y; 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=1708008403; a=rsa-sha256; cv=none; b=s22NbmOcajYWy6VLgRlz84z9+0uSX3RPOrbZ9T6xpJ3bZ27yyHecj0Ur3c1LRiJrJ6VO6k iRJI0xXMtl8utnrmHfLdgIdn7nOghkhmvBcrpSdxqlYmopWZdAjwntU5S4c+lxDTlYeBiM KDxrKgCg7w7NqS9bBZNVIj11ui4qlV8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1708008402; bh=yhcYPD4d/Sk8n4rn3QR3NdUtoL+Ae4/2ZbOPQLO15Yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x7mgTe8yNLxfxtpg+iTPiPARxBp02HXXWcLB9mazh4BP7LnRyO1121kFxQT+kKhuU JykGQ0hVnAcDGAGu816lZIza+JkBK2M22ulh2dk4Q2iOHOCysxMwltwF/QT9V0r8of LkP4FtLFPm75WXNEgxT9k6E84EKDeEOSDa5WDjv7cubEjh23cAjADmFK+ZPAQAawfk Y+V6of+KqOajj/pBLaZ6mRkfqDTrDNCCzVlzu77xKlYGQAQ5dhOBKxn9mvSjYwgwtm wVgyudyT9fNyHJq+542tx8GGChHnBlfTdrRUF6okFHHLPyEGPY9lvsxAP3PzrLcSpk XVpoIz2PJdMnw== 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 4TbHvQ0cXpzZ0l; Thu, 15 Feb 2024 09:46:42 -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 Subject: [PATCH v6 8/9] Introduce cpu_dcache_is_aliasing() across all architectures Date: Thu, 15 Feb 2024 09:46:32 -0500 Message-Id: <20240215144633.96437-9-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-Rspamd-Queue-Id: 1B7674001B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: j3baykxbdbfwkujtusg6ffabk4dwnqm9 X-HE-Tag: 1708008402-620922 X-HE-Meta: U2FsdGVkX19dtcxI7yg2XYz6WCVcHPwLBA/NTcAtAkst3P50ufk41krbvhWib1OkHvtLMIicswYlzkVYIV4bbEDoU3Q1gjAtp5kAOfhPhounjs4DCIeFZ/7b3VYydDUDjYLBURIa+bPV1zaKYXg8o59XQwgM50sRcanHSuWp8V0Ip40dlkgH2mJOpaKUqZWUJEwdvnEzoACaM0B2sw4ozeIk4oAg3qtpJuPvlVb9o6y2YrEqJdTJ0rMjbM9C/4/l5tIVb/YZ0I+wWaY4PrHvXjGP77/OC0bMybWLsKnHnE5rPP+kuZiYtFGQwEGF13ydR6Yb5wKhxL1UOPR+aiN8c7PrW139MpodpQrmPsff5/hvCKHfHRTZ9WKMyZGu0ffnMDsulbLIoL8nd/dy9PoTUb+/QqRNx8Zs0gamg9Oe4JOfPzs1ZzlhQUY0xTq2wQgMoh0pTs9wV0c8mwT2Js41ue3HX409KXpa6RCrWlH45W6RLawuzzGmRRyf4R1/jexComrez1fmByUiqmyq8HQR355OjEKJXuMCAxGtBxD8pcsxaHnleR0c9JOVCEpB8Bn3YQ9VPPqto9/PG67kkqBHMAav35XDSPo46Zq6m1LCAiv0xJsiwYd9PWketYSzlH8SVd9AQpG15XlH0UZhrrnaL4V3apxwsD8wx4mEjWrhyHMgHt2ZL8OVsLdv7Bls2wJSTipf1aivYI2VipwLcNKmld1A1gYWrV1QacI8AyN0+6m+RvpeXoth9EyCz3VoYlPZzq+8Gmp4vxSg2DdQwzp6vEnVcDJzm+lwB+1d3pOOdLA1IXjMxe9Bt7XNUXjzXTtGKSsYYdUmNYzEw5+ffkpJM2smoRfIeUQvxHpvoTjEAJF7om8vg9KMdDVHs4S606vpYZkf7hT7RJYG10q312IdRx1ufvxrqmjNTHUbz71RIciKSM1PDkwUJuRmT/moGg8bQFRaHKHdt+JDrE2C0l7 2uoy0Oes AitQjhPU+RSmiOppShN0DXaanoK8r2U32D1lo1Y2J/1u5Idlv7nQgRWyz7DljYwNBmLneYSWP79XYETdNL3e9SlSu7DSFpbVNjWk3Y0qEwINepkGrD4hxEGMJgonurfvsCRfQMx3WRkJU+Oq6v3M47lM/mFXBEHxWyGGtIm1QycQSfJSeg17wIBLLqtZ3m+giUDuvHIz1uCd1HgIDItydg2iIC81iKd2U63hIZCgYlH5Ad87DMW7loqVd4lGXRnWmRYlDSDq2yPJpwlPGVSYK9KCHIYymwi9GJtccxJVjcmtWyXToB+fGM6ovKx6mh2ezIqXwjlVTu8rKr1cFPCmooOBN3Qhim2dkCzGs02Z0687vRELBaYwf0mOEzVG5J96THwl4ZyUN14u07HhwwfM0PACFw4ytNgijBfrtuwO3PmHiyZH95Ph5tWXag+x/n1EYGzk4rhYyjqAEp1olzuW4Dq/9QSrv1pjOIIDYMIO1GrDFxCytBXafqrKHwfA55FeMS55dtbl7PKw0pzNGvl6WVzTZJXlwOxlAszxLrutM0ls7Zikgd1lVFER3ShGyq3mr6chyygCZPuSy5IxKxspyk5hnd7tZhw+P/LlBB0gBRaCi/c44Lpk7uIRdfc05NiLHi1O8/nWMpfd+RVHGU/7R9aCoVevWVTMzCYlClMMttNKG0jL+5ZjLSmFYdPdUjMqCRLAA0ll2zwkqnGdxQWYWlssLjL8CUfVS+PobTq1Q2wgoInvdJ7J2+i4bqmafH1RAazKeB5noovsfDGpa2OS1MRUIPQ== 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: Introduce a generic way to query whether the data cache is virtually aliased on all architectures. Its purpose is to ensure that subsystems which are incompatible with virtually aliased data caches (e.g. FS_DAX) can reliably query this. For data cache aliasing, there are three scenarios dependending on the architecture. Here is a breakdown based on my understanding: A) The data cache is always aliasing: * arc * csky * m68k (note: shared memory mappings are incoherent ? SHMLBA is missing there.) * sh * parisc B) The data cache aliasing is statically known or depends on querying CPU state at runtime: * arm (cache_is_vivt() || cache_is_vipt_aliasing()) * mips (cpu_has_dc_aliases) * nios2 (NIOS2_DCACHE_SIZE > PAGE_SIZE) * sparc32 (vac_cache_size > PAGE_SIZE) * sparc64 (L1DCACHE_SIZE > PAGE_SIZE) * xtensa (DCACHE_WAY_SIZE > PAGE_SIZE) C) The data cache is never aliasing: * alpha * arm64 (aarch64) * hexagon * loongarch (but with incoherent write buffers, which are disabled since commit d23b7795 ("LoongArch: Change SHMLBA from SZ_64K to PAGE_SIZE")) * microblaze * openrisc * powerpc * riscv * s390 * um * x86 Require architectures in A) and B) to select ARCH_HAS_CPU_CACHE_ALIASING and implement "cpu_dcache_is_aliasing()". Architectures in C) don't select ARCH_HAS_CPU_CACHE_ALIASING, and thus cpu_dcache_is_aliasing() simply evaluates to "false". Note that this leaves "cpu_icache_is_aliasing()" to be implemented as future work. This would be useful to gate features like XIP on architectures which have aliasing CPU dcache-icache but not CPU dcache-dcache. Use "cpu_dcache" and "cpu_cache" rather than just "dcache" and "cache" to clarify that we really mean "CPU data cache" and "CPU cache" to eliminate any possible confusion with VFS "dentry cache" and "page cache". Link: https://lore.kernel.org/lkml/20030910210416.GA24258@mail.jlokier.co.uk/ Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers 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 --- arch/arc/Kconfig | 1 + arch/arc/include/asm/cachetype.h | 9 +++++++++ arch/arm/Kconfig | 1 + arch/arm/include/asm/cachetype.h | 2 ++ arch/csky/Kconfig | 1 + arch/csky/include/asm/cachetype.h | 9 +++++++++ arch/m68k/Kconfig | 1 + arch/m68k/include/asm/cachetype.h | 9 +++++++++ arch/mips/Kconfig | 1 + arch/mips/include/asm/cachetype.h | 9 +++++++++ arch/nios2/Kconfig | 1 + arch/nios2/include/asm/cachetype.h | 10 ++++++++++ arch/parisc/Kconfig | 1 + arch/parisc/include/asm/cachetype.h | 9 +++++++++ arch/sh/Kconfig | 1 + arch/sh/include/asm/cachetype.h | 9 +++++++++ arch/sparc/Kconfig | 1 + arch/sparc/include/asm/cachetype.h | 14 ++++++++++++++ arch/xtensa/Kconfig | 1 + arch/xtensa/include/asm/cachetype.h | 10 ++++++++++ include/linux/cacheinfo.h | 6 ++++++ mm/Kconfig | 6 ++++++ 22 files changed, 112 insertions(+) create mode 100644 arch/arc/include/asm/cachetype.h create mode 100644 arch/csky/include/asm/cachetype.h create mode 100644 arch/m68k/include/asm/cachetype.h create mode 100644 arch/mips/include/asm/cachetype.h create mode 100644 arch/nios2/include/asm/cachetype.h create mode 100644 arch/parisc/include/asm/cachetype.h create mode 100644 arch/sh/include/asm/cachetype.h create mode 100644 arch/sparc/include/asm/cachetype.h create mode 100644 arch/xtensa/include/asm/cachetype.h diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 1b0483c51cc1..7d294a3242a4 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -6,6 +6,7 @@ config ARC def_bool y select ARC_TIMERS + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_CACHE_LINE_SIZE select ARCH_HAS_DEBUG_VM_PGTABLE select ARCH_HAS_DMA_PREP_COHERENT diff --git a/arch/arc/include/asm/cachetype.h b/arch/arc/include/asm/cachetype.h new file mode 100644 index 000000000000..05fc7ed59712 --- /dev/null +++ b/arch/arc/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_ARC_CACHETYPE_H +#define __ASM_ARC_CACHETYPE_H + +#include + +#define cpu_dcache_is_aliasing() true + +#endif diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f8567e95f98b..cd13b1788973 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -5,6 +5,7 @@ config ARM select ARCH_32BIT_OFF_T select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE if HAVE_KRETPROBES && FRAME_POINTER && !ARM_UNWIND select ARCH_HAS_BINFMT_FLAT + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL if MMU diff --git a/arch/arm/include/asm/cachetype.h b/arch/arm/include/asm/cachetype.h index e8c30430be33..b9dbe1d4c8fe 100644 --- a/arch/arm/include/asm/cachetype.h +++ b/arch/arm/include/asm/cachetype.h @@ -20,6 +20,8 @@ extern unsigned int cacheid; #define icache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_I_ALIASING) #define icache_is_pipt() cacheid_is(CACHEID_PIPT) +#define cpu_dcache_is_aliasing() (cache_is_vivt() || cache_is_vipt_aliasing()) + /* * __LINUX_ARM_ARCH__ is the minimum supported CPU architecture * Mask out support which will never be present on newer CPUs. diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig index cf2a6fd7dff8..8a91eccf76dc 100644 --- a/arch/csky/Kconfig +++ b/arch/csky/Kconfig @@ -2,6 +2,7 @@ config CSKY def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_DMA_PREP_COHERENT select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_SYNC_DMA_FOR_CPU diff --git a/arch/csky/include/asm/cachetype.h b/arch/csky/include/asm/cachetype.h new file mode 100644 index 000000000000..98cbe3af662f --- /dev/null +++ b/arch/csky/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_CSKY_CACHETYPE_H +#define __ASM_CSKY_CACHETYPE_H + +#include + +#define cpu_dcache_is_aliasing() true + +#endif diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 4b3e93cac723..a9c3e3de0c6d 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -3,6 +3,7 @@ config M68K bool default y select ARCH_32BIT_OFF_T + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_BINFMT_FLAT select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER diff --git a/arch/m68k/include/asm/cachetype.h b/arch/m68k/include/asm/cachetype.h new file mode 100644 index 000000000000..7fad5d9ab8fe --- /dev/null +++ b/arch/m68k/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_M68K_CACHETYPE_H +#define __ASM_M68K_CACHETYPE_H + +#include + +#define cpu_dcache_is_aliasing() true + +#endif diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 797ae590ebdb..ab1c8bd96666 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -4,6 +4,7 @@ config MIPS default y select ARCH_32BIT_OFF_T if !64BIT select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER if !CC_IS_CLANG || CLANG_VERSION >= 140000 select ARCH_HAS_DEBUG_VIRTUAL if !64BIT diff --git a/arch/mips/include/asm/cachetype.h b/arch/mips/include/asm/cachetype.h new file mode 100644 index 000000000000..9f4ba2fe1155 --- /dev/null +++ b/arch/mips/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_MIPS_CACHETYPE_H +#define __ASM_MIPS_CACHETYPE_H + +#include + +#define cpu_dcache_is_aliasing() cpu_has_dc_aliases + +#endif diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index d54464021a61..760fb541ecd2 100644 --- a/arch/nios2/Kconfig +++ b/arch/nios2/Kconfig @@ -2,6 +2,7 @@ config NIOS2 def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_DMA_PREP_COHERENT select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE diff --git a/arch/nios2/include/asm/cachetype.h b/arch/nios2/include/asm/cachetype.h new file mode 100644 index 000000000000..eb9c416b8a1c --- /dev/null +++ b/arch/nios2/include/asm/cachetype.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_NIOS2_CACHETYPE_H +#define __ASM_NIOS2_CACHETYPE_H + +#include +#include + +#define cpu_dcache_is_aliasing() (NIOS2_DCACHE_SIZE > PAGE_SIZE) + +#endif diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index d14ccc948a29..0f25c227f74b 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -8,6 +8,7 @@ config PARISC select HAVE_FUNCTION_GRAPH_TRACER select HAVE_SYSCALL_TRACEPOINTS select ARCH_WANT_FRAME_POINTERS + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_DMA_ALLOC if PA11 select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_STRICT_KERNEL_RWX diff --git a/arch/parisc/include/asm/cachetype.h b/arch/parisc/include/asm/cachetype.h new file mode 100644 index 000000000000..e0868a1d3c47 --- /dev/null +++ b/arch/parisc/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_PARISC_CACHETYPE_H +#define __ASM_PARISC_CACHETYPE_H + +#include + +#define cpu_dcache_is_aliasing() true + +#endif diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 7500521b2b98..2ad3e29f0ebe 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -2,6 +2,7 @@ config SUPERH def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM && MMU select ARCH_ENABLE_MEMORY_HOTREMOVE if SPARSEMEM && MMU select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A) diff --git a/arch/sh/include/asm/cachetype.h b/arch/sh/include/asm/cachetype.h new file mode 100644 index 000000000000..a5fffe536068 --- /dev/null +++ b/arch/sh/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_SH_CACHETYPE_H +#define __ASM_SH_CACHETYPE_H + +#include + +#define cpu_dcache_is_aliasing() true + +#endif diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 49849790e66d..5ba627da15d7 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -13,6 +13,7 @@ config 64BIT config SPARC bool default y + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI select ARCH_MIGHT_HAVE_PC_SERIO select DMA_OPS diff --git a/arch/sparc/include/asm/cachetype.h b/arch/sparc/include/asm/cachetype.h new file mode 100644 index 000000000000..caf1c0045892 --- /dev/null +++ b/arch/sparc/include/asm/cachetype.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_SPARC_CACHETYPE_H +#define __ASM_SPARC_CACHETYPE_H + +#include + +#ifdef CONFIG_SPARC32 +extern int vac_cache_size; +#define cpu_dcache_is_aliasing() (vac_cache_size > PAGE_SIZE) +#else +#define cpu_dcache_is_aliasing() (L1DCACHE_SIZE > PAGE_SIZE) +#endif + +#endif diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 7d792077e5fd..2dfde54d1a84 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -2,6 +2,7 @@ config XTENSA def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_BINFMT_FLAT if !MMU select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VM_PGTABLE diff --git a/arch/xtensa/include/asm/cachetype.h b/arch/xtensa/include/asm/cachetype.h new file mode 100644 index 000000000000..51bd49e2a1c5 --- /dev/null +++ b/arch/xtensa/include/asm/cachetype.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_XTENSA_CACHETYPE_H +#define __ASM_XTENSA_CACHETYPE_H + +#include +#include + +#define cpu_dcache_is_aliasing() (DCACHE_WAY_SIZE > PAGE_SIZE) + +#endif diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index d504eb4b49ab..2cb15fe4fe12 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@ -138,4 +138,10 @@ static inline int get_cpu_cacheinfo_id(int cpu, int level) #define use_arch_cache_info() (false) #endif +#ifndef CONFIG_ARCH_HAS_CPU_CACHE_ALIASING +#define cpu_dcache_is_aliasing() false +#else +#include +#endif + #endif /* _LINUX_CACHEINFO_H */ diff --git a/mm/Kconfig b/mm/Kconfig index 57cd378c73d6..db09c9ad15c9 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1016,6 +1016,12 @@ config IDLE_PAGE_TRACKING See Documentation/admin-guide/mm/idle_page_tracking.rst for more details. +# Architectures which implement cpu_dcache_is_aliasing() to query +# whether the data caches are aliased (VIVT or VIPT with dcache +# aliasing) need to select this. +config ARCH_HAS_CPU_CACHE_ALIASING + bool + config ARCH_HAS_CACHE_LINE_SIZE bool From patchwork Thu Feb 15 14:46:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13558539 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 A8465C4829E for ; Thu, 15 Feb 2024 14:47:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D4BB8D001E; Thu, 15 Feb 2024 09:46:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6847B8D001F; Thu, 15 Feb 2024 09:46:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FEC38D001E; Thu, 15 Feb 2024 09:46:45 -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 316A68D001F for ; Thu, 15 Feb 2024 09:46:45 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 08E9BA28F7 for ; Thu, 15 Feb 2024 14:46:45 +0000 (UTC) X-FDA: 81794314770.15.38FB051 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf15.hostedemail.com (Postfix) with ESMTP id 6F064A002D for ; Thu, 15 Feb 2024 14:46:43 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=ENsTjpMx; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf15.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=1708008403; 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=UPDJkdwf3N1VcCYbcUnUgFJY3X3oR+UFxWlZudqMVIo=; b=jsYokQgUr9Q9ELdeKW7ah9lyLuhaTYMywSit/jOPSdC/zDD3dEz7/YHKqKLXAgh2PLtky6 Ot5bwE8xgG+Wfc/qB9m3PeuOTkqPjbSYraXAvLuW44kk7jRL5tRZRJ+BbBV40KqPUVvX4f V4ffI0LC7W05EkpEHi2wq/XgkvFpKao= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=ENsTjpMx; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf15.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=1708008403; a=rsa-sha256; cv=none; b=S1Zpv+JCOfcuFgTNMMQOnNmEJFpwTLk6ALvipRaN+chTuz6xRcCxrQGtw0J4HU3ONcLiTr XrIH47W0QzX0a/FjOkA1f5Vx0Nr8ZFQwSL+Vh7LLAhkd+dqjOhYViiOiznopcopl2gHFWj FSNq8Vf08UFQP37MX0UW2agAhSif0y4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1708008402; bh=5LHEXykJS2jSVE2sCzHC5a4cdCFsRj5a/HPr77qf3tA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENsTjpMxLU1wLGqd749X/HFQGZd/c3vnn8cNkbklbkw6Pg6ZW7i6kFn81cmiMnX3+ AbjNIOQ8Du3bNfmEJ8ZLtHAEh0KN98NHRKAqLepXYe1cfaCpmfcsbCNtihbA+rngpk gdKdOKG+DbN5qVXdiKBMVZ7wpzDIjNSoxyh+Vd42SjLriNTZtWbYCMLCt7u6Qn1nmu FRcBlkrrjkJK8qAxMZJRIWdmbiie8ckjCZ+DVLtUMi93fbaISmkA9HGWfDx1wJBAES AWp7GQO12TcvOlhqO1bgojD2BVkaufnnQiT6uu4SauxatVT43b1st5JzJmJMrUSf6v pZsOUVUzt8qNA== 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 4TbHvQ3nTxzZPr; Thu, 15 Feb 2024 09:46:42 -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 Subject: [PATCH v6 9/9] dax: Fix incorrect list of data cache aliasing architectures Date: Thu, 15 Feb 2024 09:46:33 -0500 Message-Id: <20240215144633.96437-10-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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 6F064A002D X-Stat-Signature: 64hacwa9cz65ku8b7w7p1ignyfsr5taj X-Rspam-User: X-HE-Tag: 1708008403-461260 X-HE-Meta: U2FsdGVkX1/sqPKyeQOvm3BNoilRpiAq9jp0FoOz3ddq3HpuS5ywtO6UNlLhMKcmUeYi66o7J6ewOU/kKTaOdor6d4HltawIryIPRl4HVQ5Nsvl/cNghNiTR3PwJCah105oc8W14RkRyyeSNbYkXa8wF3LKYzAZLnw5XatSSOCTdJ1zWDlBpjVYRlS8CwzAy52lVg/we1tljmOJR3A1FXaMcinB3AvhXynsdsRoV9NPFrmoiEJRQKruDtmzHp/qweYkaeEFs2ZRvc6kCdtbAXLFJJzA8bza6xSxp9TxDsWLgk56o0nVZpiICqCUc4fCfzI7tpOhTHHVT8qXukgAY9RglIe6MO3ola14OESF8PAgnchlE0g3oNe8GRxhIcWITymdz7IOFGI5gjdPTQwAGN7rSNVrnoOWCk7sdrtepgRZed2IRg1g/v9GIIQjC3AhxC/WXZg/a4YUFY39Mqwmf35wC66L04uti48iQMoMCdJDbsNLC1dyON9CmBOpLjrIdkTGOT7HqFdGIDHeClD29yH8YHRD8csiJH5Qd9LYc4AtI5S6jZdtUYknekFuSTGqxpzr8pOsZejFn9Sem/C4xVz4+x9yTXIMyTZljuUbuaAvwLXHc7IBQpbIQe7W0V1xlFNw+DDPCOd84EhUIs4ecNBKx4o5FZ13ADD9b0ab/Ejie9xJ/iv0S9ufathmGrqQ+DrjW5sDZWizBvQax2uq7TqO0/Fh6mdN+coCoLMorEjTSAtXOlb+LisT8Pzfdif+cba+WWlW2lmHAdmN59sz/1yShGp5BEya60XoBZMNzX6M6mIqUw9HzhbmFvqruMh3ibwdMYigtn4KsdU9oCDNnwTlSzf4ShJWpu3kKCL/ZBB0dhmE9lUjj5AfSajr94H3gBiCEJsztNglczfKWB7n9zmmKhjFuobxWrMDBSY/A0wpVlP17SQukOPwSXCMWR16PlpF+B3iqkxAblEsYhXA oZQwBagi jXaA3OnjN+KBZLEdNfb/75H4MgBgZmppxi9xuDZ1yb0bOF3bCrg9PzzEYw01xG722vTwWjqJXu/2dW/11x5Qf/FRCUNw9Uj/OC/YWzNLJve09POjVs44dHUMtCZLyY/3aCEZpb7smCiYEmtv7vrkVbnHJ1HfiJKcAfDB05p3Kc/H20L15nNdLdxIsM9Qvqrej2+E+7pjEC4pT38302mVVoz3n7TzBRdt+blIEIAFS1UMwTiOeZ1yxjLbzTtDcsbX2m/qdxUP4Dh/4kzrdUU2h6CzeaRLC4gnthAkDYO0uKiE0AG+ARQkkbTac8fG/IrzxO+oYO0aM+m28eUnJ5Oie6ovEeCgbct4eGOSFNeF2UpsSmffpAIaxpS2f8/oY0QoHd/OJ3r4HvAdTiNG8M/tHhdxbXA0D8643/9geEmMGFYfdE0D/KoqXzrpHxJZpo1Nbz3f0BMZD9fuq0yIjIh3/x15bFUnlt4QWH5Z7RLFMWuztpXkWVlWOSdXsuZ2tvVqqFEBpBwEB3JdTNyUyDMCT4W13kJdYURxLwqe3VOjgGL4J0ucgi2N3ZpJKR4VNXbhASeMD 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: commit d92576f1167c ("dax: does not work correctly with virtual aliasing caches") prevents DAX from building on architectures with virtually aliased dcache with: depends on !(ARM || MIPS || SPARC) This check is too broad (e.g. recent ARMv7 don't have virtually aliased dcaches), and also misses many other architectures with virtually aliased data cache. This is a regression introduced in the v4.0 Linux kernel where the dax mount option is removed for 32-bit ARMv7 boards which have no data cache aliasing, and therefore should work fine with FS_DAX. This was turned into the following check in alloc_dax() by a preparatory change: if (ops && (IS_ENABLED(CONFIG_ARM) || IS_ENABLED(CONFIG_MIPS) || IS_ENABLED(CONFIG_SPARC))) return NULL; Use cpu_dcache_is_aliasing() instead to figure out whether the environment has aliasing data caches. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Reviewed-by: Dan Williams 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/dax/super.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index ce5bffa86bba..a21a7c262382 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "dax-private.h" /** @@ -455,9 +456,7 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops) * except for device-dax (NULL operations pointer), which does * not use aliased mappings from the kernel. */ - if (ops && (IS_ENABLED(CONFIG_ARM) || - IS_ENABLED(CONFIG_MIPS) || - IS_ENABLED(CONFIG_SPARC))) + if (ops && cpu_dcache_is_aliasing()) return ERR_PTR(-EOPNOTSUPP); if (WARN_ON_ONCE(ops && !ops->zero_page_range))