linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: Increase memory block size to 1GB on radix
@ 2017-12-20  4:25 Michael Ellerman
  2017-12-22  5:06 ` Michael Ellerman
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2017-12-20  4:25 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: anton, aneesh.kumar, david

When we're using the Radix MMU we map the kernel linear mapping with
1G pages. That means we must do memory hot remove in blocks of at
least that size. Otherwise the linear mapping can end up not mapping
all of memory because we've removed part of a 1G region but unmapped
the entire 1G region from the linear mapping.

Currently on pseries we consult the device tree to find out the the
"LMB" (Logical Memory Block) size. This is the unit of memory hotplug
communicated to us by the hypervisor, but it does not take into
account anything the kernel has done itself, such as use 1G pages for
the linear mapping.

So take what's in the device tree as a start, but make sure we round
up to 1G when Radix is enabled if the size from the device tree is
smaller.

Note that this code is also theoretically broken on hash, except that
with hash we use 16MB pages for the linear mapping and all hypervisors
I'm aware of use at least a 256MB LMB size.

Fixes: 4b5d62ca17a1 ("powerpc/mm: add radix__remove_section_mapping()")
Cc: stable@vger.kernel.org # v4.11+
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/hotplug-memory.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 1d48ab424bd9..a602be935777 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -67,6 +67,15 @@ unsigned long pseries_memory_block_size(void)
 			}
 		}
 	}
+
+	/*
+	 * We map the kernel linear region with 1GB large pages on radix. For
+	 * memory hot unplug to work our memory block size must be at least
+	 * that big.
+	 */
+	if (radix_enabled())
+		memblock_size = max(1u << 30, memblock_size);
+
 	return memblock_size;
 }
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/pseries: Increase memory block size to 1GB on radix
  2017-12-20  4:25 [PATCH] powerpc/pseries: Increase memory block size to 1GB on radix Michael Ellerman
@ 2017-12-22  5:06 ` Michael Ellerman
  2017-12-22  5:59   ` Balbir Singh
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2017-12-22  5:06 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: david, anton, aneesh.kumar

Michael Ellerman <mpe@ellerman.id.au> writes:

> When we're using the Radix MMU we map the kernel linear mapping with
> 1G pages. That means we must do memory hot remove in blocks of at
> least that size. Otherwise the linear mapping can end up not mapping
> all of memory because we've removed part of a 1G region but unmapped
> the entire 1G region from the linear mapping.
>
> Currently on pseries we consult the device tree to find out the the
> "LMB" (Logical Memory Block) size. This is the unit of memory hotplug
> communicated to us by the hypervisor, but it does not take into
> account anything the kernel has done itself, such as use 1G pages for
> the linear mapping.

This patch failed to survive contact with reality. ie. it doesn't work.

NAK.

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/pseries: Increase memory block size to 1GB on radix
  2017-12-22  5:06 ` Michael Ellerman
@ 2017-12-22  5:59   ` Balbir Singh
  0 siblings, 0 replies; 3+ messages in thread
From: Balbir Singh @ 2017-12-22  5:59 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Aneesh Kumar KV, Anton Blanchard, David Gibson

On Fri, Dec 22, 2017 at 4:06 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> Michael Ellerman <mpe@ellerman.id.au> writes:
>
>> When we're using the Radix MMU we map the kernel linear mapping with
>> 1G pages. That means we must do memory hot remove in blocks of at
>> least that size. Otherwise the linear mapping can end up not mapping
>> all of memory because we've removed part of a 1G region but unmapped
>> the entire 1G region from the linear mapping.
>>
>> Currently on pseries we consult the device tree to find out the the
>> "LMB" (Logical Memory Block) size. This is the unit of memory hotplug
>> communicated to us by the hypervisor, but it does not take into
>> account anything the kernel has done itself, such as use 1G pages for
>> the linear mapping.
>
> This patch failed to survive contact with reality. ie. it doesn't work.
>
> NAK.


I have patches to split the size of a region, I guess the right thing to do is
to split the size of mapping during hotplug. I can look at doing that once I
am back. What broke for you during testing?

Balbir Singh.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-22  5:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-20  4:25 [PATCH] powerpc/pseries: Increase memory block size to 1GB on radix Michael Ellerman
2017-12-22  5:06 ` Michael Ellerman
2017-12-22  5:59   ` Balbir Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).