Message ID | 20231201092654.34614-6-anna-maria@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp991668vqy; Fri, 1 Dec 2023 01:27:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdW+QsXpGgeYLq/iO1zHdyTRrfZhP5TYXo9B7VSAgnDBjVmNsnDT8IB/p0xB4AjSeOi6kx X-Received: by 2002:a05:6358:9141:b0:16d:b577:e9f1 with SMTP id r1-20020a056358914100b0016db577e9f1mr23706496rwr.9.1701422870235; Fri, 01 Dec 2023 01:27:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701422870; cv=none; d=google.com; s=arc-20160816; b=Y+FHgu01qzTYijdU300572wvPpoqUgc1tTR2Hsn0snxQ/8ubQkbIAe96X3qnJcJIOv YSX8q7NFqNzSvDMpGi01N6MtL6HgmWpYgKEnfmGF/byHofXCUZSlXd1b7Ga+qk2g4HZn yEmAz3rlVyqqEVzu8zCuDgHzdIbFyOHpPur0LdslrmsihQiKtN8iV0SibKFk8fqB5Jqa 3/CMjfIKGZTBVgU6igRfhqeRkh9vnCsMVvwuphx9YRG712Uc3t0h0kbenjMEJTjRZzTx 3ExQheYAOnLg6tRBSUZHMMngoeqLATkBvWB/TrGGA1QlAr/+zcXB5xJphR3Qp+Ukrj74 pnhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=x5NV8oLmppm4cChtNeoTUNwitHPz66rl4TtkJG1MsVE=; fh=PG6uS4TiiUSDyl8D/joYkWbwCgDm4ug0ir2h7tHBJXQ=; b=Dv+y6TiLaQpLYfH29/XbOqIto/z+g2E+aynRjdvRmH/Bgc9i9RWOtfsm1bVYrOKnZR opTkmyYsOqSOaSo36HArzbCP8FCi6MqCVuCR1yqxE1Q4DJGb4mYQ3UWQGJWSuUxc7igQ otS7ESoIbR0b0jpyiionYvdy5sO3f1DzjNaYkKprXLX/FC7+YxW39M4rJS/KVj9v4znq FvMBq2ZzgQQU2EJT3/ySQE7qzvFRNigNlqoq6ewsKhZQx5XMrK+yjUt67t72ltSj8wv3 cgZukVRkB2Y24YQOtov4zPQ7mnhNp5g+FFbld7IsmFWbKg3ov/KtO0O3uh4IwLiwycRV wyEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ACJG9BLn; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="lV7jqkG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id e20-20020a656794000000b005ab7b51ab6csi3000969pgr.515.2023.12.01.01.27.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:27:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ACJG9BLn; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="lV7jqkG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 233E180BD4C6; Fri, 1 Dec 2023 01:27:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378056AbjLAJ1S (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Fri, 1 Dec 2023 04:27:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378024AbjLAJ1E (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 1 Dec 2023 04:27:04 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E533510F3 for <linux-kernel@vger.kernel.org>; Fri, 1 Dec 2023 01:27:10 -0800 (PST) From: Anna-Maria Behnsen <anna-maria@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701422829; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x5NV8oLmppm4cChtNeoTUNwitHPz66rl4TtkJG1MsVE=; b=ACJG9BLnPweNxaHJJ9w1pbi+SRth6MXk+ue7mImxGjl0rf06m9//BXNESvnefcAi865eVp HYPHH88orIdDbxTxm6maC9Z7zjntcMuoGw+mucvviLDTWAizOZTFZb3cR0lB9l9VR/YNZ2 XThDs7w8kH85z4y9wuHUBDLuV04+NHpj5jZFQwuLoD1AFW0uGzvPXdi0y5cYapX6LTZk+6 sRTA+PR1Tq1vVNVKY5wlJ92DCMEjLBV6bANERRrmFxSDeOraYXvp1AI2n+5WJao2xPnuyI wNBYPxJiugPji/XfpCYlL5YpmVuIMRE2jvgKEs6sgx+JgsjcFf/iMB+WUJNczg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701422829; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x5NV8oLmppm4cChtNeoTUNwitHPz66rl4TtkJG1MsVE=; b=lV7jqkG/73jefeFGIVa0cvbImUlcDQjpHBuRgRZzzHojWnwJUlYoDZ+Hr85NjGiyrNZEyE 1qQTNsPXqXlEXZCQ== To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra <peterz@infradead.org>, John Stultz <jstultz@google.com>, Thomas Gleixner <tglx@linutronix.de>, Eric Dumazet <edumazet@google.com>, "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, Arjan van de Ven <arjan@infradead.org>, "Paul E . McKenney" <paulmck@kernel.org>, Frederic Weisbecker <frederic@kernel.org>, Rik van Riel <riel@surriel.com>, Steven Rostedt <rostedt@goodmis.org>, Sebastian Siewior <bigeasy@linutronix.de>, Giovanni Gherdovich <ggherdovich@suse.cz>, Lukasz Luba <lukasz.luba@arm.com>, "Gautham R . Shenoy" <gautham.shenoy@amd.com>, Srinivas Pandruvada <srinivas.pandruvada@intel.com>, K Prateek Nayak <kprateek.nayak@amd.com>, Anna-Maria Behnsen <anna-maria@linutronix.de> Subject: [PATCH v9 05/32] tracing/timers: Add tracepoint for tracking timer base is_idle flag Date: Fri, 1 Dec 2023 10:26:27 +0100 Message-Id: <20231201092654.34614-6-anna-maria@linutronix.de> In-Reply-To: <20231201092654.34614-1-anna-maria@linutronix.de> References: <20231201092654.34614-1-anna-maria@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 01 Dec 2023 01:27:43 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784071187560015896 X-GMAIL-MSGID: 1784071187560015896 |
Series |
timers: Move from a push remote at enqueue to a pull at expiry model
|
|
Commit Message
Anna-Maria Behnsen
Dec. 1, 2023, 9:26 a.m. UTC
When debugging timer code the timer tracepoints are very important. There
is no tracepoint when the is_idle flag of the timer base changes. Instead
of always adding manually trace_printk(), add tracepoints which can be
easily enabled whenever required.
Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
---
v9: New in v9
---
include/trace/events/timer.h | 20 ++++++++++++++++++++
kernel/time/timer.c | 2 ++
2 files changed, 22 insertions(+)
Comments
Le Fri, Dec 01, 2023 at 10:26:27AM +0100, Anna-Maria Behnsen a écrit : > When debugging timer code the timer tracepoints are very important. There > is no tracepoint when the is_idle flag of the timer base changes. Instead > of always adding manually trace_printk(), add tracepoints which can be > easily enabled whenever required. > > Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Just a detail below, again this can be posted as a delta patch or edited before applying: > --- > v9: New in v9 > --- > include/trace/events/timer.h | 20 ++++++++++++++++++++ > kernel/time/timer.c | 2 ++ > 2 files changed, 22 insertions(+) > > diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h > index 99ada928d445..1ef58a04fc57 100644 > --- a/include/trace/events/timer.h > +++ b/include/trace/events/timer.h > @@ -142,6 +142,26 @@ DEFINE_EVENT(timer_class, timer_cancel, > TP_ARGS(timer) > ); > > +TRACE_EVENT(timer_base_idle, > + > + TP_PROTO(bool is_idle, unsigned int cpu), > + > + TP_ARGS(is_idle, cpu), > + > + TP_STRUCT__entry( > + __field( bool, is_idle ) > + __field( unsigned int, cpu ) > + ), > + > + TP_fast_assign( > + __entry->is_idle = is_idle; > + __entry->cpu = cpu; > + ), > + > + TP_printk("is_idle=%d cpu=%d", > + __entry->is_idle, __entry->cpu) > +); > + > #define decode_clockid(type) \ > __print_symbolic(type, \ > { CLOCK_REALTIME, "CLOCK_REALTIME" }, \ > diff --git a/kernel/time/timer.c b/kernel/time/timer.c > index a81d793a43d0..46a9b96a3976 100644 > --- a/kernel/time/timer.c > +++ b/kernel/time/timer.c > @@ -1964,6 +1964,7 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem) > if ((expires - basem) > TICK_NSEC) > base->is_idle = true; > } > + trace_timer_base_idle(base->is_idle, base->cpu); This will trigger a trace everytime we loop into idle or remotely compute the next timer. Can we move that to when base->is_idle is set from false to true only? > raw_spin_unlock(&base->lock); > > return cmp_next_hrtimer_event(basem, expires); > @@ -1985,6 +1986,7 @@ void timer_clear_idle(void) > * the lock in the exit from idle path. > */ > base->is_idle = false; > + trace_timer_base_idle(0, smp_processor_id()); Same here. If base->is_idle was already false, you could spare a noisy trace. Thanks. > } > #endif > > -- > 2.39.2 >
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h index 99ada928d445..1ef58a04fc57 100644 --- a/include/trace/events/timer.h +++ b/include/trace/events/timer.h @@ -142,6 +142,26 @@ DEFINE_EVENT(timer_class, timer_cancel, TP_ARGS(timer) ); +TRACE_EVENT(timer_base_idle, + + TP_PROTO(bool is_idle, unsigned int cpu), + + TP_ARGS(is_idle, cpu), + + TP_STRUCT__entry( + __field( bool, is_idle ) + __field( unsigned int, cpu ) + ), + + TP_fast_assign( + __entry->is_idle = is_idle; + __entry->cpu = cpu; + ), + + TP_printk("is_idle=%d cpu=%d", + __entry->is_idle, __entry->cpu) +); + #define decode_clockid(type) \ __print_symbolic(type, \ { CLOCK_REALTIME, "CLOCK_REALTIME" }, \ diff --git a/kernel/time/timer.c b/kernel/time/timer.c index a81d793a43d0..46a9b96a3976 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1964,6 +1964,7 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem) if ((expires - basem) > TICK_NSEC) base->is_idle = true; } + trace_timer_base_idle(base->is_idle, base->cpu); raw_spin_unlock(&base->lock); return cmp_next_hrtimer_event(basem, expires); @@ -1985,6 +1986,7 @@ void timer_clear_idle(void) * the lock in the exit from idle path. */ base->is_idle = false; + trace_timer_base_idle(0, smp_processor_id()); } #endif