All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] Context switch to secondary mode in xenomai tasks
@ 2018-04-06 16:51 C Smith
  2018-04-06 16:54 ` Greg Gallagher
  2018-04-07  7:57 ` Philippe Gerum
  0 siblings, 2 replies; 9+ messages in thread
From: C Smith @ 2018-04-06 16:51 UTC (permalink / raw)
  To: xenomai

Hi all--

Our real time application has a main rt_task which runs concurrently with
several other rt_tasks (spawned using rt_task_create) and we are concerned
about a context switch in one of the tasks. The problematic task uses
libxml2 to parse an xml document sent over ethernet which seems to cause a
switch to secondary mode. Would this also switch the other tasks we are
running to secondary mode, or is it isolated?

We are running Xenomai 2.6.2 and Xenomai 2.6.5 in our application.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] Context switch to secondary mode in xenomai tasks
  2018-04-06 16:51 [Xenomai] Context switch to secondary mode in xenomai tasks C Smith
@ 2018-04-06 16:54 ` Greg Gallagher
  2018-04-06 17:01   ` C Smith
  2018-04-07  7:57 ` Philippe Gerum
  1 sibling, 1 reply; 9+ messages in thread
From: Greg Gallagher @ 2018-04-06 16:54 UTC (permalink / raw)
  To: C Smith; +Cc: Xenomai@xenomai.org

Do the tasks communicate with each other?

-Greg

On Fri, Apr 6, 2018 at 12:51 PM, C Smith <csmithquestions@gmail.com> wrote:
> Hi all--
>
> Our real time application has a main rt_task which runs concurrently with
> several other rt_tasks (spawned using rt_task_create) and we are concerned
> about a context switch in one of the tasks. The problematic task uses
> libxml2 to parse an xml document sent over ethernet which seems to cause a
> switch to secondary mode. Would this also switch the other tasks we are
> running to secondary mode, or is it isolated?
>
> We are running Xenomai 2.6.2 and Xenomai 2.6.5 in our application.
> _______________________________________________
> Xenomai mailing list
> Xenomai@xenomai.org
> https://xenomai.org/mailman/listinfo/xenomai


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] Context switch to secondary mode in xenomai tasks
  2018-04-06 16:54 ` Greg Gallagher
@ 2018-04-06 17:01   ` C Smith
  2018-04-06 17:17     ` Greg Gallagher
  0 siblings, 1 reply; 9+ messages in thread
From: C Smith @ 2018-04-06 17:01 UTC (permalink / raw)
  To: Greg Gallagher, xenomai

The tasks manipulate shared data however they do not communicate directly.
The rt_task which parses the xml document and the main rt_task are running
periodically at different rates using rt_task_set_periodic.

On Fri, Apr 6, 2018 at 9:54 AM, Greg Gallagher <greg@embeddedgreg.com>
wrote:

> Do the tasks communicate with each other?
>
> -Greg
>
> On Fri, Apr 6, 2018 at 12:51 PM, C Smith <csmithquestions@gmail.com>
> wrote:
> > Hi all--
> >
> > Our real time application has a main rt_task which runs concurrently with
> > several other rt_tasks (spawned using rt_task_create) and we are
> concerned
> > about a context switch in one of the tasks. The problematic task uses
> > libxml2 to parse an xml document sent over ethernet which seems to cause
> a
> > switch to secondary mode. Would this also switch the other tasks we are
> > running to secondary mode, or is it isolated?
> >
> > We are running Xenomai 2.6.2 and Xenomai 2.6.5 in our application.
> > _______________________________________________
> > Xenomai mailing list
> > Xenomai@xenomai.org
> > https://xenomai.org/mailman/listinfo/xenomai
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] Context switch to secondary mode in xenomai tasks
  2018-04-06 17:01   ` C Smith
@ 2018-04-06 17:17     ` Greg Gallagher
  2018-04-06 17:39       ` C Smith
  0 siblings, 1 reply; 9+ messages in thread
From: Greg Gallagher @ 2018-04-06 17:17 UTC (permalink / raw)
  To: C Smith; +Cc: Xenomai@xenomai.org

If a tasks switches to secondary mode it would act like a normal Linux
thread. I haven't used Xenomai 2.6 in a while but if you are seeing
both tasks drop to secondary mode you may want to list the resources
that they are sharing and how you are sharing them and then we can see
if something would cause mode switches. Are you seeing both threads
drop to secondary mode?

-Greg

On Fri, Apr 6, 2018 at 1:01 PM, C Smith <csmithquestions@gmail.com> wrote:
> The tasks manipulate shared data however they do not communicate directly.
> The rt_task which parses the xml document and the main rt_task are running
> periodically at different rates using rt_task_set_periodic.
>
> On Fri, Apr 6, 2018 at 9:54 AM, Greg Gallagher <greg@embeddedgreg.com>
> wrote:
>>
>> Do the tasks communicate with each other?
>>
>> -Greg
>>
>> On Fri, Apr 6, 2018 at 12:51 PM, C Smith <csmithquestions@gmail.com>
>> wrote:
>> > Hi all--
>> >
>> > Our real time application has a main rt_task which runs concurrently
>> > with
>> > several other rt_tasks (spawned using rt_task_create) and we are
>> > concerned
>> > about a context switch in one of the tasks. The problematic task uses
>> > libxml2 to parse an xml document sent over ethernet which seems to cause
>> > a
>> > switch to secondary mode. Would this also switch the other tasks we are
>> > running to secondary mode, or is it isolated?
>> >
>> > We are running Xenomai 2.6.2 and Xenomai 2.6.5 in our application.
>> > _______________________________________________
>> > Xenomai mailing list
>> > Xenomai@xenomai.org
>> > https://xenomai.org/mailman/listinfo/xenomai
>
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] Context switch to secondary mode in xenomai tasks
  2018-04-06 17:17     ` Greg Gallagher
