Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3832249ybb; Tue, 31 Mar 2020 12:55:07 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvmSWQo+Ms5Eyg++kpdaF1r3KbzGUGkD+txMeviMxj8YDLmeY5IkOwoKhEg7d+UI64sgAEw X-Received: by 2002:a4a:2cc6:: with SMTP id o189mr4329050ooo.20.1585684507262; Tue, 31 Mar 2020 12:55:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585684507; cv=none; d=google.com; s=arc-20160816; b=tG223xuwfX/Ck20762XhPMbUTHJ0mHbvga2HqIhBNrg/6guzyadnn7X0NMmrN894uj rcx0Dcvw9zFNA6V7mYmEwlJCFK6J7k+LvjMuoViDcuocDqBleVxecepxIh30vG6L9+cO W4mfCdb7/4TVmxA89sXq2Ldkp5DsBeGLKswfyrtqPhFgM8po2LCybzR7K4xjPOn2KRCo 4wakTK+aFAaIyg+8Y5AK7bj7oMRGKRKId+IGp+nG1zAQo1Pzcsa83Qe9XMCpMV+20k+7 jqoZVBvrBZzQlc3h76VIcMeYTuwdn97gFeMKR1b3e8IH03CKaqb+wwxkgJMcguPJlnSD gDxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=UnNGbqw4CiU2b1yMc4obIxPTMu+of5pZP5ZU1i5O1Ms=; b=j7dVra6E0a55N/j/i79aqEFMAmzvoiUx9nViPjL651MC8HvJU6lQQoTMOfawrWC48p npEwjUOEQjAZId1hn+8FANLVBDYMNP9VLO4n8434qz7BRtdwxAObIKdUSNc+WVsJxkcR bRsQ5eWguJtkMXTKedvbNKergwKJ82oU/BFzWUb3AvyoQ1RVQyWvXyiLaYDWICFUY1h7 Zv1NLhYqhS+/fdotyZPQ1gi8gXBBT2tNm4Uc2ZpUovIypea3jYJy2C5Gn5QBC5jU2WJO XkHTvhiLgG53Oa+VAcD6NGeU0wZgx9z9omiUQ5Bq11osSFo1jwArCiQE+0W09cFlDLb5 r39Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=dTra5YWd; 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 y29si9267189ote.208.2020.03.31.12.54.54; Tue, 31 Mar 2020 12:55:07 -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; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=dTra5YWd; 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 S1730592AbgCaTxG (ORCPT + 99 others); Tue, 31 Mar 2020 15:53:06 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43750 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726548AbgCaTxG (ORCPT ); Tue, 31 Mar 2020 15:53:06 -0400 Received: by mail-pf1-f194.google.com with SMTP id f206so10834713pfa.10 for ; Tue, 31 Mar 2020 12:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=UnNGbqw4CiU2b1yMc4obIxPTMu+of5pZP5ZU1i5O1Ms=; b=dTra5YWd+la6sJKFy0wsNu7jaNDhqwpkpW9ysYZ2pE14Q4PJtOiawDORBbbuSsyQ1L 9L7JTfGaJvaEjUSIImNvxY2NKm4qH9WV0/oUVI1F/wq39tLfZwnaDJAMqj2DHCJrFG1Y e+gbtuh7zBHpFy+3taNZet6/x/rKvgfsxFpL8PoBJseL8OQBebz2p7vlOoTYg7J/mfN6 VWbDbR4Oe4K3SdUgwx8ufEHCgHURMYmBVzN55uS3x8tpta2rqElx8+89nF13JrAEC/bi abI2WYfSB5zy6ZCZxK/SgWv4pFXLDeqvg3vi0OEaza47TQ+oYb0MIm9L9mwSBm/+Fg/g ix8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=UnNGbqw4CiU2b1yMc4obIxPTMu+of5pZP5ZU1i5O1Ms=; b=Gex6tqSwPUVYXDN0Cr2zKUWYD+m+OBD/mSeOBrXuZ6hkhFTwzYj1nYcO2XYa47U3SS Q+jetUfuvicIMrTRXlFRKzzO0NW8NQMQ5IfaghTQaSB58PE4awcK9CYRdw12DKKUs2UF QcYbXlnae9/XKHk50nRQgRBy/Yb866mW0R4aq9JOsstRX0F8N2Z+Sjel6WTIeqk6VD7q rTGT4RIHWI1OQ06yooJ0jB0TIDca/u0NsVtGAluNx2j8EExsjReyyYWtHdhKS6zctSL2 ZH6vWx460FB2hM96fD3L2n9GrK7RSyw0iBCV1QDdSEJJ7bEhkIWfBXnT2Cif6KFvkKRJ ujFQ== X-Gm-Message-State: ANhLgQ3vl/YEnNhDkLpz90tKhShphFtim7hICL8JmEopCIPpZvqgRn/m VUHaJRe7vvyu8Or5PUCS5T6UrRrtom8= X-Received: by 2002:a62:7811:: with SMTP id t17mr20111632pfc.268.1585684384593; Tue, 31 Mar 2020 12:53:04 -0700 (PDT) Received: from localhost (c-67-161-15-180.hsd1.ca.comcast.net. [67.161.15.180]) by smtp.gmail.com with ESMTPSA id a71sm13499762pfa.162.2020.03.31.12.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 12:53:04 -0700 (PDT) Date: Tue, 31 Mar 2020 12:53:04 -0700 (PDT) X-Google-Original-Date: Tue, 31 Mar 2020 12:51:33 PDT (-0700) Subject: Re: [RFC PATCH 0/7] Introduce sv48 support In-Reply-To: <20200322110028.18279-1-alex@ghiti.fr> CC: Paul Walmsley , zong.li@sifive.com, anup@brainfault.org, Christoph Hellwig , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, alex@ghiti.fr From: Palmer Dabbelt To: alex@ghiti.fr Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 22 Mar 2020 04:00:21 PDT (-0700), alex@ghiti.fr wrote: > This patchset implements sv48 support at runtime. The kernel will try to > boot with 4-level page table and will fallback to 3-level if the HW does not > support it. > > The biggest advantage is that we only have one kernel for 64bit, which > is way easier to maintain. Thanks, that's great! This is something we've been missing for a long time now. > Folding the 4th level into a 3-level page table has almost no cost at > runtime. > > At the moment, there is no way to enforce 3-level if the HW supports > 4-level page table: early parameters are parsed after the choice must be > made. This is different than how I'd been considering doing it -- specifically, my worry was that 4-level paging would have a meaningful performance hit and therefor we'd want to allow users to select 3-level paging somehow. I'd been thinking of having a Kconfig option, so the options would be "3-level only" or "3 or 4 level". That came with a bunch of drawbacks, so I'd be much happier to have a single kernel. Where did you get your performance numbers from? Appologies in advance if there's more info in the patches, I'll look at those now... > It is based on my relocatable patchset v3 that I have not posted yet, > you can try the sv48 support by using the branch > int/alex/riscv_sv48_runtime_v1 here: > > https://github.com/AlexGhiti/riscv-linux > > Any feedback appreciated, > > Thanks, > > Alexandre Ghiti (7): > riscv: Get rid of compile time logic with MAX_EARLY_MAPPING_SIZE > riscv: Allow to dynamically define VA_BITS > riscv: Simplify MAXPHYSMEM config > riscv: Implement sv48 support > riscv: Use pgtable_l4_enabled to output mmu type in cpuinfo > dt-bindings: riscv: Remove "riscv,svXX" property from device-tree > riscv: Explicit comment about user virtual address space size > > .../devicetree/bindings/riscv/cpus.yaml | 13 -- > arch/riscv/Kconfig | 34 ++--- > arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 4 - > arch/riscv/include/asm/csr.h | 3 +- > arch/riscv/include/asm/fixmap.h | 1 + > arch/riscv/include/asm/page.h | 15 +- > arch/riscv/include/asm/pgalloc.h | 36 +++++ > arch/riscv/include/asm/pgtable-64.h | 98 +++++++++++- > arch/riscv/include/asm/pgtable.h | 24 ++- > arch/riscv/include/asm/sparsemem.h | 2 +- > arch/riscv/kernel/cpu.c | 24 +-- > arch/riscv/kernel/head.S | 37 ++++- > arch/riscv/mm/context.c | 4 +- > arch/riscv/mm/init.c | 142 +++++++++++++++--- > 14 files changed, 341 insertions(+), 96 deletions(-)