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 C966BC77B7C for ; Tue, 24 Jun 2025 18:32:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 39F056B00AE; Tue, 24 Jun 2025 14:32:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3500B6B00AF; Tue, 24 Jun 2025 14:32:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 23FA56B00B3; Tue, 24 Jun 2025 14:32:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0F6386B00AE for ; Tue, 24 Jun 2025 14:32:49 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A6E6A122610 for ; Tue, 24 Jun 2025 18:32:48 +0000 (UTC) X-FDA: 83591140416.05.CA16F8A Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by imf23.hostedemail.com (Postfix) with ESMTP id AA8B2140008 for ; Tue, 24 Jun 2025 18:32:46 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; spf=pass (imf23.hostedemail.com: domain of segher@kernel.crashing.org designates 63.228.1.57 as permitted sender) smtp.mailfrom=segher@kernel.crashing.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750789967; 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=SdL6EIXqtCwoMCw2+J9Y2V1BpD91T6/sD6VzhQzmPeA=; b=HYVylURjs74w9w3AtOa3R00NS5k5jp8AbuYYXCySLIs9cMetwNZlbOx208r/3AUaA/LyAV Dhc8ajth+O5hvN7ogKV4tPd1ZFKWrV1VIInq4OGdPNdUokWJOxT4vExUQpwwtvUHUmALbk ne7GaENb0hdzxZxzKJ9AIivnpmEXscU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750789967; a=rsa-sha256; cv=none; b=eUTjrZZEjN5SO694y5XnaeXpn9unrEIXSWoao50B2HN6vCMwn/vWRAEJ5jbu42ivbFRg6w F+zR1Bx9CNjVKSYyMgW0aw2YqeLYm+OaRKcg30pHJvh5Ki2J7gN+Sc0foy3EWdb0aEmdv2 29ypPfI7RDpIDqtDNLChgNkegk8L6Ho= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of segher@kernel.crashing.org designates 63.228.1.57 as permitted sender) smtp.mailfrom=segher@kernel.crashing.org; dmarc=none Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 55OIP98u005379; Tue, 24 Jun 2025 13:25:09 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 55OIP5sr005378; Tue, 24 Jun 2025 13:25:05 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Tue, 24 Jun 2025 13:25:05 -0500 From: Segher Boessenkool To: David Laight Cc: Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Madhavan Srinivasan , Alexander Viro , Christian Brauner , Jan Kara , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Darren Hart , Davidlohr Bueso , Andre Almeida , Andrew Morton , Dave Hansen , Linus Torvalds , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 0/5] powerpc: Implement masked user access Message-ID: <20250624182505.GH17294@gate.crashing.org> References: <20250622172043.3fb0e54c@pumpkin> <20250624131714.GG17294@gate.crashing.org> <20250624175001.148a768f@pumpkin> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250624175001.148a768f@pumpkin> User-Agent: Mutt/1.4.2.3i X-Rspamd-Queue-Id: AA8B2140008 X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: cs7wykcjb9ybud8p3um37q8tybfs7i4t X-HE-Tag: 1750789966-636105 X-HE-Meta: U2FsdGVkX1/XxEuocSauuu7noAvxy7F2xbp4DN//9aoVJ0OC4PEUoIywLr4t9G8swXttCu5q9s0QzbgAozy3w+lyH+kWxeYAk4TmZQRQWvhOcf6ll+hLpcCmftykgz2V1BpVVI34OY3lRVxQGmFYUwk4F6YIYcCcrt8Fa8NpQtIJJWxCymcoEQeasa5JigVwsMu2QfRb8/rMGJdwPoiZmYoDkxBAIic9hjLDNiiYLXy60PUwLiXJQtfqS5ucq0XrnYKgJ5Z+mO57wSwOLzxFffn+/SaRxj+ZiwcbZ0NkLMmonrHDlhTeYIk3IGvdu3NOpKjdkFVg3oOVslCxgqBE4B1rSfL2Xtk9ITkq3AS2yZdfIQUY8md/LVMg5RNwyMpo2YB4SXC4JXICniLsE0YJYcggCDgqaYsLGefRe+HMPJ1rMX66gcauOmAF108T1+URKmcOXWVWgvPJz2bx/SWCl5R1D38hn5MDESUq5ejZN3PeILJPGpRW6UtRTfzkAzuiSIWKBNW1iRF2nuHDDHvD/ccAYSrVVIZrkj/2d+76nfk3sWGqR4Vw644chBsSy9GzG647L+cVvNM3AAX1XZ7yKIJC+MpHcyKlm/n69kPAtH3kbFRNtIwUdRWc5bB5x3MONNAsmF9NKhB9jJWwI+yW5SJclg+V7lr/26RvyX05EAknrWDj8imK3AMWOC8Ux4KURET+grFSYxJRQH4umQqFXIGMewRgnNtl77kK+o3lexmcNUEPcEUnc3ZKu6xL+gvvsBx1oNfb6TwR2apSX61HD8Ezqw2TbPtthnPWfv7J5m4qtem/WqF3lebpKGP+ytswQPfVXbIe8Xj7gg6S01/x+S6d/bBXxD2p0aFU9HuLbFpUDLeCHxvfA4fDLpPg+IDs8s63tEFAayUL7nwBBFfriaBCuhI37JFtTLYcK3p/qQzlAKxIXiUEYKWNw2jyz0PjKPruC0FrkxJ7ld/fSGL 28Tl0lJp zLGqnrcH5OHD9chB7DOUMHPCQrdCDFn8hBljJ0q/q7Z9IPmosX7iAQfEEZjBXsOPTg3MZaXM8j6VrfpZxfiJpQnqr+4aGc3+XLnDFGYhqTIg/k6ES0O4wA+2uKrnDvGscI7q1hfjQazFRwX2wlx+uSMp+7gOOlWonfYC/jUDvnkw0LiL1KLEBmgwsSxILhMbenR23OUGzbdgyAXk= 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: Hi! On Tue, Jun 24, 2025 at 05:50:01PM +0100, David Laight wrote: > On Tue, 24 Jun 2025 08:17:14 -0500 > Segher Boessenkool wrote: > > > On Tue, Jun 24, 2025 at 07:27:47AM +0200, Christophe Leroy wrote: > > > Ah ok, I overlooked that, I didn't know the cmove instruction, seem > > > similar to the isel instruction on powerpc e500. > > > > cmove does a move (register or memory) when some condition is true. > > The destination of x86 'cmov' is always a register (only the source can be > memory - an is probably always read). Both source operands can be mem, right? But probably not both at the same time. > It is a also a computational instruction. Terminology... x86 is not a RISC architecture, or more generally, a load/store architecture. A computational instruction is one that doesn't touch memory or does a branch, or some system function, some supervisor or hypervisor instruction maybe. x86 does not have many computational insns, most insns can touch memory :-) (The important thing is that most computational insns do not ever cause exceptions, the only exceptions are if you divide by zero or similar :-) ) > It may well always do the register write - hard to detect. > > There is a planned new instruction that would do a conditional write > to memory - but not on any cpu yet. Interesting! Instructions like the atomic store insns we got for p9, maybe? They can do minimum/maximum and various kinds of more generic reductions and similar. > > isel (which is base PowerPC, not something "e500" only) is a > > computational instruction, it copies one of two registers to a third, > > which of the two is decided by any bit in the condition register. > > Does that mean it could be used for all the ppc cpu variants? No, only things that implement architecture version of 2.03 or later. That is from 2006, so essentially everything that is still made implements it :-) But ancient things do not. Both 970 (Apple G5) and Cell BE do not yet have it (they are ISA 2.01 and 2.02 respectively). And the older p5's do not have it yet either, but the newer ones do. And all classic PowerPC is ISA 1.xx of course. Medieval CPUs :-) > > But sure, seen from very far off both isel and cmove can be used to > > implement the ternary operator ("?:"), are similar in that way :-) > > Which is exactly what you want to avoid speculation. There are cheaper / simpler / more effective / better ways to get that, but sure, everything is better than a conditional branch, always :-) Segher