On Thu, Apr 10, 2025 at 01:14:42PM +0800, kernel test robot wrote:
> 
> 
> Hello,
> 
> kernel test robot noticed 
> "WARNING:at_mm/truncate.c:#truncate_folio_batch_exceptionals" on:
> 
> commit: bde708f1a65d025c45575bfe1e7bf7bdf7e71e87 ("fs/dax: always remove DAX 
> page-cache entries when breaking layouts")

This is warning about hitting the bug that commit 0e2f80afcfa6 ("fs/dax: ensure
all pages are idle prior to filesystem unmount") fixes. I couldn't reorder that
patch before this one because it relies on the DAX page-cache entries always
being removed when breaking layouts.

However I note that this is ext2. Commit 0e2f80afcfa6 doesn't actually update
ext2 so the warning will persist. The fix should basically be the same as for
ext4:

--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -74,6 +74,8 @@ void ext2_evict_inode(struct inode * inode)
        struct ext2_block_alloc_info *rsv;
        int want_delete = 0;
 
+        dax_break_layout_final(inode);
+
        if (!inode->i_nlink && !is_bad_inode(inode)) {
                want_delete = 1;
                dquot_initialize(inode);

What's more troubling though is unlike ext4 there is no ext2_dax_break_layouts()
defined, which is how I missed updating it. That means truncate with FS DAX
is already pretty broken for ext2, and will need more than just the above fix
to ensure DAX pages are idle before truncate. So I think FS DAX on ext2 should
probably just be removed or marked broken unless someone with more knowledge of
ext2 wants to fix it up?

> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
> 
> in testcase: xfstests
> version: xfstests-x86_64-8467552f-1_20241215
> with following parameters:
> 
>       bp1_memmap: 4G!8G
>       bp2_memmap: 4G!10G
>       bp3_memmap: 4G!16G
>       bp4_memmap: 4G!22G
>       nr_pmem: 4
>       fs: ext2
>       test: generic-dax
> 
> 
> 
> config: x86_64-rhel-9.4-func
> compiler: gcc-12
> test machine: 8 threads Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (Skylake) 
> with 28G memory
> 
> (please refer to attached dmesg/kmsg for entire log/backtrace)
> 
> 
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version 
> of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <oliver.s...@intel.com>
> | Closes: https://lore.kernel.org/oe-lkp/202504101036.390f29a5-...@intel.com
> 
> 
> [   46.394237][ T4025] ------------[ cut here ]------------
> [ 46.399593][ T4025] WARNING: CPU: 7 PID: 4025 at mm/truncate.c:89 
> truncate_folio_batch_exceptionals (mm/truncate.c:89 (discriminator 1)) 
> [   46.409748][ T4025] Modules linked in: ext2 snd_hda_codec_hdmi snd_ctl_led 
> snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component 
> intel_rapl_msr btrfs intel_rapl_common blake2b_generic xor ipmi_devintf 
> zstd_compress ipmi_msghandler x86_pkg_temp_thermal snd_soc_avs 
> intel_powerclamp raid6_pq snd_soc_hda_codec snd_hda_ext_core coretemp 
> snd_soc_core snd_compress kvm_intel i915 sd_mod snd_hda_intel kvm 
> snd_intel_dspcfg sg snd_intel_sdw_acpi intel_gtt snd_hda_codec cec dell_pc 
> platform_profile drm_buddy ghash_clmulni_intel snd_hda_core sha512_ssse3 
> dell_wmi ttm sha256_ssse3 snd_hwdep nd_pmem sha1_ssse3 dell_smbios 
> drm_display_helper nd_btt snd_pcm dax_pmem mei_wdt rapl drm_kms_helper ahci 
> mei_me snd_timer libahci rfkill nd_e820 intel_cstate sparse_keymap video 
> wmi_bmof dcdbas dell_wmi_descriptor libnvdimm libata pcspkr intel_uncore 
> i2c_i801 snd mei i2c_smbus soundcore intel_pch_thermal intel_pmc_core 
> intel_vsec wmi pmt_telemetry acpi_pad pmt_class binfmt_misc fuse loop drm 
> dm_mod ip_tables
> [   46.498759][ T4025] CPU: 7 UID: 0 PID: 4025 Comm: umount Not tainted 
> 6.14.0-rc6-00297-gbde708f1a65d #1
> [   46.508156][ T4025] Hardware name: Dell Inc. OptiPlex 7040/0Y7WYT, BIOS 
> 1.2.8 01/26/2016
> [ 46.516324][ T4025] RIP: 0010:truncate_folio_batch_exceptionals 
> (mm/truncate.c:89 (discriminator 1)) 
> [ 46.523347][ T4025] Code: 84 70 ff ff ff 4d 63 fd 49 83 ff 1e 0f 87 d4 01 00 
> 00 4c 89 f0 48 c1 e8 03 42 80 3c 00 00 0f 85 9b 01 00 00 41 f6 06 01 74 c6 
> <0f> 0b 48 89 c8 48 c1 e8 03 42 80 3c 00 00 0f 85 d6 01 00 00 48 8b
> All code
> ========
>    0: 84 70 ff                test   %dh,-0x1(%rax)
>    3: ff                      (bad)
>    4: ff 4d 63                decl   0x63(%rbp)
>    7: fd                      std
>    8: 49 83 ff 1e             cmp    $0x1e,%r15
>    c: 0f 87 d4 01 00 00       ja     0x1e6
>   12: 4c 89 f0                mov    %r14,%rax
>   15: 48 c1 e8 03             shr    $0x3,%rax
>   19: 42 80 3c 00 00          cmpb   $0x0,(%rax,%r8,1)
>   1e: 0f 85 9b 01 00 00       jne    0x1bf
>   24: 41 f6 06 01             testb  $0x1,(%r14)
>   28: 74 c6                   je     0xfffffffffffffff0
>   2a:*        0f 0b                   ud2             <-- trapping instruction
>   2c: 48 89 c8                mov    %rcx,%rax
>   2f: 48 c1 e8 03             shr    $0x3,%rax
>   33: 42 80 3c 00 00          cmpb   $0x0,(%rax,%r8,1)
>   38: 0f 85 d6 01 00 00       jne    0x214
>   3e: 48                      rex.W
>   3f: 8b                      .byte 0x8b
> 
> Code starting with the faulting instruction
> ===========================================
>    0: 0f 0b                   ud2
>    2: 48 89 c8                mov    %rcx,%rax
>    5: 48 c1 e8 03             shr    $0x3,%rax
>    9: 42 80 3c 00 00          cmpb   $0x0,(%rax,%r8,1)
>    e: 0f 85 d6 01 00 00       jne    0x1ea
>   14: 48                      rex.W
>   15: 8b                      .byte 0x8b
> [   46.542938][ T4025] RSP: 0018:ffffc9000d74f370 EFLAGS: 00010202
> [   46.548900][ T4025] RAX: 1ffff92001ae9ec8 RBX: ffff8881e2d959d8 RCX: 
> ffffc9000d74f4f8
> [   46.556787][ T4025] RDX: 0000000000000001 RSI: ffffc9000d74f638 RDI: 
> ffff8881e2d95874
> [   46.564676][ T4025] RBP: 1ffff92001ae9e74 R08: dffffc0000000000 R09: 
> fffff52001ae9eec
> [   46.572557][ T4025] R10: 0000000000000003 R11: 1ffff110d4bf8d9c R12: 
> ffffc9000d74f638
> [   46.580439][ T4025] R13: 0000000000000000 R14: ffffc9000d74f640 R15: 
> 0000000000000000
> [   46.588319][ T4025] FS:  00007fe696f3a840(0000) GS:ffff8886a5f80000(0000) 
> knlGS:0000000000000000
> [   46.597163][ T4025] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [   46.603691][ T4025] CR2: 00007fff266c5ec0 CR3: 00000001ead7e002 CR4: 
> 00000000003726f0
> [   46.611586][ T4025] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 
> 0000000000000000
> [   46.619468][ T4025] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 
> 0000000000000400
> [   46.627353][ T4025] Call Trace:
> [   46.630520][ T4025]  <TASK>
> [ 46.633337][ T4025] ? __warn (kernel/panic.c:748) 
> [ 46.637296][ T4025] ? truncate_folio_batch_exceptionals (mm/truncate.c:89 
> (discriminator 1)) 
> [ 46.643697][ T4025] ? report_bug (lib/bug.c:180 lib/bug.c:219) 
> [ 46.648091][ T4025] ? handle_bug (arch/x86/kernel/traps.c:285) 
> [ 46.652322][ T4025] ? exc_invalid_op (arch/x86/kernel/traps.c:309 
> (discriminator 1)) 
> [ 46.656905][ T4025] ? asm_exc_invalid_op 
> (arch/x86/include/asm/idtentry.h:574) 
> [ 46.661838][ T4025] ? truncate_folio_batch_exceptionals (mm/truncate.c:89 
> (discriminator 1)) 
> [ 46.668239][ T4025] ? __kernel_text_address (kernel/extable.c:79) 
> [ 46.673356][ T4025] ? __pfx_truncate_folio_batch_exceptionals 
> (mm/truncate.c:62) 
> [ 46.680123][ T4025] ? arch_stack_walk (arch/x86/kernel/stacktrace.c:26) 
> [ 46.684782][ T4025] truncate_inode_pages_range (mm/truncate.c:339) 
> [ 46.690407][ T4025] ? __pfx_truncate_inode_pages_range (mm/truncate.c:304) 
> [ 46.696546][ T4025] ? __pfx_i_callback (fs/inode.c:322) 
> [ 46.701292][ T4025] ? kasan_save_stack (mm/kasan/common.c:49) 
> [ 46.706032][ T4025] ? kasan_record_aux_stack (mm/kasan/generic.c:548) 
> [ 46.711298][ T4025] ? __call_rcu_common+0xc3/0x9e0 
> [ 46.717279][ T4025] ? evict (fs/inode.c:772 (discriminator 2)) 
> [ 46.721236][ T4025] ? dispose_list (fs/inode.c:846) 
> [ 46.725751][ T4025] ? evict_inodes (fs/inode.c:860) 
> [ 46.730339][ T4025] ? generic_shutdown_super (fs/super.c:633) 
> [ 46.735699][ T4025] ? kill_block_super (fs/super.c:1711) 
> [ 46.740447][ T4025] ? deactivate_locked_super (fs/super.c:473) 
> [ 46.745905][ T4025] ? cleanup_mnt (fs/namespace.c:281 fs/namespace.c:1414) 
> [ 46.750400][ T4025] ? task_work_run (kernel/task_work.c:227 (discriminator 
> 1)) 
> [ 46.755076][ T4025] ? syscall_exit_to_user_mode 
> (include/linux/resume_user_mode.h:50 kernel/entry/common.c:114 
> include/linux/entry-common.h:329 kernel/entry/common.c:207 
> kernel/entry/common.c:218) 
> [ 46.760796][ T4025] ? do_syscall_64 (arch/x86/entry/common.c:102) 
> [ 46.765381][ T4025] ? entry_SYSCALL_64_after_hwframe 
> (arch/x86/entry/entry_64.S:130) 
> [ 46.771363][ T4025] ? blk_finish_plug (block/blk-core.c:1241 
> block/blk-core.c:1237) 
> [ 46.776026][ T4025] ? blkdev_writepages (block/fops.c:453) 
> [ 46.780864][ T4025] ? __pfx_blkdev_writepages (block/fops.c:453) 
> [ 46.786241][ T4025] ? __blk_flush_plug (include/linux/blk-mq.h:234 
> block/blk-core.c:1220) 
> [ 46.791152][ T4025] ? xas_find_marked (lib/xarray.c:1382) 
> [ 46.795990][ T4025] ? __pfx_inode_free_by_rcu (security/security.c:1708) 
> [ 46.801351][ T4025] ? rcu_segcblist_enqueue 
> (arch/x86/include/asm/atomic64_64.h:25 
> include/linux/atomic/atomic-arch-fallback.h:2672 
> include/linux/atomic/atomic-long.h:121 
> include/linux/atomic/atomic-instrumented.h:3261 
> kernel/rcu/rcu_segcblist.c:214 kernel/rcu/rcu_segcblist.c:231 
> kernel/rcu/rcu_segcblist.c:332) 
> [ 46.806537][ T4025] ? fsnotify_grab_connector (fs/notify/mark.c:702) 
> [ 46.811898][ T4025] ? _raw_spin_lock (arch/x86/include/asm/atomic.h:107 
> include/linux/atomic/atomic-arch-fallback.h:2170 
> include/linux/atomic/atomic-instrumented.h:1302 
> include/asm-generic/qspinlock.h:111 include/linux/spinlock.h:187 
> include/linux/spinlock_api_smp.h:134 kernel/locking/spinlock.c:154) 
> [ 46.816473][ T4025] ? inode_wait_for_writeback 
> (arch/x86/include/asm/atomic.h:23 
> include/linux/atomic/atomic-arch-fallback.h:457 
> include/linux/atomic/atomic-instrumented.h:33 
> include/asm-generic/qspinlock.h:57 fs/fs-writeback.c:1541) 
> [ 46.822012][ T4025] ? _raw_spin_lock_irq (arch/x86/include/asm/atomic.h:107 
> include/linux/atomic/atomic-arch-fallback.h:2170 
> include/linux/atomic/atomic-instrumented.h:1302 
> include/asm-generic/qspinlock.h:111 include/linux/spinlock.h:187 
> include/linux/spinlock_api_smp.h:120 kernel/locking/spinlock.c:170) 
> [   46.824528][  T331] LKP: stdout: 302: HOSTNAME lkp-skl-d01, MAC 
> f4:8e:38:7c:5b:de, kernel 6.14.0-rc6-00297-gbde708f1a65d 1
> [ 46.826917][ T4025] ? __pfx__raw_spin_lock_irq 
> (kernel/locking/spinlock.c:169) 
> [   46.826949][  T331]
> [ 46.838033][ T4025] ? _raw_spin_lock (arch/x86/include/asm/atomic.h:107 
> include/linux/atomic/atomic-arch-fallback.h:2170 
> include/linux/atomic/atomic-instrumented.h:1302 
> include/asm-generic/qspinlock.h:111 include/linux/spinlock.h:187 
> include/linux/spinlock_api_smp.h:134 kernel/locking/spinlock.c:154) 
> [ 46.838054][ T4025] ext2_evict_inode (fs/ext2/inode.c:99) ext2 
> [   46.847318][  T333] 262144 bytes (262 kB, 256 KiB) copied, 0.0043872 s, 
> 59.8 MB/s
> [ 46.850251][ T4025] evict (fs/inode.c:796) 
> [   46.855527][  T333]
> [ 46.863038][ T4025] ? __pfx_evict (fs/inode.c:772) 
> [ 46.863056][ T4025] ? _raw_spin_lock (arch/x86/include/asm/atomic.h:107 
> include/linux/atomic/atomic-arch-fallback.h:2170 
> include/linux/atomic/atomic-instrumented.h:1302 
> include/asm-generic/qspinlock.h:111 include/linux/spinlock.h:187 
> include/linux/spinlock_api_smp.h:134 kernel/locking/spinlock.c:154) 
> [   46.867191][  T333] 512+0 records in
> [ 46.869033][ T4025] ? __pfx__raw_spin_lock (kernel/locking/spinlock.c:153) 
> [   46.873347][  T333]
> [ 46.877892][ T4025] dispose_list (fs/inode.c:846) 
> [   46.881842][  T333] 512+0 records out
> [ 46.886610][ T4025] evict_inodes (fs/inode.c:860) 
> [   46.888832][  T333]
> [ 46.893113][ T4025] ? __pfx_evict_inodes (fs/inode.c:860) 
> [ 46.893135][ T4025] ? filemap_check_errors 
> (arch/x86/include/asm/bitops.h:206 (discriminator 6) 
> arch/x86/include/asm/bitops.h:238 (discriminator 6) 
> include/asm-generic/bitops/instrumented-non-atomic.h:142 (discriminator 6) 
> mm/filemap.c:349 (discriminator 6)) 
> [ 46.913439][ T4025] generic_shutdown_super (fs/super.c:633) 
> [ 46.918627][ T4025] kill_block_super (fs/super.c:1711) 
> [ 46.923204][ T4025] deactivate_locked_super (fs/super.c:473) 
> [ 46.928477][ T4025] cleanup_mnt (fs/namespace.c:281 fs/namespace.c:1414) 
> [ 46.932792][ T4025] task_work_run (kernel/task_work.c:227 (discriminator 1)) 
> [ 46.937282][ T4025] ? __pfx_task_work_run (kernel/task_work.c:195) 
> [ 46.942292][ T4025] ? __x64_sys_umount (fs/namespace.c:2074 
> fs/namespace.c:2079 fs/namespace.c:2077 fs/namespace.c:2077) 
> [ 46.947218][ T4025] ? __pfx___x64_sys_umount (fs/namespace.c:2077) 
> [ 46.952480][ T4025] ? vfs_fstatat (fs/stat.c:372) 
> [ 46.956809][ T4025] syscall_exit_to_user_mode 
> (include/linux/resume_user_mode.h:50 kernel/entry/common.c:114 
> include/linux/entry-common.h:329 kernel/entry/common.c:207 
> kernel/entry/common.c:218) 
> [ 46.962348][ T4025] do_syscall_64 (arch/x86/entry/common.c:102) 
> [ 46.966749][ T4025] ? syscall_exit_to_user_mode 
> (arch/x86/include/asm/irqflags.h:37 arch/x86/include/asm/irqflags.h:92 
> include/linux/entry-common.h:232 kernel/entry/common.c:206 
> kernel/entry/common.c:218) 
> [ 46.972284][ T4025] ? syscall_exit_to_user_mode 
> (arch/x86/include/asm/irqflags.h:37 arch/x86/include/asm/irqflags.h:92 
> include/linux/entry-common.h:232 kernel/entry/common.c:206 
> kernel/entry/common.c:218) 
> [ 46.977832][ T4025] ? syscall_exit_to_user_mode 
> (arch/x86/include/asm/irqflags.h:37 arch/x86/include/asm/irqflags.h:92 
> include/linux/entry-common.h:232 kernel/entry/common.c:206 
> kernel/entry/common.c:218) 
> [ 46.983369][ T4025] ? do_syscall_64 (arch/x86/entry/common.c:102) 
> [ 46.987953][ T4025] ? check_heap_object (mm/usercopy.c:189) 
> [ 46.992887][ T4025] ? kasan_save_track (arch/x86/include/asm/current.h:49 
> mm/kasan/common.c:60 mm/kasan/common.c:69) 
> [ 46.997649][ T4025] ? kmem_cache_free (mm/slub.c:4622 mm/slub.c:4724) 
> [   47.000912][  T333] 262144 bytes (262 kB, 256 KiB) copied, 0.00767215 s, 
> 34.2 MB/s
> [ 47.002474][ T4025] ? vfs_fstatat (fs/stat.c:372) 
> [   47.002504][  T333]
> [ 47.010137][ T4025] ? vfs_fstatat (fs/stat.c:372) 
> [   47.014750][  T333] 512+0 records in
> [ 47.016647][ T4025] ? __do_sys_newfstatat (fs/stat.c:533) 
> [ 47.016665][ T4025] ? __pfx___do_sys_newfstatat (fs/stat.c:528) 
> [   47.020981][  T333]
> [ 47.024567][ T4025] ? __count_memcg_events (mm/memcontrol.c:583 
> mm/memcontrol.c:859) 
> [ 47.024588][ T4025] ? handle_mm_fault (mm/memory.c:6102 mm/memory.c:6255) 
> [ 47.024593][ T4025] ? syscall_exit_to_user_mode 
> (arch/x86/include/asm/irqflags.h:37 arch/x86/include/asm/irqflags.h:92 
> include/linux/entry-common.h:232 kernel/entry/common.c:206 
> kernel/entry/common.c:218) 
> [   47.029926][  T333] 512+0 records out
> [ 47.035106][ T4025] ? do_syscall_64 (arch/x86/entry/common.c:102) 
> [ 47.035129][ T4025] ? exc_page_fault (arch/x86/include/asm/irqflags.h:37 
> arch/x86/include/asm/irqflags.h:92 arch/x86/mm/fault.c:1488 
> arch/x86/mm/fault.c:1538) 
> [   47.037332][  T333]
> [ 47.042576][ T4025] entry_SYSCALL_64_after_hwframe 
> (arch/x86/entry/entry_64.S:130) 
> [   47.042596][ T4025] RIP: 0033:0x7fe697166af7
> [   47.048552][  T333] 262144 bytes (262 kB, 256 KiB) copied, 0.00560232 s, 
> 46.8 MB/s
> [ 47.052938][ T4025] Code: 0f 93 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 
> 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 
> <48> 3d 00 f0 ff ff 77 01 c3 48 8b 15 d9 92 0c 00 f7 d8 64 89 02 b8
> All code
> ========
>    0: 0f 93 0c 00             setae  (%rax,%rax,1)
>    4: f7 d8                   neg    %eax
>    6: 64 89 01                mov    %eax,%fs:(%rcx)
>    9: 48 83 c8 ff             or     $0xffffffffffffffff,%rax
>    d: c3                      ret
> 
> 
> The kernel config and materials to reproduce are available at:
> https://download.01.org/0day-ci/archive/20250410/202504101036.390f29a5-...@intel.com
> 
> 
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
> 

Reply via email to