@ 2018-04-06 17:39       ` C Smith
  2018-04-06 17:41         ` Greg Gallagher
  0 siblings, 1 reply; 9+ messages in thread
From: C Smith @ 2018-04-06 17:39 UTC (permalink / raw)
  To: Greg Gallagher, xenomai

How can we verify which tasks are switching to secondary mode? We know the
xml parser definitely is switching to secondary mode, setting T_WARNSW,
causing the application to send the SIGXCPU signal, but we don't know if
it's affecting the other tasks.

On Fri, Apr 6, 2018 at 10:17 AM, Greg Gallagher <greg@embeddedgreg.com>
wrote:

> If a tasks switches to secondary mode it would act like a normal Linux
> thread. I haven't used Xenomai 2.6 in a while but if you are seeing
> both tasks drop to secondary mode you may want to list the resources
> that they are sharing and how you are sharing them and then we can see
> if something would cause mode switches. Are you seeing both threads
> drop to secondary mode?
>
> -Greg
>
> On Fri, Apr 6, 2018 at 1:01 PM, C Smith <csmithquestions@gmail.com> wrote:
> > The tasks manipulate shared data however they do not communicate
> directly.
> > The rt_task which parses the xml document and the main rt_task are
> running
> > periodically at different rates using rt_task_set_periodic.
> >
> > On Fri, Apr 6, 2018 at 9:54 AM, Greg Gallagher <greg@embeddedgreg.com>
> > wrote:
> >>
> >> Do the tasks communicate with each other?
> >>
> >> -Greg
> >>
> >> On Fri, Apr 6, 2018 at 12:51 PM, C Smith <csmithquestions@gmail.com>
> >> wrote:
> >> > Hi all--
> >> >
> >> > Our real time application has a main rt_task which runs concurrently
> >> > with
> >> > several other rt_tasks (spawned using rt_task_create) and we are
> >> > concerned
> >> > about a context switch in one of the tasks. The problematic task uses
> >> > libxml2 to parse an xml document sent over ethernet which seems to
> cause
> >> > a
> >> > switch to secondary mode. Would this also switch the other tasks we
> are
> >> > running to secondary mode, or is it isolated?
> >> >
> >> > We are running Xenomai 2.6.2 and Xenomai 2.6.5 in our application.
> >> > _______________________________________________
> >> > Xenomai mailing list
> >> > Xenomai@xenomai.org
> >> > https://xenomai.org/mailman/listinfo/xenomai
> >
> >
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] Context switch to secondary mode in xenomai tasks
  2018-04-06 17:39       ` C Smith
@ 2018-04-06 17:41         ` Greg Gallagher
  2018-04-06 17:43           ` Giulio Moro
  0 siblings, 1 reply; 9+ messages in thread
From: Greg Gallagher @ 2018-04-06 17:41 UTC (permalink / raw)
  To: C Smith; +Cc: Xenomai@xenomai.org

Check here:
https://xenomai.org/2014/08/porting-a-linux-application-to-xenomai-dual-kernel/#Chasing_the_unwanted_mode_switches


On Fri, Apr 6, 2018 at 1:39 PM, C Smith <csmithquestions@gmail.com> wrote:
> How can we verify which tasks are switching to secondary mode? We know the
> xml parser definitely is switching to secondary mode, setting T_WARNSW,
> causing the application to send the SIGXCPU signal, but we don't know if
> it's affecting the other tasks.
>
> On Fri, Apr 6, 2018 at 10:17 AM, Greg Gallagher <greg@embeddedgreg.com>
> wrote:
>>
>> If a tasks switches to secondary mode it would act like a normal Linux
>> thread. I haven't used Xenomai 2.6 in a while but if you are seeing
>> both tasks drop to secondary mode you may want to list the resources
>> that they are sharing and how you are sharing them and then we can see
>> if something would cause mode switches. Are you seeing both threads
>> drop to secondary mode?
>>
>> -Greg
>>
>> On Fri, Apr 6, 2018 at 1:01 PM, C Smith <csmithquestions@gmail.com> wrote:
>> > The tasks manipulate shared data however they do not communicate
>> > directly.
>> > The rt_task which parses the xml document and the main rt_task are
>> > running
>> > periodically at different rates using rt_task_set_periodic.
>> >
>> > On Fri, Apr 6, 2018 at 9:54 AM, Greg Gallagher <greg@embeddedgreg.com>
>> > wrote:
>> >>
>> >> Do the tasks communicate with each other?
>> >>
>> >> -Greg
>> >>
>> >> On Fri, Apr 6, 2018 at 12:51 PM, C Smith <csmithquestions@gmail.com>
>> >> wrote:
>> >> > Hi all--
>> >> >
>> >> > Our real time application has a main rt_task which runs concurrently
>> >> > with
>> >> > several other rt_tasks (spawned using rt_task_create) and we are
>> >> > concerned
>> >> > about a context switch in one of the tasks. The problematic task uses
>> >> > libxml2 to parse an xml document sent over ethernet which seems to
>> >> > cause
>> >> > a
>> >> > switch to secondary mode. Would this also switch the other tasks we
>> >> > are
>> >> > running to secondary mode, or is it isolated?
>> >> >
>> >> > We are running Xenomai 2.6.2 and Xenomai 2.6.5 in our application.
>> >> > _______________________________________________
>> >> > Xenomai mailing list
>> >> > Xenomai@xenomai.org
>> >> > https://xenomai.org/mailman/listinfo/xenomai
>> >
>> >
>
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] Context switch to secondary mode in xenomai tasks
  2018-04-06 17:41         ` Greg Gallagher
