Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1452457rdb; Fri, 16 Feb 2024 17:28:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXWUWXm4mpmTEnhwsar8mYipayEyTCjUhcPEyompGYfnsxLOEubuBzI4gm4UQdjWHoNPAWVlWjMCtFP5gI/FNdPebXHTzCkXNCk4cOHSg== X-Google-Smtp-Source: AGHT+IFSBm6FLeSL3s/R4rL/7ckSsbqJwINai23fkP6fJMrERxzNJOpD6eXbuuHJ+OTX9n9XtSmn X-Received: by 2002:a0d:d7c2:0:b0:607:92a7:a99b with SMTP id z185-20020a0dd7c2000000b0060792a7a99bmr7024758ywd.8.1708133286665; Fri, 16 Feb 2024 17:28:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708133286; cv=pass; d=google.com; s=arc-20160816; b=losKlMlDB3pA27Vp0H4ugd6XWP8dwT/WsfImkjPAjzeneMfeuxXl5imdVl5oi6weuK r8e7AjL7cRR8wk6g+XIAHejyaCUhuTV3/V6lvIAEicKYmODJx8PVr+BxWKB9vEHWYIeo uCia6g82oLbpwQiFQkLhwuEQ38I5wasJkD5/EZvkxvAiYPtLI+4mfF7NwYOpARQldhTb iHMl0E2y4QyG+yVD4R40OMOGxK7wnk9ZerU7mW2piKQrcnxS+Eo26X3MXXe4pQC6/fQ5 olhaOKtxwG1b76o0QhpSJkoItq0++sy2yID062znE+7nNBjSySZvfay9AcclXMXDBOCY kB+A== 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:feedback-id:dkim-signature; bh=eSS+leYgx/1CnoRDNP0u4WvLSnhQI+J7A/LTWeqZnSM=; fh=9oilMSntsrFYP7dgQAt69A8yD3LklPyGE6zHxU54lRs=; b=UrLu/ywh+LlxiJr2InOBfqgo1ddCCDvRV4XW8uDvy5hdSdniSd9NKxHx86UrnLxkfC hEPe9QqQAS4pYB3L8Pt9MT6hLxwWH/2wP2+NUFp98zHBl8r6G2nNjZ+4W6iWhvIRqTY1 v5PsHHHN1GnUTeUjB8Cy2Q0rQzkN7eAPdNsPcyxNW20NkqI6GPAGjUpAsF0U0IFi9cSf nh9wGGEbzOLTnQEyWrudrVKq6pIEKRYkAW9aEnvnWA8Aieus/KhnexL5ca/pn77vgEUz c3l5dKnTbNzzo4xlYbBR6xjWZu20XwTPmeR2z+tYm/4Xsy4wWZIHepy27RjmXgOI7NrR tZ0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XT9C+nFm; 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-69640-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69640-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t19-20020ac865d3000000b0042de77a5f5fsi1004382qto.783.2024.02.16.17.28.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 17:28:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69640-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XT9C+nFm; 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-69640-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69640-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6BD061C21649 for ; Sat, 17 Feb 2024 01:28:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EE051773D; Sat, 17 Feb 2024 01:28:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XT9C+nFm" Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (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 CB5D74C8F; Sat, 17 Feb 2024 01:27:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708133280; cv=none; b=Hae704mcMC4M5q9G/2OpbadNvL7QbnqZ+tPBqkMkLdx5QSjFL8SBxXkbmg2MlzQIVxONMsDTbhwpvNkVfrk55srH9pij4DPzWuD4dTVGNOEiRc359ZB1v2glCLklbvU1rWMXOZv/rwyqc2u38wpwRDgLGR6QikhhSxSAsYJrgrg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708133280; c=relaxed/simple; bh=IPhTwhd+sG/j2XT8YGeqy+Bq/Ymg/GX/lulfajzIek0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rJwFe0Qao+Xk4nNOYrsRgb74kSdgOBoim74lFi2OvTGZgeobEJFUdBZyGXWACYgNvJL9ikLG6KlhqEQVqu/CI3AqfNd40iXcL3xvqm+FE87I+qEHQC8nkShNWGLOkxThIy7QuEPhS0yATaNxK53675MFqJg7rHpA7U+C3aWZGoc= 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=XT9C+nFm; arc=none smtp.client-ip=209.85.160.173 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-qt1-f173.google.com with SMTP id d75a77b69052e-429d7896d35so15653621cf.3; Fri, 16 Feb 2024 17:27:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708133277; x=1708738077; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:from:to:cc:subject :date:message-id:reply-to; bh=eSS+leYgx/1CnoRDNP0u4WvLSnhQI+J7A/LTWeqZnSM=; b=XT9C+nFmGsjUZelHvCh7UDqtDD42//xwV/56k6cCZLDvmYUkD9sDbV6YYbFcPS0dpZ eDCWIvQcrse746JM2AtyG4xmO4C9A0+1zAy9dmO/R1RD+a40FYxABwdyaxrz36s/ZDSq Y8PkUXjyD27O3h7ezsatIZAju3AktWYznlFTpELllRQk4BSDQDmaxAUk1XtuaR90dcEM hDYzQvzGlIZ7Ugu1JwUUlpVddz8N//CNVquXmwyqIJDGdXPM4cc4go93yUWBVl0FgRj1 oUzayr8jEUsTOLDs9/gPoJqn0sSTiy6tbeMfLGqQgD8JTK5n+gnMqyc4L746qzXfeY1r HYHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708133277; x=1708738077; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=eSS+leYgx/1CnoRDNP0u4WvLSnhQI+J7A/LTWeqZnSM=; b=Gmz1sDU+L0U/Mj1hsLwIgnqGPdOSI/UJcVQzch17WL72NeIlhOSH/XOVKaDLCmBhn7 QBx+YH/DjkjMrGykfIrNDjhdCfWbhRc1Q5JvO7rb2V7vacOh/Z20IdYwb4mvCyCV5ra+ BCc/kPNQg0TH1cIZchrNBUks7l4zvwTFSrwQ9NEXMGJ2hopa380pTkmkgQLvoTa0xt1f jQqkO9G0I7tTUuHq4eXSSTBHwPKi4pcF8glmkQWWzOvNrPlmwMTSZVXAmUevESLGXXFG LrPoDyKl5HSdWdqBRVmoja8hnmxn1diP6Q4fDVbpmnxU+VyUT+BKGvTdNlKuycnSikPr +8GQ== X-Forwarded-Encrypted: i=1; AJvYcCUU1Mb5O1oyfnRfKGK1mSbAf687DbAcfSxHqzrwM3SxG1yjE6D28x7e9+TcvVAZZXL/aX5mO4Mi3c0DQvBLBWjH8EXb X-Gm-Message-State: AOJu0YxhVuAjXoQOxCuI0IO4Mib4j6Wqv4Xm35HQUc5gGHUbE62+R9Cm PuXRsnIn1cou8HO4oikDoQFlGVw5LDgnY2Q18YOffZFaVL7oAn/W X-Received: by 2002:a05:622a:316:b0:42a:9d03:1c1d with SMTP id q22-20020a05622a031600b0042a9d031c1dmr7243965qtw.63.1708133277533; Fri, 16 Feb 2024 17:27:57 -0800 (PST) Received: from fauth2-smtp.messagingengine.com (fauth2-smtp.messagingengine.com. [103.168.172.201]) by smtp.gmail.com with ESMTPSA id 2-20020ac85742000000b0042d8bf105c7sm432772qtx.2.2024.02.16.17.27.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 17:27:56 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfauth.nyi.internal (Postfix) with ESMTP id 77F1D1200064; Fri, 16 Feb 2024 20:27:56 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 16 Feb 2024 20:27:56 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdefgdefgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhepgeeljeeitdehvdehgefgjeevfeejjeekgfevffeiueejhfeuiefggeeuheeg gefgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsg hoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedtieeg qddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfhhigi hmvgdrnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 16 Feb 2024 20:27:55 -0500 (EST) From: Boqun Feng To: linux-kernel@vger.kernel.org, rcu@vger.kernel.org Cc: Neeraj Upadhyay , "Paul E. McKenney" , Steven Rostedt , Boqun Feng , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Zqiang Subject: [PATCH v2 1/6] rcu-tasks: Repair RCU Tasks Trace quiescence check Date: Fri, 16 Feb 2024 17:27:36 -0800 Message-ID: <20240217012745.3446231-2-boqun.feng@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240217012745.3446231-1-boqun.feng@gmail.com> References: <20240217012745.3446231-1-boqun.feng@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Paul E. McKenney" 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 --- 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 0746b1b0b663..16f519914415 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