All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: "RAKOTOSALAMA, Nirilanto" <NIRILANTO.RAKOTOSALAMA@airbus.com>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] [Newbie question] threads and task CPU affinity
Date: Thu, 31 May 2007 15:32:10 +0200	[thread overview]
Message-ID: <465ECE5A.8080809@domain.hid> (raw)
In-Reply-To: <5C40CD1E4697424ABDE3AC57CF1B22C6032202CB@FR0-MAILMB20.res.airbus.corp>

[-- Attachment #1: Type: text/plain, Size: 2128 bytes --]

RAKOTOSALAMA, Nirilanto wrote:
> Hi,
> 
> I'm still blocked on a CPU affinity problem.
> In order to adapt a set affinity function which is based on
> posix linux lib :
> - CPU_AssignPID(uint32 PID, uint32 CPU_id)
> - the cpu affinity of the caller and all its child threads must be set to CPU_id.
> 
> Problems are:
> Child PIDs must be listed, the only means I found is listing pids using `ls /proc/"Parent pid"/ > temp_file`
> And each listed pid is sched_setaffinity'ed.
> I don't know if setting affinity of RT threads from an other thread (parent) using pid works with xenomai.

It works in so far as the Xenomai thread will not change its CPU until
it enters secondary mode. Moreover, there is no explicit "hey, RT thread
x, go to CPU #n!" under the POSIX skin. Migration always go through
secondary mode.

> 
> So, my question is :
> With xenomai, is recursively cpu affinity setting from a parent thread, a good way of doing ?
> I read switchtest program, and I conclude that in a xenomai and RT perspective, it seems "nicer"
> to set affinity each threads separately during their init phase before the RT infinite loop.
> Otherwise, setting affinity after child threads creation from its parent, may switch them into 
> secondary mode during their RT loop, and at an unknown moment.

Actually, this issue has nothing to do with Xenomai's internals. It's
rather a generic question for RT apps: Shall some thread be forced to
migrate on a different CPU while it is running? Note that this can cause
unexpected latency hickups.

I wouldn't allow such a scheme via your middleware. Either you have
clear pre-operational states of your threads in which you can change
affinity safely (also across process boundaries - if this is required),
or try to establish a different CPU assignment scheme.

> Argumentation is important for my internship because I have to port on xenomai a very big RT 
> posix based application. And I should justify any modifications and prevent potential problems.
> 
> Sorry, I don't know if it is clear.
> 
> Thanks in advance, Niry.
> 

HTH,
Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  parent reply	other threads:[~2007-05-31 13:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-31 13:08 [Xenomai-help] [Newbie question] threads and task CPU affinity RAKOTOSALAMA, Nirilanto
2007-05-31 13:29 ` Gilles Chanteperdrix
2007-05-31 13:32 ` Jan Kiszka [this message]
2007-05-31 14:18   ` Gilles Chanteperdrix
2007-05-31 14:28     ` Jan Kiszka
2007-05-31 14:36       ` Gilles Chanteperdrix
2007-05-31 13:36 ` Gilles Chanteperdrix
2007-05-31 14:28 ` Philippe Gerum
  -- strict thread matches above, loose matches on Subject: below --
2007-06-01  8:36 RAKOTOSALAMA, Nirilanto
2007-05-31 15:48 RAKOTOSALAMA, Nirilanto
2007-05-31 15:48 RAKOTOSALAMA, Nirilanto
2007-05-24 10:12 RAKOTOSALAMA, Nirilanto
2007-05-24 12:07 ` Jan Kiszka
2007-05-24 12:28   ` Gilles Chanteperdrix
2007-05-23  8:47 RAKOTOSALAMA, Nirilanto
2007-05-24  7:53 ` Jan Kiszka
2007-05-22 14:51 RAKOTOSALAMA, Nirilanto
2007-05-22 16:59 ` 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=465ECE5A.8080809@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=NIRILANTO.RAKOTOSALAMA@airbus.com \
    --cc=xenomai@xenomai.org \
    /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.