Received: by 2002:ab2:855:0:b0:1ef:b27b:cc29 with SMTP id 21csp1721218lqy; Fri, 29 Mar 2024 06:47:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWqjNj6jrH/7ZO0TOLyJWMV1c5Ts4NZvDIY4rwSmrQ17DCURCSQf3qgdZTtCOlu5yIsB2ZDAtRWDBkiIwtSx92p+S5rhebP1IARJF6ZRQ== X-Google-Smtp-Source: AGHT+IFWWvXrjy5APZvS+tQjRrqzIJyl5gjQ1RV2UXPY4d2ay6tRFWzo3lfeGTiFskh+1B2L8K4k X-Received: by 2002:a05:6358:42a3:b0:17f:1c95:7b94 with SMTP id s35-20020a05635842a300b0017f1c957b94mr2760170rwc.12.1711720074418; Fri, 29 Mar 2024 06:47:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711720074; cv=pass; d=google.com; s=arc-20160816; b=QJBL47/ilW1KKJWMarTNRpFtHeIOhLD4RIDaXgVzzE+0n7r7/sgo+MyuZeohyVoq57 HL0YmeEuWrSqPh/VjpjugWKX5HFhIpoE5Hc73MWZzSqsRCUe14EanIj9k6X0ByNHHS6n 7cSxqDZPrB/180lPgL7b4brMi5WOYOe/OWfzmHiBZIeajqTTybgf0CtqNdcHlYFiCSv7 imTPfwFrZGH+fQAuU1VbI82g0G8jHMHfrEbPfUsgLHhfNTE1YfRF4YZ27UeQUy2l5lEh ixqBs+oUrskbpgmlKiLFDgoAz0BR9lQY2U0zO3lXpm41LWQfXB5YdQB6cMIzcLpLjXR+ zF3g== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=RcPsCWI+Z1R2efl1Z9Ys+ntwo8YgbfwCJQD1ENPfrTs=; fh=H+lyx4jeLey6FZg5EaLqsJFW1AfGLi8PPqBSh+jU8Ws=; b=nsW17clKTOt9SVcNvF5uFauKJ+x0xWnnJ3bfYXWihSHJF49nof3iouobZSM0MezeS/ Wr+giG8w6iKrgc5x2G/hyeyG9NKO7d10rzGwvh9ZSepGwAynHc4Em3/hhqeIsLHxwjs+ 748NhHEaRp5L/2bvYI49iyrNS6Vx2OZ0Oktvev7nWiX3CgJ8aNAwGHXDSyGnqcB8OjVL hUL8a+retoQlzXUneYSTu9Vne04kstoi3YJ+GkvGaQQJYY9qPTl9IuOrpTySlqbmqm8V M+iXENwEMEZkZyV/vCve4GnfxSFDed3jgFe18t/nn3Bv5BTZjj+M/61uRUZ6NKoM00I1 UYXw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ktrxV8jT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124750-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o13-20020a635d4d000000b005dc87643cd1si3582359pgm.138.2024.03.29.06.47.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 06:47:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124750-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ktrxV8jT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124750-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 137012894CA for ; Fri, 29 Mar 2024 13:41:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0911B17B519; Fri, 29 Mar 2024 12:41:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ktrxV8jT" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0F67317D222; Fri, 29 Mar 2024 12:41:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716076; cv=none; b=N2J7V5rdOqn4KjMVU/lXoYz+PaMMf98JRXnOJhjKfyFaLq6iDcVL9d8BBTaQkc3EsAH3gcGunpdJ4RMoQCgSWuvTbDWcSSBrDp/0IYPhMfa4WDBLzvF791fIKV/NJGhqM2Khzs+qtKLz01UdB6qXDSSpqV60pFHi/TRgQk6ah0s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716076; c=relaxed/simple; bh=bxVGzJ3AzIudmCa/MTstvcMBg6Yvgfv7mF2wpvMvwZg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JhRQ9BGi2m1qT1AJ1ZY3LhtCUjPL1mFTTWWienKykO74B15gy4fOCeDIF45qFX9RLuXLN/EFq2SjCayhhTh/hiPKdtLzEE6OQcCjs8Mp75z8cjo3zY68UDR/2mDnaPpN6mn9xJZTpCV8z5EkAbpxAj63Ocgo5PP3KdRinLiV4O0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ktrxV8jT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8544C43394; Fri, 29 Mar 2024 12:41:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711716075; bh=bxVGzJ3AzIudmCa/MTstvcMBg6Yvgfv7mF2wpvMvwZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ktrxV8jT4zq0rqCiFoyqXEC5CfAfRBHzGFm7HXBVpX9AJU/hfKUJazGyR5UnphNF4 YvPSGfy+qEe2sn85gqpPxBog2PXhsd+7nDExoRq/IshrGFqlmC0eqTdKIMDc/vCQZv b7FYK45H3J9KJpCGDNpBAkNbbSOUitkddTBPMe2xh5m/Ek//Ce3MmVVVI7FPpz808r hH9iY6St0Yn17EHalTfNTx9qz+oaeYBbRb+htSKZ5aeIJr6lwuxO574dIplQxpAEAi UpD/0uvkARoRRkPy9IE2BNESNeg0x99G3PqUWtwbiP1mbRArnS13noXGceGWh18bWT P4H4o90v+LOBA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Paul E. McKenney" , Steven Rostedt , Boqun Feng , Sasha Levin , frederic@kernel.org, quic_neeraju@quicinc.com, joel@joelfernandes.org, josh@joshtriplett.org, rcu@vger.kernel.org Subject: [PATCH AUTOSEL 6.8 41/98] rcu-tasks: Repair RCU Tasks Trace quiescence check Date: Fri, 29 Mar 2024 08:37:12 -0400 Message-ID: <20240329123919.3087149-41-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329123919.3087149-1-sashal@kernel.org> References: <20240329123919.3087149-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.2 Content-Transfer-Encoding: 8bit From: "Paul E. McKenney" [ Upstream commit 2eb52fa8900e642b3b5054c4bf9776089d2a935f ] The context-switch-time check for RCU Tasks Trace quiescence expects current->trc_reader_special.b.need_qs to be zero, and if so, updates it to TRC_NEED_QS_CHECKED. This is backwards, because if this value is zero, there is no RCU Tasks Trace grace period in flight, an thus no need for a quiescent state. Instead, when a grace period starts, this field is set to TRC_NEED_QS. This commit therefore changes the check from zero to TRC_NEED_QS. Reported-by: Steven Rostedt Signed-off-by: Paul E. McKenney Tested-by: Steven Rostedt (Google) Signed-off-by: Boqun Feng Signed-off-by: Sasha Levin --- include/linux/rcupdate.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 0746b1b0b6639..16f519914415e 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -184,9 +184,9 @@ void rcu_tasks_trace_qs_blkd(struct task_struct *t); do { \ int ___rttq_nesting = READ_ONCE((t)->trc_reader_nesting); \ \ - if (likely(!READ_ONCE((t)->trc_reader_special.b.need_qs)) && \ + if (unlikely(READ_ONCE((t)->trc_reader_special.b.need_qs) == TRC_NEED_QS) && \ likely(!___rttq_nesting)) { \ - rcu_trc_cmpxchg_need_qs((t), 0, TRC_NEED_QS_CHECKED); \ + rcu_trc_cmpxchg_need_qs((t), TRC_NEED_QS, TRC_NEED_QS_CHECKED); \ } else if (___rttq_nesting && ___rttq_nesting != INT_MIN && \ !READ_ONCE((t)->trc_reader_special.b.blocked)) { \ rcu_tasks_trace_qs_blkd(t); \ -- 2.43.0