On Sat, Apr 17, 2021 at 12:45:59AM +0800, Zhou Yanjie wrote: > > On 2021/4/16 下午5:20, 黄沛 wrote: > > Is there any log about the panic? > > > Yes, below is the log: > > > [ 195.436017] CPU 0 Unable to handle kernel paging request at virtual > address 77eb8000, epc == 80117868, ra == 80118208 > [ 195.446709] Oops[#1]: > [ 195.448977] CPU: 0 PID: 1461 Comm: Xsession Not tainted > 5.12.0-rc6-00227-gc8fc6defbd2e-dirty #1 > [ 195.457661] $ 0 : 00000000 00000001 80117864 77eb9000 > [ 195.462888] $ 4 : 77eb8000 82419600 838ea000 82482ba0 > [ 195.468116] $ 8 : 826f8b18 8306f800 000072d5 8306f800 > [ 195.473343] $12 : 00000002 00000a03 00000001 00000402 > [ 195.478568] $16 : 77eb8000 809faf60 00000004 82482ba0 > [ 195.483794] $20 : 77eb8000 82419600 82482ba0 80860000 > [ 195.489021] $24 : 8086121c 80117864 > [ 195.494248] $28 : 838ea000 838ebd70 00000000 80118208 > [ 195.499475] Hi : 00008c4e > [ 195.502343] Lo : 00004627 > [ 195.505212] epc : 80117868 r4k_blast_dcache_page_dc32+0x4/0x9c > [ 195.511217] ra : 80118208 local_r4k_flush_cache_page+0x120/0x1b8 > [ 195.517476] Status: 10001403 KERNEL EXL IE > [ 195.521657] Cause : 4080800c (ExcCode 03) > [ 195.525654] BadVA : 77eb8000 > [ 195.528523] PrId : 00d00100 (Ingenic XBurst) > [ 195.532866] Modules linked in: > [ 195.535911] Process Xsession (pid: 1461, threadinfo=00975a3e, > task=3724fd66, tls=77ebd690) > [ 195.544162] Stack : 808a05ec f7edcbfd 8306f800 00000000 80860000 809faf60 > 80990a3c 80117f90 > [ 195.552524] 809faf60 82419600 8306f800 801fd84c 00000000 801180b4 > 838ebe80 80110b7c > [ 195.560887] 80990a3c 82482ba0 82482ba0 77eb8000 00004627 f7edcbfd > 838ebe80 801cbc08 > [ 195.569249] 00000001 181b2000 00000000 801fa06c 00000000 83999ae0 > 80860000 00000004 > [ 195.577610] 80990a3c f7edcbfd 80990a3c 838ebe80 00000004 80990a3c > 82482ba0 04627685 > [ 195.585973] ... > [ 195.588413] Call Trace: > [ 195.590849] [<80117868>] r4k_blast_dcache_page_dc32+0x4/0x9c > [ 195.596501] [<80118208>] local_r4k_flush_cache_page+0x120/0x1b8 > [ 195.602413] [<80117f90>] r4k_on_each_cpu.isra.8+0x24/0x58 > [ 195.607805] [<801180b4>] r4k_flush_cache_page+0x34/0x58 > [ 195.613023] [<801cbc08>] wp_page_copy+0x3a8/0x56c > [ 195.617723] [<801ce944>] do_swap_page+0x4cc/0x558 > [ 195.622419] [<801cf3f8>] handle_mm_fault+0x790/0x93c > [ 195.627374] [<8011025c>] do_page_fault+0x19c/0x540 > [ 195.632159] [<801142f0>] tlb_do_page_fault_1+0x10c/0x11c > [ 195.637465] > [ 195.638947] Code: 03e00008 00000000 24831000 <bc950000> bc950020 > bc950040 bc950060 bc950080 bc9500a0 > [ 195.648706] > [ 195.650243] ---[ end trace 7cc7d7f611932c42 ]--- > [ 195.654857] Kernel panic - not syncing: Fatal exception > [ 195.660072] Rebooting in 10 seconds.. > > > this problem can be triggered stably (by use Microsoft Remote Desktop client > to login to debian9 running on CU1830-Neo). > Could you print out the PTE value at 0x77eb8000 ? I really have no idea of how the page_prot setting affecting the swap handling. > > Thanks and best regards! > > > > > > Original Message > > From: 周琰杰 (Zhou Yanjie) > > Sent: 2021年4月16日星期五 16:48 > > To: tsbogend@xxxxxxxxxxxxxxxx > > Cc: linux-mips@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; paul.burton@xxxxxxxx; paul@xxxxxxxxxxxxxxx; siyanteng@xxxxxxxxxxx; huangpei@xxxxxxxxxxx; ira.weiny@xxxxxxxxx; yangtiezhu@xxxxxxxxxxx; zhouyanjie@xxxxxxxxxxxxxx; jun.jiang@xxxxxxxxxxx; dongsheng.qiu@xxxxxxxxxxx; aric.pzqi@xxxxxxxxxxx; rick.tyliu@xxxxxxxxxxx; sernia.zhou@xxxxxxxxxxx > > Subject: [PATCH] Revert "MIPS: make userspace mapping young by default". > > > > This reverts commit f685a533a7fab35c5d069dcd663f59c8e4171a75. > > > > It cause kernel panic on Ingenic X1830, so let's revert it. > > > > Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@xxxxxxxxxxxxxx> > > --- > > arch/mips/mm/cache.c | 31 ++++++++++++++----------------- > > 1 file changed, 14 insertions(+), 17 deletions(-) > > > > diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c > > index 7719d63..9cfd432 100644 > > --- a/arch/mips/mm/cache.c > > +++ b/arch/mips/mm/cache.c > > @@ -21,7 +21,6 @@ > > #include <asm/cpu.h> > > #include <asm/cpu-features.h> > > #include <asm/setup.h> > > -#include <asm/pgtable.h> > > > > /* Cache operations. */ > > void (*flush_cache_all)(void); > > @@ -157,31 +156,29 @@ unsigned long _page_cachable_default; > > EXPORT_SYMBOL(_page_cachable_default); > > > > #define PM(p) __pgprot(_page_cachable_default | (p)) > > -#define PVA(p) PM(_PAGE_VALID | _PAGE_ACCESSED | (p)) > > > > static inline void setup_protection_map(void) > > { > > protection_map[0] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); > > - protection_map[1] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC); > > - protection_map[2] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); > > - protection_map[3] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC); > > - protection_map[4] = PVA(_PAGE_PRESENT); > > - protection_map[5] = PVA(_PAGE_PRESENT); > > - protection_map[6] = PVA(_PAGE_PRESENT); > > - protection_map[7] = PVA(_PAGE_PRESENT); > > + protection_map[1] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC); > > + protection_map[2] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); > > + protection_map[3] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC); > > + protection_map[4] = PM(_PAGE_PRESENT); > > + protection_map[5] = PM(_PAGE_PRESENT); > > + protection_map[6] = PM(_PAGE_PRESENT); > > + protection_map[7] = PM(_PAGE_PRESENT); > > > > protection_map[8] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); > > - protection_map[9] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC); > > - protection_map[10] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | > > + protection_map[9] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC); > > + protection_map[10] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | > > _PAGE_NO_READ); > > - protection_map[11] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE); > > - protection_map[12] = PVA(_PAGE_PRESENT); > > - protection_map[13] = PVA(_PAGE_PRESENT); > > - protection_map[14] = PVA(_PAGE_PRESENT); > > - protection_map[15] = PVA(_PAGE_PRESENT); > > + protection_map[11] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE); > > + protection_map[12] = PM(_PAGE_PRESENT); > > + protection_map[13] = PM(_PAGE_PRESENT); > > + protection_map[14] = PM(_PAGE_PRESENT | _PAGE_WRITE); > > + protection_map[15] = PM(_PAGE_PRESENT | _PAGE_WRITE); > > } > > > > -#undef _PVA > > #undef PM > > > > void cpu_cache_init(void)