From: Philippe Gerum <rpm@xenomai.org>
To: "Rosenow, James" <jim.rosenow@mts.com>
Cc: "xenomai@lists.linux.dev" <xenomai@lists.linux.dev>
Subject: Re: Relax tracing not working for me
Date: Wed, 08 Jan 2025 10:36:00 +0100 [thread overview]
Message-ID: <87r05dve9r.fsf@xenomai.org> (raw)
In-Reply-To: <MN2PR04MB6255403DD160D9EDA3319AA5E2112@MN2PR04MB6255.namprd04.prod.outlook.com> (James Rosenow's message of "Tue, 7 Jan 2025 22:51:10 +0000")
"Rosenow, James" <jim.rosenow@mts.com> writes:
> I am using Xenomai v3.2.1 on 5.15.57-dovetail and I have selected the following kernel configuration option.
>
> .config - Linux/x86 5.15.57 Kernel Configuration
> Xenomai/cobalt > Debug support
> [*] Trace relax requests
>
> When I run my application, I am getting MSW's on one of my real-time tasks, i.e. seqTask-00 (below).
>
> Every 10.0s: cat /proc/xenomai/sched/stat test: Tue Jan 7 16:32:14 2025
> CPU PID MSW CSW XSC PF STAT %CPU NAME
> 0 0 0 3526511 0 0 00018000 99.8 [ROOT/0]
> 1 0 0 22166547 0 0 00018000 98.7 [ROOT/1]
> 2 0 0 6 0 0 00018000 100.0 [ROOT/2]
> 3 0 0 0 0 0 00018000 100.0 [ROOT/3]
> 4 0 0 12 0 0 00018000 100.0 [ROOT/4]
> 5 0 0 0 0 0 00018000 100.0 [ROOT/5]
> 0 311 0 2 0 0 00000042 0.0 [rtnet-stack]
> 0 312 0 2 0 0 00020042 0.0 [rtnet-rtpc]
> 0 34201 8 8 54 0 000480c0 0.0 coops_target_main
> 0 34203 714420 714421 1429756 0 000480c0 0.2 userCycle
> 1 34204 2 2 571184 0 000480c0 0.0 clockInterrupt
> 1 34205 1 571183 1356559 0 00048042 0.4 dispatch
> 1 34206 571182 1142364 713982 0 00048042 0.5 seqTask-00
> 1 34207 1 285594 356993 0 00048042 0.3 seqTask-01
> 1 34208 1 142798 180963 0 00048042 0.1 seqTask-02
> 1 34209 1 2 3 0 00048042 0.0 seqTask-03
> 1 34210 1 2 3 0 00048042 0.0 seqTask-04
>
> This is an iterative task that is executing at 2000Hz, I get 1 additional MSW for each run iteration. As you can see there are many MSW's. Shouldn't the trace buffer be full of these relaxations? If I cat the buffer, I see nothing.
>
> test@test:~$ cat /proc/xenomai/debug/relax
> test@test:~$
>
> What am I doing wrong?
>
In short, you may want to make sure that PTHREAD_WARNSW is set for
'seqTask-00'. The STAT field for that task reveals that it's not (0x4000
is clear there).
Why? Because the logic of MSW tracing is as follows when
CONFIG_XENO_OPT_DEBUG_TRACE_RELAX is set:
1. On MSW detected by the core for the current thread _and only if_
PTHREAD_WARNSW is set for such thread (which is running a syscall), the
latter is immediately sent SIGWINCH(aka SIGSHADOW), with
info=SIGSHADOW_ACTION_BACKTRACE (xnthread_relax ->
xndebug_notify_relax).
2. The pre-defined SIGSHADOW handler in libcobalt.so (see
lib/cobalt/sigshadow.c) runs, taking a snapshot of the current stack
backtrace, then sends it to the core via Cobalt's 'backtrace' system
call. Since we are not using alternate stacks, the code which caused the
MSW must appear somewhere in the lower frames below the current signal
frame. This location is figured out by the slackspot utility when
analyzing the captured frames.
3. The core receives the backtrace data, then logs it into the
appropriate trace buffer which is behind /proc/xenomai/debug/relax
(backtrace -> xndebug_trace_relax, cobalt/posix/syscall.c).
HTH,
--
Philippe.
next prev parent reply other threads:[~2025-01-08 9:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 22:51 Relax tracing not working for me Rosenow, James
2025-01-08 5:26 ` Chen, Hongzhan
2025-01-08 5:53 ` Chen, Hongzhan
2025-01-08 9:36 ` Philippe Gerum [this message]
2025-01-09 19:48 ` Relax tracing not working for me (solved) Rosenow, James
2025-01-11 18:07 ` 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=87r05dve9r.fsf@xenomai.org \
--to=rpm@xenomai.org \
--cc=jim.rosenow@mts.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.