From nobody Tue Apr 7 13:46:41 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 B78FD38E5F7 for ; Wed, 25 Feb 2026 09:52:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772013165; cv=none; b=r1aTv+YjLnhRwVS2W5pHJyemtXPlO40xHpPL2yN4BacJtmiY7d6DCaG+GXNogzzNtG+xq9rDKzzkgzmrBKEQg9VsUMwU5wxartfdmrKrTzMe5sT3vacRBxIJw3egX+iIUIdhGuxssi5zataDvsMoRQsIbXiO7vinps8nsF+gTNk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772013165; c=relaxed/simple; bh=AEBfxdTriy20MJnz8r0xIadoTC2x6K1Gb7ua1iTMxfY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X3zQknf48i4iPcaaeabKGzjokYEcf7wV0ed3DnCSZ9CnZDSkOWyngYMGVQ+m3veJup+IFh5YB4RZhYeOCqN+9o2nnsJWoaNZq7EMaEtncFsUv3Xc8Xej3cWYqqrDhSeK2DMr74zzNELeSK7gCqRiIGv20pP5R6yKjGtR9CbZ9hA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=TDhYmsOL; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TDhYmsOL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772013162; 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=ITObmCO7WU0L25e6SiafZwuNp2N+z1xPs34HwvxwJS4=; b=TDhYmsOLXd+Nl4BBxzH35mbbSc1ghOHrX2xKytH6bM76TbJIIWuJPuTxkjiECqjsvQ/OP4 KGBTA/0d+yjeSEkFcsPmt0q0QL9QKAnLoFUdbbz1d4uScpmp2gk31LbuXsd0d/5NF5xfKw SIFKh9D74lE+NaOQoR6wvu50echr91I= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-365-wCzPTpOqMQOwPXtU-NLyzA-1; Wed, 25 Feb 2026 04:52:38 -0500 X-MC-Unique: wCzPTpOqMQOwPXtU-NLyzA-1 X-Mimecast-MFC-AGG-ID: wCzPTpOqMQOwPXtU-NLyzA_1772013157 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2FAFC180A9A4; Wed, 25 Feb 2026 09:52:37 +0000 (UTC) Received: from gmonaco-thinkpadt14gen3.rmtit.csb (unknown [10.44.34.216]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 26C3F180067A; Wed, 25 Feb 2026 09:52:31 +0000 (UTC) From: Gabriele Monaco To: linux-kernel@vger.kernel.org, Steven Rostedt , Nam Cao , Juri Lelli , Masami Hiramatsu , Ingo Molnar , Peter Zijlstra , linux-trace-kernel@vger.kernel.org Cc: Gabriele Monaco , Phil Auld , Tomas Glozar , Clark Williams , John Kacur Subject: [PATCH v6 12/16] sched: Add deadline tracepoints Date: Wed, 25 Feb 2026 10:51:18 +0100 Message-ID: <20260225095122.80683-13-gmonaco@redhat.com> In-Reply-To: <20260225095122.80683-1-gmonaco@redhat.com> References: <20260225095122.80683-1-gmonaco@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Content-Type: text/plain; charset="utf-8" Add the following tracepoints: * sched_dl_throttle(dl_se, cpu, type): Called when a deadline entity is throttled * sched_dl_replenish(dl_se, cpu, type): Called when a deadline entity's runtime is replenished * sched_dl_update(dl_se, cpu, type): Called when a deadline entity updates without throttle or replenish * sched_dl_server_start(dl_se, cpu, type): Called when a deadline server is started * sched_dl_server_stop(dl_se, cpu, type): Called when a deadline server is stopped Those tracepoints can be useful to validate the deadline scheduler with RV and are not exported to tracefs. Reviewed-by: Phil Auld Signed-off-by: Gabriele Monaco --- Notes: V6: * Add dl_se type to differentiate between fair and ext servers * Add event to track dl_update_curr not firing other events V3: * Rename dl argument to dl_se in tracepoints include/trace/events/sched.h | 26 ++++++++++++++++++++++++++ kernel/sched/core.c | 4 ++++ kernel/sched/deadline.c | 25 ++++++++++++++++++++++++- 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 5844147ec5fd..944d65750a64 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -904,6 +904,32 @@ DECLARE_TRACE(sched_dequeue, TP_PROTO(struct task_struct *tsk, int cpu), TP_ARGS(tsk, cpu)); =20 +#define DL_OTHER 0 +#define DL_TASK 1 +#define DL_SERVER_FAIR 2 +#define DL_SERVER_EXT 3 + +DECLARE_TRACE(sched_dl_throttle, + TP_PROTO(struct sched_dl_entity *dl_se, int cpu, uint8_t type), + TP_ARGS(dl_se, cpu, type)); + +DECLARE_TRACE(sched_dl_replenish, + TP_PROTO(struct sched_dl_entity *dl_se, int cpu, uint8_t type), + TP_ARGS(dl_se, cpu, type)); + +/* Call to update_curr_dl_se not involving throttle or replenish */ +DECLARE_TRACE(sched_dl_update, + TP_PROTO(struct sched_dl_entity *dl_se, int cpu, uint8_t type), + TP_ARGS(dl_se, cpu, type)); + +DECLARE_TRACE(sched_dl_server_start, + TP_PROTO(struct sched_dl_entity *dl_se, int cpu, uint8_t type), + TP_ARGS(dl_se, cpu, type)); + +DECLARE_TRACE(sched_dl_server_stop, + TP_PROTO(struct sched_dl_entity *dl_se, int cpu, uint8_t type), + TP_ARGS(dl_se, cpu, type)); + #endif /* _TRACE_SCHED_H */ =20 /* This part must be outside protection */ diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 4ca79ff58fca..b5bb2eb112bf 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -124,6 +124,10 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(sched_exit_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_set_need_resched_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_enqueue_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_dequeue_tp); +EXPORT_TRACEPOINT_SYMBOL_GPL(sched_dl_throttle_tp); +EXPORT_TRACEPOINT_SYMBOL_GPL(sched_dl_replenish_tp); +EXPORT_TRACEPOINT_SYMBOL_GPL(sched_dl_server_start_tp); +EXPORT_TRACEPOINT_SYMBOL_GPL(sched_dl_server_stop_tp); =20 DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); DEFINE_PER_CPU(struct rnd_state, sched_rnd_state); diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index d08b00429323..b8d01f0eda7d 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -115,6 +115,20 @@ static inline bool is_dl_boosted(struct sched_dl_entit= y *dl_se) } #endif /* !CONFIG_RT_MUTEXES */ =20 +static inline uint8_t dl_get_type(struct sched_dl_entity *dl_se, + struct rq *rq) +{ + if (!dl_server(dl_se)) + return DL_TASK; + if (dl_se =3D=3D &rq->fair_server) + return DL_SERVER_FAIR; +#ifdef CONFIG_SCHED_CLASS_EXT + if (dl_se =3D=3D &rq->ext_server) + return DL_SERVER_EXT; +#endif + return DL_OTHER; +} + static inline struct dl_bw *dl_bw_of(int i) { RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held(), @@ -733,6 +747,7 @@ static inline void replenish_dl_new_period(struct sched= _dl_entity *dl_se, dl_se->dl_throttled =3D 1; dl_se->dl_defer_armed =3D 1; } + trace_sched_dl_replenish_tp(dl_se, cpu_of(rq), dl_get_type(dl_se, rq)); } =20 /* @@ -848,6 +863,8 @@ static void replenish_dl_entity(struct sched_dl_entity = *dl_se) if (dl_se->dl_throttled) dl_se->dl_throttled =3D 0; =20 + trace_sched_dl_replenish_tp(dl_se, cpu_of(rq), dl_get_type(dl_se, rq)); + /* * If this is the replenishment of a deferred reservation, * clear the flag and return. @@ -1345,6 +1362,7 @@ static inline void dl_check_constrained_dl(struct sch= ed_dl_entity *dl_se) dl_time_before(rq_clock(rq), dl_next_period(dl_se))) { if (unlikely(is_dl_boosted(dl_se) || !start_dl_timer(dl_se))) return; + trace_sched_dl_throttle_tp(dl_se, cpu_of(rq), dl_get_type(dl_se, rq)); dl_se->dl_throttled =3D 1; if (dl_se->runtime > 0) dl_se->runtime =3D 0; @@ -1508,6 +1526,7 @@ static void update_curr_dl_se(struct rq *rq, struct s= ched_dl_entity *dl_se, s64 =20 throttle: if (dl_runtime_exceeded(dl_se) || dl_se->dl_yielded) { + trace_sched_dl_throttle_tp(dl_se, cpu_of(rq), dl_get_type(dl_se, rq)); dl_se->dl_throttled =3D 1; =20 /* If requested, inform the user about runtime overruns. */ @@ -1532,7 +1551,8 @@ static void update_curr_dl_se(struct rq *rq, struct s= ched_dl_entity *dl_se, s64 =20 if (!is_leftmost(dl_se, &rq->dl)) resched_curr(rq); - } + } else + trace_sched_dl_update_tp(dl_se, cpu_of(rq), dl_get_type(dl_se, rq)); =20 /* * The dl_server does not account for real-time workload because it @@ -1810,6 +1830,7 @@ void dl_server_start(struct sched_dl_entity *dl_se) if (WARN_ON_ONCE(!cpu_online(cpu_of(rq)))) return; =20 + trace_sched_dl_server_start_tp(dl_se, cpu_of(rq), dl_get_type(dl_se, rq)); dl_se->dl_server_active =3D 1; enqueue_dl_entity(dl_se, ENQUEUE_WAKEUP); if (!dl_task(dl_se->rq->curr) || dl_entity_preempt(dl_se, &rq->curr->dl)) @@ -1821,6 +1842,8 @@ void dl_server_stop(struct sched_dl_entity *dl_se) if (!dl_server(dl_se) || !dl_server_active(dl_se)) return; =20 + trace_sched_dl_server_stop_tp(dl_se, cpu_of(dl_se->rq), + dl_get_type(dl_se, dl_se->rq)); dequeue_dl_entity(dl_se, DEQUEUE_SLEEP); hrtimer_try_to_cancel(&dl_se->dl_timer); dl_se->dl_defer_armed =3D 0; --=20 2.53.0