All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: YinJie LI <liyinjie0418@gmail.com>
Cc: xenomai@lists.linux.dev
Subject: Re: Assistance Needed with EVL4 Monitoring Data Not Updating
Date: Sat, 22 Jun 2024 12:25:19 +0200	[thread overview]
Message-ID: <87frt5e005.fsf@xenomai.org> (raw)
In-Reply-To: <8AE92F55-6328-43C0-9548-952CBCF19929@gmail.com>


YinJie LI <liyinjie0418@gmail.com> writes:

> Hi,all
>
> I recently started working with EVL and wrote a simple piece of code to understand its behavior.
> However, I’ve encountered an issue where the monitoring data does not update as expected, 
> while latmus tests show changes.
>
> Here’s the code snippet:
>
> #include <sys/types.h>
> #include <unistd.h>
> #include <error.h>
> #include <sched.h>
> #include <pthread.h>
> #include <evl/sched.h>
> #include <evl/evl.h>
> #include <evl/thread.h>
>
> int main(int argc, char *const argv[]) {
> 	struct sched_param param;
> 	int ret, tfd;
>
> 	ret = evl_init();
> 	if (ret)
> 		error(1, -ret, "cannot initialize EVL”);
>
> 	param.sched_priority = 8;
> 	ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, &param);
>
> 	tfd = evl_attach_thread(EVL_CLONE_PUBLIC, "evl-example-%d", getpid());
> 	if (tfd < 0)
> 		error(1, -tfd, "evl_attach_self() failed”);
>
> 	for (;;) {
> 		struct evl_version ver_t = evl_get_version();
> 		printf("Hello, EVL! %s \n", ver_t.version_string);

evl_printf(...)

> 		usleep(50);

evl_usleep(50)


> 	}
>
> 	return 0;
> }
>
> The monitoring command (evl ps -tsp) shows the following, which does not change over time:
>
> Every 1.0s: evl ps -tsp                                                                       
>
> CPU   PID   SCHED   PRIO  ISW     CTXSW     SYS       RWA       STAT     TIMEOUT      %CPU      CPUTIME       NAME
>   3       96822  fifo          8       1           1                1             0             X              -                   0.0        0:000.009        evl-example-96822
>
> The relevant versions used are as follows:
> libevl:r46
> Linux-evl: v6.6.23-evl2
> Gcc : 8.4
> Linux : x64 intel
>
> Could anyone help me understand why the monitoring data isn’t updating or suggest what I might be missing?
>
> Thanks in advance for your assistance!

This code loop never runs real-time evl-wise, because it's using plain
so-called "in-band" calls from the regular kernel logic, not evl
services. The first call to printf() downgrades the thread execution
mode to in-band, leaving it there indefinitely since there is no evl
call causing a switch back to out-of-band scheduling. As a result, this
thread does not perform any evl context switch as reported by 'evl ps'
in the CTXSW column, consumes no time in real-time mode and so on.

You may want to read this:
https://v4.xenomai.org/core/user-api/thread/
https://v4.xenomai.org/dovetail/altsched/

-- 
Philippe.

      reply	other threads:[~2024-06-22 10:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-22  5:48 Assistance Needed with EVL4 Monitoring Data Not Updating YinJie LI
2024-06-22 10:25 ` Philippe Gerum [this message]

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=87frt5e005.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=liyinjie0418@gmail.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.