From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 728C5C48260 for ; Fri, 16 Feb 2024 16:56:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 00B776B0093; Fri, 16 Feb 2024 11:56:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EFA086B0096; Fri, 16 Feb 2024 11:56:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9C086B0098; Fri, 16 Feb 2024 11:56:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C52386B0093 for ; Fri, 16 Feb 2024 11:56:20 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7FC51A049B for ; Fri, 16 Feb 2024 16:56:20 +0000 (UTC) X-FDA: 81798270120.20.CCC3142 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id EAA221A001B for ; Fri, 16 Feb 2024 16:56:18 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708102579; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SQdpf+q1ZjlLbCjDrsZfm42aPxZMvTHrJoe+yU7A+1A=; b=PuZlfdz02uREn8/RDWC5kbKPiAEfw4tfSjE6UbIY+/8leYRq1tm7ipHyXBieLe17P0YCpW BBMkCDRm+fWsGbeV3xL1FUbQP0pdnEK8F3/o1PZLVLZ3VuZvr2A15Yg8Q3MR/QXD+l4XJL PKIShtfuE2S7UQELZLQ6DHcjfX6iICQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708102579; a=rsa-sha256; cv=none; b=lYRru7Ui6ewtuvhRRfcgqhi1MzikrfPCMUTn29qYB0iV9qIiCx8yDVrEqLefXThqxHJ5Kh pq2sX012tol9J56sOgZe4s0ev04TsfNtxLnFnspfSyiRANYS/yTZ9RCldaH97WVPayYluQ 6mMciRaJSd9FBLiYc1ZZuppJBfa2yqU= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B4FC861FFE; Fri, 16 Feb 2024 16:56:17 +0000 (UTC) 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <892caa6a-e4fe-4009-aa33-0570526961c5@arm.com> X-Rspamd-Queue-Id: EAA221A001B X-Rspam-User: X-Stat-Signature: e4mam1c4zcq6iifmeeyt1h6kgfbnt14x X-Rspamd-Server: rspam03 X-HE-Tag: 1708102578-346638 X-HE-Meta: U2FsdGVkX1/hvijeQWq5D7uvBlUiOEqAF1SVZrHaKRZtwXf/dcej45i1pgOV9zRpSBWxOD2hUxPI43XNWOQ9isdDa5cICBWbTbSOx334gNmT6eXxjeqjuC9z1gq+R96g1H1sqsIKJKF8ZUquLZ/o8S1qLZZzvSjK9sYwBlzXj6NCWUgPKjZtemqRqmHxtGXlGWeVe11vfUy1b4oBqt6vpDlQFYLSJXMPU86AVia0KvRxyBwf5eTQcSwsQ5fxgsO5sBWylhoi/JQhJZh/zdibquv8r/vG39O042fsXV2FDXpdytjsKRplU2SBquZpRC8LHkGmU3HX1A+4jJ+6yxm5lY9EPDfqJ04nbJVhs6oMlgzulpKH2FLIJZHUQMbQZqdmX9vCeM+DR4bKipuv+zpLaU6TfjCbkb0U7BWsiklsVHHQnsEUWdpmsx0nFb0uzmAhyIhOtNPQqvOWMqPfPrRnhvVCSgpIlxc/fXOTUABSpriOFAF8KfU6HtiRMjHydAme/nik41zKJjBAXfCRtgQJ0y59c4h70udUF4HS3FWMBG8VgNQbF6t2tCJ4X5nS4HFkR0MVaAL4XBYjZlmXTpgI+0zL7bketqf7sU3zvb4H1a2LjxHQQ2xb2KAbcvvWI2dchSECHFOY5gzwuUV4V3T7QL1eXZB422/L0Reyr1uO/sXP4Ig3SBMvTSBCC9Ma3NUE6lT+ZRtNz+422HZohYXMPV1oE2PzXAuTgLlo2+9AHMEkiTHpYCeXFWXtF62cRNLKjjvMw9yO+gqU+3zBXA/CGqe2QLQNip72zAW026RnNWHPQ+34kYEoWB+I7xv9zNgt8lTe6U7Ht0Iyk53oVBqLQa+WggQIjR8rh78BLxn7S4SnU2C73CkQtQ9iKDDgq8/aNXRwrby0z+1iHGsIW9TzVp4cF2W9uW4ofSSA0GljZdHJ/hlUP9SAi/tB5Td1SQmPPNarovkaofIu4MUZ97H ip+gAgQS +DGiep5IPuaOYSVxVZz4lj5rR1N3Q+WfnjvF39rwk5qxL47eAafNjXuQq1+aEq61dvfKj8TYmyv/c3O/MXIm1DDAIcH9GmTWzl1loWifj8tNTmM+TbKXgnaSP9Qgja/hYffjlzGvBxPNXhMoP//suaVoiXEOgEAvN7bN6 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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