The realtime-lsm module is needed if you want to get a good latency. (at least better than 10ms!)
Error on starting MusEIf you get this error: midi thread 21011 _NOT_ running SCHED_FIFO There is proably something going wrong with MusE and realtime. Check if you have installed the LSM module below. A simple "lsmod | grep realtime" can point out if it's installed. The example below shows that the module is installed: joachim@knabber:~$ lsmod | grep realtime realtime 8336 0 INSTALLThese instructions assume you know how to configure, build and install Linux kernels. If not, please consult the README and Documentation files in your kernel sources. When you configure the 2.6 kernel, you need at least these options. CONFIG_MODULES=y CONFIG_SECURITY=y CONFIG_SECURITY_CAPABILITIES=m CONFIG_SECURITY_SELINUX=y You probably also want CONFIG_MODULE_UNLOAD=y, so the LSM can be unloaded. Reloading is currently the only way to change parameters. Note that CONFIG_SECURITY_CAPABILITIES *must* be a module. If it is configured directly into the kernel ("=y"), the realtime LSM will not work. Compile the kernel and its modules in the usual way. This need not be done as `root', but does require write access to the kernel build tree. $ make bzImage $ make modules Don't forget (as root) to install the kernel `bzImage' in some appropriate place, update /etc/lilo.conf, and run `lilo'. Unpack the LSM. $ tar xvzf realtime-lsm-${version}
$ cd realtime-lsm-${version}
If `/usr/src/linux' does not point to your kernel sources, set the appropriate KERNEL_DIR in the Makefile or pass it as an argument to make. Now build the LSM and install all the kernel modules. The make can be done by any user, but does require write access to the kernel build tree. Ensure you build using the same compiler used to build your kernel (add CC=<path/to/compiler> to the make commands below if required). $ make KERNEL_DIR=/usr/src/linux-2.6.6 $ sudo make install The install requires root authority. For 2.6.5 and earlier kernels this also recreates the entire /lib/modules/2.6.x subdirectory. If that already exists, you might want to save it under a different name first, just to be safe. For 2.6.6 and later kernels, make install only writes `realtime.ko' to the `extras' subdirectory. So, you still need to go back to the kernel directory and install the remaining modules... $ cd /usr/src/linux $ sudo make modules_install READMERealtime Linux Security Module Copyright (C) 2003 Torben Hohn Copyright (C) 2003, 2004 Jack O'Quin This Linux Security Module (LSM) enables realtime capabilities. It was written by Torben Hohn and Jack O'Quin, who make no warranty concerning the safety, security or even stability of your system when using it. It is provided under the provisions of the GPL (see the file COPYING in this directory). This LSM requires a 2.6 kernel. It might work with a 2.4 kernel that has the SELinux security hooks installed, but that has not been tested. INSTALL gives a brief description of how to build and install this program as a kernel module. Once the LSM has been installed and the kernel for which it was built is running, the root user can load it and pass parameters as follows: # modprobe realtime any=1 Any program can request realtime privileges. This allows any local user to crash the system by hogging the CPU in a tight loop or locking down too much memory. But, it is simple to administer. :-) # modprobe realtime gid=29 All users belonging to group 29 and programs that are setgid to that group have realtime privileges. Use any group number you like. # modprobe realtime mlock=0 Grants realtime scheduling privileges without the ability to lock memory using mlock() or mlockall() system calls. This option can be used in conjunction with any of the other options. # modprobe realtime allcaps=1 Enables all capabilities, including CAP_SETPCAP. This is equivalent to the 2.4 kernel capabilities patch. It is needed for root programs to assign realtime capabilities to other processes. This option can be used in conjunction with any of the other options. The JACK Audio Connection Kit (jackit.sourceforge.net) includes a `jackstart' program which uses CAP_SETPCAP to run the JACK daemon and its clients with realtime capabilities. There are serious security exposures with CAP_SETPCAP. If an attacker manages to subvert some system daemon running with root privileges, it can use this capability to deny needed privileges to other root processes. TestingTo test if the latency patch is installed and loaded type: If you get something like this, something went wrong: root@debian:/usr/src/realtime-lsm-0.1.1# jackstart
jackstart: cannot get realtime capabilities, current capabilities are:
=ep cap_setpcap-ep
probably running under a kernel with capabilities disabled,
a suitable kernel would have printed something like "=eip"
If you get this, it is ok: root@debian:/usr/src/realtime-lsm-0.1.1# jackstart -d alsa back from read, ret = 1 errno == Success jackd 0.94.0 Copyright 2001-2003 Paul Davis and others. jackd 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 compiled with System V SHM support loading driver .. creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|rt|32bit control device hw:0 configuring for 48000Hz, period = 1024 frames, buffer = 2 periods Couldn't open hw:0 for 32bit samples trying 24bit instead Couldn't open hw:0 for 24bit samples trying 16bit instead Couldn't open hw:0 for 32bit samples trying 24bit instead Couldn't open hw:0 for 24bit samples trying 16bit instead Starting MusE as normal user resulting in this is also bad: joachim@knabber:~/muse/0.7/muse/muse$ ./muse set realtime scheduler: Operation not permitted midi thread 13997 _NOT_ running SCHED_FIFO JACK ERROR: cannot open specified fifo [/dev/shm/jack-1000-ack-fifo-13918-1] for writing (Permission denied) cca_open_socket: could not connect to host 'localhost', service '14541' cca_init: could not connect to server 'localhost' - disabling ladcca JACK ERROR: cannot continue execution of the processing graph (Bad file descriptor) LatencyTo check which latency you get first close "jackstart -d alsa" with a CTRL+C from commandline. Next start the "qjackctl" program which is a nice frontend for the jackdaemon. Now click the "SETUP" button on the right and:
After this you close with an "OK" click. Next start the "jack daemon" with clicking the play button in the main toolbar. If you don't get any error after 2-5 sec everything should be fine. -> Check the "Status" and the "Logs" if everything went fine. Debian noticeMy current unstable system loaded the module "realtime" (because of the entry in the /etc/modules file) but didn't load it with the right parameters. Even after i added the following line into the /etc/modules.conf file. options realtime allcaps=1 The problem was because i had a new version of modprobe ii module-init-to 3.1-rel-2 tools for managing Linux kernel modules ii modutils 2.4.26-1.1 Linux module utilities and because of that i had to add ln -s /etc/modules.conf /etc/modprobe.conf |