Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1874399lqe; Tue, 9 Apr 2024 03:05:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXr/VOhv96kvDiRuWXPqNoQ2m+4seftosewNwwY5H1g5W1EDXhuAlH2zEARecoZXcJOPIxTh/ag/PWMhayshJY6WielSHCSUySBMzG4Iw== X-Google-Smtp-Source: AGHT+IFMz+lpau4Ay0zR+NDRpfnlUsFgPeYgwb7lujMI44hY3nuey8tC+DpdR8FcEIoBqDLPWDYE X-Received: by 2002:ac2:5150:0:b0:515:8dd3:e94d with SMTP id q16-20020ac25150000000b005158dd3e94dmr9019414lfd.68.1712657159204; Tue, 09 Apr 2024 03:05:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712657159; cv=pass; d=google.com; s=arc-20160816; b=veTSzuqB3G0VPzqPAFYl1Ub8WOfVGrCiGIV/5l3JE2qfBsbS5GPqYxkOGevioQKXWK 9/8iyp913Nyt74q7q9GLuV8mHLeRWahRLW6F/5aFVPt+DZQPqE3nY6pkMrL9zwywVeCj G9gwlfabzn8u4uVn1G1enYzqJJiY8Tm8UlZs1nr1/h4u/AMK0zYoLG0Nr3MhS1n3cQb6 Ot73p854ciigub9JTYLhsTTr7T8ww2J8zxXAPdjLAUsDQ1oaffafwlmNkGOgBNaWBkD1 hrXgsVpdvl8/oYVLaNoES0iVjaDGLxSG2Sp1VdNkBCkDMD84+SieIFhk67Om1LDOTWaH DXew== 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=PXxs/Ql+oc0xYZASgCwylM08ISKpd1PCbAaMTA3JecA=; fh=2jFg4q75K3U52QmBuPegjYQg5MTeO7JGoT459lJ3X2k=; b=bdmVm1keJwNggrsUMpeGzH0AlI1Ic4SGa2LWVoeK21yY2+Hu4PpEJG0u3LJIEp2/f5 JKXoOX4+sl5BoPg0MfQlihD8kLxuEFBzNIHpgMTXfa039M4VxYZVCNX5y0wn3Puuojsk IjLxyU8iHAtchoZnb3WXJd6TNB85wRCAYFaqU5s2zdoKLwTBWwKgOhvHozNYrKhnwTBV DjELllVFmsz2k/P2BkKOk2ernr4IkOgHUyhOTB8WY/KCdvikACtF+1/5pUyRDqCSjPQE RcswwytVEXs9otOUT7ifnQgNe6m14BuKJZEFa3ptEhaopsti9dnvM3HccVZgpSEFObaW doZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=apNOILVl; 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-136622-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136622-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a7-20020a17090640c700b00a4e51098c6fsi4642262ejk.613.2024.04.09.03.05.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 03:05:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136622-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=apNOILVl; 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-136622-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136622-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D60BE1F22498 for ; Tue, 9 Apr 2024 10:05:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B029381745; Tue, 9 Apr 2024 10:05:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="apNOILVl" Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 321FB1272A7 for ; Tue, 9 Apr 2024 10:05:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712657110; cv=none; b=Y/d+Q7ZvaTxQz/rLaxTBTj2r5pbY5cgKfgLrD8uadTTOavLTfLgLvRqLqnjttsBXk0Y9kUZ5R1fMPs/HLgupdlYqL5Lbkhu/DQhqLiQNK9O2fPoqd1xttzR08M1P1mkhOdzARFVovWQou7FobDQddhsjKdsJvWnfmJdCW1XCDD4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712657110; c=relaxed/simple; bh=gwLvLFd0MMGWfdLzPnwLoZ10qVGdHNimIcL5XjfxALo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=q/z2EI1wWLqrG1HLJJhRnmgakGUtMl55fCDlerFHt8LDIT0uZu5kLNxFPH1JsyXsQTs8luCJpv46QX2+QVAv8rF+A7g+CSP4w4a8BCSLTbz9j2UsKCDxQRXcIXZOr6AOW9KwuhRVgAxSaNCH18mF1BM2cuHrkJKMvgLHaFYdJFU= 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=apNOILVl; arc=none smtp.client-ip=209.85.167.41 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-lf1-f41.google.com with SMTP id 2adb3069b0e04-516c403cc46so9882277e87.3 for ; Tue, 09 Apr 2024 03:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712657107; x=1713261907; 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=PXxs/Ql+oc0xYZASgCwylM08ISKpd1PCbAaMTA3JecA=; b=apNOILVlczF5mu2rlzuDkA22dZq34+KhW+VCa70to20egjGXmPO4MYBeaHRrd38VfM UH7HrqFrwVvDD2jjR3LtQmoqdFPVmJc7fo0WnkA0pkaFrfWmGW2BNsbZJgE/5JZnkHd6 4Ap7b590h2qEJxRwjlzghxnhEO/hVivAzcLb3kfkFYJ9qATm9DFYbAdKjUQMk0K0iLOd xfc6Y3PMJSGdCm5lubnj58g5lW3YJh3ncWZmCcl+FNeX93KuTXratPL8nv6eumgj4oEo 1n1zV1tBTObDZkxec699/6T/KQpynfzwxNypcgHemFbe0p5NS6k0joUJPY2IojoWkMWz zGew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712657107; x=1713261907; 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=PXxs/Ql+oc0xYZASgCwylM08ISKpd1PCbAaMTA3JecA=; b=evwfCc0q2rFluv74w9FaZXX29UJ1EuQmr6CpcRcHnSTHnR1KT1lvlH2mXVD3ECCk8K NvZEsXkTrVkdShhXoAS68eOzXrWvkEpVG2ib4pc1D8UGHxGvN/P/5cEL0QnIBV9pibwU hwVMcRbelUmMKkWc18QjhG/guc1Tn3SLJYsmTp0FrI/vUHOcT6WWDvb0c30UM9l5Tmc1 E5dR/HyZHJLQDTv2XSMS8ex7Dn20gzFsCmCdjXxlAmmk7uT13JBO9FL9pwHnCaKcy45d pbd9I4Nj5UWiy+dDqqbjVlb0/fe5++37agEcTQllFX34WQq9yWJh41tMs2H0WY8N5Ejw Wvbg== X-Forwarded-Encrypted: i=1; AJvYcCUpzQlu0YtnlCBNbar1kz9/QPe6gShExECZLTGHhfpXFVQuiBlnkXAmB9uLFBg3Y+R8TepRmPJZPHFKrpdwxQ0yMb8lNXqj91rjGGqK X-Gm-Message-State: AOJu0Yxc5jCO5OS2j5Nl4uarZlZY45inrIWz1XL85Fn3zLk4IWxGxAvU SKRcXBe+k981XxrnFhUYlu3MyPNDu+rcDZmX7WuqOKfs1ku2+rgi X-Received: by 2002:a05:6512:2387:b0:515:d176:dfd1 with SMTP id c7-20020a056512238700b00515d176dfd1mr11744378lfv.56.1712657106947; Tue, 09 Apr 2024 03:05:06 -0700 (PDT) Received: from fedora.iskraemeco.si ([193.77.86.250]) by smtp.gmail.com with ESMTPSA id qs1-20020a170906458100b00a4e6626ae21sm5496681ejc.0.2024.04.09.03.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 03:05:06 -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" , Peter Zijlstra Subject: [PATCH 0/6] locking/atomic/x86: Improve arch_atomic*() family of functions Date: Tue, 9 Apr 2024 12:03:51 +0200 Message-ID: <20240409100503.274629-1-ubizjak@gmail.com> X-Mailer: git-send-email 2.44.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 The following patch series improves x86 arch_atomic*() family of functions and merges x86_32 and x86_64 arch_atomic64_fetch_{and,or,xor}() functions. The patch series enables impressive assembly code reductions for x86_32 target and lowers future maintenace burden and technical debt of the source code by unifying several functions between x86_32 and x86_32 targets. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Peter Zijlstra Uros Bizjak (6): locking/atomic/x86: Introduce arch_atomic64_try_cmpxchg to x86_32 locking/atomic/x86: Rewrite x86_32 arch_atomic64_{,fetch}_{and,or,xor}() functions locking/atomic/x86: Use READ_ONCE before atomic{,64}_try_cmpxchg loops locking/atomic/x86: Merge x86_32 and x86_64 arch_atomic64_fetch_{and,or,xor}() functions locking/atomic/x86: Define arch_atomic_sub() family using arch_atomic_add() functions locking/atomic/x86: Reorder a couple of arch_atomic64 functions arch/x86/include/asm/atomic.h | 50 ++++++++++---- arch/x86/include/asm/atomic64_32.h | 103 ++++++++++------------------- arch/x86/include/asm/atomic64_64.h | 44 +----------- 3 files changed, 75 insertions(+), 122 deletions(-) -- 2.44.0