From nobody Wed Jan 7 23:07:29 2026 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) (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 024E531AA8F for ; Mon, 5 Jan 2026 03:21:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767583279; cv=none; b=RM5qX5eO58ObeOXt1zeYhiDS1XRH8daxYXh4Fs9afw2bmzzd3zVODWuSth8s987gC04+3UvVjiwWAsb3JYwPY34tbJRiMLdhBVGT13BodPDZIYygWX0SCLThZJzn/OyuqAAQnt5cUXzb3BO4SY0aIe/tOyKVgMwAqOBrRBi/fys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767583279; c=relaxed/simple; bh=2yVqUrAH/rAV3CFEQtEB1zHKuYftuWks5gMh0PYY0bA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=jQgSGcMVW7fWSH485QgqIPUO8RnatwrVknI3PalxPOR/mLLb8dlWL/QooQn42vNyrUWaxPa1hiiP3DUTiWA2yu4WY7ma6CnbeB+OakhCthlyMFg0pPIq96F5oLMOT2rbah+hFFcoCcqu3kGnQfeySisYJKMRUa74YEN2VGJshHA= 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=drPHTw+E; arc=none smtp.client-ip=209.85.210.195 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="drPHTw+E" Received: by mail-pf1-f195.google.com with SMTP id d2e1a72fcca58-7f0db5700b2so11638820b3a.0 for ; Sun, 04 Jan 2026 19:21:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767583277; x=1768188077; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nP3qC9T00rl9JbXEVxwHQu5KUyBQJJofS5UcrCiyeJU=; b=drPHTw+EAFM81qVVnxN7+mwQmviud3S8P/nRua6ly5Q4w7NwOkBREwzW5ByssPeVNI e4byB2SRYFXQ/yUkJNC0cyKx0C25Be/ToWGov0JXTeuJCyIUo7rlrViRASJWV9wPONFl /gD3Vbh5Ovzlfsu8P1jRyxV1G88LBE0CAr8aPtNQGTpesVX2pEzHFQyL/4QR6iyD3pW4 eMDtcLjoPUS8Bbasl5mJQpb2raSrRCgxt8C215Hr4HLgq7hOyYXGcAV1PQTypcxOcl8t 3DS80bgFPXgDf08fH3Uza9NLdEwAgzkb7Mwt4W4KnJbnxyEbYxB7RfJ4Vm7j7lygDVqh vMNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767583277; x=1768188077; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nP3qC9T00rl9JbXEVxwHQu5KUyBQJJofS5UcrCiyeJU=; b=C0p24I68tfjcs0JlbyLEgkuUsQxAvNEukEfDwwU5rFGe13bFlUYCMH/1oQT4R4o5KA BfwzEmsNg5/LkWlgo3yJ/VKz3TSjknYA0EpijBBhAik1hB0PnTanwvJrAM6WTATRvi51 sD60YIkWvN7e668ydefx68FHDxhf4TU0ogStze9LDrvcqPJhesiOIJ1XwE/MiI09ySA/ +cnRwxsUoC4+9YH7nGWDYaVmnJB+unblNcdDXqMvmpt4KAFWV6udPcI2l6SLxTMqQ6t5 a6tiDSbrsJJSyEjlfsDJ6z0Sq0eLixJhgYcGTS4ONbmztWkXpfLwHzGiz22S/jAdnQiN 0ZmA== X-Forwarded-Encrypted: i=1; AJvYcCXPuousAALYGRUpp+vUwEErAmb0G51vm/xCKkIU1C/kooIZbBnwKKQR4SzCxNe+DHcgrLJj+cWgYJy1HBQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxE8HrwkYnQX5J+nYIe9aX1JorW5qEm5ZFyN/xqbBvNuIfPHBdV 2/rpedISQOAnUKd5ooYNBLKZJ54NmYU+HVdJ9OIwC8NtsKDezeA/emHN X-Gm-Gg: AY/fxX4sTECoP+D3xZzPrf0gL9D0fN4n2CKeiBH8liGhcZy5YuaqhbkvSQP3yIk9uYY jEQqOq5mBUS/zTMeTkYW1snZErCDKlilwVlp4ukiPFogZGHjchVoQI76Iw7wfBYGep1uagj8heI UCRF03F5jBNuXjUuhsyHmTdUBPCCiplU3LcjfUSCWgTJbVSHuexb7uEz6yOvGhxPPTJndGk6tTL dtOasWAbW4v0mnjolz7Hpm2LWTuydvW6xmdU6AXKEgLkQ0R/dZWtq8E4hYlJH1lcsqWloQ069z2 RtuqCLEQCZ6K/Lu/c3nKCK9Fikcv4VOtlUBO2EPAjPy0NN0CrFBUuWOKczKfZDY8P+HTVcJCHF2 6Xch/GsAPeyK+rR449Gt5R6kPVMRFpoJV+0lD2I5WYh3uVQ1CDt0k8MiXO7bg9sSoEQyJetFAko H71BttqzAfxsjZIitjGOMuFD45zI0= X-Google-Smtp-Source: AGHT+IFbs+o5yKIznB+pkFkpmwW+HUV98k22TQ6APUvUWR/GyQ8u08zMV5eXgcFE9HSlhVMYAlKceQ== X-Received: by 2002:a05:6a00:4307:b0:7e8:4398:b35c with SMTP id d2e1a72fcca58-7ff66672928mr38546276b3a.47.1767583277310; Sun, 04 Jan 2026 19:21:17 -0800 (PST) Received: from pengdl-pc.mioffice.cn ([43.224.245.249]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7ff7b127b00sm46565337b3a.21.2026.01.04.19.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jan 2026 19:21:16 -0800 (PST) From: Donglin Peng To: paulmck@kernel.org Cc: frederic@kernel.org, neeraj.upadhyay@kernel.org, joelagnelf@nvidia.com, qiang.zhang@linux.dev, rostedt@goodmis.org, rcu@vger.kernel.org, linux-kernel@vger.kernel.org, Donglin Peng Subject: [PATCH v2] rcu: Align stall warning 'idle=' output with documentation Date: Mon, 5 Jan 2026 11:21:12 +0800 Message-Id: <20260105032112.1156359-1-dolinux.peng@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Donglin Peng The RCU stall warning message includes an "idle=3D" field to indicate the dyntick-idle state of a CPU. According to Documentation/RCU/stallwarn.r= st, the hexadecimal number before the first '/' represents the low-order 16 bits of the dynticks counter. An even value denotes that the CPU is in dyntick-idle mode, while an odd value indicates otherwise. This was valid until commit 171476775d32 ("context_tracking: Convert state = to atomic_t"), which merged the context-tracking state and dynticks counter into a single atomic variable. In the new layout, the dynticks counter occupies the higher bits starting from CT_RCU_WATCHING_START. However, the current stall warning code prints the value from `ct_rcu_watching_cpu()`, which returns `atomic_read(&ct->state) & CT_RCU_WATCHING_MASK`. This masks out (clears) the lower state bits, resulting in a value that is always even. This obscures the CPU's true idle state and makes the output inconsistent with the documentation. To restore consistency between the code's output and the documentation, shift the atomic value right by CT_RCU_WATCHING_START bits before printing. This extracts and displays only the relevant dynticks counter portion, allowing the parity (even/odd) to correctly reflect the CPU's dyntick-idle state. Fixes: 171476775d32 ("context_tracking: Convert state to atomic_t") Signed-off-by: Donglin Peng Reviewed-by: Joel Fernandes --- v2: - Use CT_RCU_WATCHING_START to replace ilog2(CT_RCU_WATCHING) to clean up the code, thanks to Zqiang. - Clarify the commit message. --- kernel/rcu/tree_stall.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h index b67532cb8770..fd9d7fd6e17c 100644 --- a/kernel/rcu/tree_stall.h +++ b/kernel/rcu/tree_stall.h @@ -555,7 +555,7 @@ static void print_cpu_stall_info(int cpu) rdp->rcu_iw_pending ? (int)min(delta, 9UL) + '0' : "!."[!delta], ticks_value, ticks_title, - ct_rcu_watching_cpu(cpu) & 0xffff, + (ct_rcu_watching_cpu(cpu) >> CT_RCU_WATCHING_START) & 0xffff, ct_nesting_cpu(cpu), ct_nmi_nesting_cpu(cpu), rdp->softirq_snap, kstat_softirqs_cpu(RCU_SOFTIRQ, cpu), data_race(rcu_state.n_force_qs) - rcu_state.n_force_qs_gpstart, --=20 2.34.1