Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3169093lqo; Tue, 21 May 2024 08:42:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWRguNckNT3JfHNgBkCQETPMK7AtVQNV/fCVcLeqFFp//ADs05N8ke3FUcaCWAMs3RHMtidti2LjrFIqH4iDAmR8ticIK0L1a1blqj0bQ== X-Google-Smtp-Source: AGHT+IF1j9mFQ2vNAAkLferLycpqTzIdRvsPabWOV9MbxwZlFCJOWVuIdbougjRXyRlNSPu3jDf5 X-Received: by 2002:a17:902:ba89:b0:1eb:1485:9d2e with SMTP id d9443c01a7336-1ef43e280e8mr339468635ad.30.1716306122704; Tue, 21 May 2024 08:42:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716306122; cv=pass; d=google.com; s=arc-20160816; b=tplkeCZGnL1R7WbcH0f41PdGzdODffxoKhOApAf3wOULq6UPJyP8FyySDyHp3QFw9z hLHplSOwS3n0lQHwLnNbNqR4fMYJftqT5PnnHB3dHJxno5WTo2fJWBQuHxntKS/B053F p6PQM4k4PX90AfrmDxlnf5fZI1JsWu0gw9zpsKWtBGcUQbuTa9stLQK/7MTxg6Bp1YwV 0r8lMSYlkUjXteIHLX57pAfsSAnw0o8hdtFH+WzNnxzVL4mFEQD3oX5kRtkQqXfVdmk/ YUr+8m7WdMmMr0yXcrx1gZG5DWcKMHdkrrrhyghAFNVUY7xK5D8PLKGUkQIRLCW88P4I wG9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=TeellwoKZ0zlrV7V+ziWlsye10PSNVrXFNVzLtw7K9I=; fh=QuHA94rEnTMArTIK147VH71i4uFuDdGB0u4Nj6cmN9E=; b=ytfrY58wagj7hEtlmghuTny3eK1lxrsxOkcDqBlgdIgG5hsXYjWwEGT/YK/+i7hYTy 80hvqSkMx+c2Bqp+I2gjEBZaCKVTdLrrnECmVlodBwwnm7/lOknHz+M3smYu8oqCg0x2 8BXUsZgHbSr6xgFqVHu3muW630N1UDoQYGRXuXJ1J7XVVuhfCEUvDDpIu+Mn58fT8QdP +gkInkZATmdOv11k0MaEvv1AYeak5v3qjVnY8r30AyA+xyEmvQY2EEZawVQyx7TXVhQi p2r63VkSY+vm1JX2FoXwASYutOH7Nmb87w9BdUekP7gqOnUfTgzNqz7inNb/VC9s4Bu7 MgKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ceYz5xjd; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-185173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0bf31790si13103155ad.281.2024.05.21.08.42.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 08:42:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ceYz5xjd; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-185173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EBE5C283F5D for ; Tue, 21 May 2024 15:41:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10C58147C8B; Tue, 21 May 2024 15:41:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ceYz5xjd" Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D9E81474DF for ; Tue, 21 May 2024 15:40:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716306059; cv=none; b=VTobpsnAgluNyZsAH7wByxHw5k1db+aGIDV8ieuI4BCQcoVePQRRlPs9tMpILCSzFuRoSl8b3Pm39qId3kMs5jjNo5SS+kJ9aiZJ987159QwVNbYFW10aM2nKb7oJznpWm275aJlPjm1tP+MDeZaWtv4P8k3tIAZfxtap4W9lb0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716306059; c=relaxed/simple; bh=lD/VvV5cQNmX9lBlY4Rg/253A8Uo2p6wQBL/wkK5+Xw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UN3QX0Jm8SM1eHJwItBKU44Y0x9f85jy9UCcn0vkdAvc1TsQWU8kJ6gmfZ/Dp9QgVVdUfvyymGuM3IAna6s0raQTE9bMAH9WEemN2o+DbheEfh4vBoPpmDAhF9Jg40RlTuUQMq0LO7DyD+ZHVZIfdOkDybluXdvhQsodbdxmXno= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ceYz5xjd; arc=none smtp.client-ip=209.85.218.43 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 Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a59a352bbd9so1247056866b.1 for ; Tue, 21 May 2024 08:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716306056; x=1716910856; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TeellwoKZ0zlrV7V+ziWlsye10PSNVrXFNVzLtw7K9I=; b=ceYz5xjdkpA4bB5FMCLvhdX/kQhGOB8SWh5YUzwqe/u59fjehD7Kfn5YWhNqpZnD3p O7ZEuYvNrcxYajaK2J0/052Dg+iyviiZqGDZePJ/cbuki04dip9gyi1Wp1a14FAz8mmc ujfla/3X1NNudCq4KO3OZBUNqL2bdKnoULJd29O1dsyZ9URxzxHgwDeHavqf66gT959A XrECqI5ZIx2gd0hCvTUu9mCwsVAEe1P5NWH09PRYh8jgtD5c9kUycQvLVHkYAyuZKD1W tIQJglQD+tEU+xdlH7buVeQ5PR0d0USVTy4X7zYXozncquBS0jNfCnoWzEcb1YU3f4Ou N2gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716306056; x=1716910856; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TeellwoKZ0zlrV7V+ziWlsye10PSNVrXFNVzLtw7K9I=; b=eey+pE7gzOKK6xlusm4Iaq+e+9L6y1VtdTZvZR9FM3IKCXrMEkDWvMQBTpS/e/oSp0 MgzgR43hZgiWoaxtvoXhc2JaM5SngqXKrwLzrjLp73j5G/epdBGW0ZZG7LaAUTTRMKz3 eOOF7pF6TZeXdB8ACBAby50O0HnXqZoLG5k0ZgayEPYK6A2JTKkGlQINIc5+/nMrHV74 xoxD11wXF98qV0kI4YbwlyrNh5k482mM5fBu8+N9rPI4Mwf6WoG7eslZZDrVWNsoztPW Z4CIkvYoCa0ew6IT/gmL6PRuDLfpY0MBcPv84WZAdkHGYjDLjusRs93oAHFdI6S6CHNI guCA== X-Forwarded-Encrypted: i=1; AJvYcCVXLO52xhhHjsufbv3iNv+Ko8FGebptCnY0koWWtazEw6f0FJzHNEmlpYKgYKvlNRSrQyByJEaN2K2f8npP2fScOWJj9bpG4LF/Q64y X-Gm-Message-State: AOJu0Yze+GE9PI2V0e4wYOu4xm2aboPMhn5X/egkl4/p1T4mMC9bgWWZ SPOHwvHw29nKxaVrmIE4zBmQVuSLDgG4vOct0kgl+gVtd6yYgn5n X-Received: by 2002:a17:906:1f42:b0:a62:196e:ef45 with SMTP id a640c23a62f3a-a62196ef14cmr110706066b.19.1716306055331; Tue, 21 May 2024 08:40:55 -0700 (PDT) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a179c7ddfsm1625157966b.121.2024.05.21.08.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 08:40:54 -0700 (PDT) From: Uros Bizjak To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: [PATCH 1/2] locking/atomic/x86: Introduce read64_nonatomic macro to x86_32 with cx8 Date: Tue, 21 May 2024 17:40:32 +0200 Message-ID: <20240521154047.47972-1-ubizjak@gmail.com> X-Mailer: git-send-email 2.42.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit As described in: commit e73c4e34a0e9 ("locking/atomic/x86: Introduce arch_atomic64_read_nonatomic() to x86_32") the value preload before the cmpxchg loop does not need to be atomic. Introduce read64_nonatomic macro to load the value from atomic_t location in a faster non-atomic way and use it in atomic64_cx8_32.S. Signed-off-by: Uros Bizjak Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" --- arch/x86/lib/atomic64_cx8_32.S | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/x86/lib/atomic64_cx8_32.S b/arch/x86/lib/atomic64_cx8_32.S index 90afb488b396..b2eff07d65e4 100644 --- a/arch/x86/lib/atomic64_cx8_32.S +++ b/arch/x86/lib/atomic64_cx8_32.S @@ -16,6 +16,11 @@ cmpxchg8b (\reg) .endm +.macro read64_nonatomic reg + movl (\reg), %eax + movl 4(\reg), %edx +.endm + SYM_FUNC_START(atomic64_read_cx8) read64 %ecx RET @@ -51,7 +56,7 @@ SYM_FUNC_START(atomic64_\func\()_return_cx8) movl %edx, %edi movl %ecx, %ebp - read64 %ecx + read64_nonatomic %ecx 1: movl %eax, %ebx movl %edx, %ecx @@ -79,7 +84,7 @@ addsub_return sub sub sbb SYM_FUNC_START(atomic64_\func\()_return_cx8) pushl %ebx - read64 %esi + read64_nonatomic %esi 1: movl %eax, %ebx movl %edx, %ecx -- 2.42.0