public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 4/7] ext2: Use dax_is_supported()
       [not found] <20240129210631.193493-1-mathieu.desnoyers@efficios.com>
@ 2024-01-29 21:06 ` Mathieu Desnoyers
  2024-01-30 11:33   ` Jan Kara
  2024-01-29 21:06 ` [RFC PATCH 5/7] ext4: " Mathieu Desnoyers
  1 sibling, 1 reply; 4+ messages in thread
From: Mathieu Desnoyers @ 2024-01-29 21:06 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang
  Cc: linux-kernel, Mathieu Desnoyers, Jan Kara, linux-ext4,
	Andrew Morton, Linus Torvalds, linux-mm, linux-arch,
	Matthew Wilcox, nvdimm, linux-cxl

Use dax_is_supported() to validate whether the architecture has
virtually aliased caches at mount time.

This is relevant for architectures which require a dynamic check
to validate whether they have virtually aliased data caches
(ARCH_HAS_CACHE_ALIASING_DYNAMIC=y).

Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Jan Kara <jack@suse.com>
Cc: linux-ext4@vger.kernel.org
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: nvdimm@lists.linux.dev
Cc: linux-cxl@vger.kernel.org
---
 fs/ext2/super.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 01f9addc8b1f..0398e7a90eb6 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -585,13 +585,13 @@ static int parse_options(char *options, struct super_block *sb,
 			set_opt(opts->s_mount_opt, XIP);
 			fallthrough;
 		case Opt_dax:
-#ifdef CONFIG_FS_DAX
-			ext2_msg(sb, KERN_WARNING,
-		"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
-			set_opt(opts->s_mount_opt, DAX);
-#else
-			ext2_msg(sb, KERN_INFO, "dax option not supported");
-#endif
+			if (dax_is_supported()) {
+				ext2_msg(sb, KERN_WARNING,
+					 "DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
+				set_opt(opts->s_mount_opt, DAX);
+			} else {
+				ext2_msg(sb, KERN_INFO, "dax option not supported");
+			}
 			break;
 
 #if defined(CONFIG_QUOTA)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFC PATCH 5/7] ext4: Use dax_is_supported()
       [not found] <20240129210631.193493-1-mathieu.desnoyers@efficios.com>
  2024-01-29 21:06 ` [RFC PATCH 4/7] ext2: Use dax_is_supported() Mathieu Desnoyers
@ 2024-01-29 21:06 ` Mathieu Desnoyers
  1 sibling, 0 replies; 4+ messages in thread
From: Mathieu Desnoyers @ 2024-01-29 21:06 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang
  Cc: linux-kernel, Mathieu Desnoyers, Theodore Ts'o,
	Andreas Dilger, linux-ext4, Andrew Morton, Linus Torvalds,
	linux-mm, linux-arch, Matthew Wilcox, nvdimm, linux-cxl

Use dax_is_supported() to validate whether the architecture has
virtually aliased caches at mount time.

This is relevant for architectures which require a dynamic check
to validate whether they have virtually aliased data caches
(ARCH_HAS_CACHE_ALIASING_DYNAMIC=y).

Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: linux-ext4@vger.kernel.org
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: nvdimm@lists.linux.dev
Cc: linux-cxl@vger.kernel.org
---
 fs/ext4/super.c | 52 ++++++++++++++++++++++++-------------------------
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index c5fcf377ab1f..9e0606289239 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2359,34 +2359,32 @@ static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param)
 		return ext4_parse_test_dummy_encryption(param, ctx);
 	case Opt_dax:
 	case Opt_dax_type:
-#ifdef CONFIG_FS_DAX
-	{
-		int type = (token == Opt_dax) ?
-			   Opt_dax : result.uint_32;
-
-		switch (type) {
-		case Opt_dax:
-		case Opt_dax_always:
-			ctx_set_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS);
-			ctx_clear_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER);
-			break;
-		case Opt_dax_never:
-			ctx_set_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER);
-			ctx_clear_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS);
-			break;
-		case Opt_dax_inode:
-			ctx_clear_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS);
-			ctx_clear_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER);
-			/* Strictly for printing options */
-			ctx_set_mount_opt2(ctx, EXT4_MOUNT2_DAX_INODE);
-			break;
+		if (dax_is_supported()) {
+			int type = (token == Opt_dax) ?
+				   Opt_dax : result.uint_32;
+
+			switch (type) {
+			case Opt_dax:
+			case Opt_dax_always:
+				ctx_set_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS);
+				ctx_clear_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER);
+				break;
+			case Opt_dax_never:
+				ctx_set_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER);
+				ctx_clear_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS);
+				break;
+			case Opt_dax_inode:
+				ctx_clear_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS);
+				ctx_clear_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER);
+				/* Strictly for printing options */
+				ctx_set_mount_opt2(ctx, EXT4_MOUNT2_DAX_INODE);
+				break;
+			}
+			return 0;
+		} else {
+			ext4_msg(NULL, KERN_INFO, "dax option not supported");
+			return -EINVAL;
 		}
-		return 0;
-	}
-#else
-		ext4_msg(NULL, KERN_INFO, "dax option not supported");
-		return -EINVAL;
-#endif
 	case Opt_data_err:
 		if (result.uint_32 == Opt_data_err_abort)
 			ctx_set_mount_opt(ctx, m->mount_opt);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 4/7] ext2: Use dax_is_supported()
  2024-01-29 21:06 ` [RFC PATCH 4/7] ext2: Use dax_is_supported() Mathieu Desnoyers
