From patchwork Mon Jan 13 15:59:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13937716 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 9276DC02180 for ; Mon, 13 Jan 2025 16:00:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 116ED6B0088; Mon, 13 Jan 2025 11:00:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C8076B0089; Mon, 13 Jan 2025 11:00:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED0AB6B008A; Mon, 13 Jan 2025 11:00:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CA2B06B0088 for ; Mon, 13 Jan 2025 11:00:29 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 779861C7697 for ; Mon, 13 Jan 2025 16:00:29 +0000 (UTC) X-FDA: 83002890978.04.4DBD3AB Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) by imf10.hostedemail.com (Postfix) with ESMTP id 9308DC001C for ; Mon, 13 Jan 2025 16:00:27 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="Bkh6ZH/B"; spf=pass (imf10.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736784027; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=MCZRk8F5oIr78QIJHIsQc5tZNTNUkD+BR9QkiJxVXFM=; b=2Hw3OeC6fOYCLlQiEuhu63FXejAnTghfnMY9ie8QX7NdHYNFn5CNZiqrWjAUNLfuMt9H+U 47wVrTOtSsRf9d+5awXsCMm9xNxkuqNfss51+bqQ2Y9F3XRB7WDS/rL+4p+AwCBPTcdEvm bB2RNX6ptmcdPVWj3qfasaezHqU+toQ= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="Bkh6ZH/B"; spf=pass (imf10.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736784027; a=rsa-sha256; cv=none; b=rpxbBqNTVTbxseqAcqF+OziXh46bYvspXLOz8pxkz4bZAQsRfuoHIrua8ipV/OR/MevUDo IilJrwa8I/uXDWJ7b4VgwdtQN0PGEUUZ699Ovn6JCQr0ppZzzdCvBvZHfZaxUKKC5pw4jo +tud4Un16P7rtI915HtAZ1zxNjbK6to= Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5d3f57582a2so10891327a12.1 for ; Mon, 13 Jan 2025 08:00:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736784026; x=1737388826; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=MCZRk8F5oIr78QIJHIsQc5tZNTNUkD+BR9QkiJxVXFM=; b=Bkh6ZH/Bm7yI7VIvoYbX4lqBOO+rRfxZ5938dcpz7qKXWlDeUy10cblEcqE/w8QZRR nTT3E+WumOf33UyFM2CXG3wrqnWVTA3Yctcu2sgAcH96evn3RSdChdTTf+kB1v7eAhpk oPTZcIEnC4weqZhgGgemTy14aiOPORNdqaHbYDmYeDlY8MZXaxzyJHJ5Trf7wdpsmxYX jzvDzvxtjjQFiPhLiS0IGlwlh+OiPIO6BLI5DZ4Ol5JEd6m3hZqYHqIoMAqRG3BV3bp3 519I79M+77V4/cYIL4bFv9rkPUOa+rCbMixi8vZ2zflffY0IEKjeoKI5OwNKadx8Z6tR unAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736784026; x=1737388826; 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=MCZRk8F5oIr78QIJHIsQc5tZNTNUkD+BR9QkiJxVXFM=; b=OxmynJ6c5K9lzjH71yG42abD+xMObC9+7tnEBAEl0sjCqB+DAZ7LgXTdyUe4IZTcou Jxj2oT811h+XqaoBrLrhrdbAF3NHTSbozSbMDFfULDWkmqnNA4Us22yYestoD+a32nMm o+02BdcYVLkv0D+pll4lgeCrivr7CRFXdnNWoXfPrN4RJLojJyu5ZnA0YGJ4sOEGfdhm KoPfjY7ScGQc4JefqenZ0IoIorJ0rrl6rZiQEKB0bIr6yk7HGTzm2NAVi/GZggNb4Svu MGiLGm0PHXuauxdzepu3XjbzLYPT6NgrJ4fCFtJOytHUGUlgHdnY/cknhjqa2uwOg9nt LyWQ== X-Forwarded-Encrypted: i=1; AJvYcCVOV4+U1LooRwiHzenZTYqNrLtDPLWD+gsiw4gJ85AbLmcQwfCXI1cbvdzSRwFZDM3HtIXkJ8WmGw==@kvack.org X-Gm-Message-State: AOJu0YxQX4SSO/Xw5YiGQ58uFVPZ/aNy+rG9r9i5uim7fa8YS1d3nuji hmYtbGndMh1DB0Xflft16/9/rXzGPL1v2uiPT+CNJCBcfUo4nRB3 X-Gm-Gg: ASbGncsXLZr3ABR4rWph/YHqncgqqD/HpozQNUrXJVphVT+tK4jQju6B0M79yfKf5z1 G0YNgcLGUdQexxthdTpR1LWK+V+OnkypKgx5V6BemML/tF3sFumno2xjBRRtg117TPtTxFzDvmU 71FaTVK4N5FNP9mIzPyRdhUP3+dxuEeqtY6dLaUeblC7snarGbrHzOOxIctxnOMtXm8CexWz7fj Ja3y7FOubziQq4i4Z3mEbp8q89VCxPyHyHLGHoRdOY1iDD9NewI5+eN+Xi6lcNhRg== X-Google-Smtp-Source: AGHT+IFDO+ZRixaurSV/iVvKo0ypX+0BAPSjuVqMvAjxKSSRCFaUBi1bVJmJGDlKs47SyO7rITjjMQ== X-Received: by 2002:a17:907:1c1a:b0:aa6:bcc2:3f02 with SMTP id a640c23a62f3a-ab2c3d341b6mr1737149866b.29.1736784025431; Mon, 13 Jan 2025 08:00:25 -0800 (PST) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab2c956472fsm515944166b.119.2025.01.13.08.00.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 08:00:24 -0800 (PST) From: Uros Bizjak To: x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Dennis Zhou , Tejun Heo , Christoph Lameter , "Peter Zijlstra (Intel)" Subject: [PATCH 1/2] x86/locking: Use ALT_OUTPUT_SP() for percpu_{,try_}cmpxchg{64,128}_op() Date: Mon, 13 Jan 2025 16:59:35 +0100 Message-ID: <20250113160017.17668-1-ubizjak@gmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Stat-Signature: nesaa6grghimi3ga3p741wngcuyfwq56 X-Rspamd-Queue-Id: 9308DC001C X-Rspam-User: X-HE-Tag: 1736784027-864424 X-HE-Meta: U2FsdGVkX1+REBF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dnV5qh2ng14PkWVjBeP0U5gILHXsEJgVKB2+Ll793Tn1USzo1/BwIaFZmqffMmwvtCTc9KJhEDjZMCWpBnb/qZRLpuWgaL/S7Q4F+Vwtv/C0T4pnP4ZwjqiRrnjs/xWtixS9VvVkX8J19OpKJyLvfFkMxoroAtbo6ckP5YJ5BS24w6oM7MHJo0UqGFHmPJOv5MFy/oVeEnN6EcdGU4CZcliGgInkV55/H6Fh7JvGPbQgyp7pHGfOUlMxQx/mJ2x1arRubxiC/9zujr5j+u5QMrxWDuo3ZqIep8KGTb3TEfcw44jo+4eBJSBLpAt/rgsz+W/WelcAAip8Onw6bA9gAzaWvbV5knqiP8DRz3+869fcnHjEoJJqmaA8BWecdHdFp+97Te8V6DSa8Aw/te2whh8fxsADEQ8Enqhb/hbQ2nDrf9QGUkvBZnXj8EczRYm2D9ro/60fD8GdjQ7jwuHEkoDIFwpm1HQXGj+7/M47EZxcwEoTroiKrQl+5pqaUQzcDWtcXQHU3JgjwxFf4SGjPo= 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: percpu_{,try_}cmpxchg{64,128}() macros use CALL instruction inside asm statement in one of their alternatives. Use ALT_OUTPUT_SP() macro to add required dependence on %esp register. Signed-off-by: Uros Bizjak Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: "Peter Zijlstra (Intel)" --- arch/x86/include/asm/percpu.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index e525cd85f999..0ab991fba7de 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h @@ -350,9 +350,9 @@ do { \ \ asm qual (ALTERNATIVE("call this_cpu_cmpxchg8b_emu", \ "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \ - : [var] "+m" (__my_cpu_var(_var)), \ - "+a" (old__.low), \ - "+d" (old__.high) \ + : ALT_OUTPUT_SP([var] "+m" (__my_cpu_var(_var)), \ + "+a" (old__.low), \ + "+d" (old__.high)) \ : "b" (new__.low), \ "c" (new__.high), \ "S" (&(_var)) \ @@ -381,10 +381,10 @@ do { \ asm qual (ALTERNATIVE("call this_cpu_cmpxchg8b_emu", \ "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \ CC_SET(z) \ - : CC_OUT(z) (success), \ - [var] "+m" (__my_cpu_var(_var)), \ - "+a" (old__.low), \ - "+d" (old__.high) \ + : ALT_OUTPUT_SP(CC_OUT(z) (success), \ + [var] "+m" (__my_cpu_var(_var)), \ + "+a" (old__.low), \ + "+d" (old__.high)) \ : "b" (new__.low), \ "c" (new__.high), \ "S" (&(_var)) \ @@ -421,9 +421,9 @@ do { \ \ asm qual (ALTERNATIVE("call this_cpu_cmpxchg16b_emu", \ "cmpxchg16b " __percpu_arg([var]), X86_FEATURE_CX16) \ - : [var] "+m" (__my_cpu_var(_var)), \ - "+a" (old__.low), \ - "+d" (old__.high) \ + : ALT_OUTPUT_SP([var] "+m" (__my_cpu_var(_var)), \ + "+a" (old__.low), \ + "+d" (old__.high)) \ : "b" (new__.low), \ "c" (new__.high), \ "S" (&(_var)) \ @@ -452,10 +452,10 @@ do { \ asm qual (ALTERNATIVE("call this_cpu_cmpxchg16b_emu", \ "cmpxchg16b " __percpu_arg([var]), X86_FEATURE_CX16) \ CC_SET(z) \ - : CC_OUT(z) (success), \ - [var] "+m" (__my_cpu_var(_var)), \ - "+a" (old__.low), \ - "+d" (old__.high) \ + : ALT_OUTPUT_SP(CC_OUT(z) (success), \ + [var] "+m" (__my_cpu_var(_var)), \ + "+a" (old__.low), \ + "+d" (old__.high)) \ : "b" (new__.low), \ "c" (new__.high), \ "S" (&(_var)) \