All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Miehlbradt <nicholas@linux.ibm.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH 1/4] powerpc/64s: Add DEBUG_PAGEALLOC for radix
Date: Mon, 19 Sep 2022 07:05:30 +0000	[thread overview]
Message-ID: <ad4817c8-3802-fa78-ba03-aae998b603e7@csgroup.eu> (raw)
In-Reply-To: <87k05zlugl.fsf@mpe.ellerman.id.au>



Le 19/09/2022 à 09:00, Michael Ellerman a écrit :
> Nicholas Miehlbradt <nicholas@linux.ibm.com> writes:
>> There is support for DEBUG_PAGEALLOC on hash but not on radix.
>> Add support on radix.
>>
>> Signed-off-by: Nicholas Miehlbradt <nicholas@linux.ibm.com>
>> ---
>>   arch/powerpc/mm/book3s64/radix_pgtable.c | 16 +++++++++++++++-
>>   1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c
>> index db2f3d193448..483c99bfbde5 100644
>> --- a/arch/powerpc/mm/book3s64/radix_pgtable.c
>> +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
>> @@ -30,6 +30,7 @@
>>   #include <asm/trace.h>
>>   #include <asm/uaccess.h>
>>   #include <asm/ultravisor.h>
>> +#include <asm/set_memory.h>
>>   
>>   #include <trace/events/thp.h>
>>   
>> @@ -503,6 +504,9 @@ static unsigned long __init radix_memory_block_size(void)
>>   {
>>   	unsigned long mem_block_size = MIN_MEMORY_BLOCK_SIZE;
>>   
>> +	if (debug_pagealloc_enabled())
>> +		return PAGE_SIZE;
>> +
>>   	/*
>>   	 * OPAL firmware feature is set by now. Hence we are ok
>>   	 * to test OPAL feature.
>> @@ -519,6 +523,9 @@ static unsigned long __init radix_memory_block_size(void)
>>   
>>   static unsigned long __init radix_memory_block_size(void)
>>   {
>> +	if (debug_pagealloc_enabled())
>> +		return PAGE_SIZE;
>> +
>>   	return 1UL * 1024 * 1024 * 1024;
>>   }
>    
> This value ends up in radix_mem_block_size, which is returned by
> pnv_memory_block_size(), which is wired up as ppc_md.memory_block_size,
> and that's called by memory_block_size_bytes().
> 
> And I thought that value had to be >= MIN_MEMORY_BLOCK_SIZE.
> 
> #define MIN_MEMORY_BLOCK_SIZE     (1UL << SECTION_SIZE_BITS)
> #define SECTION_SIZE_BITS       24
> 
> 
> I would expect us to hit the panic in memory_dev_init().
> 
> So that's odd.
> 
> I suspect you need to leave radix_memory_block_size() alone, or at least
> make sure you return MIN_MEMORY_BLOCK_SIZE when debug page alloc is
> enabled.
> 
> We probably need a separate variable that holds the max page size used
> for the linear mapping, and that would then be 1G in the normal case or
> PAGE_SIZE in the debug page alloc case.
> 

I don't know the details of PPC64, but as you mention linear mapping, be 
aware that you don't need to map everything with pages. Only data. You 
can keep text mapped by blocks, it's what is done on 8xx and book3s/32.

Christophe

  reply	other threads:[~2022-09-19  7:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19  1:44 [PATCH 1/4] powerpc/64s: Add DEBUG_PAGEALLOC for radix Nicholas Miehlbradt
2022-09-19  1:44 ` [PATCH 2/4] powerpc/64s: Remove unneeded #ifdef CONFIG_DEBUG_PAGEALLOC in hash_utils Nicholas Miehlbradt
2022-09-19  1:44 ` [PATCH 3/4] powerpc/64s: Allow double call of kernel_[un]map_linear_page() Nicholas Miehlbradt
2022-09-19  1:44 ` [PATCH 4/4] powerpc/64s: Enable KFENCE on book3s64 Nicholas Miehlbradt
2022-09-19  6:20   ` Christophe Leroy
2022-09-19  6:17 ` [PATCH 1/4] powerpc/64s: Add DEBUG_PAGEALLOC for radix Christophe Leroy
2022-09-19  7:00 ` Michael Ellerman
2022-09-19  7:05   ` Christophe Leroy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-05-17  6:16 [PATCH 0/4] powerpc/64s: Enable KFENCE Jordan Niethe
2021-05-17  6:16 ` [PATCH 1/4] powerpc/64s: Add DEBUG_PAGEALLOC for radix Jordan Niethe
2021-06-18  7:28   ` Daniel Axtens

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=ad4817c8-3802-fa78-ba03-aae998b603e7@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=nicholas@linux.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.