Monday, November 30, 2009

ulimit



Do you want to enable realtime priority or change maximum memory locking with non root user?, the /etc/security/limits.conf store this limitation, for list of limitation issue a uname -a command, the name of limitation is described in limits.conf file. This is a example to enable realtime priority and change maximum locked memory to user ajhwb:

ajhwb    -    rtprio     60
ajhwb    -    memlock    512


Now save the file, if the affected user is currently login, logout first and re-login. Changes are made after next login. You may want to test by write a simple code that switch to a realtime scheduler and priority or you can use chrt utility, also test maximum locked memory more than 64Kb as standard definition. There are many you can change in the limits.conf, have fun!

Sunday, November 29, 2009

CONFIG_PREEMPT_RT kernel patch



On rt-users kernel mailing lists Linus said:
"Controlling a laser with Linux is crazy, but everyone in this room is crazy in his own way. So if you want to use Linux to control an industrial welding laser, I have no problem with your using PREEMPT_RT" -- Linus Torvalds

As you may know that the standard build Linux kernel is always preempt high priority user-mode process when kernel-mode process is executing, this bad for time critical application. Realtime application need precise timing for it's work. Let say you control a motor machine, it's use many sensors to determine it's rotor position, you need to know each sensor's state by reading the sensor device. With a high speed motor, you will need to read sensor state for example every 1 milisecond and do something as soon as sensor state change. Imagine what will happen when the kernel-mode process is running and delaying your realtime application while you ask the machine to stop? of course disaster.

In 2.6 kernel version, there are some preemption setting introduced such as CONFIG_PREEMPT_VOLUNTARY and CONFIG_PREEMPT, but these are not meet a realtime application that need very small latencies. The PREEMPT_RT patch convert Linux to be fully preemptible kernel, this done with:
  • Making in-kernel locking-primitives (using spinlocks) preemptible though reimplementation with rtmutexes.

  • Critical sections protected by i.e. spinlock_t and rwlock_t are now preemptible. The creation of non-preemptible sections (in kernel) is still possible with raw_spinlock_t (same APIs like spinlock_t).

  • Implementing priority inheritance for in-kernel spinlocks and semaphores. For more information on priority inversion and priority inheritance please consult Introduction to Priority Inversion.

  • Converting interrupt handlers into preemptible kernel threads: The RT-Preempt patch treats soft interrupt handlers in kernel thread context, which is represented by a task_struct like a common user space process. However it is also possible to register an IRQ in kernel context.

  • Converting the old Linux timer API into separate infrastructures for high resolution kernel timers plus one for timeouts, leading to user space POSIX timers with high resolution.


Main Maintainer: Ingo Molnar, Thomas Gleixner
Website: http://rt.wiki.kernel.org/index.php/Main_Page
Files: http://www.kernel.org/pub/linux/kernel/projects/rt/

Thursday, November 05, 2009

Sierra's AirCard 875U Modem



This is wvdial.conf configuration with Sierra's AirCard 875U USB Modem, it works on Debian Lenny (kernel-2.6.26)

[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 9600
Init = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Phone = *99#
Username = www.xlgprs.net
Password = proxl
New PPPD = yes


lsusb output:
Bus 004 Device 002: ID 1199:6812 Sierra Wireless, Inc. MC8775 Device