All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: ronny meeus <ronny.meeus@domain.hid>
Cc: Xenomai-help@domain.hid
Subject: Re: [Xenomai-help] Debug/trace tools for xenomai applications.
Date: Mon, 15 Nov 2010 10:30:22 +0100	[thread overview]
Message-ID: <1289813422.1933.79.camel@domain.hid> (raw)
In-Reply-To: <AANLkTinuEh+5J4Osq895PN92VXNc1OgNF8HD526f--dA@mail.gmail.com>

On Sun, 2010-11-14 at 01:24 +0100, ronny meeus wrote:
> Hello
> 
> I'm currently fighting with a problem in the pSOS+ skin.
> This my system information:
> 
> [    2.314676] pci 0000:00:01.0: Activating ISA DMA hang workarounds
> [    2.416025] I-pipe: Domain Xenomai registered.
> [    2.418183] Xenomai: hal/i386 started.
> [    2.422780] Xenomai: scheduling class idle registered.
> [    2.424116] Xenomai: scheduling class rt registered.
> [    2.566737] Xenomai: real-time nucleus v2.5.4 (Sleep Walk) loaded.
> [    2.590628] Xenomai: starting native API services.
> [    2.604491] Xenomai: starting pSOS+ services.
> [    2.619941] HugeTLB registered 4 MB page size, pre-allocated 0
> pages
> 
> This is a piece of testcode I have created:
> 
>         check("tm_evevery",tm_evevery(4,3,&tmr_id),0);
>         check("tm_cancel",tm_cancel(tmr_id),0);
>         ev_rcvd = 0;
>         ret = ev_receive(4,EV_ANY|EV_WAIT,10,&ev_rcvd);
>         check("ev_receive",ret,ERR_TIMEOUT);
> 
> I just start a periodic timer that expires every 3 ticks and at expiry
> sends event 4 to my task.

You test rather arms a timer for sending event_list=0x3 each 4 ticks.

> I want to check the cancel of the timer, so I cancel it and I would
> expect not to receive any event.
> 
> What I observe is that this code is not working: I immediately receive
> the event after starting the timer.

Please try this test code as well:

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <psos+/psos.h>

void foo (u_long a0, u_long a1, u_long a2, u_long a3)
{
	u_long ret, ev = 0, tmid;

	printf("Started... (%lu, %lu, %lu, %lu)\n", a0, a1, a2, a3);
	ret = tm_evevery(4, 3, &tmid);
	printf("tm_evevery(4, 3, &tmid) => %lu\n", ret);

	ret = tm_cancel(tmid);
	printf("tm_cancel(&tmid) => %lu\n", ret);

	ret = ev_receive(4, EV_ANY|EV_WAIT, 10, &ev);
	printf("ev_receive(4, EV_ANY|EV_WAIT, 10, &ev) => %lu, ev=0x%lx\n", ret, ev);
}

int main (int ac, char **av)
{
	u_long ret, tid = 0, args[4];
	
	mlockall(MCL_CURRENT | MCL_FUTURE);

	ret = t_create("TEST", 1, 0, 0, 0, &tid);
	printf("t_create(tid=%lu) = %lu\n", tid, ret);
	args[0] = 1;
	args[1] = 2;
	args[2] = 3;
	args[3] = 4;
	ret = t_start(tid, 0, foo, args);
	printf("t_start(tid=%lu) = %lu\n", tid, ret);

	return 0;
}

> If I change the code like shown below (I added the ev_receive with the
> NO_WAIT option after starting the timer), the code works fine.
> 
>         check("tm_evevery",tm_evevery(4,3,&tmr_id),0);
>         ret = ev_receive(4,EV_ANY|EV_NOWAIT,0,&ev_rcvd);

Do you receive ERR_NOEVS as expected here?

>         check("tm_cancel",tm_cancel(tmr_id),0);
>         ev_rcvd = 0;
>         ret = ev_receive(4,EV_ANY|EV_WAIT,10,&ev_rcvd);
>         check("ev_receive",ret,ERR_TIMEOUT);
> 


> Now my question is: how do I investigate an issue like this? In other
> words, which are the best tools since this code involves both user and
> kernel space debugging.
> Are there some trace tools available that are able to generate a kind
> of sequence / trace of what is happing over time.
> 
> I also have other issues that are not consistently reproducible. For
> this kind of problems trace tools would also be useful.
> 

If you want to validate the pSOS emulation core, the best tool is the
simulator. Unfortunately, this tools still requires to be built with an
antiquated C++ toolchain, so the only sane way to enable it nowadays is
via qemu. You would need ~2 hours to set this up.

If you want to try this, I can help. Otherwise, other suggestions you
already got on this list will do.

> Thanks
> Ronny
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help

-- 
Philippe.




  reply	other threads:[~2010-11-15  9:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-14  0:24 [Xenomai-help] Debug/trace tools for xenomai applications ronny meeus
2010-11-15  9:30 ` Philippe Gerum [this message]
2010-11-15 13:10   ` Gilles Chanteperdrix
2010-11-15 15:07     ` Philippe Gerum
2010-11-15 20:26       ` ronny meeus
2010-11-15 20:56         ` Philippe Gerum
2010-11-17 13:49   ` ronny meeus
2010-11-17 14:01     ` Philippe Gerum
2010-11-17 15:00       ` ronny meeus
  -- strict thread matches above, loose matches on Subject: below --
2010-11-14 11:27 Andreas Glatz
2010-11-14 15:36 ` Gilles Chanteperdrix
     [not found] <mailman.45.1289905237.25153.xenomai@xenomai.org>
2010-11-16 11:46 ` Andreas Glatz
2010-11-17  8:43   ` Philippe Gerum
2010-11-17  9:42     ` Jan Kiszka

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=1289813422.1933.79.camel@domain.hid \
    --to=rpm@xenomai.org \
    --cc=Xenomai-help@domain.hid \
    --cc=ronny.meeus@domain.hid \
    /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.