From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98445C433E0 for ; Wed, 8 Jul 2020 12:14:57 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 34EEF206C3 for ; Wed, 8 Jul 2020 12:14:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="N0ME8wmj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 34EEF206C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4B1yt55vT4zDqWF for ; Wed, 8 Jul 2020 22:14:53 +1000 (AEST) Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4B1yqM6tXzzDqfj for ; Wed, 8 Jul 2020 22:12:31 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=N0ME8wmj; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4B1yqK51zdz9sRf; Wed, 8 Jul 2020 22:12:29 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1594210349; bh=PL91sEuccRkhCqAtfob7pQDXe5kXLWacpArSdJI++2o=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=N0ME8wmjahxXIllko4JiHNHsPJ+Y/dibVdmAITs9ILi21kzLUVcddomQhNONrRrQ7 Fen4r1zL+mUwXMW9o4Ri0zEmdRCfAAfK6Yly6R9p16T0CJ0OaDHkFPliJQKpj+gp7a K3ljPIuCVdUoDu0jWUi+aGo9uNMGpepdEfs+Dzj/lX5GIEi+hneIzr63owt4Rghy/C 1KuTUAAiqmDUcoFjZM6EuwMyNSsTErE/ZrVfoYxei/HUjiNCa9EsXWs5tIHe2zWIFD RaQJZ4VnbEDULlWUt8YHVe8sLOwk1THi/D4HvciPY2cAPJavYMsk1uPnGHnlosOkqm lgcDW4coYq9og== From: Michael Ellerman To: "Aneesh Kumar K.V" , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2 4/4] powerpc/mm/radix: Create separate mappings for hot-plugged memory In-Reply-To: References: <20200625064547.228448-1-aneesh.kumar@linux.ibm.com> <20200625064547.228448-5-aneesh.kumar@linux.ibm.com> <877dve4nvj.fsf@mpe.ellerman.id.au> Date: Wed, 08 Jul 2020 22:14:44 +1000 Message-ID: <87mu4a2ogb.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bharata B Rao Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" "Aneesh Kumar K.V" writes: > On 7/8/20 10:14 AM, Michael Ellerman wrote: >> "Aneesh Kumar K.V" 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; >>> }