Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1528261ybb; Thu, 2 Apr 2020 02:32:40 -0700 (PDT) X-Google-Smtp-Source: APiQypIMX3tVXyb67nys3edTRKLhWy6MMv4DtPhRvTNg8GxFr7l2WDS4JWyRvTAlmgpp3DzxgcVR X-Received: by 2002:aca:4243:: with SMTP id p64mr1556796oia.21.1585819960418; Thu, 02 Apr 2020 02:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585819960; cv=none; d=google.com; s=arc-20160816; b=e6zlbUUzuterTFHh7FNOr7CVT6sfu/QXixZdrRx3Dch+dhLgkgoSAv6ELyRbiRkH68 JW0tNp6q7pfQpJfEJiNtVaKJNRDsbSvaB6sGbY7cY9B++gkKw85Bwg0j7OwHzA4ITwLp sAaE1vUMBuaopcAiHuY8kuhxpIxNrg77MjXkFbxDNz8g73YQ/MH2FHD1fnlRx9M1t1i1 LhoERzu9W3R0jLfaUw+gt7cfQOgYALi/4/1q3/kbtK2AGq//qBTn1nYBveUdqkqJDJD5 4dL93qVd553dvgyIEJbCH5LchRtklgNLqAf/+zuy6ZNGsaAlGfkYHR3yOhspqVpccI+W ukTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=jyLGy4wIa9YpfvGIOZu1h8jBq1vT93tHHQe1KR3dfrU=; b=JFxPST6TtIneYbROpqJsxR/u9lrllP6jlJQNzoO1y+ugMMTG5aCrzazAnnKledXoc/ XACcRimtAQMVLV71rcss5usIige28JCR2EjP8QZFyayLZaCQV20H/XhmBBVyH+2T5Bqs qcVRIR71dmfAGR4tiZqfw23fFtdQgPEFNoCHJSDftZPvevu3i6Pd6/C+QUUu+ScKOMQO 8MsKeR08IBnSD9kdjYhTOtOeY6JJ4XZIHQv8je7nwPRy5oxq0Zi4A2yfuiQ5h6wlCqyd 5I5ZB0KEleNxKl7YUsLdKaYt++0oTZsMEwz0YxvEVCp+9Xd5NsScLiKbqrzq02ArM2e+ LtRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m7si1983143oim.179.2020.04.02.02.32.27; Thu, 02 Apr 2020 02:32:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387822AbgDBJb4 (ORCPT + 99 others); Thu, 2 Apr 2020 05:31:56 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:41445 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725965AbgDBJb4 (ORCPT ); Thu, 2 Apr 2020 05:31:56 -0400 Received: from mail-qt1-f177.google.com ([209.85.160.177]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPSA (Nemesis) id 1MlO9r-1iuClr41qn-00lpBO for ; Thu, 02 Apr 2020 11:31:55 +0200 Received: by mail-qt1-f177.google.com with SMTP id t17so2614184qtn.12 for ; Thu, 02 Apr 2020 02:31:54 -0700 (PDT) X-Gm-Message-State: AGi0PuZWrPDQm8FP6TAVP9EDtII0P2MN4xMOyeio7uQXE7oJs0Zf1vc6 F6WmXD48cLJ2/g2BqCMrgxCbWDyr8PK0/0giSWc= X-Received: by 2002:ac8:7292:: with SMTP id v18mr1898092qto.304.1585819913839; Thu, 02 Apr 2020 02:31:53 -0700 (PDT) MIME-Version: 1.0 References: <20200331093241.3728-1-tesheng@andestech.com> In-Reply-To: <20200331093241.3728-1-tesheng@andestech.com> From: Arnd Bergmann Date: Thu, 2 Apr 2020 11:31:37 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/3] Highmem support for 32-bit RISC-V To: Eric Lin Cc: linux-riscv@lists.infradead.org, Albert Ou , Gary Guo , alex@ghiti.fr, David Abdurachmanov , Steven Price , Anup Patel , "linux-kernel@vger.kernel.org" , Mike Rapoport , atish.patra@wdc.com, yash.shah@sifive.com, Palmer Dabbelt , Greentime Hu , zong.li@sifive.com, Paul Walmsley , Andrew Morton , Borislav Petkov , Logan Gunthorpe , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:mZH8CricPUBuTLMEoGKz3luhD0XBZqzmZPaec3uE5Oo1LZLiu9D nCes7BdOdjX+e4OPEKf6KJnl1GOMTQWYpTNxnTm7e2XtWAdpnk3Qge0D5jy17NzlI5A7ErB 0DZe1ugkS5xHJdYyo7whtWwsJb0P2sRLo3xtJ42HTUNedx200T1rjTuzjh6B6K6GvRLe93K Jey3pyfWYCxxbcUy/IdLQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:UFvhvFuRUEE=:xw+s9AXkz80ZpQ1r/k1Xc7 /gFz7NzfkWyb8X/hs4CYFW/8Sf4WKLQ7cvI9lhIcML19pgr/1xW6mgngfEkkfzZcedPeeU/2S kdpb3P2IDwB4Ukt/pA9PSLgLzfBJom56etCNtoM9Z/uAILL+VZRll1q8ZP1xepEL2droxQn8I jzVYrCjTg0RqfNKQFfqLJgXfU7E4Me3ZDpgIYHv2eI5TRPrZKW5qiZAsn94OnKSgij5kd43Ft aJ/S1H+JzBEqRF+DTESUzRetyEnsl3oXCHF3iplqAuujv4FUYbK7w9rUAoAuNukkwVefiAfGd a25eZzMtWI1wW/p6tkWm8HuPO97ANj6rYxBIgZlkFnMcj1H60EfAFx45eeYdXcAIorij5JIXN XQawJDhBTC9hW3GRl//0gFKNa4yOIgdzDgk1CzT1NIklw3Stt/E1UUI6x4UVWq27zjL6KrX57 VvIHJKvpQy9seVy/UKS8nePKxtAVZbeoOC0Vxg/pDf3eaBk4xptWAL0pv4YXh0lDGYc7m11Ss i/oSjKRsqXgs+h9if94OkJPGhEN5oRdgA0ocSVBbiGMLT1LRnEn/Lydu/le8U5aM0/cfNgFys 9QyXE1ETyGbGv2vxCoXQs+4aJF49I9i/A9o0wdnyTEstLzEc+SqD6FJZe25c+vWaZ9h+ZihDM 96vDehiyngFz2iBHugjjVe14QTIie9j9+fxcjGG3GptYxQzDRWYzYxlA/fETfSB4/SG46oOQI Z6r8mAoAFHtvw6qrsBPIw1iQ6NorWFEDpV6bticRli0mN+qG/+VGsq/1mMOfYGAgrfburGbyG Adaelst6Wt7j0L2LwGoANwNB06b/bUC645myozAHpRYtlvJkSc= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 31, 2020 at 11:34 AM Eric Lin wrote: > > With Highmem support, the kernel can map more than 1GB physical memory. > > This patchset implements Highmem for RV32, referencing to mostly nds32 > and others like arm and mips, and it has been tested on Andes A25MP platform. I would much prefer to not see highmem added to new architectures at all if possible, see https://lwn.net/Articles/813201/ for some background. For the arm32 architecture, we are thinking about implementing a VMPLIT_4G_4G option to replace highmem in the long run. The most likely way this would turn out at the moment looks like: - have a 256MB region for vmalloc space at the top of the 4GB address space, containing vmlinux, module, mmio mappings and vmalloc allocations - have 3.75GB starting at address zero for either user space or the linear map. - reserve one address space ID for kernel mappings to avoid tlb flushes during normal context switches - On any kernel entry, switch the page table to the one with the linear mapping, and back to the user page table before returning to user space - add a generic copy_from_user/copy_to_user implementation based on get_user_pages() in asm-generic/uaccess.h, using memcpy() to copy from/to the page in the linear map. - possible have architectures override get_user/put_user to use a cheaper access based on a page table switch to read individual words if that is cheaper than get_user_pages(). There was an implementation of this for x86 a long time ago, but it never got merged, mainly because there were no ASIDs on x86 at the time and the TLB flushing during context switch were really expensive. As far as I can tell, all of the modern embedded cores do have ASIDs, and unlike x86, most do not support more than 4GB of physical RAM, so this scheme can work to replace highmem in most of the remaining cases, and provide additional benefits (larger user address range, higher separate of kernel/user addresses) at a relatively small performance cost. Arnd