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=ham 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 C248EC4363A for ; Thu, 8 Oct 2020 03:31:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C9526206F7 for ; Thu, 8 Oct 2020 03:31:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C9526206F7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E17E08E0001; Wed, 7 Oct 2020 23:31:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA1196B005D; Wed, 7 Oct 2020 23:31:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C679D8E0001; Wed, 7 Oct 2020 23:31:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9A69B6B005C for ; Wed, 7 Oct 2020 23:31:00 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2D4A51EE6 for ; Thu, 8 Oct 2020 03:31:00 +0000 (UTC) X-FDA: 77347331880.20.map50_1e15977271d4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 0EB7B180C07A3 for ; Thu, 8 Oct 2020 03:31:00 +0000 (UTC) X-HE-Tag: map50_1e15977271d4 X-Filterd-Recvd-Size: 6059 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Thu, 8 Oct 2020 03:30:57 +0000 (UTC) Received: from ambrosehua-HP-xw6600-Workstation (unknown [182.149.161.192]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxWuTkh35f4UEbAA--.39703S2; Thu, 08 Oct 2020 11:30:46 +0800 (CST) Date: Thu, 8 Oct 2020 11:30:43 +0800 From: Huang Pei To: Thomas Bogendoerfer 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: <20201008033043.x2fyc354ivjqyfe3@ambrosehua-HP-xw6600-Workstation> References: <20200919074731.22372-1-huangpei@loongson.cn> <20201002123502.GA11098@alpha.franken.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201002123502.GA11098@alpha.franken.de> User-Agent: NeoMutt/20171215 X-CM-TRANSID:AQAAf9AxWuTkh35f4UEbAA--.39703S2 X-Coremail-Antispam: 1UD129KBjvJXoWxuryUJw18XF1DtrWrAryUtrb_yoW5ur48pa s7CF10kr4jqr13ArWfAwnFyr1rJws3KF4vgF93Zw1rZa4av3s5Jrn5KFZ3ZryDXFZ2kFW8 urW5WF15WrsIvrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvl14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1j6r1xM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Jr0_Gr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4j6r 4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcVAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kI c2xKxwCY02Avz4vE14v_Gr4l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr 1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE 14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7 IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvE x4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvj DU0xZFpf9x0JU-miiUUUUU= X-CM-SenderInfo: xkxd0whshlqz5rrqw2lrqou0/ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Oct 02, 2020 at 02:35:03PM +0200, Thomas Bogendoerfer wrote: Hi, > 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 | \ > sorry, my bad > 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 > for arch/mips/kvm/mmu.c, the comment says: ... /* Also set valid and dirty, so refill handler doesn't have to */ *ptep = pte_mkyoung(pte_mkdirty(pfn_pte(pfn, PAGE_SHARED))); ... the net effect is the same, dirty and valid, so I think it is ok; for arch/mips/kernel/vdso.c, both mappings are kernel mapping, which means the physical memory(or io memory) is already allocated and will not be reclaimed by kernel. > 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. > I think we can clean up rixi part of mm/cache.c after this patch, or within V4; > Thomas. > > -- > Crap can work. Given enough thrust pigs will fly, but it's not necessarily a > good idea. [ RFC1925, 2.3 ]