From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796136488; b=Si2kr6W67au4BNzqsWmeZCRoN6/TANXnMR/Kl/MwsGFf9G5o4UTk6gA7PKGn/Bea2X9C VnA29QzZhkHRNZqqnUI1NwK0DvVI0DsDRQxnJzEz0M0UZzYVKBbuAgTv7j6hMA9un4C3I LT4LX8MJOND1js5GYzueNX7O592ckJ9qlbsz2kTwpIke2sqN1fsq9ltvv1rXoi0bfzeSP lY2Qaz0uRFXC8Wi2rMo8Lk+1MqoYO3QaKRjUct4Rij6fGyI7DoSZ91HirIwrhcyyQ9s64 PXw9kk+bbHG5kTseRpMnvTP8880oiUR6/6oE3tAiDWzGlAkCxyBpMXb9s0/P8VL5FIA== 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=cAEXW/KluulP2AqyqyBRt9mq3/iEnlIJlsQ4Cvwrxb8JDaMUyRH+JuhDJeuxU0Xpgi5P Vuaa06AwiMHxbslnYWN9YcM8n3w8+9d3ym/fS2dRoK7CzAYob3Sa/9hafaABbrKhxTtw2 toxeZHxmc/IkhRFN/NA0ZX4KJfKXz46V4LDk4ukE+API4xK2IsHvyjJYC/vGxlI8zGlB3 LX8qZTI+gfCba0cRFEqinOypg9Q+nddnOPF9qM8goQr5zDB84/H3/NDs0R+0hINj4+kjY dwoWLSKini23AGb3O3STkl4/mVgIVGyKtzfWTOAYLPcE1wRX7ob76QDV1h+dE3bn66g== 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=ByM3iYu4; arc=none smtp.remote-ip=209.85.221.46 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 0C463606A320 for ; Tue, 1 Dec 2026 14:48:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0C463606A320 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=ByM3iYu4 Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-4c8fef0a906so905443f8f.1 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=vger.kernel.org; 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=ByM3iYu4SwMfcnU/TiPUX9yQ3yyUvyT84nYdOqjwGGKWc+3uuTbJJk4x6qT1TR8ggr a6kO6/JGXzQ2S8bfxmQ/NuHt/Ghzwnsbf+JeflAKgVPnT/QWaZbnxoomaeXvayr7f7RN Q6cjQesit2RK5LFA/qaniyV0snqN0sl0MomWsEyfKTFJ48osppXD+oVmX3mNsvjMCPS2 W0DOGiGjfpLhQfu7gaUumtX5zAZE4bVFN1Faij4Lbc98l6T8RYVKzyAlEEWX+4ENMv4p NmDfO6wdIy38EG2ZHkftvIlJ4oGSoKw4RVwCEGsYi9rsnW5w/AhudNNnHTNw2GEe6yQu TfWg== 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=dAe6EzCODiHEotuLYGqQIkkTsAIYKgYJl2Dx+VQVAnXLVu4kACxoCSiYwxmA/G+QhD b6XPC+afVZdXfll1kWmJm6HDaQQvo0DxHSt5q+WHNuRShp9/XLBuJElhzs3WhgHozR26 TxR/USkfWw94CC7d7L2PSvm/mXij8o8DrvZqTZ7A0w6vpAKdkb1wuwyUPHOC5m/26Oqq SXSwFXYzRKAM0Uy1Uk/gSlKSqgnQ+LpoHjsQV/nPwPLTdikslv0ICjTkmtH7xPfhHTHb sy7B6JmbPPKRhPsXLQShewJcm4yEbcllUfiDQgS+2AkwoYwdq2vZFIo7vXTH8Ri3Y0Rb 6pSQ== X-Forwarded-Encrypted: i=1; AL+hErG8MWD689bIU8ahEJDh20G0u6q5x75fD9iBtLQTt/4M3ziyjWmD6sUQPdke4U9Zw1JqdmItFIqj8WzEHqE=@vger.kernel.org X-Gm-Message-State: APuU4Z/PzPpgFYozp4rJaDiRnpvm0Wm+mkiwdEgY37FcVKxuImKr0yPj ZM/dL5jNWrgnd59TwvHcn814wcnXtqk140l4sK/Uq12W6go9yrUMtJeF X-Gm-Gg: AZFdTZf0TH9xDIvH1zUtsSsjXxreeVQppDbr92x2SRQtrjoR7JzECNy+SaNAD/c6fEm WeCrgvfjNTrvMGbYX8Iv5rcM4DYLUpX294KmCfNCA+RlXGoRRMbjkAyDm+K2g9e8IZMCenJ2yoi mJEPa0yn9d6RV7/Ny6pLVQ7grRPrB0Tp4tmg12B9Gwqd0itCgDjnob2qQ4Q0I9kT/EGsY3DG+AG fh10Hp4u3YJMq4MJkp//le3zval0xfgVjw9GVXdLYFbkegVgZAt6AgnWHwoAP8wGzx9ruhOTv4q bX7xweouaD7bKk+EAgX8bsy0Uk8RIH+Q9NfEPEKAYgew1U4P1tkpMokbz/imG39TGx984iWe5SB ou7qwzMDh1Mo0C1xVnr5LScDCQYLWifZwp7WI2yGIJv8UN9HGcy+AIEuOKzVcPxF35J0TtQ4J6r eyvwi4Sab1dLQlj7HAEE95y+917riXvAGN1MKv8Vm7cFM/ekzJZQJvWaiHi6dpXKNirzocRPidQ xuhsL8OY86KJQuP1ltCak6iJ8xxM1u/XQ6eM/PlxBynLn5Z5eN9CBwVcFDw2FyT6E9xILs2TrhW Y5WCrP17W3OgLBgF7IVk0xI82/OLHlBXwZ5FmgnBqR6gTuPOoMuubnXwVq/xmjol 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: linux-kernel@vger.kernel.org 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