From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Tobias Schaffner <tobias.schaffner@siemens.com>,
xenomai@lists.linux.dev
Subject: Re: [RFC PATCH dovetail 2/7] dovetail: trace stage switches
Date: Thu, 19 Nov 2026 20:07:29 +0100 [thread overview]
Message-ID: <87bj7kod1q.fsf@xenomai.org> (raw)
In-Reply-To: <4c0e980d-32d8-4b2a-b369-ecfb6f190f9e@siemens.com> (Jan Kiszka's message of "Wed, 11 Nov 2026 08:40:14 +0100")
Jan Kiszka <jan.kiszka@siemens.com> writes:
> On 10.11.26 19:08, Tobias Schaffner wrote:
>> Add tracepoints for a task leaving the in-band and the out-of-band stage,
>> for use by the Dovetail RV monitors.
>>
>> Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
>> ---
>> include/linux/dovetail.h | 9 +++++++++
>> include/trace/events/dovetail.h | 23 +++++++++++++++++++++++
>> kernel/dovetail.c | 13 +++++++++++++
>> kernel/sched/core.c | 2 ++
>> 4 files changed, 47 insertions(+)
>> create mode 100644 include/trace/events/dovetail.h
>>
>> diff --git a/include/linux/dovetail.h b/include/linux/dovetail.h
>> index b41ea0f8fc4e..5ab07e69152a 100644
>> --- a/include/linux/dovetail.h
>> +++ b/include/linux/dovetail.h
>> @@ -18,6 +18,7 @@ struct files_struct;
>> #include <linux/mm.h>
>> #include <linux/thread_info.h>
>> #include <linux/irqstage.h>
>> +#include <linux/tracepoint-defs.h>
>> #include <uapi/asm-generic/dovetail.h>
>> #include <asm/dovetail.h>
>>
>> @@ -163,8 +164,16 @@ void dovetail_stop_altsched(void);
>>
>> __must_check int dovetail_leave_inband(void);
>>
>> +DECLARE_TRACEPOINT(dovetail_leave_inband_tp);
>> +void __trace_dovetail_leave_inband(struct task_struct *p);
>> +
>> +DECLARE_TRACEPOINT(dovetail_leave_oob_tp);
>> +void __trace_dovetail_leave_oob(void);
>> +
>> static inline void dovetail_leave_oob(void)
>> {
>> + if (tracepoint_enabled(dovetail_leave_oob_tp))
>> + __trace_dovetail_leave_oob();
>> clear_thread_local_flags(_TLF_OOB|_TLF_OFFSTAGE);
>> clear_thread_flag(TIF_MAYDAY);
>> }
>> diff --git a/include/trace/events/dovetail.h b/include/trace/events/dovetail.h
>> new file mode 100644
>> index 000000000000..785a653252d3
>> --- /dev/null
>> +++ b/include/trace/events/dovetail.h
>> @@ -0,0 +1,23 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#undef TRACE_SYSTEM
>> +#define TRACE_SYSTEM dovetail
>> +
>> +#if !defined(_TRACE_DOVETAIL_H) || defined(TRACE_HEADER_MULTI_READ)
>> +#define _TRACE_DOVETAIL_H
>> +
>> +#include <linux/tracepoint.h>
>> +
>> +struct task_struct;
>> +
>> +DECLARE_TRACE(dovetail_leave_inband,
>> + TP_PROTO(struct task_struct *p),
>> + TP_ARGS(p));
>> +
>> +DECLARE_TRACE(dovetail_leave_oob,
>> + TP_PROTO(struct task_struct *p),
>> + TP_ARGS(p));
>> +
>> +#endif /* _TRACE_DOVETAIL_H */
>> +
>> +/* This part must be outside protection */
>> +#include <trace/define_trace.h>
>> diff --git a/kernel/dovetail.c b/kernel/dovetail.c
>> index da4016697b67..98892f0a63da 100644
>> --- a/kernel/dovetail.c
>> +++ b/kernel/dovetail.c
>> @@ -12,6 +12,19 @@
>> #include <asm/syscall.h>
>> #include <uapi/asm-generic/dovetail.h>
>>
>> +#define CREATE_TRACE_POINTS
>> +#include <trace/events/dovetail.h>
>> +
>> +void __trace_dovetail_leave_inband(struct task_struct *p)
>> +{
>> + trace_dovetail_leave_inband_tp(p);
>> +}
>> +
>> +void __trace_dovetail_leave_oob(void)
>> +{
>> + trace_dovetail_leave_oob_tp(current);
>> +}
>> +
>> static bool dovetail_enabled;
>>
>> void __weak arch_inband_task_init(struct task_struct *p)
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index 3ec77a682c4a..b2ad0ab0626c 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -10689,6 +10689,8 @@ int dovetail_leave_inband(void)
>> */
>> if (likely(__schedule(SM_NONE))) {
>> arch_dovetail_switch_finish(false);
>> + if (tracepoint_enabled(dovetail_leave_inband_tp))
>> + __trace_dovetail_leave_inband(p);
>
> Why does trace point have to be conditional? Rather unusual.
>
I guess that the upside of having a static key to fully skip the
tracepoint prep dynamically may be wanted here. Granted,
dovetail_leave_inband() should not be on the hot path, but we are
nevertheless on the switch tail path to oob.
--
Philippe.
next prev parent reply other threads:[~2026-11-19 19:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 18:08 [RFC PATCH dovetail 0/7] rv: runtime verification monitors for Dovetail Tobias Schaffner
2026-11-10 18:08 ` [RFC PATCH dovetail 1/7] dovetail: factor out the mayday check on return to user mode Tobias Schaffner
2026-11-10 18:08 ` [RFC PATCH dovetail 2/7] dovetail: trace stage switches Tobias Schaffner
2026-11-11 7:40 ` Jan Kiszka
2026-11-19 19:07 ` Philippe Gerum [this message]
2026-11-10 18:08 ` [RFC PATCH dovetail 3/7] rv: add dovetail container and offstage monitor Tobias Schaffner
2026-11-10 18:08 ` [RFC PATCH dovetail 4/7] dovetail: trace out-of-band trap notifications Tobias Schaffner
2026-11-10 18:08 ` [RFC PATCH dovetail 5/7] rv: add oob_trap monitor Tobias Schaffner
2026-11-10 18:08 ` [RFC PATCH dovetail 6/7] dovetail: trace signal notifications and out-of-band returns Tobias Schaffner
2026-11-10 18:08 ` [RFC PATCH dovetail 7/7] rv: add oob_signal monitor Tobias Schaffner
2026-11-19 19:14 ` [RFC PATCH dovetail 0/7] rv: runtime verification monitors for Dovetail Philippe Gerum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bj7kod1q.fsf@xenomai.org \
--to=rpm@xenomai.org \
--cc=jan.kiszka@siemens.com \
--cc=tobias.schaffner@siemens.com \
--cc=xenomai@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.