All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anup Patel <anup@brainfault.org>
To: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Andrew Jones <ajones@ventanamicro.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v9 0/3] riscv: Use PUD/P4D/PGD pages for the linear mapping
Date: Mon, 27 Mar 2023 17:42:57 +0530	[thread overview]
Message-ID: <CAAhSdy3L59sUK3nniio8iWvAAR13cMzvXDX+wxyjEOajuuEhxw@mail.gmail.com> (raw)
In-Reply-To: <20230324155421.271544-1-alexghiti@rivosinc.com>

On Fri, Mar 24, 2023 at 9:24 PM Alexandre Ghiti <alexghiti@rivosinc.com> wrote:
>
> This patchset intends to improve tlb utilization by using hugepages for
> the linear mapping.
>
> As reported by Anup in v6, when STRICT_KERNEL_RWX is enabled, we must
> take care of isolating the kernel text and rodata so that they are not
> mapped with a PUD mapping which would then assign wrong permissions to
> the whole region: it is achieved the same way as arm64 by using the
> memblock nomap API which isolates those regions and re-merge them afterwards
> thus avoiding any issue with the system resources tree creation.
>
> base-commit-tag: v6.3-rc1
>
> v9:
> - Remove new API and arm64 patches as it created more issues than it
>   solved, thanks Anup for reporting those bugs!
> - Add a patch that moves the linear mapping creation outside of setup_vm_final
> - Use nomap API like arm64
> - Removed RB from Andrew and Anup as the patch changed its logic
> - Fix kernel rodata size computation
>
> v8:
> - Fix rv32, as reported by Anup
> - Do not modify memblock_isolate_range and fixes comment, as suggested by Mike
> - Use the new memblock API for crash kernel too in arm64, as suggested by Andrew
> - Fix arm64 double mapping (which to me did not work in v7), but ends up not
>   being pretty at all, will wait for comments from arm64 reviewers, but
>   this patch can easily be dropped if they do not want it.
>
> v7:
> - Fix Anup bug report by introducing memblock_isolate_memory which
>   allows us to split the memblock mappings and then avoid to map the
>   the PUD which contains the kernel as read only
> - Add a patch to arm64 to use this newly introduced API
>
> v6:
> - quiet LLVM warning by casting phys_ram_base into an unsigned long
>
> v5:
> - Fix nommu builds by getting rid of riscv_pfn_base in patch 1, thanks
>   Conor
> - Add RB from Andrew
>
> v4:
> - Rebase on top of v6.2-rc3, as noted by Conor
> - Add Acked-by Rob
>
> v3:
> - Change the comment about initrd_start VA conversion so that it fits
>   ARM64 and RISCV64 (and others in the future if needed), as suggested
>   by Rob
>
> v2:
> - Add a comment on why RISCV64 does not need to set initrd_start/end that
>   early in the boot process, as asked by Rob
>
> Alexandre Ghiti (3):
>   riscv: Get rid of riscv_pfn_base variable
>   riscv: Move the linear mapping creation in its own function
>   riscv: Use PUD/P4D/PGD pages for the linear mapping

I have tested this series again on QEMU RV64 and RV32. I also tried
KVM RV64 and RV32, this works fine as well.

>
>  arch/riscv/include/asm/page.h |  19 ++++++-
>  arch/riscv/mm/init.c          | 102 ++++++++++++++++++++++++++--------
>  arch/riscv/mm/physaddr.c      |  16 ++++++
>  drivers/of/fdt.c              |  11 ++--
>  4 files changed, 118 insertions(+), 30 deletions(-)
>
> --
> 2.37.2
>

Regards,
Anup

WARNING: multiple messages have this Message-ID (diff)
From: Anup Patel <anup@brainfault.org>
To: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Albert Ou <aou@eecs.berkeley.edu>,
	Rob Herring <robh+dt@kernel.org>,
	 Frank Rowand <frowand.list@gmail.com>,
	Andrew Jones <ajones@ventanamicro.com>,
	 linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	 devicetree@vger.kernel.org
Subject: Re: [PATCH v9 0/3] riscv: Use PUD/P4D/PGD pages for the linear mapping
Date: Mon, 27 Mar 2023 17:42:57 +0530	[thread overview]
Message-ID: <CAAhSdy3L59sUK3nniio8iWvAAR13cMzvXDX+wxyjEOajuuEhxw@mail.gmail.com> (raw)
In-Reply-To: <20230324155421.271544-1-alexghiti@rivosinc.com>

