Howto schedule realtime tasks to CPU1 when isolcpus=1

More
24 Jan 2017 09:08 #86540 by DomCa
Hi all,

as I mentioned in my other thread I installed LinuxCNC on Lubunut. I am now down to a max latency of 13000, which seems ok to me for a start. The PC is an Athlon64 X2 (dual core)

However I noticed one thing:

All threads are on CPU0 when I use the isolcpus=1 parameter. Nothing is on CPU1.

Wouldn't it make sense to run the realtime threads on the CPU1?

Is this possible?

Thanks
Domca

Please Log in or Create an account to join the conversation.

More
24 Jan 2017 10:06 #86542 by ArcEye

However I noticed one thing:
All threads are on CPU0 when I use the isolcpus=1 parameter. Nothing is on CPU1.
Wouldn't it make sense to run the realtime threads on the CPU1?


I can only suggest you read what isol(ate)cpus does and why it is used.

Short answer NO

The reason you are getting 13K max jitter, is because they are NOT spread across 2 core caches.

Please Log in or Create an account to join the conversation.

More
24 Jan 2017 10:41 #86546 by DomCa
Hi!

I know that isolcpus prevents the scheduler from using the isolated CPUs.
But wouldn't it make sense to run the realtime part (and only that) of linuxcnc on exactly that isolated CPUs?

Please Log in or Create an account to join the conversation.

More
24 Jan 2017 11:19 - 24 Jan 2017 11:19 #86548 by DomCa
Hi again,


ArcEye: such a NO asks for some experimenting...

I just tried rescheduling single tasks that are spanwed when LinuxCNC is started.

The command:

taskset -p 1 <PID of "milltask">

reduced my latency to under 7000 from 13000
Last edit: 24 Jan 2017 11:19 by DomCa.

Please Log in or Create an account to join the conversation.

More
25 Jan 2017 12:51 - 25 Jan 2017 12:55 #86608 by andypugh

But wouldn't it make sense to run the realtime part (and only that) of linuxcnc on exactly that isolated CPUs?


I _think_ that is actually what happens. Do you see the realtime task running on the non-isolated CPU?
As far as I recall "top" does not see the isolated cores.

[Edit]

Yes, RTAI knows how to use the isolated CPUs:
github.com/ShabbyX/RTAI/blob/master/README.ISOLCPUS
Last edit: 25 Jan 2017 12:55 by andypugh.

Please Log in or Create an account to join the conversation.

More
25 Jan 2017 13:45 #86615 by DomCa
Hi Andy,

I expected such a behaviour. But htop Shows that all tasks are on CPU 0. In htop you can show the "Processor". According to htop every Task is on CPU 0.

Using taskset you can move single tasks to CPU 1, this is then also reflected in htop (and on my system reduces latency, this is reproducible. But I will perform more tests).

Please Log in or Create an account to join the conversation.

More
22 Feb 2017 14:24 #88498 by DomCa
Hi again,

since nothing is run on the isolated CPUs at all, I suppose that LinuxCNC does not implement the instructions in section 2. of
github.com/ShabbyX/RTAI/blob/master/README.ISOLCPUS


2. IsolCpuMask in RTAI

Then what you have to do on the RTAI side is to load the core RTAI HAL module
using something like: "insmod rtai_hal.ko IsolCpusMask=<xxx>", where <xxx>
is the mask of isolated CPUs. Please notice that Linux uses a list if isolated
CPUs while RTAI requires the corresponding mask (I'm lazy and let you do it).


Is there any way to add the IsolCpusMark=XXX to the loading of the rtai_hal.ko?

Thanks
DomCa

Please Log in or Create an account to join the conversation.

More
22 Feb 2017 19:28 #88511 by Bari
Linuxcnc runs RTAI on an isolated cpu. It does so by default and
you don't have to use isolcpus=x for the past few years.

Use this tree and RTAI will work with Linuxcnc:
github.com/NTULINUX/RTAI

Please Log in or Create an account to join the conversation.

More
23 Feb 2017 11:18 #88534 by DomCa
Hi Bari,

thank you for pointing out the RTAI tree. I will test it as soon as possible.

With the standard install from the live CD all tasks (non-realtime and real-time) are scheduled on the non-isolated CPU, at least on my system.
Should the Live-CD be modified to include the NTULINUX tree?

Thanks
DomCa

Please Log in or Create an account to join the conversation.

More
25 Feb 2017 21:05 #88621 by Bari
That is up to the Linuxcnc developers to decide.

Please Log in or Create an account to join the conversation.

Time to create page: 0.088 seconds
Powered by Kunena Forum