Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp31991lql; Fri, 12 Apr 2024 02:45:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUTe7UflAOXWexEQT6GA7oKQxKCBPyh2cR3bMhKqjngxhXPE85lFIAWtYP5K/HIsE2iouRj+gHHaw6/2A784AHBojJ1CEHs9MNU/msBtw== X-Google-Smtp-Source: AGHT+IGNNLzcM2EuV74Sm05tPfaAmgPc4iYaaWYNdTev0YEoWCURHzkEMsuK0aSzP8Hv5bhqQO2V X-Received: by 2002:a05:6a20:6a1d:b0:1a7:6eb1:583c with SMTP id p29-20020a056a206a1d00b001a76eb1583cmr2767538pzk.3.1712915157548; Fri, 12 Apr 2024 02:45:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712915157; cv=pass; d=google.com; s=arc-20160816; b=w3HY0YeTFgsphV/3H6MVMTRk1Q2XQO+cfY2Xb9agoQ6+pkmXr6ZtsYZMwgIj6Kdvu3 AVaivAO4GkespL/wklgn9o/lvyvY9E6Gq7ppMoHBmpRzThAm6SvnXrUZn8oVzrXAGho0 4qEEAtPdAKiIa2fJOHBtu3WSLSNoNYyqu6kPdl0HHFo+p4Q3Az0J0/Ock3NbXi9WMQob 5eBHWYts4n8EXMXJY0QbQndemJQ+n2KE+BnaphuN9FK39wpOUvuRDJzU9ndRfOsUc3eF K2wxVnB+RGDYopgXDQc8nkR/7mSjZLiayz21Pa7dLU9/seFbPeD5WYRnvfL9q2cXA6Xl 2z9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=P/FHUquWuddHgfqIj0/BPX+NYU/ipObBibu7br3NzAg=; fh=aMuEctUrpEjcm7+Z6FW9dcyBzbyQClfa+XesJRjdIVw=; b=kU4S6MPW/RF8KAgGbeu7+UFnqydvEMwaq7dlr0p/nM+SQVW4ttEu/aXzMx0cJP8gz7 JUjFu50Wav79oDkyb+ZsYVfHBc4h2kZEyhZw9VZF2sNz6itAuM8nuCzpOVhby8noFYl5 F+8ERkjpD6n2YZgpqrwHCx/c3o+g5nPCeyxgq4QW4FA8EBq/ZJxXrmSVl7F2s0nV+xrF Ngoge/zMvENd6xJIDCItsBX2VKnBh3f8bzzpvN2XtSE7dl3jZdeAPGi5nBjRAhQbBLaW dau+fyjZdsn4Gbup0xUQCpBZFY1COgDjgAZLeG5UmMjVUpCYfRgMS4MlEVtWpWFHtb6g JSzw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QAUIUl4T; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-142396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142396-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t10-20020a17090ae50a00b002a5a407e79csi3063692pjy.159.2024.04.12.02.45.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 02:45:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QAUIUl4T; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-142396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142396-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E63D6B271FD for ; Fri, 12 Apr 2024 09:24:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A29651C36; Fri, 12 Apr 2024 09:21:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QAUIUl4T"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="v30Ka9lu" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D130030673; Fri, 12 Apr 2024 09:21:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712913676; cv=none; b=t0ZUgXPC9X4KcLeYohyONYXdBQR1G2C/aaj1nuMRhL7/P++c9qA5gxQwVFjJS8o+G5EW8oRSUgr1bxN1d7vfniNZsOO3iRgtUPX8fXksgotxqHFUHsHjJ4Y+vnHtsfk+vNJ2cV3tGorWffSinS5qElW02jiRiuPpiu0TvM5vcb8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712913676; c=relaxed/simple; bh=eS6alrJrOHEZiEj5dc7a7A5wTet5RFhvCr5aeiTu6+U=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=cKW2TENaBjEjj2IIBBIpCZgN+Pqs1OL7ixs1XgV5WYJPN675RVAWed3iyGUj00XhIMgB1jabpBOuFuFv57bNigfdqO7UwGiNzyFyxrGx8lmQO9hnu8pnm2Ut9eOmD8ysP5qacAhkpVKqkt0zexZ/c/Ap51WNwD1O5HvhIZgtlug= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=QAUIUl4T; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=v30Ka9lu; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Fri, 12 Apr 2024 09:21:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712913667; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P/FHUquWuddHgfqIj0/BPX+NYU/ipObBibu7br3NzAg=; b=QAUIUl4TGf556WS9MVEzN5xD80k/Yp6MntgGPh8yeilsLZ/ZhdeKDqBPK29WAg5PEdC/Jb VU7qMxoSsfURhCcUuGYzQs6jZqNLmqLHCkV1bnRDRviLhVoFSAvS6vwWaHCcTOUpv5Wk0r jJUKB0mzKB9hAV8L8X9LHNz21dXnMmzFYuMbhLuFbJuw8t+plneaL6rvHj5ndKYxE9HVIr zLqW4mBXaPz55NrNwxe/LSRzA/HL6DR+hQOv1pN7x8qMkhsItxDYUZIno2cJ85HDTcW0mN 97arDs7nbDYkZfvp49GLD3POBq8vGvhkEyHYJsHoAJqejy/VspWHxZrFtVeIFw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712913667; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P/FHUquWuddHgfqIj0/BPX+NYU/ipObBibu7br3NzAg=; b=v30Ka9luA8Rv2YDn5s3eRl6WOHYhorWN/GLjOpnxPoWxrYoseOACMvIvuLQJpwUeQS55U+ //gbDpW2/Jws6mCQ== From: "tip-bot2 for Uros Bizjak" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] locking/pvqspinlock/x86: Remove redundant CMP after CMPXCHG in __raw_callee_save___pv_queued_spin_unlock() Cc: Uros Bizjak , Ingo Molnar , Linus Torvalds , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240412083908.282802-1-ubizjak@gmail.com> References: <20240412083908.282802-1-ubizjak@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171291366605.10875.10498022147272421254.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the locking/core branch of tip: Commit-ID: 8793f85688fee3c6640f1cc3c9feab54c0910fc1 Gitweb: https://git.kernel.org/tip/8793f85688fee3c6640f1cc3c9feab54c0910fc1 Author: Uros Bizjak AuthorDate: Fri, 12 Apr 2024 10:38:53 +02:00 Committer: Ingo Molnar CommitterDate: Fri, 12 Apr 2024 10:56:45 +02:00 locking/pvqspinlock/x86: Remove redundant CMP after CMPXCHG in __raw_callee_save___pv_queued_spin_unlock() x86 CMPXCHG instruction returns success in the ZF flag. Remove redundant CMP instruction after CMPXCHG that performs the same check. Also update the function comment to mention the modern version of the equivalent C code. Signed-off-by: Uros Bizjak Signed-off-by: Ingo Molnar Cc: Linus Torvalds Link: https://lore.kernel.org/r/20240412083908.282802-1-ubizjak@gmail.com --- arch/x86/include/asm/qspinlock_paravirt.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/qspinlock_paravirt.h b/arch/x86/include/asm/qspinlock_paravirt.h index ef9697f..466af57 100644 --- a/arch/x86/include/asm/qspinlock_paravirt.h +++ b/arch/x86/include/asm/qspinlock_paravirt.h @@ -25,9 +25,9 @@ __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text"); * * void __lockfunc __pv_queued_spin_unlock(struct qspinlock *lock) * { - * u8 lockval = cmpxchg(&lock->locked, _Q_LOCKED_VAL, 0); + * u8 lockval = _Q_LOCKED_VAL; * - * if (likely(lockval == _Q_LOCKED_VAL)) + * if (try_cmpxchg(&lock->locked, &lockval, 0)) * return; * pv_queued_spin_unlock_slowpath(lock, lockval); * } @@ -43,7 +43,6 @@ __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text"); "mov $0x1,%eax\n\t" \ "xor %edx,%edx\n\t" \ LOCK_PREFIX "cmpxchg %dl,(%rdi)\n\t" \ - "cmp $0x1,%al\n\t" \ "jne .slowpath\n\t" \ "pop %rdx\n\t" \ FRAME_END \