@ 2018-04-06 17:43           ` Giulio Moro
  0 siblings, 0 replies; 9+ messages in thread
From: Giulio Moro @ 2018-04-06 17:43 UTC (permalink / raw)
  To: Greg Gallagher, C Smith; +Cc: Xenomai@xenomai.org

or
   cat /proc/xenomai/stat
and see if the count in the MSW column increases for that task
________________________________________
From: Xenomai <xenomai-bounces@xenomai.org> on behalf of Greg Gallagher <greg@embeddedgreg.com>
Sent: 06 April 2018 18:41
To: C Smith
Cc: Xenomai@xenomai.org
Subject: Re: [Xenomai] Context switch to secondary mode in xenomai tasks

Check here:
https://xenomai.org/2014/08/porting-a-linux-application-to-xenomai-dual-kernel/#Chasing_the_unwanted_mode_switches


On Fri, Apr 6, 2018 at 1:39 PM, C Smith <csmithquestions@gmail.com> wrote:
> How can we verify which tasks are switching to secondary mode? We know the
> xml parser definitely is switching to secondary mode, setting T_WARNSW,
> causing the application to send the SIGXCPU signal, but we don't know if
> it's affecting the other tasks.
>
> On Fri, Apr 6, 2018 at 10:17 AM, Greg Gallagher <greg@embeddedgreg.com>
> wrote:
>>
>> If a tasks switches to secondary mode it would act like a normal Linux
>> thread. I haven't used Xenomai 2.6 in a while but if you are seeing
>> both tasks drop to secondary mode you may want to list the resources
>> that they are sharing and how you are sharing them and then we can see
>> if something would cause mode switches. Are you seeing both threads
>> drop to secondary mode?
>>
>> -Greg
>>
>> On Fri, Apr 6, 2018 at 1:01 PM, C Smith <csmithquestions@gmail.com> wrote:
>> > The tasks manipulate shared data however they do not communicate
>> > directly.
>> > The rt_task which parses the xml document and the main rt_task are
>> > running
>> > periodically at different rates using rt_task_set_periodic.
>> >
>> > On Fri, Apr 6, 2018 at 9:54 AM, Greg Gallagher <greg@embeddedgreg.com>
>> > wrote:
>> >>
>> >> Do the tasks communicate with each other?
>> >>
>> >> -Greg
>> >>
>> >> On Fri, Apr 6, 2018 at 12:51 PM, C Smith <csmithquestions@gmail.com>
>> >> wrote:
>> >> > Hi all--
>> >> >
>> >> > Our real time application has a main rt_task which runs concurrently
>> >> > with
>> >> > several other rt_tasks (spawned using rt_task_create) and we are
>> >> > concerned
>> >> > about a context switch in one of the tasks. The problematic task uses
>> >> > libxml2 to parse an xml document sent over ethernet which seems to
>> >> > cause
>> >> > a
>> >> > switch to secondary mode. Would this also switch the other tasks we
>> >> > are
>> >> > running to secondary mode, or is it isolated?
>> >> >
>> >> > We are running Xenomai 2.6.2 and Xenomai 2.6.5 in our application.
>> >> > _______________________________________________
>> >> > Xenomai mailing list
>> >> > Xenomai@xenomai.org
>> >> > https://xenomai.org/mailman/listinfo/xenomai
>> >
>> >
>
>

_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] Context switch to secondary mode in xenomai tasks
  2018-04-06 16:51 [Xenomai] Context switch to secondary mode in xenomai tasks C Smith
  2018-04-06 16:54 ` Greg Gallagher
