kernel-rt

Enable real-time capabilities of the mainline kernel Carsten Emde
< C. >
Revision History
Revision 0.12006-12-07
First release
Revision 0.22006-12-13
CONFIG_DEBUG_PREEMPT must be set to obtain /proc/latency_trace
Revision 0.32006-12-26
Omitted to initialize /proc/sys/kernel/preeempt_max_latency
Revision 0.42007-03-19
Added paragraph on Ubuntu, thanks to Alessio Igor Bogani
Revision 0.52007-04-25
Removed .config settings, provided menuconfig description, added latency histogram Revision 0.62007-05-10
中国管理Introduced latency fighting
Revision 0.72007-05-31
Added latency trace example
Revision 0.82007-10-09
Adapted to the download directory , removed dead links to Fedora prebuilt kernels Revision 0.92008-08-29
Adapted to 2.6.24.7-rt17, added a section on ketchup, added debug fs, mentioned stress tools Revision 0.102008-12-10
Adapted to 2.6.24.7-rt23, updated kernel CONFIGs
Revision 0.112009-11-07
Adapted to 2.6.31.5-rt17, updated kernel CONFIGs, dirs and files
Table of Contents
1. Introduction
2. Installation
2.1. Ubuntu Feisty (7.04)
2.2. Other 2.6 systems
3. Testing and using the realtime-preempt patch
3.1. Built-in tools
3.2. External testing tool
3.3. Latency fighting
1. Introduction
In August 2006, a large part of the realtime-preempt kernel patch that is maintained by Ingo Molnar, Thmomas Gleixner and Steven Rostedt was merged into the mainline kernel and is now immediately available. A number of functions, however, still is only available, if the realtime-preempt patch is applied. It is planned to merge the vast majority of these functions into the mainline kernel before the end of 2008. In addition to the traditional installation method that requires download, patch and recompilation of the kernel, an apt repository is now provided that greatly facilitates the installation of the realtime-preempt patch. This mechanism, however, is currently only available when the Ubuntu Feisty distribution is used. It is expected that Redhat Enterprise Linux and Fedora will contain prepatched realtime-preempt kernels in the near future.
This HOWTO explains how to install, configure, test and use the realtime- preempt kernel patch in Ubuntu Feisty (7.04) and other 2.6 systems.
2. Installation
2.1. Ubuntu Feisty (7.04)
Add, as root, to your /etc/apt/sources.list (remember to do a backup of this file) the following line:
# deb ware.it/ubuntu feisty/
Then execute:
# wget -q ware.it/ubuntu/feisty/BBA3222D.gpg -O- | sudo apt-key add -
# sudo apt-get update
# sudo apt-get install linux-realtime
The provided packages include realtime-enabled kernels as well as the cyclictest utility (see below). Thanks to Alessio Igor Bogani for making these kernels available. Additional information is given here.
2.2. Other 2.6 systems
2.2.1. Download and patch the kernel manually
Download the mainstream kernel sources and the corresponding realtime-preempt patch, for example linux-2.6.31.5 and patch-2.6.31.5-rt17:
# cd /usr/src/kernels
# wget /pub/linux/kernel/v2.6/linux-2.6.31.5.tar.bz2
# wget /pub/linux/kernel/projects/rt/patch-2.6.31.5-rt17.bz2 Unpack the kernel:
# tar -jxvf linux-2.6.31.5.tar.bz2
Rename the kernel directory:
# mv linux-2.6.31.5 linux-2.6.31.5-rt17
Apply the patch:
# bunzip2 patch-2.6.31.5-rt17.bz2
# cd linux-2.6.31.5-rt17
# patch -p1 <../patch-2.6.31.5-rt17
2.2.2. Download and patch the kernel using ketchup
Alternatively, you can let ketchup do the above work for you automatically:
硫酸银
# cd /usr/src/kernels
# mkdir tmp
# cd tmp
# ketchup -r -G 2.6.31.5-rt17
Matt Mackall’s and Steven Rostedt’s ketchup is available at
dhat/srostedt/rt/tools/ketchup-0.9.8-rt3. To install it, type
上海卫生和计划生育委员会# wget -O /usr/local/bin/ketchup dhat/srostedt/rt/tools/ketchup-0.9.8-rt3 # chmod +x /usr/local/bin/ketchup
2.2.
3. Configure and build the kernel
After the patched kernel is available on your system, copy the configuration file as provided by your distribution to the file .config:
# cp /boot/config-‘uname -r‘ .config
Invoke the text based kernel configuration menu:
# make menuconfig
The preemption model is selected along with the processor type and features:
Processor type and features  --->
Preemption Mode (Complete Preemption (Real-Time))  --->
Debug, trace and diagnostic tools are part of the "kernel hacking" settings, for example:
Kernel hacking  --->
[*] Tracers  --->
--- Tracers
[*]  Kernel Function Tracer
鄄城盐矿
[*]  Interrupts-off Latency Tracer
[*]    Interrupts-off Latency Histogram
[*]  Preemption-off Latency Traver
[*]    Preemption-off Latency Histogram
[*]  Scheduling Latency Tracer
[*]    Scheduling Latency Histogram
[*]  Missed timer offsets histogram
These settings, however, are only useful during development and evaluation. Some of them are better disabled when the system goes into production. The scheduling latency and the missed timer offsets histograms, however, only slightly interfere with the system and may, thus, be used to continuously register the wakeup latency under production conditions. In any case, make sure that stack overflow checking is disabled, since this may produce additional latencies when enabled:
Kernel hacking  --->
[ ] Check for stack overflows
The new kernel is then compiled, linked and installed as usual.
# make
# make modules_install install
When the system is rebooted, the newly provided kernel becomes part of the boot menu and can be selected.
Should you happen to be the proud owner of a multi-core processor, be sure to specify the -j <jobs> option of make where <jobs> is twice the number of cores your processor has, as this will speed up kernel compilation considerably.
3. Testing and using the realtime-preempt patch
3.1. Built-in tools
The kernel version must now contain the tags PREEMPT and RT such as
uname -v
#42 SMP PREEMPT RT Fri Nov 6 18:55:29 CET 2009
or something went completely wrong, otherwise.
In order to access the built-in diagnostic tools, the debug file system must be mounted. This is either done manually by entering
# mount -t sysfs nodev /sys
# mount -t debugfs nodev /sys/kernel/debug
or by appending the lines
nodev /sys sysfs defaults 0 0
nodev /sys/kernel/debug debugfs defaults 0 0
to the file /etc/fstab to have the debug file system mounted automatically at boot time.
Note
In earlier kernels, the built-in diagnostic tools were immediately available in the proc file system that is normally mounted by default.
The histograms of the wakeup latencies (one per CPU) are available here:
# ls /sys/kernel/debug/tracing/latency_hist/wakeup_latency/CPU?
From 2.6.2.31 onwards, the files are in:
# ls /sys/kernel/debug/tracing/latency_hist/wakeup/CPU?
This configuration feature is always available in the prebuilt Ubuntu kernels; in the locally created kernels it is only available, if configured as shown above. The granularity of the histograms amounts to one microsecond:
# grep -v " 0$" /sys/kernel/debug/tracing/latency_hist/wakeup*/CPU0
#Minimum latency: 0 microseconds.
energyplus#Average latency: 7 microseconds.
#Maximum latency: 39 microseconds.
#Total samples: 7069336
#There are 0 samples greater or equal than 10240 microseconds
#usecs          samples
0            249884
1            120023
e1592            338781
3            197834
4            210872
5            150366
6              45870
7            1053204
8            564637
9            273756
10            190432
11            483611
12            328509
13              44716

本文发布于:2024-09-21 01:44:14,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/349604.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:管理   委员会   鄄城   中国   上海
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议