Re: [PATCH] x86/mm: Remove unnecessary casts in init_64.c

From: kernel test robot
Date: Fri Jan 12 2024 - 08:20:46 EST




Hello,

kernel test robot noticed "kernel_BUG_at_arch/x86/mm/init_64.c" on:

commit: b4f7cb0d6fbedcc9946304f02513f97ae2d3ef0c ("[PATCH] x86/mm: Remove unnecessary casts in init_64.c")
url: https://github.com/intel-lab-lkp/linux/commits/Yukai-Wu/x86-mm-Remove-unnecessary-casts-in-init_64-c/20240107-123342
base: https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git 91c17d7b04498ffb52939a18eb7e28fd23c9b654
patch link: https://lore.kernel.org/all/tencent_16DE28073E2F2BF284331B21ADFA58AB2907@xxxxxx/
patch subject: [PATCH] x86/mm: Remove unnecessary casts in init_64.c

in testcase: filebench
version: filebench-x86_64-22620e6-1_20221010
with following parameters:

disk: 1HDD
fs: btrfs
fs2: cifs
test: filemicro_create.f
cpufreq_governor: performance



compiler: gcc-12
test machine: 96 threads 2 sockets Intel(R) Xeon(R) Platinum 8260L CPU @ 2.40GHz (Cascade Lake) with 128G 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.sang@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-lkp/202401121719.fb50534f-oliver.sang@xxxxxxxxx


