From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796136488; b=VhpmuF+LWzskPDpfVxnqBacwtiXt6C5Cx3zBKazO2o9RMUMEPjObXhrfjRdsgj8JVohX xIhEV6ARg3Hb6TwY0IxzYunlAylwOLb/UX21dw2twfA3vAZrN7mswP0uqf8jpkR7xkMn0 kbowWBnM3eV8yiPYtqP/vVzsYcPPc9zAnmAqYv2M9++77rt3LxMkovdWa82sfXUM6fE+c KnzvZOZj1+Gff2dquQuZnvs/+trOdmSnyOzIXmpX2CFOnfCbkQmus7DD9JzuEI+RPCatt si0gq7y2JhcrMiPR2zwboidLMbtESL5I00TzCc2E90Ls6CFJR/0kOXy67nMdEDwx+pA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796136488; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=Ub48uf6fUfr3uRLhcRvfxWY7hnjXOWOcWESuQDVS/0s=; b=XTyzPCD6aHr1VNzJfzc0+F9HjrkpA9Wz6/yxVWANDMWyqk0HgkENbP2N5Cm5+UcZh04t xHwUBwpAaGPke5eue8vxfaSn6WUDE0+5n4Y9jq5y8ClCaZggJcWSiWZgLNswlv/AZZA/r 8xmU5elMG9AQaTTNGVCGnlpZO6m4y/WKC6QEiimCKMSHDSvnD/rDV96Nl61ieMd/sfKxh PhUL5bFws7Mzb0nB78xd8DxYBLe0IehGQEfUd+n7jSNztILf6BbC9jY+0nA3edzJkgJUM q4jhqPKbRirvYePxkVGyOCk39ILC8T7hHg0hjYGu/U+KSGiwEfASk8Z4fLHWvc8TgRw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=CtRt0zlC; arc=none smtp.remote-ip=209.85.221.47 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F00C6606A31A for ; Tue, 1 Dec 2026 14:48:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F00C6606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=CtRt0zlC Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-4a7b8abe209so9164084f8f.0 for ; Tue, 01 Dec 2026 06:48:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796136486; x=1796741286; darn=lists.linux.dev; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Ub48uf6fUfr3uRLhcRvfxWY7hnjXOWOcWESuQDVS/0s=; b=CtRt0zlC9UQmwUPwxDLRdcrDuG45yiE2tn45ekV3pJujQqcXBd+4CyAQ5o1w3ZLxvY Ty5AgCRWj8HriFdtFvr3Fd/+2wSUxjWyvtTycBl1WMu45YokgDC7rI4PNGmJrZtXTthM C/UywYlwK7jm8Vs+qETgQaDILluQ0jx/PmQwyIQaNf0BJRk8Cohy3/dxnaN93VYLZ9Nb pJrCZe6X8df0Idyjn9l4nLAYvNc8ss+a8kUX1UMkIl1JWd9ZbEZeXLnlJ7oQZ0qVpQDs 7LVvQdgPOccfycHgS9agBfZILJI+87sjpUK4dPlqAtD5/aPDeTb7fKQG2u6/ohtJmHE/ MS2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796136486; x=1796741286; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Ub48uf6fUfr3uRLhcRvfxWY7hnjXOWOcWESuQDVS/0s=; b=mUBMomqxWB+XsS6AqXCVdsiQ5hkAKBgLBOe9lGmznP6aYo/KT59hodVI5Ld+RF15le 3rYPYlUFmBEWu5HpPAUZMOS8AkM8N2SaxqQIBZTmQkMfEL2JWuNWmSSyJxUg5ev0kU/x yqZvYJeyWY70S1Sk+olj2gsh9l5Sz4hO3m7ozpvUxXwwIWfvhPHxdkDPcJG41FCEMyTb ydDkSJ1lf6P82C+MBj9YOXCkJuuUMSPRVU4DqFR/5mVGEWMpLNLU+1sl49LeXuRiUtWE 8ftu4Pyoo4hnZ3SpVm23geIgN9STRh4C9w3Ltt5qGguq0CMiBoC0FCviR3aW4+cg9KQF HfxQ== X-Forwarded-Encrypted: i=1; AL+hErECZzvycmxQjWeb6tYAqJMdbbNa0mt83fufzgHvFKGYyykqAzJSKhpmbJwtaQ8GeB0OuJ9T@lists.linux.dev X-Gm-Message-State: APuU4Z9q9ZIfMUirwpa6v54FV9mmZF68JYEoqV3e5U4VXG4Tr7QfQHG6 Za/69+l1zDrevqYZejoQzkpEUrf+5QsqWMw6f3eptsFJApvq+rW5/0ko X-Gm-Gg: AZFdTZdHH64nSkUuJz4J8DpUaly1hReMaqJY3hxEcFTyH5/cXddg0o0L9orTHCBr1TY ZvmGhZZdNHsP/0giYaUWhSqmc5+oeEbYQwmZDsuvJ5llcEHdJagg/xpwIEKx0CFnE2Cox30dWqI qroVjjEEnPkFabqWUMFMtTWc3V30IwjUQgeHt6piSvrTk+eSjeKR1cqPjRYD4kdpHrg3gbp0iyp Yve8/pdzfYHiJvO36bjnBfGRdan+XJdF3UA5QdyU+EH+9tJeARnBZoqXxzoFin51mAnhNz+l1zt VMqVNGizfPckEN04sZf0XgptQ8uArRlxToLftlY1l++jnqLYb4BVZOGvbJ0WGyIZubIoD5NSap/ mOJWBdczTPmHA6z5ycx/1kj9kEgdFLxIy0pwBqfkHQoX1wwRr8ZMNxGxWc13BcOS/FMoebKrf47 dG5fXFndj2u7ugIgBFR8mrGVmaqbnSWfuLq954f4Ka4/EL1zTH9YB/7WZMle/cCiWDajptDXYUf 1iFc8fCBorhAwn/6BRfrRhCFMkHSSWCLmjqWtoMDwKfWBH3Eb7HeA7qfPVTa+Vj8gHn0LH8dDR0 11Vcu328/dQPz0G0TdO+AqumIkutqqKS6nrcQOdKJy0ZG+w5H8H8nF3YGDLqvdZ2 X-Received: by 2002:a05:6000:4304:b0:4b7:6d41:f12d with SMTP id ffacd0b85a97d-4b76d608a13mr49315445f8f.27.1796136486278; Tue, 01 Dec 2026 06:48:06 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab658e2c8csm72272046f8f.2.2026.12.01.06.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 06:48:06 -0800 (PST) Date: Tue, 1 Dec 2026 14:48:04 +0000 From: David Laight To: "Nysal Jan K.A." Cc: linuxppc-dev@lists.ozlabs.org, Jeevitha Palanisamy , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , "Ritesh Harjani (IBM)" , Shrikanth Hegde , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andrew Morton , "David Hildenbrand (Arm)" , Ryan Roberts , Andreas Larsson , Usama Arif , Kevin Brodsky , "Kiryl Shutsemau (Meta)" , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH 1/3] powerpc: Add support for 128-bit cmpxchg Message-ID: <20261201144804.6a0270d5@pumpkin> In-Reply-To: References: <20261125174035.1412724-1-nysal@linux.ibm.com> <20261125174035.1412724-2-nysal@linux.ibm.com> <20261126112714.021a3e66@pumpkin> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) X-Mailing-List: llvm@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 1 Dec 2026 19:22:06 +0530 "Nysal Jan K.A." wrote: > On Thu, Nov 26, 2026 at 11:27:14AM +0000, David Laight wrote: > > On Wed, 25 Nov 2026 23:10:22 +0530 > > "Nysal Jan K.A." wrote: > > > > > > > > +#ifdef CONFIG_HAVE_CMPXCHG_DOUBLE > > > +union __u128_halves { > > > + u128 full __mode(PTI); > > > + struct { > > > + u64 low, high; > > > > There seems to be a mismatch between the register order that PTI > > assigns and the one that C uses. > > It might be less confusing to swap low and high in the above > > and only use 'full' (probably renamed) in the asm statement. > > > > I can swap high and low here to indicate that it maps to the big-endian > register layout if that makes it less confusing. But AFICT it doesn't (if I believe the AI from google for "ppc64le lq word order". The high bits (from EA + 8) end up in the even register and the low bits (from EA) in the odd register. I suspect (as in the other email I just sent) that when you do: u128 x; asm(... : "=r" (x)) you are getting the register that holds the low bits of 'x'. But you want the one containing the high bits so that you can use L[] to reference the low bits. The code might appear to work because on a function call the lower register contains the low bits; so, if the register isn't reused, L[x] will be the high bits. You might be able to tell which registers gcc thinks are 'live' by adding one to the clobber list. You can't add one that is in use; so it should force an alternative register allocation. David