All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] cpu usage
@ 2012-07-27 13:04 Frederik Bayart
  2012-07-27 13:21 ` Gilles Chanteperdrix
  2012-07-27 13:35 ` Jan Kiszka
  0 siblings, 2 replies; 7+ messages in thread
From: Frederik Bayart @ 2012-07-27 13:04 UTC (permalink / raw)
  To: xenomai

I'm running Xenomai 2.6.0 on Linux 2.6.38

I have a dual core processor.
When I run a busywait loop on cpu 0 (see source in attachment), I
can't do anything anymore on the computer although cpu 1 is almost
entirely idle. I can't interrupt the busywait loop, login, type
something in a shell, ...
This is even the case if I run linux entirely on cpu 1 (by using
isolcpus=0 as kernel parameter)

How can this be explained ?

Is it possible to use cpu 0 at 100% for a xenomai tasks and cpu 1 for
normal linux tasks so that you can still work on the computer ?

Regards,

Frederik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busywaitd.c
Type: text/x-csrc
Size: 1349 bytes
Desc: not available
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20120727/41790162/attachment.c>

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

* Re: [Xenomai] cpu usage
  2012-07-27 13:04 [Xenomai] cpu usage Frederik Bayart
@ 2012-07-27 13:21 ` Gilles Chanteperdrix
  2012-07-27 13:35 ` Jan Kiszka
  1 sibling, 0 replies; 7+ messages in thread
From: Gilles Chanteperdrix @ 2012-07-27 13:21 UTC (permalink / raw)
  To: Frederik Bayart; +Cc: xenomai

On 07/27/2012 03:04 PM, Frederik Bayart wrote:

> I'm running Xenomai 2.6.0 on Linux 2.6.38
> 
> I have a dual core processor.
> When I run a busywait loop on cpu 0 (see source in attachment), I
> can't do anything anymore on the computer although cpu 1 is almost
> entirely idle. I can't interrupt the busywait loop, login, type
> something in a shell, ...
> This is even the case if I run linux entirely on cpu 1 (by using
> isolcpus=0 as kernel parameter)
> 
> How can this be explained ?
> 
> Is it possible to use cpu 0 at 100% for a xenomai tasks and cpu 1 for
> normal linux tasks so that you can still work on the computer ?


Is it an issue worth investigating? If a xenomai task uses 100% of the
cpu, it is a bug, enable the watchdog, and you will avoid the lockup. If
it is by design, then it really looks like a bad design.

-- 
                                                                Gilles.


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

* Re: [Xenomai] cpu usage
  2012-07-27 13:04 [Xenomai] cpu usage Frederik Bayart
  2012-07-27 13:21 ` Gilles Chanteperdrix
@ 2012-07-27 13:35 ` Jan Kiszka
  2012-07-27 13:58   ` Frederik Bayart
  1 sibling, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2012-07-27 13:35 UTC (permalink / raw)
  To: Frederik Bayart; +Cc: xenomai

On 2012-07-27 15:04, Frederik Bayart wrote:
> I'm running Xenomai 2.6.0 on Linux 2.6.38
> 
> I have a dual core processor.
> When I run a busywait loop on cpu 0 (see source in attachment), I
> can't do anything anymore on the computer although cpu 1 is almost
> entirely idle. I can't interrupt the busywait loop, login, type
> something in a shell, ...
> This is even the case if I run linux entirely on cpu 1 (by using
> isolcpus=0 as kernel parameter)
> 
> How can this be explained ?
> 
> Is it possible to use cpu 0 at 100% for a xenomai tasks and cpu 1 for
> normal linux tasks so that you can still work on the computer ?

It's a FAQ: This is not possible with current Linux. It will lock up
quite quickly if kernel helper threads for RCU or work queues cannot run
once in a while. Also, time keeping will be affected. Due to the latter,
you should release the core to Linux once every scheduling tick.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux




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

* Re: [Xenomai] cpu usage
  2012-07-27 13:35 ` Jan Kiszka
@ 2012-07-27 13:58   ` Frederik Bayart
  2012-07-27 14:01     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 7+ messages in thread
From: Frederik Bayart @ 2012-07-27 13:58 UTC (permalink / raw)
  To: Jan Kiszka, xenomai

The use case is : we are using an i7 processor. We noticed that
internally, the processor is shifting frequency to minimize idle time.
(This is not done by linux, we used cpufreq to avoid that but there is
still some software on the processor that is shifting frequency). This
has as consequence that the required rate of our realtime process,
which is a periodic task, becomes to fast for the processor.
To avoid downscaling of the cpu frequency, we had the  idea to run
additionally a busywait loop at priority 0 so that the processor is
always running at 100%, there is no idle time and the frequency will
not scale down.

We want only 1 core running at 100% for temperature reasons.

On 27 July 2012 15:35, Jan Kiszka <jan.kiszka@siemens.com> wrote:
> On 2012-07-27 15:04, Frederik Bayart wrote:
>> I'm running Xenomai 2.6.0 on Linux 2.6.38
>>
>> I have a dual core processor.
>> When I run a busywait loop on cpu 0 (see source in attachment), I
>> can't do anything anymore on the computer although cpu 1 is almost
>> entirely idle. I can't interrupt the busywait loop, login, type
>> something in a shell, ...
>> This is even the case if I run linux entirely on cpu 1 (by using
>> isolcpus=0 as kernel parameter)
>>
>> How can this be explained ?
>>
>> Is it possible to use cpu 0 at 100% for a xenomai tasks and cpu 1 for
>> normal linux tasks so that you can still work on the computer ?
>
> It's a FAQ: This is not possible with current Linux. It will lock up
> quite quickly if kernel helper threads for RCU or work queues cannot run
> once in a while. Also, time keeping will be affected. Due to the latter,
> you should release the core to Linux once every scheduling tick.
>
> Jan
>
> --
> Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
> Corporate Competence Center Embedded Linux
>
>



-- 
Frederik Bayart | Senior software engineer
Triphase NV | Research Park Zone 1719 | Romeinse straat 18 | B-3001 Heverlee
T  +32 2 669 06 05 | E frederik.bayart@triphase.com | W www.triphase.com


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

* Re: [Xenomai] cpu usage
  2012-07-27 13:58   ` Frederik Bayart
