Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2492747rdb; Mon, 12 Feb 2024 06:45:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgDGN/xSsk2OJ8viS7BZizq4Nc7XW4I7wmNk7mkkzkxhByKlwg13ZWg2wLEXbxHpeJioLv X-Received: by 2002:a05:6870:c98e:b0:21a:47fc:4bcf with SMTP id hi14-20020a056870c98e00b0021a47fc4bcfmr6828158oab.29.1707749117259; Mon, 12 Feb 2024 06:45:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707749117; cv=pass; d=google.com; s=arc-20160816; b=lHn3SekzWvN1cnrIaYrGjS2QPmXll/h6pU/axDcJ9RbEwNTILCKusIO2mFWhbtilHL 5DKPN5brsFGqvwyehq0hg83ArPVUirvJZZjqdCS/ViZN+zqJo6cTlhVx6ZNHmDpnyR8Y 8dXv0EGzLIdoRvuY9rimxGWMRUVJOnAmoH+UiWf+tcwtjW/GzOi3aaGUSMly4YZqNeRH 8u6Vgxcq0tz+X6/t6kxzHk9UD4xQojXC9j1gI7kvKBuQhfUfnQ9n5Cb0Jod4N8mXRE43 xBax+3QHfJv0EZ2/HqKCf8/HZUA7rrygpOn0A+15gbeWjmZsOBfGd2lhBRS7wz1cTOs8 AJ9g== 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=16qMSmAEvLPOcIqczpGhiqxJnkTMn5xlIaVWX44ktlc=; fh=SZZv0oAlu0xJ6CULCJM2HkCTEl5pz4VM6A9Du/56mps=; b=wieNdTqm0UCyYMGxZVJ+MzoklZmBQJNrb/qs9Aw4HJmB9KKVlnPKQrLYBcqAFccZdR m0Fji7YOjG6vreNy/smsFbzaCcIKUiCyYfYQ04gRLYLr4LglY6cCvdJdmUj1PWRy1VtN mc9vW+9s0VRYFvlmqxcgJNP/G19ntqXwbOiXYM4oT6EmfCTFoKzkjn5aYzJ0ZCzAia0t gyQnE9v8xDKt82K6jl61H3VZqmXt7w/CuXzC7O95huXUvSdl9CSS6fvu/RaonFWVdjVY aEozRSZAEtfkgyhBpWPRXa2HHMEGk2Vo3CwmUa7pj69AOj/eu1nTHOmFOyvYrdIEYQKW nbow==; 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-61836-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61836-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=2; AJvYcCX6d350TI/Xsq+WNrvrPV20ywFNnkCwygybGChPL+4JadDl1HxhgS1ap9mjpxhiOIFNnnGtFTaH1FS9+sLQQzcCz+YE5L0BedCaTHif1w== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x21-20020ac87a95000000b00429e56aee2esi485266qtr.288.2024.02.12.06.45.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:45:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61836-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-61836-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61836-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C3EAC1C21641 for ; Mon, 12 Feb 2024 14:45:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B1D133B78D; Mon, 12 Feb 2024 14:45:10 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05EE83B293 for ; Mon, 12 Feb 2024 14:45:07 +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=1707749110; cv=none; b=jruRg/m+h2jMquP9r687+OCU+KE2TbMIlegBSG+QEd2TbRBJmOCFuIY5YkBp0nZw2DmFF/pPrMV57lSV5JQRoFqzu2uZ1zlQwTjLoOKM3xIXMeL6vL7Wu/o7Utm0/HUDTwUamm8eFqimHQDvppNYqUgcWUQ+P/ZqaU8b3r0bexs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707749110; c=relaxed/simple; bh=PYDl2gYJnlvnlLeOVBQz6a0LXuUbhrJgTgIJlDrAo3Q=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=SWqO+MNLGJdVMOB8hhySLts6XAbVrLzRULStyLRGucu3oeXWPRPSwkUtMbFvcCB5UzbRcQ4LWZ5LXLfCLjVzXugFeER2z7C0o2MN8iR2oufpHph5C8tjOBuLzNwJCnO5vwKi5FsS10LlIYmyiYPYcp3CeEasknqFbGWlrlVZ8uY= 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 39022DA7; Mon, 12 Feb 2024 06:45:48 -0800 (PST) Received: from [10.57.78.115] (unknown [10.57.78.115]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8F7543F766; Mon, 12 Feb 2024 06:45:02 -0800 (PST) Message-ID: <502a3ea7-fd86-4314-8292-c7999eda92eb@arm.com> Date: Mon, 12 Feb 2024 14:45:00 +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 v5 19/25] arm64/mm: Wire up PTE_CONT for user mappings Content-Language: en-GB To: David Hildenbrand , Mark Rutland Cc: Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , James Morse , Andrey Ryabinin , Andrew Morton , Matthew Wilcox , Kefeng Wang , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240202080756.1453939-1-ryan.roberts@arm.com> <20240202080756.1453939-20-ryan.roberts@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/02/2024 13:54, David Hildenbrand wrote: >>> If so, I wonder if we could instead do that comparison modulo the access/dirty >>> bits, >> >> I think that would work - but will need to think a bit more on it. >> >>> and leave ptep_get_lockless() only reading a single entry? >> >> I think we will need to do something a bit less fragile. ptep_get() does collect >> the access/dirty bits so its confusing if ptep_get_lockless() doesn't IMHO. So >> we will likely want to rename the function and make its documentation explicit >> that it does not return those bits. >> >> ptep_get_lockless_noyoungdirty()? yuk... Any ideas? >> >> Of course if I could convince you the current implementation is safe, I might be >> able to sidestep this optimization until a later date? > > As discussed (and pointed out abive), there might be quite some callsites where > we don't really care about uptodate accessed/dirty bits -- where ptep_get() is > used nowadays. > > One way to approach that I had in mind was having an explicit interface: > > ptep_get() > ptep_get_uptodate() > ptep_get_lockless() > ptep_get_lockless_uptodate() Yes, I like the direction of this. I guess we anticipate that call sites requiring the "_uptodate" variant will be the minority so it makes sense to use the current names for the "_not_uptodate" variants? But to do a slow migration, it might be better/safer to have the weaker variant use the new name - that would allow us to downgrade one at a time? > > Especially the last one might not be needed. I've done a scan through the code and agree with Mark's original conclusions. Additionally, huge_pte_alloc() (which isn't used for arm64) doesn't rely on access/dirty info. So I think I could migrate everything to the weaker variant fairly easily. > > Futher, "uptodate" might not be the best choice because of PageUptodate() and > friends. But it's better than "youngdirty"/"noyoungdirty" IMHO. Certainly agree with "noyoungdirty" being a horrible name. How about "_sync" / "_nosync"? > > Of course, any such changes require care and are better done one step at at time > separately. > So I propose to introduce ptep_get_lockless_nosync() (name up for discussion) and migrate all users to it, as part of this series. This will side-step Mark's correctness concerns. We can add ptep_get_nosync() later and migrate slowly. Shout if you think this is a bad plan. Thanks, Ryan