Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp49150lqj; Thu, 11 Apr 2024 09:30:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQHHoi9gFWJK2cERTKyHohxEijVOZJJziJ9FZm+IiH1EiB10Xs8wCpu8CDvHAUlGGd7dkIvTqvcGVykQnsb+aQ9rGDwZTr5z6pByVH0A== X-Google-Smtp-Source: AGHT+IGk3ogIHc9/kGZVjgWrs9EZbC1XKriD1xih3g3M2ptLD/c6HODcJpqB+IQK1YM8CmVMj/6A X-Received: by 2002:a17:906:f6d5:b0:a51:b36e:61c7 with SMTP id jo21-20020a170906f6d500b00a51b36e61c7mr169033ejb.13.1712853051959; Thu, 11 Apr 2024 09:30:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712853051; cv=pass; d=google.com; s=arc-20160816; b=LaSruVSJmOAbvEKxloLFMf90YIgvP2at5RC1QmHdrcQgRwLFxuNg71v5qn8MV7luUk I1iHREF4wUmM+UVMl+7FGuYTdyS4rR4rYdkGHob1xPyohxw4+UpAJEp2EUqUMLJguErn v8pTtbQ54kfhSRimDh9Anbj2LApz0oyz/vjuz7NDst1bNGEMwKuiGyDQ9atqSBaNB105 A/XVcce5k7kKX9RHqzAR17WoZuBvWdhlYM28Ah1nIGDKSAJ4Mg2UaKVICvPsU7sn/en8 /5OHttbrH4ytna20ViXLIjwfIWsWUcXVwNuBSItkmrmZdPLyF/eR9QkJTFBq6li+/Qlo gIrg== 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=zKEhX3gPoRz+xFgFTdwbSKHkGbWrYNse6vY2zm+k1hk=; fh=y85H5Q7wZMvy/8UF7CTeGIuhWlHY8vDY5yZjQk4g9Qs=; b=0k/Q0LHOrvhnZeAt4xbEIHRDWupgBCrycMWDra39+k3z0l7CeKLt+Vqnh9M74d6ylD F8gmS+l3YNQ7b+hwCZnrN+Jw+vZyqF56PZXrPkMeXyOK0TBBroWIrF4Lgy0V51EbrSWB 3ii374ObLG3w6wlliwTQJLdWSU2JKTRYtMCr9ux8Bwyh+kO2eYUyVUV9/RuiFwUDdb4s Il/kPVm4lNh3ddcJrBA+49Q/SX+U6EKBt6YNCTuMnzjgJ72pZsticoJXoHP2Bj4EggCc oUkJQ14faRwMHIchqNeHNNXyUFEkGXGjILrnoW1S3LJiKELeTrQOl3Tpiz4epoKW2joc l2sA==; 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-140997-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140997-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. [147.75.80.249]) by mx.google.com with ESMTPS id f20-20020a170906495400b00a522e542340si124655ejt.800.2024.04.11.09.30.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 09:30:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140997-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-140997-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140997-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 B37A81F284C1 for ; Thu, 11 Apr 2024 16:30:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72B6C1C127F; Thu, 11 Apr 2024 15:38:00 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85FD61C124F for ; Thu, 11 Apr 2024 15:37:58 +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=1712849879; cv=none; b=kdRI0GzvVZm4iDBTS9jTC+ADFMQ4PxaHGvghkxmYcfTSVttF1wVg+17sI5gv73JH7QYwfT1C0nYtnC8fZsBxudcENDAaF/CJEiLQjEMqFXkIyDE3AAFonp4WGraSzk9CVMqyYSN88pSfjojdend/JxvWtvyhnnUxyZLSoFjEkhc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849879; c=relaxed/simple; bh=MAMYui+jp1n4vPA6ZwebIUQNWsmP7XShJzR/yynCjEo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IgWte94ir1gGqZLXSlyK4iCeFkBaWXq/Fu7uB0aOSYbpKakFsVE6Wnp4Iw3OD7x3uTAV4XvLvaVnqOHtVlojzGH0VGlvCJD3jB2mWYgD/oc4YRrO5lAwfA3V77OAzTKkM1wulxhJwXYNtz8EYS9CubP01J6q2vYzasKVDe+S+Cg= 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 7EB48113E; Thu, 11 Apr 2024 08:38:27 -0700 (PDT) Received: from [10.1.38.151] (XHFQ2J9959.cambridge.arm.com [10.1.38.151]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BBD303F6C4; Thu, 11 Apr 2024 08:37:56 -0700 (PDT) Message-ID: Date: Thu, 11 Apr 2024 16:37:55 +0100 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 v2 3/4] arm64: mm: Don't remap pgtables for allocate vs populate Content-Language: en-GB To: Mark Rutland Cc: Catalin Marinas , Will Deacon , Ard Biesheuvel , David Hildenbrand , Donald Dutile , Eric Chanudet , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Itaru Kitayama References: <20240404143308.2224141-1-ryan.roberts@arm.com> <20240404143308.2224141-4-ryan.roberts@arm.com> <37d4c278-3780-49ce-bd7e-e8f2ff4501fd@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/04/2024 16:25, Mark Rutland wrote: > On Thu, Apr 11, 2024 at 03:57:04PM +0100, Ryan Roberts wrote: >> On 11/04/2024 15:48, Mark Rutland wrote: >>> On Thu, Apr 11, 2024 at 02:37:49PM +0100, Ryan Roberts wrote: >>>> On 11/04/2024 14:02, Mark Rutland wrote: >>>>> but the logic remains fairly simple, and I suspect the overhead for late >>>>> allocations might not matter since the bulk of late changes are non-allocating. >>>> >>>> Its just the fixmap overhead that remains... >>> >>> True; my thinking there is that almost all of the later changes are for smaller >>> ranges than the linear map (~10s of MB vs GBs in your test data), so I'd expect >>> the overhead of those to be dominated by the cost of mappin the linear map. >>> >>> The only big exception is arch_add_memory(), but memory hotplug is incredibly >>> rare, and we're not making it massively slower than it already was... >> >> What about something like coco guest mem (or whatever its called). Isn't that >> scrubbed out of the linear map? So if a coco VM is started with GBs of memory, >> could that be a real case we want to optimize? > > I think that's already handled -- the functions we have to carve portions out > of the linear map use apply_to_page_range(), which doesn't use the fixmap. See > set_memory_*() and set_direct_map_*() in arch/arm64/mm/pageattr.c. Ahh gottya. Yet another table walker :) > > Note that apply_to_page_range() does what its name implies and *only* handles > mappings at page granularity. Hence not using that for > mark_linear_text_alias_ro() and mark_rodata_ro() which need to be able to > handle blocks. > > Mark.