Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp702413lqp; Thu, 21 Mar 2024 12:53:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXAmKFrpDA9YRLu6dI6y2PYMAzV85GCeJuodt6vhxGFMVaRCaADMqND+Od77G+L23/0mrYbLgTLPciYmb/Fx07IKkQVdUvkQaFEgB0New== X-Google-Smtp-Source: AGHT+IFa/Y3ML166KNW28yNvcIYlW+G4M6sO3fcn2RLlKRqG10gL/lZG/DJdpLcszQhoUrt4XtWS X-Received: by 2002:a05:620a:21d8:b0:78a:18d6:e4eb with SMTP id h24-20020a05620a21d800b0078a18d6e4ebmr182803qka.34.1711050797629; Thu, 21 Mar 2024 12:53:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711050797; cv=pass; d=google.com; s=arc-20160816; b=PWIVzNGilbaNSjIlSXCUXhwGTw/kq9aHB+var7giv1/vk4l0LvNWA8/a2nfOirZOkS KwJDMtUMFLJuS5hzJI+0Oqcxt37KNE5d9Hi2SarpVmOJmJ+WASmWzKPTMbLKsqvOBUZw ZBtiB4LjQwGHyv9WD0XrsWRLjBuoUDAgH692/9+k/hH37rrA5mgfFJz6lA9xvQEq0vMW LehvWGFtlWCKwT691Ep7z0fzFMjQ0SJxx++ciiSlUNMd1bgOX5778UbIa5UNT8nqrBzl e7NzNfTBiRRFf0aANfPI+JXd85ohG23R0izwZ1qlRRudMV02LP/J7/iIDGZaGX1Q2wlN +meg== 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=nggiyJFhgjwRPFJ4jzj9pqC5QV0DGtas+sT2vrcFy3U=; fh=clqiXc233P9WpJ2ohBIfz3jJsiAfz7u1AWJomYTTpnk=; b=eJt1dGSbRHlvtTjvgESJ504ZL81euerjmJOPngmeu+Q6K98jVhrC7ovm3snghWk7hm ut3er4F24gOZ/kmohJriD8Rhz9edKtSfm+Y3hH1218SnLAQr3UQxR1RzJ9xj64o7LxQe P0NUjpdptEnDve1P8eNrTsM7PF4Z28DZeVo71NmdoiARqKWyloVqCwracG8fvLbARiNU fNtfB+HaMN1cfMOzstlkdqsZ44wIg0kyHYJu/8BFI+d4RO2FPFlX1YGAcIq9V2eaRTxE y0/FVXIO377s2UR+cihqKPLXAqv9RlJPXr+jbDyeFL2SWYzBaLdJq8ANaGwPYPGANh8d Syjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Wn7sVzO8; 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-110615-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110615-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ou34-20020a05620a622200b00789ec48653asi431704qkn.302.2024.03.21.12.53.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 12:53:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110615-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Wn7sVzO8; 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-110615-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110615-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 478181C21834 for ; Thu, 21 Mar 2024 19:53:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4B82134724; Thu, 21 Mar 2024 19:52:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Wn7sVzO8"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ZBuDx+YE" 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 4C4C013441C; Thu, 21 Mar 2024 19:52:53 +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=1711050774; cv=none; b=UL6r0PMSmSmdrmWOdG1Bo+ZAjKC/uQxCfFciQ9xVrotL58KPD4zrKBquJG0MAW5wFxVsxoyzBuCp+iGA06OHI9PBo0qWfT8wL7KOrQrM0ncismTbQDxHzM7DILjSCH3nKJ1hrDNedHfdFe8uxfsx38XZEohFmv04Q1Wt5flugd8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711050774; c=relaxed/simple; bh=OG4oZDlj7xSAP0j1SD7NCJmENp5RQXYQObEeb4Is2hc=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=mKMAMr7iST3r6KH8NJyLew7W/HkQuijpTKZyGBUghoHHrHXXy94XN4cliF6ZpqRfjLiuUoVG2rWombQ9RYzp8EA7rLIBBeYm27c58wvvDHbdkTDxXGCLTmxgSCy5hVgNIiVs8rIs0P+MP2VIuNBFdT/xjAl5BZ2xjYIpnO0H8lg= 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=Wn7sVzO8; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ZBuDx+YE; 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: Thu, 21 Mar 2024 19:52:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1711050771; 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=nggiyJFhgjwRPFJ4jzj9pqC5QV0DGtas+sT2vrcFy3U=; b=Wn7sVzO8ufj5zBYJQdFNpin9dfchuazNbgphg6V6L5RSMtLGu6A4jktrt3GlRuXP7eLO1p BfmWnZRnQC5U0KNs/eGd7R3CgYiri20DcdMW+lIpP1fqLJ9Ty+/xom7xjJ5hTwXlY7Sf1+ O0Z8woUVdu72jvzPvb83oE0b/0Ec5YIYFCkjk2ETZK9bVtwq7fX3q/fJmQfvyRaoQn6A4g 3+m+7iX2syi7rfFbOCfVo7Rg2uRudYk4ZBEiHLPto1rECKE2pLriFl+oLO4OpuewSvW4C/ ggL9kNvdItB26R3xDf/d2BtktO732QdKvetZlxHhWeDOO8RMhjg4OC1XySnfgA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1711050771; 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=nggiyJFhgjwRPFJ4jzj9pqC5QV0DGtas+sT2vrcFy3U=; b=ZBuDx+YExIGZrBJG1VFgvwG6XhtVlLga+OKws7DYp9qJ2m0QtowINN3Rozw4TiKqF6UOBz a6Og6v94b60UBrBQ== From: "tip-bot2 for Waiman Long" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] locking/qspinlock: Always evaluate lockevent* non-event parameter once Cc: Ingo Molnar , Waiman Long , Boqun Feng , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240319005004.1692705-1-longman@redhat.com> References: <20240319005004.1692705-1-longman@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171105077065.10875.8732979745826273189.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: 3774b28d8f3b9e8a946beb9550bee85e5454fc9f Gitweb: https://git.kernel.org/tip/3774b28d8f3b9e8a946beb9550bee85e5454fc9f Author: Waiman Long AuthorDate: Mon, 18 Mar 2024 20:50:04 -04:00 Committer: Ingo Molnar CommitterDate: Thu, 21 Mar 2024 20:45:17 +01:00 locking/qspinlock: Always evaluate lockevent* non-event parameter once The 'inc' parameter of lockevent_add() and the cond parameter of lockevent_cond_inc() are only evaluated when CONFIG_LOCK_EVENT_COUNTS is on. That can cause problem if those parameters are expressions with side effect like a "++". Fix this by evaluating those non-event parameters once even if CONFIG_LOCK_EVENT_COUNTS is off. This will also eliminate the need of the __maybe_unused attribute to the wait_early local variable in pv_wait_node(). Suggested-by: Ingo Molnar Signed-off-by: Waiman Long Signed-off-by: Ingo Molnar Reviewed-by: Boqun Feng Link: https://lore.kernel.org/r/20240319005004.1692705-1-longman@redhat.com --- kernel/locking/lock_events.h | 4 ++-- kernel/locking/qspinlock_paravirt.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/locking/lock_events.h b/kernel/locking/lock_events.h index a6016b9..d2345e9 100644 --- a/kernel/locking/lock_events.h +++ b/kernel/locking/lock_events.h @@ -53,8 +53,8 @@ static inline void __lockevent_add(enum lock_events event, int inc) #else /* CONFIG_LOCK_EVENT_COUNTS */ #define lockevent_inc(ev) -#define lockevent_add(ev, c) -#define lockevent_cond_inc(ev, c) +#define lockevent_add(ev, c) do { (void)(c); } while (0) +#define lockevent_cond_inc(ev, c) do { (void)(c); } while (0) #endif /* CONFIG_LOCK_EVENT_COUNTS */ diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock_paravirt.h index ae2b12f..169950f 100644 --- a/kernel/locking/qspinlock_paravirt.h +++ b/kernel/locking/qspinlock_paravirt.h @@ -294,7 +294,7 @@ static void pv_wait_node(struct mcs_spinlock *node, struct mcs_spinlock *prev) { struct pv_node *pn = (struct pv_node *)node; struct pv_node *pp = (struct pv_node *)prev; - bool __maybe_unused wait_early; + bool wait_early; int loop; for (;;) {