On Fri, Mar 24, 2023 at 9:24 PM Alexandre Ghiti <alexghiti@rivosinc.com> wrote:
>
> This patchset intends to improve tlb utilization by using hugepages for
> the linear mapping.
>
> As reported by Anup in v6, when STRICT_KERNEL_RWX is enabled, we must
> take care of isolating the kernel text and rodata so that they are not
> mapped with a PUD mapping which would then assign wrong permissions to
> the whole region: it is achieved the same way as arm64 by using the
> memblock nomap API which isolates those regions and re-merge them afterwards
> thus avoiding any issue with the system resources tree creation.
>
> base-commit-tag: v6.3-rc1
>
> v9:
> - Remove new API and arm64 patches as it created more issues than it
>   solved, thanks Anup for reporting those bugs!
> - Add a patch that moves the linear mapping creation outside of setup_vm_final
> - Use nomap API like arm64
> - Removed RB from Andrew and Anup as the patch changed its logic
> - Fix kernel rodata size computation
>
> v8:
> - Fix rv32, as reported by Anup
> - Do not modify memblock_isolate_range and fixes comment, as suggested by Mike
> - Use the new memblock API for crash kernel too in arm64, as suggested by Andrew
> - Fix arm64 double mapping (which to me did not work in v7), but ends up not
>   being pretty at all, will wait for comments from arm64 reviewers, but
>   this patch can easily be dropped if they do not want it.
>
> v7:
> - Fix Anup bug report by introducing memblock_isolate_memory which
>   allows us to split the memblock mappings and then avoid to map the
>   the PUD which contains the kernel as read only
> - Add a patch to arm64 to use this newly introduced API
>
> v6:
> - quiet LLVM warning by casting phys_ram_base into an unsigned long
>
> v5:
> - Fix nommu builds by getting rid of riscv_pfn_base in patch 1, thanks
>   Conor
> - Add RB from Andrew
>
> v4:
> - Rebase on top of v6.2-rc3, as noted by Conor
> - Add Acked-by Rob
>
> v3:
> - Change the comment about initrd_start VA conversion so that it fits
>   ARM64 and RISCV64 (and others in the future if needed), as suggested
>   by Rob
>
> v2:
> - Add a comment on why RISCV64 does not need to set initrd_start/end that
>   early in the boot process, as asked by Rob
>
> Alexandre Ghiti (3):
>   riscv: Get rid of riscv_pfn_base variable
>   riscv: Move the linear mapping creation in its own function
>   riscv: Use PUD/P4D/PGD pages for the linear mapping

I have tested this series again on QEMU RV64 and RV32. I also tried
KVM RV64 and RV32, this works fine as well.

>
>  arch/riscv/include/asm/page.h |  19 ++++++-
>  arch/riscv/mm/init.c          | 102 ++++++++++++++++++++++++++--------
>  arch/riscv/mm/physaddr.c      |  16 ++++++
>  drivers/of/fdt.c              |  11 ++--
>  4 files changed, 118 insertions(+), 30 deletions(-)
>
> --
> 2.37.2
>

Regards,
Anup

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2023-03-27 12:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 15:54 [PATCH v9 0/3] riscv: Use PUD/P4D/PGD pages for the linear mapping Alexandre Ghiti
2023-03-24 15:54 ` Alexandre Ghiti
2023-03-24 15:54 ` [PATCH v9 1/3] riscv: Get rid of riscv_pfn_base variable Alexandre Ghiti
2023-03-24 15:54   ` Alexandre Ghiti
2023-03-24 15:54 ` [PATCH v9 2/3] riscv: Move the linear mapping creation in its own function Alexandre Ghiti
2023-03-24 15:54   ` Alexandre Ghiti
2023-03-27  9:39   ` Andrew Jones
2023-03-27  9:39     ` Andrew Jones
2023-03-27 12:14   ` Anup Patel
2023-03-27 12:14     ` Anup Patel
2023-03-24 15:54 ` [PATCH v9 3/3] riscv: Use PUD/P4D/PGD pages for the linear mapping Alexandre Ghiti
2023-03-24 15:54   ` Alexandre Ghiti
2023-03-27  9:39   ` Andrew Jones
2023-03-27  9:39     ` Andrew Jones
2023-03-27 11:15     ` Alexandre Ghiti
2023-03-27 11:15       ` Alexandre Ghiti
2023-03-27 11:37       ` Andrew Jones
2023-03-27 11:37         ` Andrew Jones
2023-03-27 11:37   ` Andrew Jones
2023-03-27 11:37     ` Andrew Jones
2023-03-27 12:13   ` Anup Patel
2023-03-27 12:13     ` Anup Patel
2023-03-27 12:12 ` Anup Patel [this message]
2023-03-27 12:12   ` [PATCH v9 0/3] " Anup Patel
2023-04-19 14:22 ` Palmer Dabbelt
2023-04-19 14:22   ` Palmer Dabbelt
2023-04-19 14:30 ` patchwork-bot+linux-riscv
2023-04-19 14:30   ` patchwork-bot+linux-riscv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAhSdy3L59sUK3nniio8iWvAAR13cMzvXDX+wxyjEOajuuEhxw@mail.gmail.com \
    --to=anup@brainfault.org \
    --cc=ajones@ventanamicro.com \
    --cc=alexghiti@rivosinc.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.