Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp763593lqh; Thu, 28 Mar 2024 16:09:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX848ykNiG3Sg0HHUD/DXmD7/1y/NB1a6Xlhz0Ce7/d0yw97onl6RP4gPE3wZEx5IH3EvjWlab2kSErtzSOzw+2xtnnDg/PD8kmSjEk+A== X-Google-Smtp-Source: AGHT+IHd4QZVaM/dSwptaAgJstR53sC98GWNX7yGeYsH0SrSpHdKhrK6rB5CzhkRdyyyFhkAWK9j X-Received: by 2002:a17:90a:7d10:b0:2a0:3824:cd9d with SMTP id g16-20020a17090a7d1000b002a03824cd9dmr1004634pjl.11.1711667398483; Thu, 28 Mar 2024 16:09:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711667398; cv=pass; d=google.com; s=arc-20160816; b=mksbxzYNQB0X5tpkVUmBqR0gvDoTjBefuK0fPUo3fsckmr8QjFJ0lwAqSIoCAkSc1M OehuM+GWHMEHTohkcOXpxXQiG+O26RxqIOJQlxQ9JVh5WHbQEIFloImhCQUU2skO0+Ne rQ9HjruiyvGjTIDbz8sbmDInB14Klm5WPFrnTVkbQLuam1R00KnUQfcx1UkVkKku2KwQ cliagXNyAAKN3QFK5cLBuEnrlUJ8U8X/FtpkKKiSNn4MX0BMHJKryqA77iU7eqXHXbZ/ INYEBPK3dhHaZbx3j/wkUeBPImOqdfsQaJKtLxOzbiuU7o+Y562tjqXdpJ4yD8aLzQK7 BJYw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=O7NE4hNdw70IHlUQLVH8pzLazVAP9l2/O8oPbhQHcdo=; fh=obL9J7VDL8EBp7SIQxOXIjCpbqDDm7De13MMS4y0lcA=; b=ZMvi357ZADALk/OMvvimgdLAy1DsFD1UYRaoWzrSl7B3nUAcsHrBe2GmwNV09583ey WhRB0SYdcZGsuNiJBIFwTYJ1q1MNuRq2XU1N366OtAHa43dHjjAAljxiqHA0HW6v2s7W qaTkGDlHZ0A4waOjXgSXbanDH+jeQX8OrL1UqA/EAANuz3sgeKSy4UtKio1yzrmsBIwN SwYTbvZJQ2GrKHJlR0B6VuPaiZ0q+1o5/VfQor6Tr2NBmWK2B6Ln3M/8EwHq5gvn4Ldg XYboVt8u2jlAsHaWszrvsnYg8G+rQmxe6IBEbnzQDGiwnBQaCnHExh7IjoRdtYu/gLBH kqTw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iuS5OM8u; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-123803-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123803-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id hk2-20020a17090b224200b0029c3ff6c354si2745028pjb.148.2024.03.28.16.09.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 16:09:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123803-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iuS5OM8u; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-123803-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123803-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E1DCD289A95 for ; Thu, 28 Mar 2024 23:09:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0CB457874; Thu, 28 Mar 2024 23:08:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iuS5OM8u" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F4BA657BC for ; Thu, 28 Mar 2024 23:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711667334; cv=none; b=oEiZZcHp1APt00ztvyJdur5zcCnEIUe3avQxHWAIUKwPsiJ81xf8cVbnDvnIN3BMnsWIi9U1JPhspe0IWsSny7/QStwgoryyH73nLv0g6IFviL0ylyePVYvggOsi15/n1VCzUsN233cJG9+K4GALU3GlQQgJpCr/RCrdyGHkOgY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711667334; c=relaxed/simple; bh=O4rtQZGlV/wx6M+vu+AV+jxl5oNZk1HfuZuYghttxEc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=prctoaa/1qWim5T7Jn0NQ2/5kBLr8oiGds8yXDmN0C81+ZTKZO66pP1RryzDcyDktMpeMyj0wJ7nHFsCYVX/+9o5pEMD4rM14YmRn4+RAcO7aaAvyEhOgSv4WI0apC2Y33eMqI769kbLG3fLM1KomFgISfKHCtMRPBFHZHElm54= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iuS5OM8u; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711667331; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=O7NE4hNdw70IHlUQLVH8pzLazVAP9l2/O8oPbhQHcdo=; b=iuS5OM8u1TG9A7m9+AqOOsgrXHs5qCsyTyEzDugZKs/AZB7ja6TCDHZw6DziOc19Z2WuAY /P6NtNmOx6sE1FZs5yksORquNnfMlALKuI5bTFuHWfVzPw+mIDGawnsEgiourLLX4JV07Y FsIkwY/s8ApfVO3X/y+37tQEW5U72QM= Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-138-2nXZ72X_MPyapbrds-l9jg-1; Thu, 28 Mar 2024 19:08:50 -0400 X-MC-Unique: 2nXZ72X_MPyapbrds-l9jg-1 Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-3c3cfc89b23so1045768b6e.3 for ; Thu, 28 Mar 2024 16:08:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711667329; x=1712272129; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=O7NE4hNdw70IHlUQLVH8pzLazVAP9l2/O8oPbhQHcdo=; b=JExeqH7wARF+tcwcN6dtNaq/L6UtIPTZZ6Q9BnLxiPNafZ+62zUpoNCxZ5uN8hm2T3 a8GpxgUcRMf/mcStuJnXgS3oOme2Em3u9DbFYh+JaWRX/4GSgdhmylmnzTuCpA/vqNdG 0Z6yiHGYTKg0xokU83rSItpAEerNbFGOW9OaiDGU8v/cFu6agqcY/OGFA8Yu3+Pz8NED h4mUxF8ulhA2uK6f8eXUxUbC+hjazVddmOPcG5ijqpOyLBqjx72fdVv0kPqy2pqC4K2k 0o5Q62X6GrRSKorMOS9GxR/szAcwCjEecNwAw/nyfyKZWAzPB7ffWStMyXi+hdUMq2hH BuwQ== X-Forwarded-Encrypted: i=1; AJvYcCXDNNrXU5eFmRv7p+nKvX7oHMrlGuit+F4AjS1+w9Uj4eCyp6UDVUkjpQmLQC2A+T7455QEmcbsef/k+t7sLKHuine4LnPAPmowpYe1 X-Gm-Message-State: AOJu0YxLOJVOcCrC+88rEv8q/Vx9gA6bjKIVoDOWKlTb5Wp+mQB4IVdb kKt2B7jghbIfeiiZDuN7MPn3P+NbTYrolPKCTjRNBg3P7A/hbXhTZtYKcnCGWDls0QwA9dUMCKh lTCjic/cU6LnUsx7+NddMv0izz+3yzCUAsWLOIDvhxLX4CTMTB6P9gzQ0eB6S0i5OrZhT+A== X-Received: by 2002:a05:6808:2190:b0:3c3:d84d:57e8 with SMTP id be16-20020a056808219000b003c3d84d57e8mr876887oib.12.1711667328954; Thu, 28 Mar 2024 16:08:48 -0700 (PDT) X-Received: by 2002:a05:6808:2190:b0:3c3:d84d:57e8 with SMTP id be16-20020a056808219000b003c3d84d57e8mr876863oib.12.1711667328390; Thu, 28 Mar 2024 16:08:48 -0700 (PDT) Received: from localhost (pool-71-184-142-128.bstnma.fios.verizon.net. [71.184.142.128]) by smtp.gmail.com with ESMTPSA id js3-20020a0562142aa300b006961cc3f91asm1064646qvb.20.2024.03.28.16.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 16:08:47 -0700 (PDT) Date: Thu, 28 Mar 2024 19:08:47 -0400 From: Eric Chanudet To: Ryan Roberts Cc: Catalin Marinas , Will Deacon , Mark Rutland , Ard Biesheuvel , David Hildenbrand , Donald Dutile , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 0/3] Speed up boot with faster linear map creation Message-ID: References: <20240326101448.3453626-1-ryan.roberts@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Mar 27, 2024 at 07:12:06PM +0000, Ryan Roberts wrote: > 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. > Applied on v6.9-rc1, I have much shorter base timing on a similar machine (Ampere HR350A). no-alloc-remap didn't show much difference either. | SA8775p-ride | Ampere HR350A| | VM, 36G | Metal, 256G | ---------------|--------------|--------------| | ms (%) | ms (%) | ---------------|--------------|--------------| base | 358 (0%) | 2213 (0%) | no-cont-remap | 232 (-35%) | 1283 (-42%) | no-alloc-remap | 228 (-36%) | 1282 (-42%) | lazy-unmap | 231 (-35%) | 1248 (-44%) | batch-barriers | 25 (-93%) | 204 (-91%) | Tested-By: Eric Chanudet > > 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 > > > -- Eric Chanudet