linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Huang Pei <huangpei@loongson.cn>
Cc: ambrosehua@gmail.com, Bibo Mao <maobibo@loongson.cn>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mips@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-mm@kvack.org, Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Paul Burton <paulburton@kernel.org>,
	Li Xuefeng <lixuefeng@loongson.cn>,
	Yang Tiezhu <yangtiezhu@loongson.cn>,
	Gao Juxin <gaojuxin@loongson.cn>,
	Fuxin Zhang <zhangfx@lemote.com>, Huacai Chen <chenhc@lemote.com>
Subject: Re: [PATCH V3] MIPS: make userspace mapping young by default
Date: Fri, 2 Oct 2020 14:35:03 +0200	[thread overview]
Message-ID: <20201002123502.GA11098@alpha.franken.de> (raw)
In-Reply-To: <20200919074731.22372-1-huangpei@loongson.cn>

On Sat, Sep 19, 2020 at 03:47:31PM +0800, Huang Pei wrote:
> MIPS page fault path take 3 exceptions (1 TLB Miss + 2 TLB Invalid), but
> the second TLB Invalid exception is just triggered by __update_tlb from
> do_page_fault writing tlb without _PAGE_VALID set. With this patch, it
> only take 1 TLB Miss + 1 TLB Invalid exceptions
> 
> This version removes pte_sw_mkyoung without polluting MM code and makes
> page fault delay of MIPS on par with other architecture and covers both
> no-RIXI and RIXI MIPS CPUS
> 
> [1]: https://lkml.kernel.org/lkml/1591416169-26666-1-git-send-email
> -maobibo@loongson.cn/
> ---
> V3:
> - reformat with whitespace cleaned up following Thomas's advice
> V2:
> - remove unused asm-generic definition of pte_sw_mkyoung following Mao's
> advice
> ---
> Co-developed-by: Huang Pei <huangpei@loongson.cn>
> Signed-off-by: Huang Pei <huangpei@loongson.cn>
> Co-developed-by: Bibo Mao <maobibo@loonson.cn>
> ---
>  arch/mips/include/asm/pgtable.h | 10 ++++------
>  arch/mips/mm/cache.c            | 25 +++++++++++++------------
>  include/linux/pgtable.h         |  8 --------
>  mm/memory.c                     |  3 ---
>  4 files changed, 17 insertions(+), 29 deletions(-)
> 
> diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
> index dd7a0f552cac..931fb35730f0 100644
> --- a/arch/mips/include/asm/pgtable.h
> +++ b/arch/mips/include/asm/pgtable.h
> @@ -27,11 +27,11 @@ struct vm_area_struct;
>  
>  #define PAGE_NONE	__pgprot(_PAGE_PRESENT | _PAGE_NO_READ | \
>  				 _page_cachable_default)
> -#define PAGE_SHARED	__pgprot(_PAGE_PRESENT | _PAGE_WRITE | \
> -				 _page_cachable_default)
> +#define PAGE_SHARED    __pgprot(_PAGE_PRESENT | _PAGE_WRITE | \
> +				 __READABLE | _page_cachable_default)

you are still doing a white space changes here. 

>  #define PAGE_COPY	__pgprot(_PAGE_PRESENT | _PAGE_NO_EXEC | \
> -				 _page_cachable_default)
> -#define PAGE_READONLY	__pgprot(_PAGE_PRESENT | \
> +				 __READABLE | _page_cachable_default)
> +#define PAGE_READONLY	__pgprot(_PAGE_PRESENT |  __READABLE | \

I've grepped for usage of PAGE_SHARED and PAGE_READONLY and found
arch/mips/kvm/mmu.c and arch/mips/kernel/vdso.c. I wonder

1. Is this usage correct or should we use protection_map[X] ?
2. Are this still correct after the change in this patch ?

Right now I'm in favour to fist clean up asm/pgtable.h to get rid
of all unneeded PAGE_XXX defines and make mm/cache.c rixi part
more readable before applying this patch.

Thomas.

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


  parent reply	other threads:[~2020-10-02 12:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-19  7:47 [PATCH V3] MIPS: make userspace mapping young by default Huang Pei
2020-09-28  6:39 ` Huang Pei
2020-10-02 12:35 ` Thomas Bogendoerfer [this message]
2020-10-08  3:30   ` Huang Pei

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=20201002123502.GA11098@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=akpm@linux-foundation.org \
    --cc=ambrosehua@gmail.com \
    --cc=chenhc@lemote.com \
    --cc=gaojuxin@loongson.cn \
    --cc=huangpei@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lixuefeng@loongson.cn \
    --cc=maobibo@loongson.cn \
    --cc=paulburton@kernel.org \
    --cc=yangtiezhu@loongson.cn \
    --cc=zhangfx@lemote.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).