@ 2018-04-07  7:57 ` Philippe Gerum
  2018-04-07  8:02   ` Philippe Gerum
  1 sibling, 1 reply; 9+ messages in thread
From: Philippe Gerum @ 2018-04-07  7:57 UTC (permalink / raw)
  To: C Smith, xenomai

On 04/06/2018 06:51 PM, C Smith wrote:
> Hi all--
> 
> Our real time application has a main rt_task which runs concurrently with
> several other rt_tasks (spawned using rt_task_create) and we are concerned
> about a context switch in one of the tasks. The problematic task uses
> libxml2 to parse an xml document sent over ethernet which seems to cause a
> switch to secondary mode. Would this also switch the other tasks we are
> running to secondary mode, or is it isolated?

This is isolated in the sense that only the xml parser task will switch
to secondary mode.

However, this may still cause a priority inversion for any rt thread
which synchronizes with that switching thread, since the former may end
up waiting for a wake up event coming from the latter, which might be
delayed until it switches back to rt mode.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] Context switch to secondary mode in xenomai tasks
  2018-04-07  7:57 ` Philippe Gerum
@ 2018-04-07  8:02   ` Philippe Gerum
  0 siblings, 0 replies; 9+ messages in thread
From: Philippe Gerum @ 2018-04-07  8:02 UTC (permalink / raw)
  To: C Smith, xenomai

On 04/07/2018 09:57 AM, Philippe Gerum wrote:
> On 04/06/2018 06:51 PM, C Smith wrote:
>> Hi all--
>>
>> Our real time application has a main rt_task which runs concurrently with
>> several other rt_tasks (spawned using rt_task_create) and we are concerned
>> about a context switch in one of the tasks. The problematic task uses
>> libxml2 to parse an xml document sent over ethernet which seems to cause a
>> switch to secondary mode. Would this also switch the other tasks we are
>> running to secondary mode, or is it isolated?
> 
> This is isolated in the sense that only the xml parser task will switch
> to secondary mode.
> 
> However, this may still cause a priority inversion for any rt thread
> which synchronizes with that switching thread, since the former may end
> up waiting for a wake up event coming from the latter, which might be
> delayed until it switches back to rt mode.
> 

Also, unwanted mode switches might cause runtime overhead when they
happen frequently enough. So it depends on how frequently the parser
task is switching out of rt mode.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-04-07  8:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-06 16:51 [Xenomai] Context switch to secondary mode in xenomai tasks C Smith
2018-04-06 16:54 ` Greg Gallagher
2018-04-06 17:01   ` C Smith
2018-04-06 17:17     ` Greg Gallagher
2018-04-06 17:39       ` C Smith
2018-04-06 17:41         ` Greg Gallagher
2018-04-06 17:43           ` Giulio Moro
2018-04-07  7:57 ` Philippe Gerum
2018-04-07  8:02   ` Philippe Gerum

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.