Received: by 2002:ab2:6991:0:b0:1f2:fff1:ace7 with SMTP id v17csp267685lqo; Wed, 27 Mar 2024 12:22:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWU/I2Qun8UZkyXIQ5B1K36rDUAxuEghXrj+FuNCW9sd2kXjOegqLsa2g8BTffY5htV9rfhmogv2wHm3M9kgAbDCkZdBBoaFcAOJDk+Jw== X-Google-Smtp-Source: AGHT+IHLVTlmEmsajhzyA+53l3med3mJSmCGoPQPy6A6VLC4ZL/Yc5+8sseIWiY58HcTjxDfN12G X-Received: by 2002:a17:907:77da:b0:a46:ab93:9848 with SMTP id kz26-20020a17090777da00b00a46ab939848mr221226ejc.26.1711567357785; Wed, 27 Mar 2024 12:22:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711567357; cv=pass; d=google.com; s=arc-20160816; b=H3//YhthvcFDf5g1lJTz8QHhGG6iqgICbee8szCmN1Xo3/UGs/D6vMAZwBz4fLT4oy APUba1+WFDzkOLG54T116PT6pAqx+DpCtsvZwDh37Q+WVtnVZMyHeMqN/GEwUWH5xHUU e/pPR70FByl0baRQCfBwFl/L1mc54w4VezCtumv99Lti+idR3Hw9XQmX93EuYW3XqU3J w4Xv9b9fAS5nAEN95vZdnAku16IQGGbOJLTuowhIWcHKAadMlqTRkbJViICJ0iuq5w/k liJZy58yQXPbSdniFOgApFpXs+wV1UMEKLHlFeEX5jT0WYQ1hQzEkrbRcGiHE80eFMMC F+ig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=NsJXqsPS21iojynWWbJBHs3AJEMpATZGYN7XCZojFHo=; fh=ttP3ECNIQ2CoU0h6i/xzCgHBqxBhthg1/3VI7oSQRo0=; b=XH5ULXhgKMtifxQTwzu2zIs8V48567ru+dHE6h04X78vQsA46CB+NAOv8nRkDhxUms F/OvaniTeShWuzQoNi/9ZmzxAgClg12hHCOP2pyQcfzv8LWd/82SMAW19rZ2ycdQnAdW uu80nR2zrEqZ6sSNAWRZ1NBJ541wj/w7aQ1aNeavrEcw/mUllIzEZoKf1WmFwjdx5Qvv FoynfQN38TQ5CfhlGGwswXSgT3JlHcmLg0ie0e9aQNgshQyAsREgUTaS0X1bLPg3fv32 tCS1kM8+bEjLCNHIT7nuqHis1tpPCO6ZbtythTa8al359ltaZxV1EcGeR7QLQGBuuuxr zoQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-121893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121893-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b9-20020a170906150900b00a46b00d59cesi4717282ejd.312.2024.03.27.12.22.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 12:22:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-121893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121893-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id ED4021F35F33 for ; Wed, 27 Mar 2024 19:13:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A6401514FB; Wed, 27 Mar 2024 19:12:13 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0D0714F138 for ; Wed, 27 Mar 2024 19:12:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711566732; cv=none; b=FKWdDpik5DeyRenB60t8ClnxmdfslCjeJCd37JnU2nnHpH48NkLg6OIkFO5KOgwp6Vt+fdog1kncBe4oyie9ZV3Xmpu8kmYUXJINNpGiuh3j+S57OxAAT/830pHZyjUkAK4oMh7b6vvYq3iMW6Fds9+Pl0p5ZQxIYxMWYSExEaM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711566732; c=relaxed/simple; bh=/u/cfnccQhrohJN6KgP39BxmpL0wLRKgMCQWFFSwq3g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ZLrWwwCSst78MIvxVLQvq8xC0sjM38zjm5ndud4r4fuZSl0ppzg3PXRUEETVPeQx5x2X/IPFloTOmyaOD1JsJr+45GqTssW1jGj0PmJJaUi54OYdKGVFEpfAZtMuJeHwp90UX/dvksf+1e5TaTz/2lm1xmkThjdDmcyBOH8Tvyc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 498272F4; Wed, 27 Mar 2024 12:12:44 -0700 (PDT) Received: from [10.57.72.121] (unknown [10.57.72.121]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 54E773F694; Wed, 27 Mar 2024 12:12:08 -0700 (PDT) Message-ID: Date: Wed, 27 Mar 2024 19:12:06 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 0/3] Speed up boot with faster linear map creation Content-Language: en-GB To: Catalin Marinas , Will Deacon , Mark Rutland , Ard Biesheuvel , David Hildenbrand , Donald Dutile , Eric Chanudet Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20240326101448.3453626-1-ryan.roberts@arm.com> From: Ryan Roberts In-Reply-To: <20240326101448.3453626-1-ryan.roberts@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 26/03/2024 10:14, Ryan Roberts wrote: > Hi All, > > It turns out that creating the linear map can take a significant proportion of > the total boot time, especially when rodata=full. And a large portion of the > time it takes to create the linear map is issuing TLBIs. This series reworks the > kernel pgtable generation code to significantly reduce the number of TLBIs. See > each patch for details. > > The below shows the execution time of map_mem() across a couple of different > systems with different RAM configurations. We measure after applying each patch > and show the improvement relative to base (v6.9-rc1): > > | Apple M2 VM | Ampere Altra| Ampere Altra| Ampere Altra > | VM, 16G | VM, 64G | VM, 256G | Metal, 512G > ---------------|-------------|-------------|-------------|------------- > | ms (%) | ms (%) | ms (%) | ms (%) > ---------------|-------------|-------------|-------------|------------- > base | 151 (0%) | 2191 (0%) | 8990 (0%) | 17443 (0%) > no-cont-remap | 77 (-49%) | 429 (-80%) | 1753 (-80%) | 3796 (-78%) > no-alloc-remap | 77 (-49%) | 375 (-83%) | 1532 (-83%) | 3366 (-81%) > lazy-unmap | 63 (-58%) | 330 (-85%) | 1312 (-85%) | 2929 (-83%) I've just appended an additional patch to this series. This takes us to a ~95% reduction overall: | Apple M2 VM | Ampere Altra| Ampere Altra| Ampere Altra | VM, 16G | VM, 64G | VM, 256G | Metal, 512G ---------------|-------------|-------------|-------------|------------- | ms (%) | ms (%) | ms (%) | ms (%) ---------------|-------------|-------------|-------------|------------- base | 151 (0%) | 2191 (0%) | 8990 (0%) | 17443 (0%) no-cont-remap | 77 (-49%) | 429 (-80%) | 1753 (-80%) | 3796 (-78%) no-alloc-remap | 77 (-49%) | 375 (-83%) | 1532 (-83%) | 3366 (-81%) lazy-unmap | 63 (-58%) | 330 (-85%) | 1312 (-85%) | 2929 (-83%) batch-barriers | 11 (-93%) | 61 (-97%) | 261 (-97%) | 837 (-95%) Don't believe the intermediate block-based pgtable idea will now be neccessary so I don't intend to persue that. It might be that we choose to drop the middle two patchs; I'm keen to hear opinions. Thanks, Ryan > > This series applies on top of v6.9-rc1. All mm selftests pass. I haven't yet > tested all VA size configs (although I don't anticipate any issues); I'll do > this as part of followup. > > Thanks, > Ryan > > > Ryan Roberts (3): > arm64: mm: Don't remap pgtables per- cont(pte|pmd) block > arm64: mm: Don't remap pgtables for allocate vs populate > arm64: mm: Lazily clear pte table mappings from fixmap > > arch/arm64/include/asm/fixmap.h | 5 +- > arch/arm64/include/asm/mmu.h | 8 + > arch/arm64/include/asm/pgtable.h | 4 - > arch/arm64/kernel/cpufeature.c | 10 +- > arch/arm64/mm/fixmap.c | 11 + > arch/arm64/mm/mmu.c | 364 +++++++++++++++++++++++-------- > include/linux/pgtable.h | 8 + > 7 files changed, 307 insertions(+), 103 deletions(-) > > -- > 2.25.1 >