rtapi -- uspace -- "Using POSIX non-realtime"

More
21 Nov 2016 08:37 #83056 by jCandlish
Hi Forum

I compiled the newest linux kernel configured as preemptable, but linuxcnc uspace disagrees.
latheoperator@125cnc:~$ uname -a
Linux 125cnc 4.8.9-jbc01 #1 SMP PREEMPT Sun Nov 20 09:34:59 CET 2016 x86_64 GNU/Linux
latheoperator@125cnc:~$ !lat
latency-test 1000000 1000000
Waiting for component 'threads' to become ready....Waited 3 seconds for master.  giving up.
Note: Using POSIX non-realtime

Waiting for component 'lat' to become ready....
Note: Using POSIX non-realtime
latheoperator@125cnc:~$ ls -l /usr/bin/rtapi_app 
-rwsr-xr-x 1 root root 102072 Nov 21 09:08 /usr/bin/rtapi_app
latheoperator@125cnc:~$ 

Also, I would like to work my way though the rtapi examples in the ./src/rtapi/examples directory, but am not quite understanding the ./src/rtapi/README file.

Starting from:
2. Load the RTOS and RTAPI modules:

Note: for this and most of the following steps you will need
to be root, or use 'su -c "<command>"'

scripts/load_rtapi

See a number of messages pop up in the kernel log as components
of the RTOS are installed...
One of the last ones will be:

I can't find a load_rtapi script anywhere in the source distribution.

Are there pre-existing test-cases for the rtapi and uspace?

If so, how does one get started using them?

Thanks,
jCandlish

.

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

More
21 Nov 2016 12:54 #83066 by andypugh

I can't find a load_rtapi script anywhere in the source distribution


Yes, it appears that that README file contains a hangover from long ago. Looking back to v2.0 11 years ago it wasn't there then....

Are there pre-existing test-cases for the rtapi and uspace?


There are many tests that are run by the buildbot, and you can try those:

github.com/LinuxCNC/linuxcnc/blob/master/tests/README

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

More
21 Nov 2016 13:03 - 21 Nov 2016 13:06 #83067 by dgarrett

I compiled the newest linux kernel configured as preemptable, but linuxcnc uspace disagrees.


Did you configure uspace properly?
$ cd the_root_dir/src
$ ./autogen.sh
$ ./configure --with-realtime=uspace

am not quite understanding the ./src/rtapi/README file.


That file seems to be out-of-date. It was last modified:
2cc3ad7 2014-08-30
Last edit: 21 Nov 2016 13:06 by dgarrett.

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

More
21 Nov 2016 13:17 - 21 Nov 2016 13:18 #83070 by jCandlish
I compliled linuxcnc via the 'apt-get source' method.

That is, I downloaded the package source and built local NMU debs.

This package is working with the current 'stretch' preempt kernel.
Linux 125cnc 4.8.0-1-rt-amd64 #1 SMP PREEMPT RT Debian 4.8.5-1 (2016-10-28) x86_64 GNU/Linux

My 4.8.9 preempt kernel says:
Note: Using POSIX non-realtime

I would like to better understand the uspace rtapi wrapper. I'm only finding out of date documentation.

.
Last edit: 21 Nov 2016 13:18 by jCandlish.

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

More
21 Nov 2016 13:22 #83072 by jCandlish

There are many tests that are run by the buildbot, and you can try those:


I was thinking more specifically about the examples in ./src/rtapi/examples, and how they apply to the uspace wrapper.

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

More
21 Nov 2016 14:13 - 21 Nov 2016 14:23 #83073 by dgarrett

I compliled linuxcnc via the 'apt-get source' method.


You must still use .configure with --realtime=uspace for a preempt-rt kernel
$ ./configure --help|grep realtime
  --enable-simulator      Deprecated! Use --with-realtime=uspace instead.
  --with-realtime=PATH    Path where RTAI is installed, or "uspace" for POSIX

Once configured for uspace realtime, you should see a correct report
(to stdout) for commands like
$ latency-test 
Note: Using POSIX realtime
...


Configuration is not correct if report is:
Note: Using POSIX non-realtime
Last edit: 21 Nov 2016 14:23 by dgarrett.

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

More
21 Nov 2016 15:17 - 21 Nov 2016 15:20 #83079 by dgarrett
I looked some more and it seems that the uname -a report for
your custom debian stretch kernel:
latheoperator@125cnc:~$ uname -a
Linux 125cnc 4.8.9-jbc01 #1 SMP PREEMPT Sun Nov 20 09:34:59 CET 2016 x86_64 GNU/

does not comply with a test in src/rtapi/uspace_common.h
static int detect_realtime() {
    struct utsname u;
    int crit1, crit2 = 0;
    FILE *fd;

    uname(&u);
    crit1 = strcasestr (u.version, "PREEMPT RT") != 0;

    if ((fd = fopen("/sys/kernel/realtime","r")) != NULL) {
        int flag;
        crit2 = ((fscanf(fd, "%d", &flag) == 1) && (flag == 1));
        fclose(fd);
    }
    return crit1 && crit2;
}

Your kernel is reporting "SMP PREEMPT without the specific
substring expected, namely: "PREEMPT RT".
So it appears no preempt-rt patch has been applied to the kernel you are using.

On a system i use (jessie,uspace), the report is:
Linux t520 4.1.0-0.bpo.2-rt-amd64 #1 SMP PREEMPT RT Debian 4.1.6-1~bpo8+1 (2015-09-09) x86_64 GNU/Linux

ref (2.7 tree):
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...d8;hb=refs/heads/2.7
Last edit: 21 Nov 2016 15:20 by dgarrett.

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

More
21 Nov 2016 15:41 #83080 by PCW
I dont even think there is RT a patch for 4.8.9

AFAIK 4.8.6-rt5 is the latest as of Nov 21,2016

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

More
21 Nov 2016 15:46 - 21 Nov 2016 15:47 #83081 by jCandlish
Thanks!

Somehow I thought PREEMPT RT was in mainline. I checked, and no patch is yet available for 4.8.9

...

Anyway, the servo thread jitter I am seeing with a celereon skylake system is quite disappointing. >= 100μs.



I question if it is sufficient?

This is with

GRUB_CMDLINE_LINUX="ipv6.disable=1 intel_idle.max_cstate=1 processor.max_cstate=1"


I've looked also to 'powertop' and 'i7z' for insight on this jitter, but no joy.

.
Last edit: 21 Nov 2016 15:47 by jCandlish.

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

More
19 Aug 2017 15:23 #97743 by thuwrx10
One should remember to execute 'sudo make setuid' after compilation. Otherwise still not able to use POSIX realtime

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

Time to create page: 0.093 seconds
Powered by Kunena Forum