From patchwork Wed Dec 20 04:25:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 851264 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z1hkK3sGRz9s7F for ; Wed, 20 Dec 2017 15:34:17 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3z1hkK2mxRzDrn0 for ; Wed, 20 Dec 2017 15:34:17 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3z1hXB1xx4zDr77 for ; Wed, 20 Dec 2017 15:25:30 +1100 (AEDT) Received: by ozlabs.org (Postfix) id 3z1hX95nKPz9s7f; Wed, 20 Dec 2017 15:25:29 +1100 (AEDT) Delivered-To: linuxppc-dev@ozlabs.org Received: by ozlabs.org (Postfix, from userid 1034) id 3z1hX952GSz9s7F; Wed, 20 Dec 2017 15:25:29 +1100 (AEDT) From: Michael Ellerman To: linuxppc-dev@ozlabs.org Subject: [PATCH] powerpc/pseries: Increase memory block size to 1GB on radix Date: Wed, 20 Dec 2017 15:25:20 +1100 Message-Id: <20171220042520.7946-1-mpe@ellerman.id.au> X-Mailer: git-send-email 2.14.3 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: david@gibson.dropbear.id.au, anton@samba.org, aneesh.kumar@linux.vnet.ibm.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 --- 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; }