@ 2012-07-27 14:01     ` Gilles Chanteperdrix
  2012-07-27 14:05       ` Gilles Chanteperdrix
  0 siblings, 1 reply; 7+ messages in thread
From: Gilles Chanteperdrix @ 2012-07-27 14:01 UTC (permalink / raw)
  To: Frederik Bayart; +Cc: xenomai

On 07/27/2012 03:58 PM, Frederik Bayart wrote:

> The use case is : we are using an i7 processor. We noticed that
> internally, the processor is shifting frequency to minimize idle time.
> (This is not done by linux, we used cpufreq to avoid that but there is
> still some software on the processor that is shifting frequency). This
> has as consequence that the required rate of our realtime process,
> which is a periodic task, becomes to fast for the processor.
> To avoid downscaling of the cpu frequency, we had the  idea to run
> additionally a busywait loop at priority 0 so that the processor is
> always running at 100%, there is no idle time and the frequency will
> not scale down.
> 
> We want only 1 core running at 100% for temperature reasons.


Then simply put the busy loop in a task not running with real-time
priority. A plain Linux task. You should also use the SCHED_IDLE policy
in order to avoid it to delay other non real-time task.

-- 
                                                                Gilles.


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

* Re: [Xenomai] cpu usage
  2012-07-27 14:01     ` Gilles Chanteperdrix
@ 2012-07-27 14:05       ` Gilles Chanteperdrix
  2012-07-27 14:42         ` Gilles Chanteperdrix
  0 siblings, 1 reply; 7+ messages in thread
From: Gilles Chanteperdrix @ 2012-07-27 14:05 UTC (permalink / raw)
  To: Frederik Bayart; +Cc: xenomai

On 07/27/2012 04:01 PM, Gilles Chanteperdrix wrote:

> On 07/27/2012 03:58 PM, Frederik Bayart wrote:
> 
>> The use case is : we are using an i7 processor. We noticed that
>> internally, the processor is shifting frequency to minimize idle time.
>> (This is not done by linux, we used cpufreq to avoid that but there is
>> still some software on the processor that is shifting frequency). This
>> has as consequence that the required rate of our realtime process,
>> which is a periodic task, becomes to fast for the processor.
>> To avoid downscaling of the cpu frequency, we had the  idea to run
>> additionally a busywait loop at priority 0 so that the processor is
>> always running at 100%, there is no idle time and the frequency will
>> not scale down.
>>
>> We want only 1 core running at 100% for temperature reasons.
> 
> 
> Then simply put the busy loop in a task not running with real-time
> priority. A plain Linux task. You should also use the SCHED_IDLE policy
> in order to avoid it to delay other non real-time task.
> 


BTW, do you have CONFIG_CPU_IDLE enabled ? Because that could be the
reason why you get delayed wakeups.

-- 
                                                                Gilles.


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

* Re: [Xenomai] cpu usage
  2012-07-27 14:05       ` Gilles Chanteperdrix
@ 2012-07-27 14:42         ` Gilles Chanteperdrix
  0 siblings, 0 replies; 7+ messages in thread
From: Gilles Chanteperdrix @ 2012-07-27 14:42 UTC (permalink / raw)
  To: Frederik Bayart; +Cc: xenomai

On 07/27/2012 04:05 PM, Gilles Chanteperdrix wrote:

> On 07/27/2012 04:01 PM, Gilles Chanteperdrix wrote:
> 
>> On 07/27/2012 03:58 PM, Frederik Bayart wrote:
>>
>>> The use case is : we are using an i7 processor. We noticed that
>>> internally, the processor is shifting frequency to minimize idle time.
>>> (This is not done by linux, we used cpufreq to avoid that but there is
>>> still some software on the processor that is shifting frequency). This
>>> has as consequence that the required rate of our realtime process,
>>> which is a periodic task, becomes to fast for the processor.
>>> To avoid downscaling of the cpu frequency, we had the  idea to run
>>> additionally a busywait loop at priority 0 so that the processor is
>>> always running at 100%, there is no idle time and the frequency will
>>> not scale down.
>>>
>>> We want only 1 core running at 100% for temperature reasons.
>>
>>
>> Then simply put the busy loop in a task not running with real-time
>> priority. A plain Linux task. You should also use the SCHED_IDLE policy
>> in order to avoid it to delay other non real-time task.
>>
> 
> 
> BTW, do you have CONFIG_CPU_IDLE enabled ? Because that could be the
> reason why you get delayed wakeups.
> 

Something else again: if the BIOS is actually modifying the cpu
frequency, it could do so using SMIs, in that case you could disable
SMIs to avoid the problem.

-- 
                                                                Gilles.


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

end of thread, other threads:[~2012-07-27 14:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-27 13:04 [Xenomai] cpu usage Frederik Bayart
2012-07-27 13:21 ` Gilles Chanteperdrix
2012-07-27 13:35 ` Jan Kiszka
2012-07-27 13:58   ` Frederik Bayart
2012-07-27 14:01     ` Gilles Chanteperdrix
2012-07-27 14:05       ` Gilles Chanteperdrix
2012-07-27 14:42         ` Gilles Chanteperdrix

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.