Message ID | 20240130165255.212591-9-mathieu.desnoyers@efficios.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-44997-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1373761dyb; Tue, 30 Jan 2024 09:19:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+04ZAFJ3uIjVzUm7uRqldF9aErIm1UzPtAzX7QaNLbnAAcqKEf6bNZK8ROHmXGTO5wZ9Y X-Received: by 2002:a17:90a:cb15:b0:295:b950:b7d9 with SMTP id z21-20020a17090acb1500b00295b950b7d9mr1377653pjt.0.1706635178747; Tue, 30 Jan 2024 09:19:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706635178; cv=pass; d=google.com; s=arc-20160816; b=dxOIzWC/RNTR9xWLhIOHYqnuoa+Cs8tjIPY5d/QZtJJmb/qx90f/5xCPrJgi/0Fuek z3lKvAi9iiSycVKKd0ldM+KDuetZfNHQoMnQ7lm4kd9kp1U9W1zPvHUvyS8yCNwvTSkc DFXC4LstT/wnPEmYp6e9Jj6dj1+ECzG2M9YjJM1JVCwIVKZDREC1QlxXqFOsf1CtMZpo B8A4dc6W844ztAIvs3SHSDjn4qOWqJIhizItV1T2SUQqLTJMukHLkSyTMRS4XBHFQC/8 EdP4IdWec9+9TR8QhTcbZBa5mt7MGVTA3njQCVxUbD1oLS+03zS8XutoQ1qc1ZVrx4xK sTzg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=jZU2ZbbgI/b/87AeHhjaYiSd5/oOGG+UvSS00fh9aPo=; fh=vbyj9zC2wTIZazVHAO0c0ywrUG9FLIS5Hx6RH0UNtjw=; b=Vjg1tFeVHG7WABU8kiGpZGlr9JCbLCUcIZ8ZiBxwj8lZnijmHyUao0rROowndEvCqt l8nMMnZGUMH3N93dtvCl684U+8vtNacj4C+NxwGgN/Iy0K5xTSi0hJAfR2DTa4AQ1N27 IXoAtfeaK+bNUaPk9DRZTlxJzIH8gSgODG0pGzAl4Zg0Nc8kA2rQoP4yoXZBPb3o8XpJ kvVdQ1e/MCxj298Mjucht6V22ouFvpTDUb9ep6rj62kKm2JWp8kwVRDxcG9OEm4Y3Tc6 eUwQEln/Sw+RA8W3ljic0SLO3JzYVQdvoe0YbhlSMV4tSmqgh4NacyhRepGdLTH2Wpb4 y6mg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=BUhe710j; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-44997-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44997-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bi4-20020a170902bf0400b001d4e7ad3810si7666488plb.604.2024.01.30.09.19.38 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 09:19:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44997-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=BUhe710j; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-44997-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44997-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7B464B25F85 for <ouuuleilei@gmail.com>; Tue, 30 Jan 2024 16:55:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3F34130E31; Tue, 30 Jan 2024 16:53:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="BUhe710j" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58C48128393; Tue, 30 Jan 2024 16:53:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706633594; cv=none; b=glboj2+TrvpJdo741wecK22Az9w0VJWuKdFlUjEtixV6pdbtqyORxCaTBB0XuJMXnq8jg+9yRdJUGx+pnLGnUqonAo27i8ilQZgK1jdUKGAVJvg5SOwNvo4eYviEGAXOq3ETyVbV2VOHjPdajXTLkV3ORhD8hvxqCvP5bambfBc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706633594; c=relaxed/simple; bh=39364yK8Vve2TZEwvAasv/nldxj5QFqZMMVmBMwwiu0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PgMtrCt5obc0ZOIQs8C7oxjW9UiorCnGDnYsCqlrczT8ugQIh9jzqtcI0olCsmRJrYcyt1trvMKTJFLVcgfM0UM2Tkz5HVNw5HQNlAZkscjQepJPuel9yjC1zgJIyt8/baT/YmOZO/l+ayHoCBxWs+KIj8kOdwnsUMzsvnKZus0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=BUhe710j; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706633585; bh=39364yK8Vve2TZEwvAasv/nldxj5QFqZMMVmBMwwiu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BUhe710jU2/derdpsA0dmrgdapNQmX0LXTEssfQdWcX2L97NEiIfvqlxiNskzlCQ+ uFBF2yIOIW7lLhGlgmLYL2QC0ZeqL0RkTwoEYx20D9bs890S3wdBKzVJdaeYrnozqP r4rIEq4WyYWNEKxGADF+jEmZYQH3YyuJEpH3/tIUj4UOrrV1coGgapkbjslqVS0p7F g8VCDbYKUyXI00zoYgdo6nbeTVRFmEiOfxFc5YMj8+QBGAhQlPTdTKLswnRa7tKr2a n8HrygNAcyh6r6ttOBpYmgmUin69L64Gw64u0Grq9Que0glHbaZLrtM5V+rY3Uav/H Pv8DFsI0xlUoA== 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 4TPWSd16qfzVlV; Tue, 30 Jan 2024 11:53:05 -0500 (EST) From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> To: Dan Williams <dan.j.williams@intel.com>, Vishal Verma <vishal.l.verma@intel.com>, Dave Jiang <dave.jiang@intel.com> Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Andrew Morton <akpm@linux-foundation.org>, Linus Torvalds <torvalds@linux-foundation.org>, linux-mm@kvack.org, linux-arch@vger.kernel.org, Matthew Wilcox <willy@infradead.org>, Arnd Bergmann <arnd@arndb.de>, Russell King <linux@armlinux.org.uk>, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH v2 8/8] dax: Fix incorrect list of dcache aliasing architectures Date: Tue, 30 Jan 2024 11:52:55 -0500 Message-Id: <20240130165255.212591-9-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> References: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789536689206013790 X-GMAIL-MSGID: 1789536689206013790 |
Series |
Introduce dcache_is_aliasing() to fix DAX regression
|
|
Commit Message
Mathieu Desnoyers
Jan. 30, 2024, 4:52 p.m. UTC
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 dcache.
This is a regression introduced in the v5.13 Linux kernel where the
dax mount option is removed for 32-bit ARMv7 boards which have no dcache
aliasing, and therefore should work fine with FS_DAX.
This was turned into the following implementation of dax_is_supported()
by a preparatory change:
return !IS_ENABLED(CONFIG_ARM) &&
!IS_ENABLED(CONFIG_MIPS) &&
!IS_ENABLED(CONFIG_SPARC);
Use dcache_is_aliasing() instead to figure out whether the environment
has aliasing dcaches.
Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-arch@vger.kernel.org
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <linux@armlinux.org.uk>
Cc: nvdimm@lists.linux.dev
Cc: linux-cxl@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
---
include/linux/dax.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
On Tue, Jan 30, 2024 at 11:52:55AM -0500, Mathieu Desnoyers wrote: > 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 dcache. > > This is a regression introduced in the v5.13 Linux kernel where the > dax mount option is removed for 32-bit ARMv7 boards which have no dcache > aliasing, and therefore should work fine with FS_DAX. > > This was turned into the following implementation of dax_is_supported() > by a preparatory change: > > return !IS_ENABLED(CONFIG_ARM) && > !IS_ENABLED(CONFIG_MIPS) && > !IS_ENABLED(CONFIG_SPARC); > > Use dcache_is_aliasing() instead to figure out whether the environment > has aliasing dcaches. > > Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") > Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> > Cc: Andrew Morton <akpm@linux-foundation.org> > Cc: Linus Torvalds <torvalds@linux-foundation.org> > Cc: linux-mm@kvack.org > Cc: linux-arch@vger.kernel.org > Cc: Dan Williams <dan.j.williams@intel.com> > Cc: Vishal Verma <vishal.l.verma@intel.com> > Cc: Dave Jiang <dave.jiang@intel.com> > Cc: Matthew Wilcox <willy@infradead.org> > Cc: Arnd Bergmann <arnd@arndb.de> > Cc: Russell King <linux@armlinux.org.uk> > Cc: nvdimm@lists.linux.dev > Cc: linux-cxl@vger.kernel.org > Cc: linux-fsdevel@vger.kernel.org > --- > include/linux/dax.h | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/include/linux/dax.h b/include/linux/dax.h > index cfc8cd4a3eae..f59e604662e4 100644 > --- a/include/linux/dax.h > +++ b/include/linux/dax.h > @@ -5,6 +5,7 @@ > #include <linux/fs.h> > #include <linux/mm.h> > #include <linux/radix-tree.h> > +#include <linux/cacheinfo.h> > > typedef unsigned long dax_entry_t; > > @@ -80,9 +81,7 @@ static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, > } > static inline bool dax_is_supported(void) > { > - return !IS_ENABLED(CONFIG_ARM) && > - !IS_ENABLED(CONFIG_MIPS) && > - !IS_ENABLED(CONFIG_SPARC); > + return !dcache_is_aliasing(); Yeah, if this is just a one liner should go into fs_dax_get_by_bdev(), similar to the blk_queue_dax() check at the start of the function. I also noticed that device mapper uses fs_dax_get_by_bdev() to determine if it can support DAX, but this patch set does not address that case. Hence it really seems to me like fs_dax_get_by_bdev() is the right place to put this check. -Dave.
Dave Chinner wrote: > On Tue, Jan 30, 2024 at 11:52:55AM -0500, Mathieu Desnoyers wrote: > > 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 dcache. > > > > This is a regression introduced in the v5.13 Linux kernel where the > > dax mount option is removed for 32-bit ARMv7 boards which have no dcache > > aliasing, and therefore should work fine with FS_DAX. > > > > This was turned into the following implementation of dax_is_supported() > > by a preparatory change: > > > > return !IS_ENABLED(CONFIG_ARM) && > > !IS_ENABLED(CONFIG_MIPS) && > > !IS_ENABLED(CONFIG_SPARC); > > > > Use dcache_is_aliasing() instead to figure out whether the environment > > has aliasing dcaches. > > > > Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") > > Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> > > Cc: Andrew Morton <akpm@linux-foundation.org> > > Cc: Linus Torvalds <torvalds@linux-foundation.org> > > Cc: linux-mm@kvack.org > > Cc: linux-arch@vger.kernel.org > > Cc: Dan Williams <dan.j.williams@intel.com> > > Cc: Vishal Verma <vishal.l.verma@intel.com> > > Cc: Dave Jiang <dave.jiang@intel.com> > > Cc: Matthew Wilcox <willy@infradead.org> > > Cc: Arnd Bergmann <arnd@arndb.de> > > Cc: Russell King <linux@armlinux.org.uk> > > Cc: nvdimm@lists.linux.dev > > Cc: linux-cxl@vger.kernel.org > > Cc: linux-fsdevel@vger.kernel.org > > --- > > include/linux/dax.h | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/include/linux/dax.h b/include/linux/dax.h > > index cfc8cd4a3eae..f59e604662e4 100644 > > --- a/include/linux/dax.h > > +++ b/include/linux/dax.h > > @@ -5,6 +5,7 @@ > > #include <linux/fs.h> > > #include <linux/mm.h> > > #include <linux/radix-tree.h> > > +#include <linux/cacheinfo.h> > > > > typedef unsigned long dax_entry_t; > > > > @@ -80,9 +81,7 @@ static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, > > } > > static inline bool dax_is_supported(void) > > { > > - return !IS_ENABLED(CONFIG_ARM) && > > - !IS_ENABLED(CONFIG_MIPS) && > > - !IS_ENABLED(CONFIG_SPARC); > > + return !dcache_is_aliasing(); > > Yeah, if this is just a one liner should go into > fs_dax_get_by_bdev(), similar to the blk_queue_dax() check at the > start of the function. > > I also noticed that device mapper uses fs_dax_get_by_bdev() to > determine if it can support DAX, but this patch set does not address > that case. Hence it really seems to me like fs_dax_get_by_bdev() is > the right place to put this check. Oh, good catch. Yes, I agree this can definitely be pushed down, but then I think it should be pushed down all the way to make alloc_dax() fail. That will need some additional fixups like: diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 8dcabf84d866..a35e60e62440 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2126,12 +2126,12 @@ static struct mapped_device *alloc_dev(int minor) md->dax_dev = alloc_dax(md, &dm_dax_ops); if (IS_ERR(md->dax_dev)) { md->dax_dev = NULL; - goto bad; + } else { + set_dax_nocache(md->dax_dev); + set_dax_nomc(md->dax_dev); + if (dax_add_host(md->dax_dev, md->disk)) + goto bad; } - set_dax_nocache(md->dax_dev); - set_dax_nomc(md->dax_dev); - if (dax_add_host(md->dax_dev, md->disk)) - goto bad; } format_dev_t(md->name, MKDEV(_major, minor)); ..to make it not fatal to fail to register the dax_dev.
On 2024-01-30 22:13, Dan Williams wrote: > Dave Chinner wrote: >> On Tue, Jan 30, 2024 at 11:52:55AM -0500, Mathieu Desnoyers wrote: >>> 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 dcache. >>> >>> This is a regression introduced in the v5.13 Linux kernel where the >>> dax mount option is removed for 32-bit ARMv7 boards which have no dcache >>> aliasing, and therefore should work fine with FS_DAX. >>> >>> This was turned into the following implementation of dax_is_supported() >>> by a preparatory change: >>> >>> return !IS_ENABLED(CONFIG_ARM) && >>> !IS_ENABLED(CONFIG_MIPS) && >>> !IS_ENABLED(CONFIG_SPARC); >>> >>> Use dcache_is_aliasing() instead to figure out whether the environment >>> has aliasing dcaches. >>> >>> Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") >>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> >>> Cc: Andrew Morton <akpm@linux-foundation.org> >>> Cc: Linus Torvalds <torvalds@linux-foundation.org> >>> Cc: linux-mm@kvack.org >>> Cc: linux-arch@vger.kernel.org >>> Cc: Dan Williams <dan.j.williams@intel.com> >>> Cc: Vishal Verma <vishal.l.verma@intel.com> >>> Cc: Dave Jiang <dave.jiang@intel.com> >>> Cc: Matthew Wilcox <willy@infradead.org> >>> Cc: Arnd Bergmann <arnd@arndb.de> >>> Cc: Russell King <linux@armlinux.org.uk> >>> Cc: nvdimm@lists.linux.dev >>> Cc: linux-cxl@vger.kernel.org >>> Cc: linux-fsdevel@vger.kernel.org >>> --- >>> include/linux/dax.h | 5 ++--- >>> 1 file changed, 2 insertions(+), 3 deletions(-) >>> >>> diff --git a/include/linux/dax.h b/include/linux/dax.h >>> index cfc8cd4a3eae..f59e604662e4 100644 >>> --- a/include/linux/dax.h >>> +++ b/include/linux/dax.h >>> @@ -5,6 +5,7 @@ >>> #include <linux/fs.h> >>> #include <linux/mm.h> >>> #include <linux/radix-tree.h> >>> +#include <linux/cacheinfo.h> >>> >>> typedef unsigned long dax_entry_t; >>> >>> @@ -80,9 +81,7 @@ static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, >>> } >>> static inline bool dax_is_supported(void) >>> { >>> - return !IS_ENABLED(CONFIG_ARM) && >>> - !IS_ENABLED(CONFIG_MIPS) && >>> - !IS_ENABLED(CONFIG_SPARC); >>> + return !dcache_is_aliasing(); >> >> Yeah, if this is just a one liner should go into >> fs_dax_get_by_bdev(), similar to the blk_queue_dax() check at the >> start of the function. >> >> I also noticed that device mapper uses fs_dax_get_by_bdev() to >> determine if it can support DAX, but this patch set does not address >> that case. Hence it really seems to me like fs_dax_get_by_bdev() is >> the right place to put this check. > > Oh, good catch. Yes, I agree this can definitely be pushed down, but > then I think it should be pushed down all the way to make alloc_dax() > fail. That will need some additional fixups like: > > diff --git a/drivers/md/dm.c b/drivers/md/dm.c > index 8dcabf84d866..a35e60e62440 100644 > --- a/drivers/md/dm.c > +++ b/drivers/md/dm.c > @@ -2126,12 +2126,12 @@ static struct mapped_device *alloc_dev(int minor) > md->dax_dev = alloc_dax(md, &dm_dax_ops); > if (IS_ERR(md->dax_dev)) { > md->dax_dev = NULL; > - goto bad; > + } else { > + set_dax_nocache(md->dax_dev); > + set_dax_nomc(md->dax_dev); > + if (dax_add_host(md->dax_dev, md->disk)) > + goto bad; > } > - set_dax_nocache(md->dax_dev); > - set_dax_nomc(md->dax_dev); > - if (dax_add_host(md->dax_dev, md->disk)) > - goto bad; > } > > format_dev_t(md->name, MKDEV(_major, minor)); > > ...to make it not fatal to fail to register the dax_dev. I've had a quick look at other users of alloc_dax() and alloc_dax_region(), and so far I figure that all of those really want to bail out on alloc_dax failure. Is dm.c the only special-case we need to fix to make it non-fatal ? Thanks, Mathieu
diff --git a/include/linux/dax.h b/include/linux/dax.h index cfc8cd4a3eae..f59e604662e4 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -5,6 +5,7 @@ #include <linux/fs.h> #include <linux/mm.h> #include <linux/radix-tree.h> +#include <linux/cacheinfo.h> typedef unsigned long dax_entry_t; @@ -80,9 +81,7 @@ static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, } static inline bool dax_is_supported(void) { - return !IS_ENABLED(CONFIG_ARM) && - !IS_ENABLED(CONFIG_MIPS) && - !IS_ENABLED(CONFIG_SPARC); + return !dcache_is_aliasing(); } #else static inline void *dax_holder(struct dax_device *dax_dev)