All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org
Cc: Bharata B Rao <bharata@linux.ibm.com>
Subject: Re: [PATCH v2 4/4] powerpc/mm/radix: Create separate mappings for hot-plugged memory
Date: Wed, 08 Jul 2020 22:14:44 +1000	[thread overview]
Message-ID: <87mu4a2ogb.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <aa2e029f-d6f3-60da-7840-0b377da0337a@linux.ibm.com>

"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
> On 7/8/20 10:14 AM, Michael Ellerman wrote:
>> "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
>>> To enable memory unplug without splitting kernel page table
>>> mapping, we force the max mapping size to the LMB size. LMB
>>> size is the unit in which hypervisor will do memory add/remove
>>> operation.
>>>
>>> This implies on pseries system, we now end up mapping
>> 
>> Please expand on why it "implies" that for pseries.
>> 
>>> memory with 2M page size instead of 1G. To improve
>>> that we want hypervisor to hint the kernel about the hotplug
>>> memory range.  This was added that as part of
>>                   That
>>>
>>> commit b6eca183e23e ("powerpc/kernel: Enables memory
>>> hot-remove after reboot on pseries guests")
>>>
>>> But we still don't do that on PowerVM. Once we get PowerVM
>> 
>> I think you mean PowerVM doesn't provide that hint yet?
>> 
>> Realistically it won't until P10. So this means we'll always use 2MB on
>> Power9 PowerVM doesn't it?
>> 
>> What about KVM?
>> 
>> Have you done any benchmarking on the impact of switching the linear
>> mapping to 2MB pages?
>> 
>
> The TLB impact should be minimal because with a 256M LMB size partition 
> scoped entries are still 2M and hence we end up with TLBs of 2M size.
>
>
>>> updated, we can then force the 2M mapping only to hot-pluggable
>>> memory region using memblock_is_hotpluggable(). Till then
>>> let's depend on LMB size for finding the mapping page size
>>> for linear range.
>>>
>
> updated
>
>
> powerpc/mm/radix: Create separate mappings for hot-plugged memory
>
> To enable memory unplug without splitting kernel page table
> mapping, we force the max mapping size to the LMB size. LMB
> size is the unit in which hypervisor will do memory add/remove
> operation.
>
> Pseries systems supports max LMB size of 256MB. Hence on pseries,
> we now end up mapping memory with 2M page size instead of 1G. To improve
> that we want hypervisor to hint the kernel about the hotplug
> memory range.  That was added that as part of
>
> commit b6eca18 ("powerpc/kernel: Enables memory
> hot-remove after reboot on pseries guests")
>
> But PowerVM doesn't provide that hint yet. Once we get PowerVM
> updated, we can then force the 2M mapping only to hot-pluggable
> memory region using memblock_is_hotpluggable(). Till then
> let's depend on LMB size for finding the mapping page size
> for linear range.
>
> With this change KVM guest will also be doing linear mapping with
> 2M page size.

...
>>> @@ -494,17 +544,27 @@ void __init radix__early_init_devtree(void)
>>>   	 * Try to find the available page sizes in the device-tree
>>>   	 */
>>>   	rc = of_scan_flat_dt(radix_dt_scan_page_sizes, NULL);
>>> -	if (rc != 0)  /* Found */
>>> -		goto found;
>>> +	if (rc == 0) {
>>> +		/*
>>> +		 * no page size details found in device tree
>>> +		 * let's assume we have page 4k and 64k support
>> 
>> Capitals and punctuation please?
>> 
>>> +		 */
>>> +		mmu_psize_defs[MMU_PAGE_4K].shift = 12;
>>> +		mmu_psize_defs[MMU_PAGE_4K].ap = 0x0;
>>> +
>>> +		mmu_psize_defs[MMU_PAGE_64K].shift = 16;
>>> +		mmu_psize_defs[MMU_PAGE_64K].ap = 0x5;
>>> +	}
>> 
>> Moving that seems like an unrelated change. It's a reasonable change but
>> I'd rather you did it in a standalone patch.
>> 
>
> we needed that change so that we can call radix_memory_block_size() for 
> both found and !found case.

But the found and !found cases converge at found:, which is where you
call it. So I don't understand.

But as I said below, it would be even simpler if you worked out the
memory block size first.

cheers

>>>   	/*
>>> -	 * let's assume we have page 4k and 64k support
>>> +	 * Max mapping size used when mapping pages. We don't use
>>> +	 * ppc_md.memory_block_size() here because this get called
>>> +	 * early and we don't have machine probe called yet. Also
>>> +	 * the pseries implementation only check for ibm,lmb-size.
>>> +	 * All hypervisor supporting radix do expose that device
>>> +	 * tree node.
>>>   	 */
>>> -	mmu_psize_defs[MMU_PAGE_4K].shift = 12;
>>> -	mmu_psize_defs[MMU_PAGE_4K].ap = 0x0;
>>> -
>>> -	mmu_psize_defs[MMU_PAGE_64K].shift = 16;
>>> -	mmu_psize_defs[MMU_PAGE_64K].ap = 0x5;
>>> -found:
>>> +	radix_mem_block_size = radix_memory_block_size();
>> 
>> If you did that earlier in the function, before
>> radix_dt_scan_page_sizes(), the logic would be simpler.
>> 
>>>   	return;
>>>   }

      reply	other threads:[~2020-07-08 12:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25  6:45 [PATCH v2 0/4] powerpc/mm/radix: Memory unplug fixes Aneesh Kumar K.V
2020-06-25  6:45 ` [PATCH v2 1/4] powerpc/mm/radix: Fix PTE/PMD fragment count for early page table mappings Aneesh Kumar K.V
2020-06-25 11:30   ` Aneesh Kumar K.V
2020-06-25  6:45 ` [PATCH v2 2/4] powerpc/mm/radix: Free PUD table when freeing pagetable Aneesh Kumar K.V
2020-07-08  2:12   ` Michael Ellerman
2020-07-08  2:48     ` Aneesh Kumar K.V
2020-07-08 20:30   ` Reza Arbab
2020-06-25  6:45 ` [PATCH v2 3/4] powerpc/mm/radix: Remove split_kernel_mapping() Aneesh Kumar K.V
2020-06-25  6:45 ` [PATCH v2 4/4] powerpc/mm/radix: Create separate mappings for hot-plugged memory Aneesh Kumar K.V
2020-07-08  4:44   ` Michael Ellerman
2020-07-08  6:24     ` Aneesh Kumar K.V
2020-07-08 12:14       ` Michael Ellerman [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=87mu4a2ogb.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=bharata@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.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.