From: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org,
Marco Elver <elver@google.com>,
Alexander Potapenko <glider@google.com>,
Heiko Carstens <hca@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Hari Bathini <hbathini@linux.ibm.com>,
"Aneesh Kumar K . V" <aneesh.kumar@kernel.org>,
Donet Tom <donettom@linux.vnet.ibm.com>,
Pavithra Prakash <pavrampu@linux.vnet.ibm.com>,
LKML <linux-kernel@vger.kernel.org>,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Subject: [PATCH v3 11/12] book3s64/hash: Disable kfence if not early init
Date: Fri, 18 Oct 2024 22:59:52 +0530 [thread overview]
Message-ID: <4a6eea8cfd1cd28fccfae067026bff30cbec1d4b.1729271995.git.ritesh.list@gmail.com> (raw)
In-Reply-To: <cover.1729271995.git.ritesh.list@gmail.com>
Enable kfence on book3s64 hash only when early init is enabled.
This is because, kfence could cause the kernel linear map to be mapped
at PAGE_SIZE level instead of 16M (which I guess we don't want).
Also currently there is no way to -
1. Make multiple page size entries for the SLB used for kernel linear
map.
2. No easy way of getting the hash slot details after the page table
mapping for kernel linear setup. So even if kfence allocate the
pool in late init, we won't be able to get the hash slot details in
kfence linear map.
Thus this patch disables kfence on hash if kfence early init is not
enabled.
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
arch/powerpc/mm/book3s64/hash_utils.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
index 558d6f5202b9..2f5dd6310a8f 100644
--- a/arch/powerpc/mm/book3s64/hash_utils.c
+++ b/arch/powerpc/mm/book3s64/hash_utils.c
@@ -410,6 +410,8 @@ static phys_addr_t kfence_pool;
static inline void hash_kfence_alloc_pool(void)
{
+ if (!kfence_early_init_enabled())
+ goto err;
/* allocate linear map for kfence within RMA region */
linear_map_kf_hash_count = KFENCE_POOL_SIZE >> PAGE_SHIFT;
@@ -1074,7 +1076,7 @@ static void __init htab_init_page_sizes(void)
bool aligned = true;
init_hpte_page_sizes();
- if (!debug_pagealloc_enabled_or_kfence()) {
+ if (!debug_pagealloc_enabled() && !kfence_early_init_enabled()) {
/*
* Pick a size for the linear mapping. Currently, we only
* support 16M, 1M and 4K which is the default
--
2.46.0
next prev parent reply other threads:[~2024-10-18 17:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 17:29 [PATCH v3 00/12] powerpc/kfence: Improve kfence support (mainly Hash) Ritesh Harjani (IBM)
2024-10-18 17:29 ` [PATCH v3 01/12] powerpc: mm/fault: Fix kfence page fault reporting Ritesh Harjani (IBM)
2024-10-18 17:40 ` Christophe Leroy
2024-10-22 2:42 ` Michael Ellerman
2024-10-22 3:09 ` Ritesh Harjani
2024-10-18 17:29 ` [PATCH v3 02/12] book3s64/hash: Remove kfence support temporarily Ritesh Harjani (IBM)
2024-10-18 17:29 ` [PATCH v3 03/12] book3s64/hash: Refactor kernel linear map related calls Ritesh Harjani (IBM)
2024-10-18 17:29 ` [PATCH v3 04/12] book3s64/hash: Add hash_debug_pagealloc_add_slot() function Ritesh Harjani (IBM)
2024-10-18 17:29 ` [PATCH v3 05/12] book3s64/hash: Add hash_debug_pagealloc_alloc_slots() function Ritesh Harjani (IBM)
2024-10-18 17:29 ` [PATCH v3 06/12] book3s64/hash: Refactor hash__kernel_map_pages() function Ritesh Harjani (IBM)
2024-10-18 17:29 ` [PATCH v3 07/12] book3s64/hash: Make kernel_map_linear_page() generic Ritesh Harjani (IBM)
2024-10-18 17:29 ` [PATCH v3 08/12] book3s64/hash: Disable debug_pagealloc if it requires more memory Ritesh Harjani (IBM)
2024-10-18 17:29 ` [PATCH v3 09/12] book3s64/hash: Add kfence functionality Ritesh Harjani (IBM)
2024-10-18 17:29 ` [PATCH v3 10/12] book3s64/radix: Refactoring common kfence related functions Ritesh Harjani (IBM)
2024-10-18 17:29 ` Ritesh Harjani (IBM) [this message]
2024-10-18 17:29 ` [PATCH v3 12/12] book3s64/hash: Early detect debug_pagealloc size requirement Ritesh Harjani (IBM)
2024-11-07 8:42 ` [PATCH v3 00/12] powerpc/kfence: Improve kfence support (mainly Hash) Michael Ellerman
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=4a6eea8cfd1cd28fccfae067026bff30cbec1d4b.1729271995.git.ritesh.list@gmail.com \
--to=ritesh.list@gmail.com \
--cc=aneesh.kumar@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=donettom@linux.vnet.ibm.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=hbathini@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=pavrampu@linux.vnet.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox