Problems with rtprio

Optimize your system for ultimate performance.

Moderators: khz, MattKingUSA

Problems with rtprio

Postby pimander » Wed Apr 14, 2010 6:14 pm

Hi all,
I'm fighting with RT settings for audio applications... :evil: below is a resume of settings I applied following the suggestions of realTimeConfigQuickScan.pl.
It seems all right, but there's no way of get rtprio working.
Somebody have a clue ? A missing kernel config / package installed or misconfigured..,
Thanks.

Marco

Code: Select all
$ uname -a
Linux ongu 2.6.31-gentoo-r6 #2 SMP PREEMPT Mon Mar 8 21:07:35 CET 2010 x86_64 AMD Phenom(tm) II X4 955 Processor AuthenticAMD GNU/Linux

content of /etc/security/limits.conf
@audio           -       rtprio          99
@audio           -       memlock      unlimited
@audio           -       nice            -10

output of ulimit as user
$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 30
file size               (blocks, -f) unlimited
pending signals                 (-i) 24556
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 99
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 24556
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

$ groups
disk wheel floppy audio cdrom dialout video postgres cdrw usb users portage plugdev

the trouble...
$ chrt 80 echo foo
chrt: failed to set pid 0's policy: Operation not permitted

pimander
 
Posts: 3
Joined: Wed Apr 14, 2010 5:06 pm

Re: Problems with rtprio

Postby pimander » Wed Apr 14, 2010 7:17 pm

Googling a little more I've solved this trouble. :D
The way is to disable one modern kernel feature, that disallows standard operations with SCHED_FIFO with unprivileged user. :oops:

Code: Select all
General setup  --->
    [ ] Group CPU scheduler


I've not enought skills to hack it, an easiest way is to disable it.

Thanks anyway...

Marco
pimander
 
Posts: 3
Joined: Wed Apr 14, 2010 5:06 pm

Re: Problems with rtprio

Postby kyokurider » Wed Oct 27, 2010 6:52 pm

Hi, i am sort of having the same problem. My installation is Debian squeeze i686. After installing jack, and let it configure the real time thing by creating the /etc/security/limits.d/audio.conf i restart the machine but when i do ulimit -l keeps telling me 64 when should be unlimited.
I thought this last post would be my answer but actually i have that option disable in the kernel so is actually not.

This what i get from ulimit -a:

core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31847
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 31847
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

I have unsuccessfully tried to edit /etc/security/limits.conf and the above mentioned file. I mean, is so simple, just add those lines right?

@audio - rtprio 95
@audio - memlock unlimited

, and obviously add my user to the audio group, in which he already is, but for some reason i do not know it just does not work.
I can start jack and get this in the messages window:
20:35:53.515 JACK está iniciándose...
20:35:53.516 /usr/bin/jackd -P89 -dalsa -dhw:0,0 -r44100 -p512 -n2 -m
Cannot connect to server socket err = No existe el fichero o el directorio
Cannot connect to server socket
jack server is not running or cannot be started
20:35:53.532 JACK se inició con PID=2442.
Cannot create thread 1 Operation not permitted
Cannot create thread 1 Operation not permitted
jackdmp 1.9.6
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2010 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 89
Cannot lock down memory area (Cannot allocate memory)
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0,0|hw:0,0|512|2|44100|0|0|nomon|swmeter|-|32bit
Using ALSA driver HDA-Intel running on card 0 - HDA Intel at 0xfebf8000 irq 22
configuring for 44100Hz, period = 512 frames (11.6 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
Cannot use real-time scheduling (RR/89)(1: Operation not permitted)
AcquireSelfRealTime error
20:35:55.643 Configuración del servidor salvada en "/home/kyoku/.jackdrc".
20:35:55.645 Reiniciar estadísticas.
20:35:55.656 Cliente activado.
20:35:55.673 Cambios en las conexiones JACK.
20:35:55.674 Cambió el gráfico de conexiones de JACK.
Cannot lock down memory area (No se pudo asignar memoria)

(Is in spanish but you get the idea)
It does start but of course when i start ardour is telling me about my memlock size and bla, bla..

Why does the system not pick up the configuration?, thanks.
kyokurider
Establlshed Member
 
Posts: 9
Joined: Tue Sep 22, 2009 10:13 am

Re: Problems with rtprio

Postby pimander » Wed Oct 27, 2010 9:09 pm

hi kyokurider,
well, all the stuff about user limits rely on pam_limits, a module of pam, the autentication stack, check if your installation has it.
also, I have edited /etc/security/limits.conf, the main configuration file.
my ulimit -a says:

core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 30
file size (blocks, -f) unlimited
pending signals (-i) 38912
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 99
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 38912
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

I hope this can help you.

marco
pimander
 
Posts: 3
Joined: Wed Apr 14, 2010 5:06 pm

Re: Problems with rtprio

Postby AutoStatic » Wed Oct 27, 2010 9:23 pm

kyokurider wrote:...and let it configure the real time thing by creating the /etc/security/limits.d/audio.conf...
Hello kyokurider,
kyokurider wrote:I have unsuccessfully tried to edit /etc/security/limits.conf and the above mentioned file. I mean, is so simple, just add those lines right?
Yes, but you should only edit /etc/security/limits.d/audio.conf and leave /etc/security/limits.conf untouched.

kyokurider wrote:20:35:53.516 /usr/bin/jackd -P89 -dalsa -dhw:0,0 -r44100 -p512 -n2 -m
With -m you disable memlocking while want it to be unlimited.

kyokurider wrote:Cannot use real-time scheduling (RR/89)(1: Operation not permitted)
You can't run JACK with prio 89. JACK's watchdog thread always runs +10 above the prio of JACK's primary thread. That would be 99 in your case. But you've set rtprio to 95 so JACK can't start up the watchdog thread now.

kyokurider wrote:It does start but of course when i start ardour is telling me about my memlock size and bla, bla..
That is because you disabled memlocking while Ardour prefers memlock to be set to unlimited.

kyokurider wrote:Why does the system not pick up the configuration?, thanks.
I think it does pick up the configuration. Try unticking 'No Memory Lock' in QjackCtl or omit the -m option and try running JACK at a prio no higher than 70.

Best,

Jeremy
User avatar
AutoStatic
Establlshed Member
 
Posts: 1449
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands

Re: Problems with rtprio

Postby kyokurider » Thu Oct 28, 2010 5:51 pm

Hi, thanks for the input, well, actually it does not pick up, all i have to do is check the ulimit -a command to see that is not correct, the only way to do this would be to as root:
ulimit -l unlimited
ulimit -r 99

and then also as root start qjackctl, then when i start jack i get this in the messages window:

18:57:50.372 JACK está iniciándose...
18:57:50.372 /usr/bin/jackd -dalsa -dhw:0 -r44100 -p128 -n2
18:57:50.374 JACK se inició con PID=2132.
no message buffer overruns
no message buffer overruns
jackdmp 1.9.6
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2010 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|128|2|44100|0|0|nomon|swmeter|-|32bit
Using ALSA driver HDA-Intel running on card 0 - HDA Intel at 0xfebf8000 irq 22
configuring for 44100Hz, period = 128 frames (2.9 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
18:57:52.454 Configuración del servidor salvada en "/root/.jackdrc".
18:57:52.455 Reiniciar estadísticas.
18:57:52.460 Cliente activado.
18:57:52.464 Cambios en las conexiones JACK.
18:57:52.466 Cambió el gráfico de conexiones de JACK.

Which i believe is correct. However for some reason my use can not modify this properties. I think it has to do with pam. So more of a permissions issue with my user, i am googleing now to see where it actually fails this..
kyokurider
Establlshed Member
 
Posts: 9
Joined: Tue Sep 22, 2009 10:13 am

Re: Problems with rtprio

Postby Pablo » Thu Oct 28, 2010 8:34 pm

Hi,

I think that "man pam_limits" gives a clue. At the end it reads:

EXAMPLES
For the services you need resources limits (login for example) put
the following line in /etc/pam.d/login as the last line for that
service (usually after the pam_unix session line):

#%PAM-1.0
#
# Resource limits imposed on login sessions via pam_limits
#
session required pam_limits.so

Replace "login" for each service you are using this module.


I use gdm as my login manager. I have not done nothing special. I am in ubuntu karmic. I see this in /etc/pam.d/gdm:

/etc/pam.d$ cat gdm
#%PAM-1.0
auth requisite pam_nologin.so
auth required pam_env.so readenv=1
auth required pam_env.so readenv=1 envfile=/etc/default/locale
@include common-auth
auth optional pam_gnome_keyring.so
@include common-account
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close
session required pam_limits.so
@include common-session
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open
session optional pam_gnome_keyring.so auto_start
@include common-password


So maybe, try adding something of the sort to your login manager. Which is it, by the way?

Cheers! Pablo
Pablo
Establlshed Member
 
Posts: 836
Joined: Thu Apr 17, 2008 9:57 pm

Re: Problems with rtprio

Postby kyokurider » Thu Oct 28, 2010 10:22 pm

Hi Pablo,

Dude you are everywhere :D , thanks!, it does look that is the issue. I normally use gdm, but i am in the process of trying differente options, awesome, openbox, and as the login manager using slim right now.
Lots of hand work but worth the effort, even though you come across this kind of things.
One of my colleagues at work pointed me out about the pam issues, and he actually mentioned about the gdm thing so it looks like this could be very much the reason why.
I am not at home so i could probably not test it until tomorrow, but learnt a lot in the process, i am actually excited about having my own audio recording system all build with open source, this is gonna be good times.

I will try that tomorrow and see if i can dig as into what is the root cause, and how to solve it. And maybe do a blog with the suffering details he.

Thanks a lot will keep you updated.
kyokurider
Establlshed Member
 
Posts: 9
Joined: Tue Sep 22, 2009 10:13 am

Re: Problems with rtprio

Postby kyokurider » Fri Oct 29, 2010 8:26 am

man, i knew Pablo's comment would sorted and wasn't that right :D

Ok, basically as well as you have this gdm file under the /etc/pam.d/ directory will also be needed one for slim, which maybe should be created by default when you install the login manager, the actual post that gave me the clue was this bug summited at bugs.debian.org
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=476248

From the link:
While this does not affect the main SLiM functionality, if the
pam.d/slim file is not provided PAM will use the fallback "others"
file, which is definitely not the desired behaviour for a login
program.


It was so easy but spend so much time figuring why until i found the right path to look for, i am a happy man now.
kyokurider
Establlshed Member
 
Posts: 9
Joined: Tue Sep 22, 2009 10:13 am

Re: Problems with rtprio

Postby lorenzosu » Thu Nov 17, 2011 1:18 pm

After more than 1 year this post is still useful ;) - Thanks.

I was having the same problem on Debian Wheezy with XFCE and SLIM.

I simply copied /etc/pam.d/xdm which seems to have reasonable defaults to /etc/pam.d/slim:

Code: Select all
# cp /etc/pam.d/xdm /etc/pam.d/slim


And that did the trick :)

Lorenzo.
lorenzosu
 
Posts: 1
Joined: Fri Oct 10, 2008 8:02 am

Re: Problems with rtprio

Postby didgewind » Tue Jul 17, 2012 12:15 pm

Hi there. After updating to ubuntu 12.04 (precise pangolin) i check realTimeConfigQuickScan.pl and i am running again into the rtprio problem. Basically, the message it shows is

Code: Select all
chrt: failed to set pid 0's policy: Operation not permitted


I am using alesio's 3.2.0-23-realtime kernel, as far as I know irq threading is activated, audio.limits is ok...

Is it necessary to disable the modern kernel feature, that disallows standard operations with SCHED_FIFO with unprivileged user? If so, how do u do that? Recompiling the kernel?

cheers
didgewind
Establlshed Member
 
Posts: 35
Joined: Wed Mar 16, 2011 1:22 pm

Re: Problems with rtprio

Postby AutoStatic » Fri Jul 27, 2012 11:52 am

Could you post the contents of /etc/security/limits.d/audio.conf ? And you're sure you're in the audio group? And I'd suggest compiling your own RT kernel as described here: http://wiki.linuxmusicians.com/doku.php ... n#manually
Alessio's RT kernel packages are based on an older release that contains quite some bugs, I uninstalled it because I had too much issues with it.
User avatar
AutoStatic
Establlshed Member
 
Posts: 1449
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands

Re: Problems with rtprio

Postby didgewind » Fri Aug 10, 2012 7:05 am

hi,

i'm pretty sure that file is ok, and yes, i belong to the audio group. Anyway here is the contents:

Code: Select all
@audio   -  rtprio     95
@audio   -  memlock    unlimited
#@audio   -  nice      -19


thanks for the reply, and sorry for the late feedback. I am busy now with some programming stuff, but i'll try to compile the kernel when i am a bit more free (in a month or so).

xxx
didgewind
Establlshed Member
 
Posts: 35
Joined: Wed Mar 16, 2011 1:22 pm


Return to System Tuning and Configuration

Who is online

Users browsing this forum: No registered users and 1 guest