linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* timer_create affinity
@ 2017-05-25 14:57 Nicolae Rosia
  2017-05-26  7:13 ` John Ogness
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolae Rosia @ 2017-05-25 14:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: linuxppc-dev, linux-kernel

Hello,

I'm working on a real-time application using POSIX timers running on a
QorIQ PowerPC platform with a 4.1 PREEMPT RT kernel and I'm trying to
understand whether the following can happen:
1. A thread with a core affinity #0 creates a timer which will invoke
a callback.
2. The kernel will setup the timer using a local timer running on a
different core, core #1
3. The ISR will fire, and could be dispatched by core #2
4. The scheduler will run the callback on core #3.

Is there a way to make sure this whole chain will be executed on a
single core, the core of the caller?

Best regards,
Nicolae Rosia

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

* Re: timer_create affinity
  2017-05-25 14:57 timer_create affinity Nicolae Rosia
@ 2017-05-26  7:13 ` John Ogness
  0 siblings, 0 replies; 2+ messages in thread
From: John Ogness @ 2017-05-26  7:13 UTC (permalink / raw)
  To: Nicolae Rosia; +Cc: linux-rt-users, linuxppc-dev, linux-kernel

On 2017-05-25, Nicolae Rosia <nicolae.rosia.oss@gmail.com> wrote:
> I'm working on a real-time application using POSIX timers running on a
> QorIQ PowerPC platform with a 4.1 PREEMPT RT kernel and I'm trying to
> understand whether the following can happen:
>
> 1. A thread with a core affinity #0 creates a timer which will invoke
> a callback.
> 2. The kernel will setup the timer using a local timer running on a
> different core, core #1
> 3. The ISR will fire, and could be dispatched by core #2
> 4. The scheduler will run the callback on core #3.
>
> Is there a way to make sure this whole chain will be executed on a
> single core, the core of the caller?

Avoid POSIX timers if you can. POSIX timers not only have the issue that
you mentioned, but also are generally bad for realtime applications.

The realtime wiki has an example[0] of running a cyclic task. With that
simple example you have complete control over the context of your
task. This is necessary to avoid things like priority inversion and
page-faults, and gives you control over things like affinity or cgroups.

John Ogness

[0] https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/cyclic

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

end of thread, other threads:[~2017-05-26  7:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-25 14:57 timer_create affinity Nicolae Rosia
2017-05-26  7:13 ` John Ogness

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).