Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp34589rdb; Wed, 20 Dec 2023 05:44:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiPAhzlinzvoR5mGVOz8+s9ELLOu8I93njwlURnszUX0agKnt5ektGgEGDCbKDKU+bbwIa X-Received: by 2002:a05:6e02:1e0c:b0:35f:535a:9c65 with SMTP id g12-20020a056e021e0c00b0035f535a9c65mr26946940ila.29.1703079846696; Wed, 20 Dec 2023 05:44:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703079846; cv=none; d=google.com; s=arc-20160816; b=BTQI3ZNNqo+WaG5ZLJGTX/8rjDSm1hcN8hiP+c42Dl9U/uSAemiE/nlBxHn0KmcjMx IkdaOB91wrLHSFBKaw0FEOs7R+ND+T4xdkRCSWghke/WonCR4DMuFVp/lzNI45eRUkLb ujKfaCElBFHdXzUO0hiNTpfnhQqePwb2aiESzCTwmv7i0jYhez8UuqiGzxHelqX2aOdk GP+MRGEOgtq+UDj2g1uwlU624s39QXUU+PzKMwdBztp2KKioMQc/D6n0w5U9h9TeN3TN 3V+/Ggy+9M4qTutXpVti41VzH3dqVkGRADUGE2EoeNWRt8R8qQfa1/22eXMtVihs1Xzg aBKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XD2bX+qpt3QdLpkQ+O8PMmr/7Hoqafj7AzJKJ8KAklA=; fh=rlwn4pxNjzZxzAe0OFpEm5XldgGOhioyoE/W5GSrSmE=; b=pQizKcUXmGFkA9v1Z28+KtYWZINarMuGel0zHr59jtx1rBCFjnfjPj2zy/pBvqqauS 2vtxvoFURrnKzqiE+obz5nHBSAhKn1yRzxuMtURybOefqX/r29kBr19Up9QH48Sf8m8F Xzhkm97TwQZy5W0B8hCmoG0VMu7OL8RWO5tseNMwlagwHBaFo5dtPfOCUBAfg0B5X7M2 QzONk9+NhN72cH2pZ+r1+mbH46pFQj/Nmo+g+e3nxJu0+WfMqHIOYfek+aNjCdxAyBhc HXUO7YyNg/RmxyQghtepmj7J3pu9N3jmQjlobEtTPelXM7wcGbL13DLv8TL6UTIKf982 7PWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GYTxO7tC; spf=pass (google.com: domain of linux-kernel+bounces-6980-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6980-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c3-20020a633503000000b005cd919bdadbsi5962560pga.666.2023.12.20.05.44.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 05:44:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6980-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GYTxO7tC; spf=pass (google.com: domain of linux-kernel+bounces-6980-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6980-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B7EF6B2181C for ; Wed, 20 Dec 2023 13:44:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5704838DE1; Wed, 20 Dec 2023 13:43:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GYTxO7tC" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8904B38DD4 for ; Wed, 20 Dec 2023 13:43:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53AEEC433C7; Wed, 20 Dec 2023 13:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703079834; bh=QMljrOv897FmsVWy5N1Xz1hinrz7EiFYEPnIJAs7QUk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GYTxO7tCPod+y4rqctr2YHQpxphABVWY/4y3FiRw1JNEEv9Dan5eWkIViHB2JPSaG Dacl3Sbn3Q4HjTXCmizka1qqIj/bkNLFWROf49sEF/uEPpHC21Z34tehaxEPdSIVdB rwH4WthiRs3UBfVvqnRM/d0yTHuWZanyIWsZXeb/fdGFGZrusA1L4ukUnzUoXXm/0e EvZQj/pXAJ1+EH1V/qfhSfvDR+LmCsQN9sSNuvAe0eWzoE/cmIEyiHkoYU+gUhSlfJ oHxoX62pQIgCBmdaZSuI2QHWewuRVS6Gli+AWVXu6gqIfdlHGd4YKRVn6izE81kRm5 xAaEboEdJlS9w== Date: Wed, 20 Dec 2023 14:43:51 +0100 From: Frederic Weisbecker To: Anna-Maria Behnsen Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Rik van Riel , Steven Rostedt , Sebastian Siewior , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Srinivas Pandruvada , K Prateek Nayak Subject: Re: [PATCH v9 05/32] tracing/timers: Add tracepoint for tracking timer base is_idle flag Message-ID: References: <20231201092654.34614-1-anna-maria@linutronix.de> <20231201092654.34614-6-anna-maria@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231201092654.34614-6-anna-maria@linutronix.de> 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 Reviewed-by: Frederic Weisbecker 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 >