loongson-community / discussions

Cross-community issue tracker & discussions / 跨社区工单追踪 & 讨论场所
11 stars 0 forks source link

pud_write() 没有定义导致编译时kernel panic #69

Closed hanyuwei70 closed 1 month ago

hanyuwei70 commented 1 month ago

3A6000,使用的是2级64k页表内核。 在gentoo下面 emerge net-p2p/qbittorrent 时失败,发现是编译 libtorrent时的问题。

[  327.552185] do_page_fault(): sending SIGSEGV to cc1plus for invalid read access from 00000314573ddf85
[  327.561374] era = 000002aab424627c in cc1plus[184627c,2aab2a00000+1db0000]
[  327.568236] ra  = 000002aab4246e88 in cc1plus[1846e88,2aab2a00000+1db0000]
[  333.585112] ------------[ cut here ]------------
[  333.589717] kernel BUG at include/linux/pgtable.h:1614!
[  333.594927] Oops - BUG[#1]:
[  333.597708] CPU: 6 UID: 250 PID: 1980 Comm: cc1plus Not tainted 6.12.0-rc2 #1
[  333.604809] Hardware name: Loongson Loongson-3A6000-7A2000-1w-V0.1-EVB/Loongson-3A6000-7A2000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V4.0.05823-stable202408 
[  333.618563] pc 9000000002f4ce48 ra 9000000002f4fab8 tp 9000000159170000 sp 90000001591736b0
[  333.618568] a0 900000011fb31994 a1 0000000000000000 a2 900000000445aef0 a3 000003ff90580000
[  333.618570] a4 0000000000000000 a5 000003ffc257ffff a6 0000000000000002 a7 0000000000000003
[  333.618573] t0 0000000000000001 t1 0000000000000040 t2 0000000000000001 t3 0000000000000000
[  333.618575] t4 0000000000000000 t5 900000011fc2ffe8 t6 900000011ecf1c00 t7 000003ff90580000
[  333.660077] t8 900000011ecf1c0c u0 0800080100000000 s9 0000000000001ffd s0 000000000000000e
[  333.660084] s1 9000000004845000 s2 0000000000000000 s3 0000000000000000 s4 000003ffa0000000
[  333.660086] s5 900000011fe52bc0 s6 0000000000000000 s7 900000011fb31900 s8 0000000000000000
[  333.660089]    ra: 9000000002f4fab8 __get_user_pages+0xad8/0xc30
[  333.690962]   ERA: 9000000002f4ce48 pud_write.isra.0+0x0/0x8
[  333.690973]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
[  333.702746]  PRMD: 00000004 (PPLV0 +PIE -PWE)
[  333.702755]  EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
[  333.702761]  ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7)
[  333.702767] ESTAT: 000c0000 [BRK] (IS= ECode=12 EsubCode=0)
[  333.702772]  PRID: 0014d000 (Loongson-64bit, Loongson-3A6000)
[  333.702775] Modules linked in: amdgpu vfat fat drm_exec amdxcp drm_buddy gpu_sched drm_suballoc_helper kvm cfg80211 efi_pstore drm_display_helper spi_loongson_pci pstore spi_loongson_core rfkill fuse nfnetlink ext4 crc16 mbcache jbd2 efivarfs
[  333.702805] Process cc1plus (pid: 1980, threadinfo=0000000035d9e6dd, task=00000000680f9130)
[  333.702808] Stack : 9000000159173820 0000000000000000 9000000005090000 0000000000000000
[  333.702815]         0000000000000000 0000000000000000 0000000000000001 90000001591737b0
[  333.702821]         90000001591737ac 900000011fb31900 9000000002da9a30 9000000159173708
[  333.702827]         9000000159173708 1fadae1a486d81c9 9000000159173740 0000000000000000
[  333.702832]         0000000000000000 1fadae1a486d81c9 9000000159173808 9000000111b299c0
[  333.702837]         9000000159173bd0 000003ffa0000000 9000000159173808 9000000159173810
[  333.702842]         900000011fb31998 900000011fb31900 9000000004845000 000003ffa0000000
[  333.702848]         9000000159173820 9000000002f52ea8 0000000000000000 0000000100000000
[  333.702854]         0000000000000000 1fadae1a486d81c9 9000000159173810 0000000000000001
[  333.702859]         ffffffffffffffff 000003ffc2580000 ffff83c0006d01c0 9000000003093a50
[  333.702864]         ...
[  333.702867] Call Trace:
[  333.702868] [<9000000002f4ce48>] pud_write.isra.0+0x0/0x8
[  333.702876] [<9000000002f4fab4>] __get_user_pages+0xad4/0xc30
[  333.702881] [<9000000002f52ea4>] get_dump_page+0x64/0xf8
[  333.702886] [<9000000003093a4c>] dump_user_range+0x64/0x298
[  333.702891] [<900000000308aeec>] elf_core_dump+0xc34/0xeb8
[  333.702896] [<900000000309343c>] do_coredump+0x12a4/0x1850
[  333.702900] [<9000000002d594e0>] get_signal+0x328/0x888
[  333.702906] [<9000000002d25794>] arch_do_signal_or_restart+0x54/0xe00
[  333.702910] [<9000000003eb2648>] irqentry_exit_to_user_mode+0xb8/0x138
[  333.702917] [<9000000002d35a3c>] tlb_do_page_fault_0+0x114/0x1b4

[  333.702922] Code: 03400000  03400584  4c000020 <002a0001> 03400000  02ff4063  29c06078  29c04079  29c0a061 

[  333.702957] ---[ end trace 0000000000000000 ]---

gentoo群询问得知:

正常是各个架构的linux/pgtable.h定义这个pud_write
但是龙架构没有定义这个函数,所以就到了这个通用的函数了,但这个通用的头文件只会报错
xry111 commented 1 month ago

Per #47 64-KiB page size does not work at all. Or is it patched in Gentoo?

I've been thinking about just removing 64-KiB page size support for a while. It's just stupid to keep the code for it everywhere while it does not really work.

hanyuwei70 commented 1 month ago

没有打过patch,这个是我自己拉的主线build出来的。 暂时移除64k分页也可以,公开说或者在config里面宣布禁用,希望能早日恢复支持。