All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Huang Pei <huangpei@loongson.cn>
Cc: Zhou Yanjie <zhouyanjie@wanyeetech.com>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org, paul.burton@mips.com,
	paul@crapouillou.net, siyanteng@loongson.cn, ira.weiny@intel.com,
	yangtiezhu@loongson.cn, jun.jiang@ingenic.com,
	dongsheng.qiu@ingenic.com, aric.pzqi@ingenic.com,
	rick.tyliu@ingenic.com, sernia.zhou@foxmail.com,
	sihui.liu@ingenic.com
Subject: Re: [PATCH] Revert "MIPS: make userspace mapping young by default".
Date: Thu, 29 Apr 2021 20:04:17 +0200	[thread overview]
Message-ID: <20210429180417.GA10482@alpha.franken.de> (raw)
In-Reply-To: <20210426131146.bj2r4ha7yy5norxa@ambrosehua-HP-xw6600-Workstation>

On Mon, Apr 26, 2021 at 09:11:47PM +0800, Huang Pei wrote:
> [   40.873779] Cause : 4080800c (ExcCode 03)
> [   40.877775] BadVA : 77e23000
> [   40.880645] PrId  : 00d00100 (Ingenic XBurst)
> [   40.884989] Modules linked in:
> [   40.888034] Process Xsession (pid: 1370, threadinfo=ca5ce8d6,
> task=61c8f3ad, tls=77e28690)
> 
> !!! This is my first time debug MIPS32 kernel, I think both threadinfo
> and task should be at KSEG0, instead of KSEG2 or USEG

don't print pointers with %p they will be garbled for security reasons.

see Documentation/core-api/printk-formats.rst

"A raw pointer value may be printed with %p which will hash the address
before printing."

> [   41.233877] Index: 27 pgmask=4kb va=77e22000 asid=5c
> [   41.233877]  [pa=06a17000 c=3 d=0 v=0 g=0] [pa=2017a000 c=0 d=0 v=0
> g=0]
> 
> !!! TLB entry is loading a SWAP entry(C=0, pa=swap) at BADV, the pte_buddy point to a valid
> PFN(C=3, pa seem ok), but it is impossible, since line 116 must flush the tlb and
> replaced swap entry with new page 
> 
> Am I missing something?

not sure, if I'm on the right track, but with the _PAGE_VALID bit set in
the new pte local_r4k_flush_cache_page() will do

        if ((mm == current->active_mm) && (pte_val(*ptep) & _PAGE_VALID))
                vaddr = NULL;


and then

	vaddr ? r4k_blast_dcache_page(addr) :
                r4k_blast_dcache_user_page(addr);

flush the address directly instead with r4k_blast_dcache_user_page().
But the TLB will be updated after the cache flush (which is correct IMHO). 
So setting the VALID bit too early destroys the logic of flushing
cache aliases. Do you agree ?

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

  reply	other threads:[~2021-04-29 18:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-16  8:47 [PATCH] Revert "MIPS: make userspace mapping young by default" 周琰杰 (Zhou Yanjie)
2021-04-16  9:20 ` 黄沛
     [not found]   ` <ae06522f-eda8-96d1-6f58-072905afa65c@wanyeetech.com>
2021-04-19  4:56     ` Huang Pei
2021-04-19 14:21       ` Zhou Yanjie
2021-04-20  2:48         ` Huang Pei
2021-04-20 13:47           ` Zhou Yanjie
2021-04-20 14:03           ` Zhou Yanjie
2021-04-23 14:51             ` Thomas Bogendoerfer
2021-04-24 11:24               ` Zhou Yanjie
2021-04-26 13:11                 ` Huang Pei
2021-04-29 18:04                   ` Thomas Bogendoerfer [this message]
2021-04-30  2:07                     ` Huang Pei
2021-05-08  8:48                     ` Zhou Yanjie
2021-05-26  9:43 Thomas Bogendoerfer
2021-05-26 20:49 ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210429180417.GA10482@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=akpm@linux-foundation.org \
    --cc=aric.pzqi@ingenic.com \
    --cc=dongsheng.qiu@ingenic.com \
    --cc=huangpei@loongson.cn \
    --cc=ira.weiny@intel.com \
    --cc=jun.jiang@ingenic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=paul.burton@mips.com \
    --cc=paul@crapouillou.net \
    --cc=rick.tyliu@ingenic.com \
    --cc=sernia.zhou@foxmail.com \
    --cc=sihui.liu@ingenic.com \
    --cc=siyanteng@loongson.cn \
    --cc=yangtiezhu@loongson.cn \
    --cc=zhouyanjie@wanyeetech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.