Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp43076rdh; Tue, 13 Feb 2024 08:53:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU3IYvlQRv4C8Zx0sdyQIDOuc0OF8MI/26SdMpJiishbOJgYIsyKQM2rNFYscPMYyUKMQjh/tg9Vsw0hToLlP91wXnrxaFdHLBbtX4m3A== X-Google-Smtp-Source: AGHT+IGdRyY0/a5K0TUpH72fr236UjjnM3YS/b8DY2zUxmRMh2eAWl37w9L7jL0yFsHydQV2WmF2 X-Received: by 2002:ad4:5def:0:b0:68c:aaac:46d4 with SMTP id jn15-20020ad45def000000b0068caaac46d4mr20792qvb.33.1707843196952; Tue, 13 Feb 2024 08:53:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707843196; cv=pass; d=google.com; s=arc-20160816; b=tiW9ae7y64lexFlTjoaXDTNuZR8s2jKJ9keRWYXhGg+03L1VuJOq5SnxmgP8pZHvvj Wa6q596jCvHIPi6GxWOtEJjPerr89e4mRhJucyUcvyZqY9zo2YCjctiyoI68sq9E8SMr C3Bf/z86JbESCTBzfwKnAq2UzWmtNMv4ekvGjRIs477MEFMLvs8935om74kbtLzZ1/oe hYXl0eblgXpifnJtN8SC8tlfu1hA5RbyzkvznkGtfEYFBo00lzXpak1YoGeu5GHn4Ovn TbEHIbeAeUHw0klRleD5QRpW1lErnhgz8tA/s5jgatPPtZKsLqUyQVplstjejYTXgLwJ 92kw== 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; bh=i/VInZj8WfMRcG9hK9CDrFcZl+U4X7AwgnIibvGE3cQ=; fh=94rGdSqcq9AgSiPu4FhFoJyVtaJVpENDQ6trmW+Iy3g=; b=dMmHYdV7TJL9gCyAUv1vrf4f157Hlr6qF1Pvd0arV6CIrPhIybVCpnUdT4JaZ4pY8m 27fFXk7P6WXQPGaEkC+uC/0x7/xo3sbECz8lzz0HM/B5jhKmCXdLZPiaMIsM91OJDLXM EeHV4+2br/Z/KzgCu6a2ohgC+1mvzT5sFqW3CO9Tgjil1a4jiZQ8xweZR8S6PceN+Ezt dtpv3IJHR/GgUAWoREbZni7TyYdeypjozbk240rgdcaYA0C4LJt1kcRlxzDAfgAhltbq Qzf86uD3m5l6wXYJINapL8xZbxidJQ4u4rjZ4vqOttvYL425Yt3Zwn/GwjDeUGPufuwS SJEA==; 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-63944-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63944-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; AJvYcCVNzsDQQAXacuPdKQ3NPp70lubPYQDelwWblR2kjFLa8oQsPOq0z3mbT23GDKaoywMc8QsSfhIrdypkQceZgzKE+CnN3TEC0py5WV2Pzw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r4-20020a0562140c8400b00684771ba580si1666928qvr.454.2024.02.13.08.53.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 08:53:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63944-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-63944-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63944-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 ACFF81C21ECA for ; Tue, 13 Feb 2024 16:53:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 431F55FDB7; Tue, 13 Feb 2024 16:53:10 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4ABF05FDA1 for ; Tue, 13 Feb 2024 16:53:08 +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=1707843189; cv=none; b=MjMv7P8/+dOapF/NzpcX7a0gBmYFAdHTDydJY1zbrBc6O5YkikzDaIGY9H1K5HgZ+3WNlQf7FN0sqxYBz0hvdlislcUYiVSS3RIqiXJQYw1mYv7EjHiKV6he7QsP1MUHrEK8gYqnf5t3Nr/xdX8bdLG45MUwSv2iY7Pl4MPU6QI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707843189; c=relaxed/simple; bh=IXbhYZ1xaMkBf+Jw3xxduw1mD+IlC///ZLOxs47C4Ew=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IRGl6qhgqbMNRMwMiP5EBuJhTpHcdGtGlZlV/gh5KDqULBqvGDc08WhL+10MDj1VUkq68pRXXug7VsAKOf3qvQ6uTICX0akqhWY1M4gVCinsbt+Q88i4tdaelfkEMyFUSmlm5AAwt2y2C0jSDlioXia0ZD4vdxfy7kz/HEZg+XE= 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 CCA9CDA7; Tue, 13 Feb 2024 08:53:48 -0800 (PST) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.36.130]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CB5073F5A1; Tue, 13 Feb 2024 08:53:03 -0800 (PST) Date: Tue, 13 Feb 2024 16:53:01 +0000 From: Mark Rutland To: Ryan Roberts Cc: Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , James Morse , Andrey Ryabinin , Andrew Morton , Matthew Wilcox , David Hildenbrand , 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 Subject: Re: [PATCH v5 21/25] arm64/mm: Implement new [get_and_]clear_full_ptes() batch APIs Message-ID: References: <20240202080756.1453939-1-ryan.roberts@arm.com> <20240202080756.1453939-22-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 Tue, Feb 13, 2024 at 04:48:50PM +0000, Ryan Roberts wrote: > On 13/02/2024 16:43, Mark Rutland wrote: > > On Fri, Feb 02, 2024 at 08:07:52AM +0000, Ryan Roberts wrote: > >> +static inline void __clear_full_ptes(struct mm_struct *mm, unsigned long addr, > >> + pte_t *ptep, unsigned int nr, int full) > >> +{ > >> + for (;;) { > >> + __ptep_get_and_clear(mm, addr, ptep); > >> + if (--nr == 0) > >> + break; > >> + ptep++; > >> + addr += PAGE_SIZE; > >> + } > >> +} > > > > The loop construct is a bit odd; can't this be: > > I found it a little odd at first, but its avoiding the ptep and addr increments > the last time through the loop. Its the preferred pattern for these functions in > core-mm. See default set_ptes(), wrprotect_ptes(), clear_full_ptes() in > include/linux/pgtable.h. > > So I'd prefer to leave it as is so that we match them. What do you think? That's fair enough; it I'm happy with it as-is. Mark.