[ 31.641127][ T1120] ------------[ cut here ]------------
[ 31.646457][ T1120] kernel BUG at arch/x86/mm/init_64.c:202!
[ 31.652129][ T1120] invalid opcode: 0000 [#1] SMP NOPTI
[ 31.657362][ T1120] CPU: 12 PID: 1120 Comm: systemd-udevd Not tainted 6.7.0-rc2-00003-gb4f7cb0d6fbe #1
[ 31.666670][ T1120] Hardware name: Intel Corporation S2600WFD/S2600WFD, BIOS SE5C620.86B.0D.01.0286.011120190816 01/11/2019
[ 31.677790][ T1120] RIP: 0010:sync_global_pgds_l4 (arch/x86/mm/init_64.c:202 (discriminator 1))
[ 31.683541][ T1120] Code: e8 97 ea 00 00 48 89 c6 49 89 36 e9 2a ff ff ff 48 c7 c7 48 90 bb 83 c6 07 00 0f 1f 00 8b 0d 8d d1 94 01 e9 84 fe ff ff 0f 0b <0f> 0b 66 66 2e 0f 1f 84 00 00 00 00 00 66 66 2e 0f 1f 84 00 00 00
All code
========
0: e8 97 ea 00 00 callq 0xea9c
5: 48 89 c6 mov %rax,%rsi
8: 49 89 36 mov %rsi,(%r14)
b: e9 2a ff ff ff jmpq 0xffffffffffffff3a
10: 48 c7 c7 48 90 bb 83 mov $0xffffffff83bb9048,%rdi
17: c6 07 00 movb $0x0,(%rdi)
1a: 0f 1f 00 nopl (%rax)
1d: 8b 0d 8d d1 94 01 mov 0x194d18d(%rip),%ecx # 0x194d1b0
23: e9 84 fe ff ff jmpq 0xfffffffffffffeac
28: 0f 0b ud2
2a:* 0f 0b ud2 <-- trapping instruction
2c: 66 66 2e 0f 1f 84 00 data16 nopw %cs:0x0(%rax,%rax,1)
33: 00 00 00 00
37: 66 data16
38: 66 data16
39: 2e cs
3a: 0f .byte 0xf
3b: 1f (bad)
3c: 84 00 test %al,(%rax)
...

Code starting with the faulting instruction
===========================================
0: 0f 0b ud2
2: 66 66 2e 0f 1f 84 00 data16 nopw %cs:0x0(%rax,%rax,1)
9: 00 00 00 00
d: 66 data16
e: 66 data16
f: 2e cs
10: 0f .byte 0xf
11: 1f (bad)
12: 84 00 test %al,(%rax)
...
[ 31.702992][ T1120] RSP: 0018:ffffc9000aa8b9b8 EFLAGS: 00010206
[ 31.708918][ T1120] RAX: ffff88805f7f4000 RBX: ffff88df7f20d4ac RCX: ffff888000000000
[ 31.716743][ T1120] RDX: 000ffffffffff000 RSI: ffff8881bdc72000 RDI: ffff88df7f20d4ac
[ 31.724566][ T1120] RBP: ffff890000000000 R08: 8000000000000163 R09: 0000000000000001
[ 31.732395][ T1120] R10: ffff890000000000 R11: 0000000000000001 R12: ffffffff82c1c890
[ 31.740218][ T1120] R13: 0000000001ffff12 R14: ffff88df65642112 R15: ffffea017d959080
[ 31.748045][ T1120] FS: 00007f916a9ae8c0(0000) GS:ffff88903f900000(0000) knlGS:0000000000000000
[ 31.756822][ T1120] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 31.761388][ T8] EDID block 0 (tag 0x00) checksum is invalid, remainder is 125
[ 31.763260][ T1120] CR2: 00007f9169f4f56c CR3: 0000005f6511a006 CR4: 00000000007706f0
[ 31.763261][ T1120] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 31.763262][ T1120] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 31.763263][ T1120] PKRU: 55555554
[ 31.770744][ T8] [00] BAD 00 ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff
[ 31.778566][ T1120] Call Trace:
[ 31.778568][ T1120] <TASK>
[ 31.778569][ T1120] ? die (arch/x86/kernel/dumpstack.c:421 arch/x86/kernel/dumpstack.c:434 arch/x86/kernel/dumpstack.c:447)
[ 31.786396][ T8] [00] BAD ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[ 31.794218][ T1120] ? do_trap (arch/x86/kernel/traps.c:112 arch/x86/kernel/traps.c:153)
[ 31.794221][ T1120] ? sync_global_pgds_l4 (arch/x86/mm/init_64.c:202 (discriminator 1))
[ 31.794222][ T1120] ? do_error_trap (arch/x86/include/asm/traps.h:59 arch/x86/kernel/traps.c:174)
[ 31.797627][ T8] [00] BAD ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[ 31.804843][ T1120] ? sync_global_pgds_l4 (arch/x86/mm/init_64.c:202 (discriminator 1))
[ 31.804844][ T1120] ? exc_invalid_op (arch/x86/kernel/traps.c:265)
[ 31.807991][ T8] [00] BAD ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[ 31.810789][ T1120] ? sync_global_pgds_l4 (arch/x86/mm/init_64.c:202 (discriminator 1))
[ 31.810791][ T1120] ? asm_exc_invalid_op (arch/x86/include/asm/idtentry.h:568)
[ 31.814368][ T8] [00] BAD ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[ 31.821589][ T1120] ? sync_global_pgds_l4 (arch/x86/mm/init_64.c:202 (discriminator 1))
[ 31.821590][ T1120] ? sync_global_pgds_l4 (arch/x86/mm/init_64.c:201)
[ 31.821591][ T1120] __kernel_physical_mapping_init (arch/x86/mm/init_64.c:773)
[ 31.825611][ T8] [00] BAD ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[ 31.830749][ T1120] init_memory_mapping (arch/x86/mm/init.c:548 (discriminator 3))
[ 31.830753][ T1120] arch_add_memory (arch/x86/mm/init_64.c:969)
[ 31.830755][ T1120] pagemap_range (mm/memremap.c:246)
[ 31.835203][ T8] [00] BAD ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[ 31.842420][ T1120] memremap_pages (mm/memremap.c:367)
[ 31.842422][ T1120] ? devres_add (drivers/base/devres.c:70 drivers/base/devres.c:134 drivers/base/devres.c:249)
[ 31.847568][ T8] [00] BAD ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[ 31.852100][ T1120] devm_memremap_pages (mm/memremap.c:407)
[ 31.852114][ T1120] dev_dax_probe (drivers/dax/device.c:449) device_dax
[ 31.859677][ T777] scsi host5: ahci
[ 31.864475][ T1120] dax_bus_probe (drivers/dax/bus.c:201)
[ 31.869394][ T777] ata1: DUMMY
[ 31.876575][ T1120] really_probe (drivers/base/dd.c:579 drivers/base/dd.c:658)
[ 31.881714][ T777] ata2: DUMMY
[ 31.886852][ T1120] ? __pfx___driver_attach (drivers/base/dd.c:1157)
[ 31.886854][ T1120] __driver_probe_device (drivers/base/dd.c:800)
[ 31.886856][ T1120] driver_probe_device (drivers/base/dd.c:830)
[ 31.892773][ T777] ata3: DUMMY
[ 31.899989][ T1120] __driver_attach (drivers/base/dd.c:1217)
[ 31.899992][ T1120] bus_for_each_dev (drivers/base/bus.c:368)
[ 31.899994][ T1120] bus_add_driver (drivers/base/bus.c:673)
[ 31.904873][ T777] ata4: DUMMY
[ 31.909318][ T1120] driver_register (drivers/base/driver.c:246)
[ 31.909320][ T1120] ? __pfx_dax_init (drivers/dax/device.c:263) device_dax
[ 31.913776][ T777] ata5: SATA max UDMA/133 abar m524288@0x92180000 port 0x92180300 irq 358 lpm-pol 0
[ 31.920990][ T1120] do_one_initcall (init/main.c:1236)
[ 31.925525][ T777] ata6: SATA max UDMA/133 abar m524288@0x92180000 port 0x92180380 irq 358 lpm-pol 0
[ 31.929709][ T1120] do_init_module (kernel/module/main.c:2530)
[ 31.937992][ T777] ahci 0000:00:17.0: AHCI 0001.0301 32 slots 8 ports 6 Gbps 0xff impl SATA mode
[ 31.941722][ T1120] init_module_from_file (kernel/module/main.c:3148)
[ 31.941725][ T1120] idempotent_init_module (include/linux/spinlock.h:351 kernel/module/main.c:3111 kernel/module/main.c:3165)
[ 31.947303][ T777] ahci 0000:00:17.0: flags: 64bit ncq sntf led clo only pio slum part ems deso sadm sds apst
[ 31.950878][ T1120] __x64_sys_finit_module (include/linux/file.h:45 kernel/module/main.c:3187 kernel/module/main.c:3169 kernel/module/main.c:3169)
[ 31.950880][ T1120] do_syscall_64 (arch/x86/entry/common.c:51 arch/x86/entry/common.c:82)
[ 31.977632][ T777] scsi host6: ahci
[ 31.980789][ T1120] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:129)
[ 31.984225][ T777] scsi host7: ahci
[ 31.988473][ T1120] RIP: 0033:0x7f916ae63f29
[ 31.988475][ T1120] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 37 8f 0d 00 f7 d8 64 89 01 48
All code
========
0: 00 c3 add %al,%bl
2: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
9: 00 00 00
c: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
11: 48 89 f8 mov %rdi,%rax
14: 48 89 f7 mov %rsi,%rdi
17: 48 89 d6 mov %rdx,%rsi
1a: 48 89 ca mov %rcx,%rdx
1d: 4d 89 c2 mov %r8,%r10
20: 4d 89 c8 mov %r9,%r8
23: 4c 8b 4c 24 08 mov 0x8(%rsp),%r9
28: 0f 05 syscall
2a:* 48 3d 01 f0 ff ff cmp $0xfffffffffffff001,%rax <-- trapping instruction
30: 73 01 jae 0x33
32: c3 retq
33: 48 8b 0d 37 8f 0d 00 mov 0xd8f37(%rip),%rcx # 0xd8f71
3a: f7 d8 neg %eax
3c: 64 89 01 mov %eax,%fs:(%rcx)
3f: 48 rex.W

Code starting with the faulting instruction
===========================================
0: 48 3d 01 f0 ff ff cmp $0xfffffffffffff001,%rax
6: 73 01 jae 0x9
8: c3 retq
9: 48 8b 0d 37 8f 0d 00 mov 0xd8f37(%rip),%rcx # 0xd8f47
10: f7 d8 neg %eax
12: 64 89 01 mov %eax,%fs:(%rcx)
15: 48 rex.W


The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240112/202401121719.fb50534f-oliver.sang@xxxxxxxxx



--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki