From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Cc: Nicholas Piggin <npiggin@gmail.com>,
Hari Bathini <hbathini@linux.ibm.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
"Aneesh Kumar K . V" <aneesh.kumar@kernel.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Donet Tom <donettom@linux.vnet.ibm.com>,
Pavithra Prakash <pavrampu@linux.vnet.ibm.com>
Subject: Re: [RFC v1 10/10] book3s64/hash: Disable kfence if not early init
Date: Thu, 05 Sep 2024 00:14:31 +0530 [thread overview]
Message-ID: <878qw72r8w.fsf@gmail.com> (raw)
In-Reply-To: <8fc490bc-b0e6-4730-87ff-ee247fea887d@csgroup.eu>
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 31/07/2024 à 09:56, Ritesh Harjani (IBM) a écrit :
>> [Vous ne recevez pas souvent de courriers de ritesh.list@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>>
>> 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 | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
>> index c66b9921fc7d..759dbcbf1483 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)
>> + goto err;
>>
>> // allocate linear map for kfence within RMA region
>> linear_map_kf_hash_count = KFENCE_POOL_SIZE >> PAGE_SHIFT;
>> @@ -1074,7 +1076,8 @@ 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() &&
>> + !(IS_ENABLED(CONFIG_KFENCE) && kfence_early_init)) {
>
> Looks complex, can we do simpler ?
>
Yes, kfence_early_init anyway needs clean up. Will make it simpler.
Thanks for the review!
-ritesh
prev parent reply other threads:[~2024-09-04 18:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-31 7:56 [RFC v1 00/10] book3s64/hash: Improve kfence support Ritesh Harjani (IBM)
2024-07-31 7:56 ` [RFC v1 01/10] book3s64/hash: Remove kfence support temporarily Ritesh Harjani (IBM)
2024-08-14 17:07 ` Christophe Leroy
2024-09-04 18:27 ` Ritesh Harjani
2024-07-31 7:56 ` [RFC v1 02/10] book3s64/hash: Refactor kernel linear map related calls Ritesh Harjani (IBM)
2024-07-31 7:56 ` [RFC v1 03/10] book3s64/hash: Add hash_debug_pagealloc_add_slot() function Ritesh Harjani (IBM)
2024-07-31 7:56 ` [RFC v1 04/10] book3s64/hash: Add hash_debug_pagealloc_alloc_slots() function Ritesh Harjani (IBM)
2024-07-31 7:56 ` [RFC v1 05/10] book3s64/hash: Refactor hash__kernel_map_pages() function Ritesh Harjani (IBM)
2024-07-31 7:56 ` [RFC v1 06/10] book3s64/hash: Make kernel_map_linear_page() generic Ritesh Harjani (IBM)
2024-07-31 7:56 ` [RFC v1 07/10] book3s64/hash: Disable debug_pagealloc if it requires more memory Ritesh Harjani (IBM)
2024-07-31 7:56 ` [RFC v1 08/10] book3s64/hash: Add kfence functionality Ritesh Harjani (IBM)
2024-07-31 7:56 ` [RFC v1 09/10] book3s64/radix: Refactoring common kfence related functions Ritesh Harjani (IBM)
2024-08-14 17:15 ` Christophe Leroy
2024-09-04 18:34 ` Ritesh Harjani
2024-07-31 7:56 ` [RFC v1 10/10] book3s64/hash: Disable kfence if not early init Ritesh Harjani (IBM)
2024-08-14 17:18 ` Christophe Leroy
2024-09-04 18:44 ` Ritesh Harjani [this message]
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=878qw72r8w.fsf@gmail.com \
--to=ritesh.list@gmail.com \
--cc=aneesh.kumar@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=donettom@linux.vnet.ibm.com \
--cc=hbathini@linux.ibm.com \
--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 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.