From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74B2AC47426 for ; Fri, 2 Oct 2020 12:35:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D73A9206DB for ; Fri, 2 Oct 2020 12:35:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D73A9206DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alpha.franken.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 540606B0073; Fri, 2 Oct 2020 08:35:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F1D36B0074; Fri, 2 Oct 2020 08:35:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3929A6B0075; Fri, 2 Oct 2020 08:35:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0095.hostedemail.com [216.40.44.95]) by kanga.kvack.org (Postfix) with ESMTP id 0BFDC6B0073 for ; Fri, 2 Oct 2020 08:35:21 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8C5BE8249980 for ; Fri, 2 Oct 2020 12:35:20 +0000 (UTC) X-FDA: 77326930800.06.owl55_5208a3a271a4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 6A619100529C6 for ; Fri, 2 Oct 2020 12:35:20 +0000 (UTC) X-HE-Tag: owl55_5208a3a271a4 X-Filterd-Recvd-Size: 4114 Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Fri, 2 Oct 2020 12:35:19 +0000 (UTC) Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1kOKHI-0003Ro-00; Fri, 02 Oct 2020 14:35:12 +0200 Received: by alpha.franken.de (Postfix, from userid 1000) id 0FFA5C109A; Fri, 2 Oct 2020 14:35:03 +0200 (CEST) Date: Fri, 2 Oct 2020 14:35:03 +0200 From: Thomas Bogendoerfer To: Huang Pei Cc: ambrosehua@gmail.com, Bibo Mao , Andrew Morton , linux-mips@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, Jiaxun Yang , Paul Burton , Li Xuefeng , Yang Tiezhu , Gao Juxin , Fuxin Zhang , Huacai Chen Subject: Re: [PATCH V3] MIPS: make userspace mapping young by default Message-ID: <20201002123502.GA11098@alpha.franken.de> References: <20200919074731.22372-1-huangpei@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200919074731.22372-1-huangpei@loongson.cn> User-Agent: Mutt/1.5.23 (2014-03-12) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 > Signed-off-by: Huang Pei > Co-developed-by: Bibo Mao > --- > 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 ]