Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp904489rdb; Fri, 1 Dec 2023 01:28:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHA+3QFzrikAPSnTmjO6/S95TMaq94HNDpzpvKyfKwbzqwGysGVxbgere0QG6gpMOTYbEwC X-Received: by 2002:a05:6808:302a:b0:3b5:66c2:5ffb with SMTP id ay42-20020a056808302a00b003b566c25ffbmr2547880oib.33.1701422883018; Fri, 01 Dec 2023 01:28:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701422882; cv=none; d=google.com; s=arc-20160816; b=MWvvuUYybhp0h4c/fzLfnjH1xCvNINN6JFs48jK/hnns6TXDFRd7HXGTXmkoyk11DA gpTFpVqx95Mq1Qq/cpLQiaOroxTShY4YsekH0iejCIfiJbTcGkOlah3OXv067NKi3PuL AaDdN/s+ZqYynryLHFtzpQqDkdHjsM53X+lhMPjZTC5sikWORIJRnjX7RuoLXyyIIYW7 c2cNIaL2l7I16ygB8qmU23+b1r/1oCZiV+XUnoyJIoMXf1F4bScTy5u+3kpipItLgPCF GX5pPx6T/lzjThFnVcE1o7TLcUUutAiKX+Fhduwk7bVGuBe8I7oZT6ustPPKcW9UNI+5 1APg== 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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z3-20020a056a00240300b006bceac424f7si3041078pfh.102.2023.12.01.01.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:28:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; 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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 A063B80BD4E0; Fri, 1 Dec 2023 01:27:55 -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 + 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 ); 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 ; Fri, 1 Dec 2023 01:27:10 -0800 (PST) From: Anna-Maria Behnsen 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 , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Frederic Weisbecker , Rik van Riel , Steven Rostedt , Sebastian Siewior , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Srinivas Pandruvada , K Prateek Nayak , Anna-Maria Behnsen 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: 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:55 -0800 (PST) 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 --- 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); 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 -- 2.39.2