Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp58755lqj; Wed, 10 Apr 2024 04:06:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWef/i3nrLOcHi4nicVqC7v1V8VLI/MySx8ZYUvgii+QJxxA7B5FGXR2uH0kdq/jV4wJrP6r2Vv26OZOcoqiMHAXlLhX3/tLktcyWhOsQ== X-Google-Smtp-Source: AGHT+IHeP4JSgiwadmZ2LJ265LEXl2g9KbABi1CHVmR1DR7xquoVRwg8HzFYcnz7Nxc1Z384pEaN X-Received: by 2002:a17:906:6bd7:b0:a45:f9c5:3024 with SMTP id t23-20020a1709066bd700b00a45f9c53024mr4193479ejs.11.1712747178848; Wed, 10 Apr 2024 04:06:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712747178; cv=pass; d=google.com; s=arc-20160816; b=Qf7kYevE9aN9NGFss3Hsaakbi+eIAguWJMVKSgOrvSwbcbVd+tl4GHOW0fNP4jcU0K aTGx+kxIxH3/3Uu6Jy6vVHqFMLJoLTIE9G8qCdd5zISSBjOjGCu6BbCqMIWVX/U4PG9H p2xecU15fBmVhrDYmS05GTN/WGoiKPv2vzxltDMrw5Osu3dpxxX2rc1L2uj6gNfO9xJQ NlwMIlO5RjkPj70q4eqZCLy9Fn4is1rsAyB6p86TqKSSAeUk650iEl5qea+415ymoQ8O srOzNxchdx62kB5UWVG2J48qtfvRketEQZVhPlVpEkG2d5Ja29GRNtpjwmBzDjC3EHRV Y0WQ== 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=L8/sz8JLQ2K+22SUSIKS5Zqj1MK0mhVMay6aqgkdGHo=; fh=Tu2I5UnGVvvcH7FJ+I4Gxwi1Co0Qmw9gsjqWnmg/2tA=; b=GMOYzzJwS7Ux+UyzWVkUt3lI7trkiL+VLZNcaBsmXXPqRm71uGeWBHH0JHwAcREzBe YYiJjjQJ/vMSevPgrtw38OrPNAxu4gCeNEjsQRJvAexxe1df1d0u6QgsuioMoYEAG2uH LbF3GOHDKdWitydU4Yx1haXJNOUOXA4FG5t4xR9xWoqC7SZ425gkoYzuChLAHQYMz02r B4gmKpdNrRxQmKdJsk2oFo7QZIInSnngUXDCu7FOOthSjPoYQKf97HC7ksUmFMtK0Ilc lDS+mYjrXnbRKKEQ0FxPG3KphRnN+H6XDJEf1WMLzxGLe5UG7u26ebELG65JHc19Ab78 cYKg==; 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-138379-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138379-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 f26-20020a170906c09a00b00a5210535db5si456739ejz.440.2024.04.10.04.06.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 04:06:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138379-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-138379-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138379-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 910121F222CD for ; Wed, 10 Apr 2024 11:06:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C1F915958A; Wed, 10 Apr 2024 11:06:12 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1F7DB159213 for ; Wed, 10 Apr 2024 11:06:09 +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=1712747172; cv=none; b=a/axBfG4J9VQ6QpbTte5ReUg1Hffniatatc5nDt6RYmWwcq4SiGPoRGo+smeZdsNsHejXYLlCY0nT1oeS3EMWlpn64Av6xf1noiGqdtckoVXRM3lFOMIwPwdmb6pZuM0Dzn37TjHt+um1+riutPbWLIk4oKDQ4dLCLqy6heenw0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712747172; c=relaxed/simple; bh=MIKKdWpIXzEfI2ASI08B73Fk/0HCrXyX7CADzS8qC2A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XTOaYczcc+h+yDDCYiaw3zUBfv94EV43+recxPKfHHVco5dkReLUdGqRi/9at8geYXOG8260mH/+USi1oIdyV30EK9Z2gHlZM3whtd9g5s3uOw7FV549jJLZWlx/AFB0Ms+eD+7XKk+40lB7Mew4hbNltL0IL54IEIgB6jWsDxE= 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 69B80139F; Wed, 10 Apr 2024 04:06:39 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.17.100]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BB09C3F6C4; Wed, 10 Apr 2024 04:06:07 -0700 (PDT) Date: Wed, 10 Apr 2024 12:06:04 +0100 From: Mark Rutland To: Ryan Roberts 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 Subject: Re: [PATCH v2 2/4] arm64: mm: Batch dsb and isb when populating pgtables Message-ID: References: <20240404143308.2224141-1-ryan.roberts@arm.com> <20240404143308.2224141-3-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, Apr 10, 2024 at 11:25:10AM +0100, Ryan Roberts wrote: > On 10/04/2024 11:06, Mark Rutland wrote: > > On Thu, Apr 04, 2024 at 03:33:06PM +0100, Ryan Roberts wrote: [> >> @@ -234,6 +238,13 @@ static void alloc_init_cont_pte(pmd_t *pmdp, unsigned long addr, > >> } while (addr = next, addr != end); > >> > >> pte_clear_fixmap(); > >> + > >> + /* > >> + * Ensure all previous pgtable writes are visible to the table walker. > >> + * See init_pte(). > >> + */ > >> + dsb(ishst); > >> + isb(); > > > > Hmm... currently the call to pte_clear_fixmap() alone should be sufficient, > > since that needs to update the PTE for the fixmap slot, then do maintenance for > > that. > > Yes, true... > > > > > So we could avoid the addition of the dsb+isb here, and have a comment: > > > > /* > > * Note: barriers and maintenance necessary to clear the fixmap slot > > * ensure that all previous pgtable writes are visible to the table > > * walker. > > */ > > pte_clear_fixmap(); > > > > ... which'd be fine as long as we keep this fixmap clearing rather than trying > > to do that lazily as in patch 4. > > But it isn't patch 4 that breaks it, it's patch 3. Once we have abstracted > pte_clear_fixmap() into the ops->unmap() call, for the "late" ops, unmap is a > noop. Ah, yep; I hadn't spotted that yet. > I guess the best solution there would be to require that unmap() always > issues these barriers. > > I'll do as you suggest for this patch. If we want to keep patch 3, then I'll add > the barriers for all unmap() impls. Thanks. It's going to take me a bit longer to chew through patches 3 and 4, but I will try to get through those soon. For now a slightly simpler option would be to have patch 3 introduce the DSB+ISB as above rather than in each of the unmap() impls. Mark.