Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1227366rdb; Fri, 16 Feb 2024 08:56:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXwhdeYhYms9XngRfOzFJa02wt0cRovIbr/YgE1cNaZqC2xZz3vPm/IsuqS/qXy0XoQxn+WHqQMkMmxkKgXRDTxGzDiqUdcqDlHwqexhQ== X-Google-Smtp-Source: AGHT+IECSTA+vc2zJuk1x4NctTdRSrIsbxW/fqKTavc5SVSi7DO2+0od9agToiGYBIk/vvzIzZu8 X-Received: by 2002:a0c:e241:0:b0:68f:2a2b:c6e0 with SMTP id x1-20020a0ce241000000b0068f2a2bc6e0mr3941067qvl.64.1708102584491; Fri, 16 Feb 2024 08:56:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708102584; cv=pass; d=google.com; s=arc-20160816; b=D04uoCKk6uWCqcdkTKv5xsct2rL7BPRWh5YIc3V/soi/3MteqBU3HY3F9t970ghehg PuhsL5hYSTUVmy8cCkepxbjzjIWbSJNcei/XbmZBn9P45F5rChoUWhCMwy2UJ3qua7Yg iWROWjUtzx8FhjntVn5HHNTRkYVrARPzWUNv7ha5YzV0f7XkWDk655oPknBiuPlKpHiG cnuFdxi5hj7+O5yKFYBOw+R8ibDtTGTV4tnfWTgX+ziJnjH2DJVvKFMKFLeVA9NM/IXV xU2I08X5zjg3tvkKWdcxaYzl1clbPIRLfen5UsZPM6HX1c0Pi5MfELHxG/8k+nA8+nqn hZLA== 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=SQdpf+q1ZjlLbCjDrsZfm42aPxZMvTHrJoe+yU7A+1A=; fh=r8G2JENgcRo/RTe4xvZO7IzPLZ7yvHykzgF2Da/HHrw=; b=i/UWY7NLSNX432D5diLjtay5fIQu9P0MeIdgAc/44hbHlakyMLDFnadRVdcpTV/22F gGQVSDfxWwHhsBjeTVsrWBrfd4n7FAgRp19st44CiVDX+fajlHDh1z1sdGICvbCNa7A0 ZHTJ72WqyyIOrYDeEBrHNNSXOzeNYzjxE4RArAUrJBuMoNybtuyNaQ0s4vffrevDJXLM dCMjpj5GrG1tVrhZTOy45qO/y14xdlaO0Ks3VQzj8pjY4Vt1QhTzpq2uguRb018ka8N9 IvrrczbQvChs9Axo5RUTS2Q7WSYaxlYAktIs5npWuB+bRwIHKtFt9uEUBH7UQT8hGnk4 G1Sw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-68995-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68995-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u5-20020a0562141c0500b0068cf8165965si156433qvc.365.2024.02.16.08.56.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 08:56:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68995-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 (google.com: domain of linux-kernel+bounces-68995-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68995-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 4264D1C20F59 for ; Fri, 16 Feb 2024 16:56:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57CAF130AF7; Fri, 16 Feb 2024 16:56:18 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D3B4F5465D for ; Fri, 16 Feb 2024 16:56:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708102577; cv=none; b=kTZMTwsw/O2/hu2YpKyoUV0SXg8Q5bWubLJaF5Dwf5xzASjnrDVn0g+5VETFNgcHWCPV2PFvEF7TYJliLtbDcE0u/e+FaW3jIDeRq+iB4nU99lGcxQAWr7XnRalEeai+iRbG4/UhgYKgTC5Lpb0b4mFc0scr71nDLO5zkePHaEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708102577; c=relaxed/simple; bh=YuAECvUSSs6CSyQUuMZzsqnAo9jtikzllwciZ2R7g1c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lyKAUD/XkM44moOLT9FNs8XJH0nxFT+UfrglcerSrr16clTwmx5B7wOTw1nt+964ABkrzrh6dVhxF1qgIkWAVxKRkS8UVHL5EdyvAk25miGE850NwU+4wfEOVTTIG+Njr7LHdEKZKty8f/x55aHIld9/g4TccUEaJhlGI8BRwfQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A7B0C433F1; Fri, 16 Feb 2024 16:56:12 +0000 (UTC) Date: Fri, 16 Feb 2024 16:56:10 +0000 From: Catalin Marinas To: Ryan Roberts Cc: Will Deacon , Ard Biesheuvel , Marc Zyngier , James Morse , Andrey Ryabinin , Andrew Morton , Matthew Wilcox , Mark Rutland , David Hildenbrand , Kefeng Wang , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi , 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 v6 12/18] arm64/mm: Wire up PTE_CONT for user mappings Message-ID: References: <20240215103205.2607016-1-ryan.roberts@arm.com> <20240215103205.2607016-13-ryan.roberts@arm.com> <892caa6a-e4fe-4009-aa33-0570526961c5@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: <892caa6a-e4fe-4009-aa33-0570526961c5@arm.com> On Fri, Feb 16, 2024 at 12:53:43PM +0000, Ryan Roberts wrote: > On 16/02/2024 12:25, Catalin Marinas wrote: > > On Thu, Feb 15, 2024 at 10:31:59AM +0000, Ryan Roberts wrote: > >> arch/arm64/mm/contpte.c | 285 +++++++++++++++++++++++++++++++ > > > > Nitpick: I think most symbols in contpte.c can be EXPORT_SYMBOL_GPL(). > > We don't expect them to be used by random out of tree modules. In fact, > > do we expect them to end up in modules at all? Most seem to be called > > from the core mm code. > > The problem is that the contpte_* symbols are called from the ptep_* inline > functions. So where those inlines are called from modules, we need to make sure > the contpte_* symbols are available. > > John Hubbard originally reported this problem against v1 and I enumerated all > the drivers that call into the ptep_* inlines here: > https://lore.kernel.org/linux-arm-kernel/b994ff89-1a1f-26ca-9479-b08c77f94be8@arm.com/#t > > So they definitely need to be exported. Perhaps we can tighten it to > EXPORT_SYMBOL_GPL(), but I was being cautious as I didn't want to break anything > out-of-tree. I'm not sure what the normal policy is? arm64 seems to use ~equal > amounts of both. I don't think we are consistent here. For example set_pte_at() can't be called from non-GPL modules because of __sync_icache_dcache. OTOH, such driver is probably doing something dodgy. Same with apply_to_page_range(), it's GPL-only (called from i915). Let's see if others have any view over the next week or so, otherwise I'd go for _GPL and relax it later if someone has a good use-case (can be a patch on top adding _GPL). > > If you can make this easier to parse (in a few years time) with an > > additional patch adding some more comments, that would be great. For > > this patch: > > I already have a big block comment at the top, which was trying to explain it. > Clearly not well enough though. I'll add more comments as a follow up patch when > I get back from holiday. I read that comment but it wasn't immediately obvious what the atomicity requirements are - basically we require a single PTE to be atomically read (which it is), the rest is the dirty/young state being added on top. I guess a sentence along these lines would do. Enjoy your holiday! -- Catalin