All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Ghiti <alexghiti@rivosinc.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	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>,
	Mike Rapoport <rppt@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Anup Patel <anup@brainfault.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	devicetree@vger.kernel.org, linux-mm@kvack.org
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Subject: [PATCH v7 0/4] riscv: Use PUD/P4D/PGD pages for the linear mapping
Date: Fri, 10 Mar 2023 10:45:35 +0100	[thread overview]
Message-ID: <20230310094539.764357-1-alexghiti@rivosinc.com> (raw)

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 by introducing a new memblock API.

Another patch makes use of this new API in arm64 which used some sort of
hack to solve this issue: it was built/boot tested successfully.

base-commit-tag: v6.3-rc1

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 (4):
  riscv: Get rid of riscv_pfn_base variable
  mm: Introduce memblock_isolate_memory
  arm64: Make use of memblock_isolate_memory for the linear mapping
  riscv: Use PUD/P4D/PGD pages for the linear mapping

 arch/arm64/mm/mmu.c           |  4 ++--
 arch/riscv/include/asm/page.h | 19 +++++++++++++++--
 arch/riscv/mm/init.c          | 39 ++++++++++++++++++++++++++---------
 arch/riscv/mm/physaddr.c      | 16 ++++++++++++++
 drivers/of/fdt.c              | 11 +++++-----
 include/linux/memblock.h      |  1 +
 mm/memblock.c                 | 22 +++++++++++++++++++-
 7 files changed, 92 insertions(+), 20 deletions(-)

-- 
2.37.2


WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Ghiti <alexghiti@rivosinc.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	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>,
	Mike Rapoport <rppt@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Anup Patel <anup@brainfault.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	devicetree@vger.kernel.org, linux-mm@kvack.org
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Subject: [PATCH v7 0/4] riscv: Use PUD/P4D/PGD pages for the linear mapping
Date: Fri, 10 Mar 2023 10:45:35 +0100	[thread overview]
Message-ID: <20230310094539.764357-1-alexghiti@rivosinc.com> (raw)

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 by introducing a new memblock API.

Another patch makes use of this new API in arm64 which used some sort of
hack to solve this issue: it was built/boot tested successfully.

base-commit-tag: v6.3-rc1

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 (4):
  riscv: Get rid of riscv_pfn_base variable
  mm: Introduce memblock_isolate_memory
  arm64: Make use of memblock_isolate_memory for the linear mapping
  riscv: Use PUD/P4D/PGD pages for the linear mapping

 arch/arm64/mm/mmu.c           |  4 ++--
 arch/riscv/include/asm/page.h | 19 +++++++++++++++--
 arch/riscv/mm/init.c          | 39 ++++++++++++++++++++++++++---------
 arch/riscv/mm/physaddr.c      | 16 ++++++++++++++
 drivers/of/fdt.c              | 11 +++++-----
 include/linux/memblock.h      |  1 +
 mm/memblock.c                 | 22 +++++++++++++++++++-
 7 files changed, 92 insertions(+), 20 deletions(-)

-- 
2.37.2


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

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Ghiti <alexghiti@rivosinc.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	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>,
	Mike Rapoport <rppt@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Anup Patel <anup@brainfault.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	devicetree@vger.kernel.org, linux-mm@kvack.org
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Subject: [PATCH v7 0/4] riscv: Use PUD/P4D/PGD pages for the linear mapping
Date: Fri, 10 Mar 2023 10:45:35 +0100	[thread overview]
Message-ID: <20230310094539.764357-1-alexghiti@rivosinc.com> (raw)

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 by introducing a new memblock API.

Another patch makes use of this new API in arm64 which used some sort of
hack to solve this issue: it was built/boot tested successfully.

base-commit-tag: v6.3-rc1

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 (4):
  riscv: Get rid of riscv_pfn_base variable
  mm: Introduce memblock_isolate_memory
  arm64: Make use of memblock_isolate_memory for the linear mapping
  riscv: Use PUD/P4D/PGD pages for the linear mapping

 arch/arm64/mm/mmu.c           |  4 ++--
 arch/riscv/include/asm/page.h | 19 +++++++++++++++--
 arch/riscv/mm/init.c          | 39 ++++++++++++++++++++++++++---------
 arch/riscv/mm/physaddr.c      | 16 ++++++++++++++
 drivers/of/fdt.c              | 11 +++++-----
 include/linux/memblock.h      |  1 +
 mm/memblock.c                 | 22 +++++++++++++++++++-
 7 files changed, 92 insertions(+), 20 deletions(-)

-- 
2.37.2


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

             reply	other threads:[~2023-03-10  9:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10  9:45 Alexandre Ghiti [this message]
2023-03-10  9:45 ` [PATCH v7 0/4] riscv: Use PUD/P4D/PGD pages for the linear mapping Alexandre Ghiti
2023-03-10  9:45 ` Alexandre Ghiti
2023-03-10  9:45 ` [PATCH v7 1/4] riscv: Get rid of riscv_pfn_base variable Alexandre Ghiti
2023-03-10  9:45   ` Alexandre Ghiti
2023-03-10  9:45   ` Alexandre Ghiti
2023-03-10  9:45 ` [PATCH v7 2/4] mm: Introduce memblock_isolate_memory Alexandre Ghiti
2023-03-10  9:45   ` Alexandre Ghiti
2023-03-10  9:45   ` Alexandre Ghiti
2023-03-12  9:35   ` Mike Rapoport
2023-03-12  9:35     ` Mike Rapoport
2023-03-12  9:35     ` Mike Rapoport
2023-03-12 16:14     ` Alexandre Ghiti
2023-03-12 16:14       ` Alexandre Ghiti
2023-03-12 16:14       ` Alexandre Ghiti
2023-03-10  9:45 ` [PATCH v7 3/4] arm64: Make use of memblock_isolate_memory for the linear mapping Alexandre Ghiti
2023-03-10  9:45   ` Alexandre Ghiti
2023-03-10  9:45   ` Alexandre Ghiti
2023-03-13  9:43   ` Andrew Jones
2023-03-13  9:43     ` Andrew Jones
2023-03-13  9:43     ` Andrew Jones
2023-03-13 10:01     ` Alexandre Ghiti
2023-03-13 10:01       ` Alexandre Ghiti
2023-03-13 10:01       ` Alexandre Ghiti
2023-03-10  9:45 ` [PATCH v7 4/4] riscv: Use PUD/P4D/PGD pages " Alexandre Ghiti
2023-03-10  9:45   ` Alexandre Ghiti
2023-03-10  9:45   ` Alexandre Ghiti
2023-03-11 11:24 ` [PATCH v7 0/4] " Anup Patel
2023-03-11 11:24   ` Anup Patel
2023-03-11 11:24   ` Anup Patel

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=20230310094539.764357-1-alexghiti@rivosinc.com \
    --to=alexghiti@rivosinc.com \
    --cc=akpm@linux-foundation.org \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh+dt@kernel.org \
    --cc=rppt@kernel.org \
    --cc=will@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.