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 8603BC3DA4A for ; Tue, 20 Aug 2024 14:45:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E86EB6B007B; Tue, 20 Aug 2024 10:45:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E35D66B0085; Tue, 20 Aug 2024 10:45:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4BBB6B0088; Tue, 20 Aug 2024 10:45:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B694C6B007B for ; Tue, 20 Aug 2024 10:45:30 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6BEAC1202C2 for ; Tue, 20 Aug 2024 14:45:30 +0000 (UTC) X-FDA: 82472897220.03.8D3943A Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf08.hostedemail.com (Postfix) with ESMTP id 9FF2E160037 for ; Tue, 20 Aug 2024 14:45:27 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of Dave.Martin@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=Dave.Martin@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724165070; a=rsa-sha256; cv=none; b=rM8ymRuJM2/hdfS4CcZ8cq0BnAauSqdADmy2ptggraK6dX3FwjVqSF9m1N9yr5hn5ottrv P9CVWYIoQBFulU+HjKzfYMH406DC08giWEsM/4g0UEBHIMBheuppd6VkPAHS0+zjBcdQSW TCY3jpVu+/HJ+GBvVkXqOAD8CGt9Qdg= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of Dave.Martin@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=Dave.Martin@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724165070; 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=Q8ZtmGJH4PUozpFHcHM2fTiV7hVL7d7j+8Zcub4Xhp4=; b=PkHESQwhj/yyZsEdV8BnfBMqwNcpf9G3mugznlcOJjpfHxCxBz4MSLld5tSnJnk5yRNx2o 4CzPQVO879/YDHEwqcPPYC7f6gV1ztl1mbxkll0Usn9uZBwrLQCdlPiAoPeAywcY+bLH6v EtWmWUEeTZXVCI6cTjZF9swJFGMXjeQ= 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 B7AD6DA7; Tue, 20 Aug 2024 07:45:52 -0700 (PDT) Received: from e133380.arm.com (e133380.arm.com [10.1.197.59]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B2E113F66E; Tue, 20 Aug 2024 07:45:23 -0700 (PDT) Date: Tue, 20 Aug 2024 15:45:21 +0100 From: Dave Martin To: Joey Gouly Cc: Catalin Marinas , linux-arm-kernel@lists.infradead.org, akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.com, bp@alien8.de, broonie@kernel.org, christophe.leroy@csgroup.eu, dave.hansen@linux.intel.com, hpa@zytor.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, maz@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, naveen.n.rao@linux.ibm.com, npiggin@gmail.com, oliver.upton@linux.dev, shuah@kernel.org, szabolcs.nagy@arm.com, tglx@linutronix.de, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev Subject: Re: [PATCH v4 18/29] arm64: add POE signal support Message-ID: References: <20240806103532.GA1986436@e124191.cambridge.arm.com> <20240806143103.GB2017741@e124191.cambridge.arm.com> <20240815131815.GA3657684@e124191.cambridge.arm.com> <20240820095441.GA688664@e124191.cambridge.arm.com> <20240820140606.GA1011855@e124191.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240820140606.GA1011855@e124191.cambridge.arm.com> X-Rspamd-Queue-Id: 9FF2E160037 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: kxcuub67qns67naa7xuiis6j4g4bdhwi X-HE-Tag: 1724165127-345227 X-HE-Meta: U2FsdGVkX18VR+4Pu2qyv8Vaa8lSG8vaoWmOPrNg/gYrQi1d0vg5E2LZICTeSWb+q1t/mIDRA0nfG0WY5J1CHt0IACMYEULm2eb0aTf106Mx9NH/nj9mNW4MUEVkOZmvz15sFzsOvUGx6KZdWQH2Qt7lC9ByOlQbVPrAGxhvxdvJsvEAvbcSK+Sp0cGjSVeSpBKsZvMNoa7C+8Rp9qJZWhFaWnM3awh7ybcvWT5x+s1mAnELAHp8BB0ZPb7WyGh3LfA3o/I7n/H9L0onXsufnQ/6B9ZGJmiZClhHvgVlGiiOqorORzOBB1MiJdXhQEkhy3smxDJ+B155IJytx5Fp/ICkARTm4eWXydocLcPtH0FY0UL81a+dR6q5TxivKvdYSWLh5N2sFxk60Bvb/mnND0ncDoDryxL3QK9qdx40ZVdRkncNIYOY3CUKECqgSt1rFcHtPWHAchg3aH/QcMtY5UEGMdXgsDdZ5vAE8Vw91PwduINBagAyjoTiPYcGuvTU5HLYNaxZPjNJmf5fLBJmUt+ICmHqOgBGibWtZU7tKDJSZ5aSfBpCI/B6vsXpXBO0+cJtYBP1XOXGFvn+ylVbE8BZe/iKykF7n0RQ6eZbGhnbdbfuBkUARCEomlp29LM6awoG8Wz4VS+ejCt/sdSWU4+AWcdojEQsJS2ocrxCWXn6XUXgkMn4fiOiMdNuEHKCDKKeqG/eniRy/nX9kOmR6ykg9WGHwihHBgBbKh5pZTm96QGyx846LwQp5PSs2624r0KWoH7nTM9S0tUwibFJ3G6c1baHuvRYckRi9szUdpSrPOs+NhdFruFZ05257TDhuf+TOTsiRTkWNW4ks0rovym06nKRGgf2k3bZpBAI4KXo4nQRTe7CzJOuJVPmdDt/7zu702dmVQ/scrafcOQpovAjBHzQJWGOjyoByogscdxQZDrcC11cpzhr/H7jtmBP4s61c7X2dADA5/52jWI 4uMJv1Mq 0Q2oVXAF37BpIxj3r0DPy/5PWu6AFLuWYc85MzhGj0rTkGu5I/AnhBhQMs7/b/06+03SLDFvNGkaPEVFKRkvxlXvPbBHmCg75I8+E/IkW/Lrk8Eoj/y9F1g/OpmEBH7dhcoKYmgm11F6QH2jrRRGmq+LEXrZVprDnVKlqCittK7j81Lw= 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 Tue, Aug 20, 2024 at 03:06:06PM +0100, Joey Gouly wrote: > On Tue, Aug 20, 2024 at 02:54:50PM +0100, Dave Martin wrote: > > On Tue, Aug 20, 2024 at 10:54:41AM +0100, Joey Gouly wrote: > > > On Mon, Aug 19, 2024 at 06:09:06PM +0100, Catalin Marinas wrote: > > > > On Thu, Aug 15, 2024 at 04:09:26PM +0100, Dave P Martin wrote: > > > > > On Thu, Aug 15, 2024 at 02:18:15PM +0100, Joey Gouly wrote: > > > > > > That's a lot of words to say, or ask, do you agree with the approach of only > > > > > > saving POR_EL0 in the signal frame if num_allocated_pkeys() > 1? > > > > > > > > > > > > Thanks, > > > > > > Joey > > > > > > > > > > ...So..., given all the above, it is perhaps best to go back to > > > > > dumping POR_EL0 unconditionally after all, unless we have a mechanism > > > > > to determine whether pkeys are in use at all. > > > > > > > > Ah, I can see why checking for POR_EL0_INIT is useful. Only checking for > > > > the allocated keys gets confusing with pkey 0. > > > > > > > > Not sure what the deal is with pkey 0. Is it considered allocated by > > > > default or unallocatable? If the former, it implies that pkeys are > > > > already in use (hence the additional check for POR_EL0_INIT). In > > > > principle the hardware allows us to use permissions where the pkeys do > > > > not apply but we'd run out of indices and PTE bits to encode them, so I > > > > think by default we should assume that pkey 0 is pre-allocated. > > > > > > > > > > > > > > You can consider pkey 0 allocated by default. You can actually pkey_free(0), there's nothing stopping that. > > > > Is that intentional? > > I don't really know? It's intentional from my side in that it, I allow it, > because it doesn't look like x86 or PPC block pkey_free(0). > > I found this code that does pkey_free(0), but obviously it's a bit of a weird test case: > > https://github.com/ColinIanKing/stress-ng/blob/master/test/test-pkey-free.c#L29 Of course, pkey 0 will still be in use for everything, and if the man pages are to be believed, the PKRU bits for pkey 0 may no longer be maintained after this call... So this test is possibly a little braindead. A clear use-case for freeing pkey 0 would be more convincing. In the meantime though, it makes most sense for arm64 to follow the precedent set by other arches on this (as you did). [...] Cheers ---Dave