From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 81A1F42CAF1; Tue, 21 Jul 2026 19:36:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784662595; cv=none; b=LoQQlkZigocuvMCM+TFkbvRRREdPxfHDWVSX2hTeihevORrf4q8XEw3W8xmYS9/TfAvfDJNQxE2rnuTp/GOUe7GDKBT6CBEbkM4p/1EHliPfN/xJ611wwXXsxZQfRm+wdBENjs918rpz9IHiERaMCc0BcDixZCs7G6O17sLH5ec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784662595; c=relaxed/simple; bh=LPLY+9+iv2yIZo8NUd7Qr5ToUHcDdn+RhFLYhpj+n6k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=o5DniG0u/GxhTqn2J7yUf2L6XHrziHy5hyC3tuIjf7EKeBQq3/OJjk+FFB4nR0IqF3KDlKapm3EBPReF5Q/FBex0BfN4/0K8dW4ZVQ+yaX9biAAh3Cbvo1ArIjEL82yFJ6RbQh0yYkJ0NmlMyxWCnPseyymRTsjKLHVoDkN8HR8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nc1zlhd+; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nc1zlhd+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBB2E1F000E9; Tue, 21 Jul 2026 19:36:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784662594; bh=ykBmsCvzMNFv1tdeZyAGhjJBAGb6aLunapGIiREivTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nc1zlhd+uCKcbw60YogyUdNTu9z9QnQABvjkBrGRopJ8KFfGfA21FnmHl3g6yqqPg e1C49os7n0DcMf8Tn2z/OhmGla66EQSvpbkXpj0RWnuqkYJGzwstMjlSkQQLEBQSEc WIQnMvuiBjynI3t/29c8yfYxerRSK1SXvlvi1B/M= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, sashiko-bot , Davidlohr Bueso , Namhyung Kim , Ian Rogers , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 6.12 0502/1276] perf sched: Fix idle-hist callchain display using wrong rb_first variant Date: Tue, 21 Jul 2026 17:15:45 +0200 Message-ID: <20260721152457.338898135@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnaldo Carvalho de Melo [ Upstream commit d9b99dc8148e0c1f5da3942131b47e0d21187a32 ] timehist_print_idlehist_callchain() calls rb_first_cached() on sorted_root, but the sort function (callchain_param.sort) populates it via rb_insert_color() on the plain rb_root member — not the cached variant. This means rb_leftmost is never set, so rb_first_cached() always returns NULL and the entire callchain summary is silently dropped from --idle-hist output. The original code in ba957ebb54893aca ("perf sched timehist: Show callchains for idle stat") was correct — it used struct rb_root and rb_first(). The bug was introduced when sorted_root was converted to rb_root_cached without converting the sort insertion path to use rb_insert_color_cached(). Use rb_first(&root->rb_root) to match how the tree was populated. Fixes: cb4c13a5137766c3 ("perf sched: Use cached rbtrees") Reported-by: sashiko-bot Cc: Davidlohr Bueso Cc: Namhyung Kim Acked-by: Ian Rogers Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/builtin-sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 7cf56e271a993a..0741d926590468 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -3126,7 +3126,8 @@ static size_t timehist_print_idlehist_callchain(struct rb_root_cached *root) size_t ret = 0; FILE *fp = stdout; struct callchain_node *chain; - struct rb_node *rb_node = rb_first_cached(root); + /* sort() uses rb_insert_color() on rb_root, not rb_root_cached */ + struct rb_node *rb_node = rb_first(&root->rb_root); printf(" %16s %8s %s\n", "Idle time (msec)", "Count", "Callchains"); printf(" %.16s %.8s %.50s\n", graph_dotted_line, graph_dotted_line, -- 2.53.0