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 496B23B42EF; Tue, 21 Jul 2026 20:39:55 +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=1784666397; cv=none; b=cs6/BxmBF5GsLaoOPL2eGjvX+tSxH2uAhvQuTuOg9GgUXXJKIqLzdynucLG20Y+JR+ej/PlTfnnh6r+oRTo1wFE7d+epMjQuBOKdQfZBb5VfPWZRXIie4W79VoJf5HnpUuW2YyGboH5VamMUza6oAykpcDA8UyHPLSnM/Y1g8Gs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784666397; c=relaxed/simple; bh=4iTIm6GbhTKeBYxJMqham4xIhaBWVmcQkpvCsylJKUM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FftCojFmbaLFoPkg7uNJJJqFQYM+x/93mowvnjlvEowVKSKIFZrP5S0yiQgzKsgTSgwy2i6iwUd4HdieygWOumFjLVPaTeBValrAj1OBpTwdkETWoIKLh6qvFA2gv8jr7D2YJcr1hzZECxrebJvraOO7YRDDHNVA+pDy5pOhQ+8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Nt1Htzjh; 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="Nt1Htzjh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F1651F000E9; Tue, 21 Jul 2026 20:39:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784666395; bh=A/jKXnSF+XEognwDuIUTpDLS9J9757oLGUrxGpEyhUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Nt1Htzjh3URUMYdjbnTh2osB/GTvtl1VrfGpQzvdtVRsMz02/h6qDnMlRjt480ChQ 4WpLfD04OVm0uWxKZzG4V9GHwWoYBaoohatP/Fc74eo5vsXwPYQFFKKlxoJXGJrZLe VuWncu+pZSbAvrDzgLsyPk565WVbpJYJi6A4vR2k= 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.6 0667/1266] perf sched: Fix idle-hist callchain display using wrong rb_first variant Date: Tue, 21 Jul 2026 17:18:24 +0200 Message-ID: <20260721152456.784422025@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@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.6-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 8b1573515c5781..db4ceebab8d8ad 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -2906,7 +2906,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