Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp4123865pxm; Tue, 1 Mar 2022 11:44:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrIxhFJqIdnGCOc2JaBOya75cTQA2Cdllw2ekYdrCv10Xg2gXYk0thhiBii20T5pkgkVkR X-Received: by 2002:a62:830e:0:b0:4c9:25cb:e1e with SMTP id h14-20020a62830e000000b004c925cb0e1emr28845806pfe.42.1646163898844; Tue, 01 Mar 2022 11:44:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646163898; cv=none; d=google.com; s=arc-20160816; b=JWZzmrI9beCJVS0aOZAI29DMZKjBjS9nK7ZfM4Fk06C0By4xNe19/C+eH+Tn1nG7l8 +Re8JZhycoV/iKPQaUPy5Z9XKKkt2Ll/I3i6JaYorQETtrGZ52W6KmrCo4PJgoBXBJGE 3LlLR9kT8POdhMYcJ0DDdiTsQkwq5GOlmZ9S2EU8VmY7B6jDWwaAuRkNzgNU1wTGtbDF 1N0j838diAQpvigRwpnONCL2kooPEn2mfmNyNDZiNxQOV/BBKazurrX96kEwiqWbvIqz RD5AVOkFzEmFdZH2oSyB00KOuY2FChLrUIWXa3JGD89CBP99iU9O/dJ9anvIHMLNI4gf XYEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=+C4zxahFpofeKdmB8B2bK0pDakASv/HEHs6T0IquZC4=; b=PWDxGxtj+bUaCB1iHrRFV1FAzGzZllOhbvm6uxGCmuijLnNwrngcIuL2k9NPdwKW6L Ghj6oHqcgNjlJUQffkPQ/A5tMwB3bFJMGQ3bFGeGrj33eGO9x1jpaplk10wNZw6eDykh Jf+oXoM0FOZS9kI8fxdVQ9irXCMmE0YNfaqbP1iho5/v2gxpPiUyEZ/A0FOwxnijYSUg 7ZieSO/yOqhQhHP1FGe44wx9Ag+2QZ7Q4Zt33DxFnw8N7J79gmAudc0XdR6MyRJdkyn4 aIHM0ZdrMX/99qoWQ0bcCcXL7o/hOFqOu0I49wugoAeM7qEl41GX1wsStsEtGu3AVRkm 43jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=LMu9Fk+4; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v32-20020a634820000000b0037323a4cc49si13099589pga.616.2022.03.01.11.44.42; Tue, 01 Mar 2022 11:44:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=LMu9Fk+4; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235685AbiCAPZ3 (ORCPT + 99 others); Tue, 1 Mar 2022 10:25:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235668AbiCAPZX (ORCPT ); Tue, 1 Mar 2022 10:25:23 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDA878A6EA; Tue, 1 Mar 2022 07:24:41 -0800 (PST) Date: Tue, 01 Mar 2022 15:24:38 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1646148279; 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=+C4zxahFpofeKdmB8B2bK0pDakASv/HEHs6T0IquZC4=; b=LMu9Fk+4IA2154VMKVieYwSdp6oo+JVXwFU+C+WUIgJfpvrPHs3pKW50xyjrime4oVZEl/ cB4hzWoyy7+pYEmRg1dzJ5/AxCiuzpk/3z/NEj5vUfrmu5NCB9EJOLsTuOCOMgmMRBEVjc GIqBvTd7+sHPrTq4rqgvBBAOgajpPuBI8OqgL0jeQXo7mTWSZRBkY5NiXfFLE0ZsG1TVaF T2jcF9AQctwfRqx1P1WzyObKAPYHpbr4o2H1Ol6qw4BcilDry+f3Pw+yYU6wkSIVAhJBZQ ae9Cf9gVWJJdq4ND7AnAzNruA0hBh+IXk9QxX9tz4QB//L0Pot5grzn3rz9UZA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1646148279; 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=+C4zxahFpofeKdmB8B2bK0pDakASv/HEHs6T0IquZC4=; b=6ryV83fU8Y/zRiErNYfaATMXaGk9v88bYluYyDkkB65/EAb1ZOdYufjUNd5rAaTNshxTtK utumibyRqXp+l4CQ== From: "tip-bot2 for Valentin Schneider" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/tracing: Report TASK_RTLOCK_WAIT tasks as TASK_UNINTERRUPTIBLE Cc: u.kleine-koenig@pengutronix.de, Valentin Schneider , "Peter Zijlstra (Intel)" , "Steven Rostedt (Google)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220120162520.570782-3-valentin.schneider@arm.com> References: <20220120162520.570782-3-valentin.schneider@arm.com> MIME-Version: 1.0 Message-ID: <164614827854.16921.2637635769821476298.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 25795ef6299f07ce3838f3253a9cb34f64efcfae Gitweb: https://git.kernel.org/tip/25795ef6299f07ce3838f3253a9cb34f64e= fcfae Author: Valentin Schneider AuthorDate: Thu, 20 Jan 2022 16:25:20=20 Committer: Peter Zijlstra CommitterDate: Tue, 01 Mar 2022 16:18:39 +01:00 sched/tracing: Report TASK_RTLOCK_WAIT tasks as TASK_UNINTERRUPTIBLE TASK_RTLOCK_WAIT currently isn't part of TASK_REPORT, thus a task blocking on an rtlock will appear as having a task state =3D=3D 0, IOW TASK_RUNNING. The actual state is saved in p->saved_state, but reading it after reading p->__state has a few issues: o that could still be TASK_RUNNING in the case of e.g. rt_spin_lock o ttwu_state_match() might have changed that to TASK_RUNNING As pointed out by Eric, adding TASK_RTLOCK_WAIT to TASK_REPORT implies exposing a new state to userspace tools which way not know what to do with them. The only information that needs to be conveyed here is that a task is waiting on an rt_mutex, which matches TASK_UNINTERRUPTIBLE - there's no need for a new state. Reported-by: Uwe Kleine-K=C3=B6nig Signed-off-by: Valentin Schneider Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Steven Rostedt (Google) Link: https://lore.kernel.org/r/20220120162520.570782-3-valentin.schneider@ar= m.com --- include/linux/sched.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/sched.h b/include/linux/sched.h index 457c8a0..78b606c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1630,6 +1630,14 @@ static inline unsigned int __task_state_index(unsigned= int tsk_state, if (tsk_state =3D=3D TASK_IDLE) state =3D TASK_REPORT_IDLE; =20 + /* + * We're lying here, but rather than expose a completely new task state + * to userspace, we can make this appear as if the task has gone through + * a regular rt_mutex_lock() call. + */ + if (tsk_state =3D=3D TASK_RTLOCK_WAIT) + state =3D TASK_UNINTERRUPTIBLE; + return fls(state); } =20