Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1513847pxj; Sat, 29 May 2021 16:45:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXgKBmrWeZnW4KenvMDye72FduGQSmpDndhMQwW8inFy4MOpX+8+2pTHJuXbeULCUbJB3U X-Received: by 2002:a05:6402:17d9:: with SMTP id s25mr17714137edy.337.1622331909634; Sat, 29 May 2021 16:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622331909; cv=none; d=google.com; s=arc-20160816; b=KAISim3TgMQZLeldDfgUrLib+8bZBw/H5XvMSLSIzS366ID0Ehj4kftP+TB0tVXY+O 0ELuLKHTq9S5elgR+CbVYU2KmjUVjLMHGMVP+RqMa0E77IBv0s6XCMjOkfG7n8ghuD6U 88m7glj7fnKkD7wbWGioNQUpg/T7yk6vIfkXaIvZ0qsRcN2Y5c5G9xhy1hLl7tuSzm4E xzxB40EgKmtUSLqy7858Uot9iv3PMCZsAs/zPxdkGZmQIAukPNoZ8X+Ty9Orw/RyMZV+ +Gw6CJyuJKpA9dQJHu1P7K/6J2xIjIIg7WeAVT/QYTcO031lTTMTjl1aAVPFFkT4HYas OFsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:cc:in-reply-to:subject:from:date:dkim-signature; bh=nCF8S4c2UqVaSQfWVl5eT5cODWPKUpixcjFKEGaEBsg=; b=YowAIqioX24QrzoTrRVL0K8mq0priXWdkNjNszlpDSflSX27wSwtQ1lYsYXbGLLBrG GerUUvbk247OrMgiQ73Qxag/hIZtH1wkKXGvoucF/b5YgCSn6a8Cavs+yIvXIjMwdCB1 3/QRKrfDwbxYAzBOKCXArjWn0VFiJtYZxcFx7YxH9QrPhu3RW1zSvHKo5qaRu68GffcL +wbnMqTGVXpqnluQNBKYd/CByu2RvdPcc/B2ecOM1D6r69vw+T531D2sOGvZJCEo/Ngh scBR28F97vWmiGnLGzsaWNle4m8lPAYBC3LtqRcLa9zCFwdva5Bxxb4/dEaIJ3Kt25NG 7nqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="E5j3/R9j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f6si8985145edt.368.2021.05.29.16.44.46; Sat, 29 May 2021 16:45:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="E5j3/R9j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229550AbhE2XoP (ORCPT + 99 others); Sat, 29 May 2021 19:44:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbhE2XoP (ORCPT ); Sat, 29 May 2021 19:44:15 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01C6AC061574 for ; Sat, 29 May 2021 16:42:36 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id c12so6141059pfl.3 for ; Sat, 29 May 2021 16:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:subject:in-reply-to:cc:to:message-id:mime-version :content-transfer-encoding; bh=nCF8S4c2UqVaSQfWVl5eT5cODWPKUpixcjFKEGaEBsg=; b=E5j3/R9jGWjyCkfveb2hFi3KRV59el0pmSmh+8jttzaEE49YnjYfWQrISUX64DQTYD CYRdBqqAhVie9tBk2A+r2dzPZRJyuQP4ps6vdHoJucMBqoeUE4mUuxgptKEKmked618I L7Ab8AynI+ph9zaO9IkGNdX1bYp7Nxg5H2TbkY/SYhwpws1R9fVlrkrE1LHF5r+cqVLS U7DxNqsMin6gbEHkEqcnymxvPahPMJwWPB5nKL8bBBKQQyP9ayWCz6441HZ8LELXsyxN MazOBw7l0X7C3ebInAujp8DqGA1qKg6P393sKCixoqXtj6RnfI8kVG4RTuL5Jyr88dRY n0kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:in-reply-to:cc:to:message-id :mime-version:content-transfer-encoding; bh=nCF8S4c2UqVaSQfWVl5eT5cODWPKUpixcjFKEGaEBsg=; b=g3KJc50/VMu6Ioz7+s+zk3oZua3TWT+nMCMq0pOYERNWoPpYZDOm0xaLQVvhyJ33dk ODxwi2wV0O/VCeWN6ZVY0jTW+Mqucb5hk0pumc7TfaPkaSUH41v/C/Y975aL1r6+0Xdf OZKEugBftPWdvdVw0zTsZyhCekrhJjyw5CljYNTrAZP75WUOzKsSVVyNhGZJjaNYHD/m UTm4M+8JZh1aX1z1+AH2djdqqv55xQOOuPxaAoKodUtKE8AitSeyDFEMmWaWRLgNcvhW WflDknwoTCvRTiFZrGx3L+5KgBKi1o9XMHMXazZv3YG9LSsgLWM3fTrSJ9bKCVwvice3 kLOw== X-Gm-Message-State: AOAM5312Cs+6Sfg6gPAiK1bKm6fWh75tE9tnb27kmBLTSrLZxa7eAM6G iu24OSWQpa7FA1VulRrL3ppn4g== X-Received: by 2002:a65:584d:: with SMTP id s13mr16053871pgr.97.1622331756137; Sat, 29 May 2021 16:42:36 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id k20sm7843994pgl.72.2021.05.29.16.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 May 2021 16:42:35 -0700 (PDT) Date: Sat, 29 May 2021 16:42:35 -0700 (PDT) X-Google-Original-Date: Sat, 29 May 2021 16:16:36 PDT (-0700) From: palmerdabbelt@google.com X-Google-Original-From: palmer@dabbelt.com Subject: Re: [PATCH V4 1/2] riscv: Fixup _PAGE_GLOBAL in _PAGE_KERNEL In-Reply-To: <1622008161-41451-2-git-send-email-guoren@kernel.org> CC: guoren@kernel.org, Anup Patel , Arnd Bergmann , Christoph Hellwig , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-sunxi@lists.linux.dev, guoren@linux.alibaba.com To: guoren@kernel.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 May 2021 22:49:20 PDT (-0700), guoren@kernel.org wrote: > From: Guo Ren > > Kernel virtual address translation should avoid to use ASIDs or it'll > cause more TLB-miss and TLB-refill. Because the current ASID in satp > belongs to the current process, but the target kernel va TLB entry's > ASID still belongs to the previous process. Sorry, I still can't quite figure out what this is trying to say. I went ahead and re-wrote the commit text to riscv: Use global mappings for kernel pages We map kernel pages into all addresses spages, so they can be marked as global. This allows hardware to avoid flushing the kernel mappings when moving between address spaces. LMK if I'm misunderstanding something here, it's on for-next. > > Signed-off-by: Guo Ren > Reviewed-by: Anup Patel > Reviewed-by: Christoph Hellwig > Cc: Palmer Dabbelt > --- > arch/riscv/include/asm/pgtable.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h > index 9469f46..346a3c6 100644 > --- a/arch/riscv/include/asm/pgtable.h > +++ b/arch/riscv/include/asm/pgtable.h > @@ -134,7 +134,8 @@ > | _PAGE_WRITE \ > | _PAGE_PRESENT \ > | _PAGE_ACCESSED \ > - | _PAGE_DIRTY) > + | _PAGE_DIRTY \ > + | _PAGE_GLOBAL) > > #define PAGE_KERNEL __pgprot(_PAGE_KERNEL) > #define PAGE_KERNEL_READ __pgprot(_PAGE_KERNEL & ~_PAGE_WRITE)