@ 2024-01-30 11:33   ` Jan Kara
  2024-01-30 15:21     ` Mathieu Desnoyers
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kara @ 2024-01-30 11:33 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Dan Williams, Vishal Verma, Dave Jiang, linux-kernel, Jan Kara,
	linux-ext4, Andrew Morton, Linus Torvalds, linux-mm, linux-arch,
	Matthew Wilcox, nvdimm, linux-cxl

On Mon 29-01-24 16:06:28, Mathieu Desnoyers wrote:
> Use dax_is_supported() to validate whether the architecture has
> virtually aliased caches at mount time.
> 
> This is relevant for architectures which require a dynamic check
> to validate whether they have virtually aliased data caches
> (ARCH_HAS_CACHE_ALIASING_DYNAMIC=y).
> 
> Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches")
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Jan Kara <jack@suse.com>
> Cc: linux-ext4@vger.kernel.org
> 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: nvdimm@lists.linux.dev
> Cc: linux-cxl@vger.kernel.org

Looks good to me (although I share Dave's opinion it would be nice to CC
the whole series to fsdevel - luckily we have lore these days so it is not
that tedious to find the whole series :)). Feel free to add:

Acked-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext2/super.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index 01f9addc8b1f..0398e7a90eb6 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -585,13 +585,13 @@ static int parse_options(char *options, struct super_block *sb,
>  			set_opt(opts->s_mount_opt, XIP);
>  			fallthrough;
>  		case Opt_dax:
> -#ifdef CONFIG_FS_DAX
> -			ext2_msg(sb, KERN_WARNING,
> -		"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
> -			set_opt(opts->s_mount_opt, DAX);
> -#else
> -			ext2_msg(sb, KERN_INFO, "dax option not supported");
> -#endif
> +			if (dax_is_supported()) {
> +				ext2_msg(sb, KERN_WARNING,
> +					 "DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
> +				set_opt(opts->s_mount_opt, DAX);
> +			} else {
> +				ext2_msg(sb, KERN_INFO, "dax option not supported");
> +			}
>  			break;
>  
>  #if defined(CONFIG_QUOTA)
> -- 
> 2.39.2
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 4/7] ext2: Use dax_is_supported()
  2024-01-30 11:33   ` Jan Kara
@ 2024-01-30 15:21     ` Mathieu Desnoyers
  0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Desnoyers @ 2024-01-30 15:21 UTC (permalink / raw)
  To: Jan Kara
  Cc: Dan Williams, Vishal Verma, Dave Jiang, linux-kernel, Jan Kara,
	linux-ext4, Andrew Morton, Linus Torvalds, linux-mm, linux-arch,
	Matthew Wilcox, nvdimm, linux-cxl

On 2024-01-30 06:33, Jan Kara wrote:
> On Mon 29-01-24 16:06:28, Mathieu Desnoyers wrote:
>> Use dax_is_supported() to validate whether the architecture has
>> virtually aliased caches at mount time.
>>
>> This is relevant for architectures which require a dynamic check
>> to validate whether they have virtually aliased data caches
>> (ARCH_HAS_CACHE_ALIASING_DYNAMIC=y).
>>
>> Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches")
>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> Cc: Jan Kara <jack@suse.com>
>> Cc: linux-ext4@vger.kernel.org
>> 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: nvdimm@lists.linux.dev
>> Cc: linux-cxl@vger.kernel.org
> 
> Looks good to me (although I share Dave's opinion it would be nice to CC
> the whole series to fsdevel - luckily we have lore these days so it is not
> that tedious to find the whole series :)). Feel free to add:
> 
> Acked-by: Jan Kara <jack@suse.cz>

Hi Jan,

Thanks for looking at it! I will do significant changes for v2, so
I will hold on before integrating your acked-by if it's OK with you.

Thanks!

Mathieu

> 
> 								Honza
> 
>> ---
>>   fs/ext2/super.c | 14 +++++++-------
>>   1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
>> index 01f9addc8b1f..0398e7a90eb6 100644
>> --- a/fs/ext2/super.c
>> +++ b/fs/ext2/super.c
>> @@ -585,13 +585,13 @@ static int parse_options(char *options, struct super_block *sb,
>>   			set_opt(opts->s_mount_opt, XIP);
>>   			fallthrough;
>>   		case Opt_dax:
>> -#ifdef CONFIG_FS_DAX
>> -			ext2_msg(sb, KERN_WARNING,
>> -		"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
>> -			set_opt(opts->s_mount_opt, DAX);
>> -#else
>> -			ext2_msg(sb, KERN_INFO, "dax option not supported");
>> -#endif
>> +			if (dax_is_supported()) {
>> +				ext2_msg(sb, KERN_WARNING,
>> +					 "DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
>> +				set_opt(opts->s_mount_opt, DAX);
>> +			} else {
>> +				ext2_msg(sb, KERN_INFO, "dax option not supported");
>> +			}
>>   			break;
>>   
>>   #if defined(CONFIG_QUOTA)
>> -- 
>> 2.39.2
>>

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-30 15:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240129210631.193493-1-mathieu.desnoyers@efficios.com>
2024-01-29 21:06 ` [RFC PATCH 4/7] ext2: Use dax_is_supported() Mathieu Desnoyers
2024-01-30 11:33   ` Jan Kara
2024-01-30 15:21     ` Mathieu Desnoyers
2024-01-29 21:06 ` [RFC PATCH 5/7] ext4: " Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox