下载地址:
内核打xenomai的补丁
cd linux-3.18.20
/opt/xenomai-3-3.0.6/scripts/prepare-kernel.sh --arch=x86 --ipipe=../ipipe-core-3.18.20-x86-9.patch
menuconfig配置
官网要求禁用以下选项:
Power management and ACPI options->CPU Frequency scaling
Power management and ACPI options->ACPI (Advanced Configuration and Power Interface) Support-> 除过下面几项外其它全部禁用
<*> AC Adapter
<*> Battery
{*} Button
{M} Video
<*> Fan
-*- NUMA support
Power management and ACPI options->CPU Idle-> CPU idle PM support
Executable file formats / Emulations-> IA32 Emulation 必须禁用,否则编译不过
Kernel hacking-> Kernel debugging 必须禁用,否则编译不过
Bus options (PCI etc.)-> Message Signaled Interrupts (MSI and MSI-X)
Device Drivers>Input device support>Generic input layer>Miscellaneous devices (来源于网络)
make -j 46 ; make modules ; make modules_install ; make install
编译xenomai的库
cd /opt/xenomai-3.0.6
./configure
make;make install
使用xenomai的库重新编译rt 测试程序
修改rt的Makefile文件,增加:
33 XENO_CONFIG := /usr/xenomai/bin/xeno-config
34 CFLAGS += $(shell $(XENO_CONFIG) --posix --cflags)
35 LDFLAGS += $(shell $(XENO_CONFIG) --posix --ldflags)
36 CC := $(shell $(XENO_CONFIG) --cc)
[root@localhost rt-tests]# ldd cyclictest
linux-vdso.so.1 => (0x00007ffc247fe000)
libcobalt.so.2 => /lib/libcobalt.so.2 (0x00007fdf27117000)
libmodechk.so.0 => /lib/libmodechk.so.0 (0x00007fdf26f15000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdf26cf9000)
librt.so.1 => /lib64/librt.so.1 (0x00007fdf26af1000)
libnuma.so.1 => /lib64/libnuma.so.1 (0x00007fdf268e5000)
libc.so.6 => /lib64/libc.so.6 (0x00007fdf26524000)
/lib64/ld-linux-x86-64.so.2 (0x00007fdf27338000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fdf2630e000)
保持测试1小时的结果:
[root@localhost ~]# date && taskset f0 cyclictest -p 99 -m -c 0 -i 100 -n -h 30 -D 1h && date
Wed Jan 10 07:31:41 CST 2018
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 1.00 1.01 0.96 1/445 7222
T: 0 ( 5168) P:99 I:100 C:35999902 Min: 0 Act: 0 Avg: 0 Max: 16
# Histogram
000000 35999717
000001 000159
000002 000000
000003 000000
000004 000017
000005 000036
000006 000048
000007 000006
000008 000009
000009 000004
000010 000001
000011 000001
000012 000000
000013 000000
000014 000001
000015 000000
000016 000001
000017 000000
000018 000000
000019 000000
000020 000000
000021 000000
000022 000000
000023 000000
000024 000000
000025 000000
000026 000000
000027 000000
000028 000000
000029 000000
# Total: 036000000
# Min Latencies: 00000
# Avg Latencies: 00000
# Max Latencies: 00016
# Histogram Overflows: 00000
# Histogram Overflow at cycle number:
# Thread 0:
Wed Jan 10 08:31:41 CST 2018
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.18.20 #2 SMP Tue Jan 9 05:03:01 CST 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.18.20 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap iommu=pt usbcore.autosuspend=-1 selinux=0 enforcing=0 nmi_watchdog=0 softlockup_panic=0 intel_iommu=on audit=0 cgroup_disable=memory kvm-intel.eptad=0 hugepagesz=1G hugepages=2 hugepagesz=2M hugepages=0 default_hugepagesz=1G isolcpus=1-23,25-47 rcu_nocbs=1-23,25-47 kthread_cpus=0,24 irqaffinity=0,24 nohz_full=1-23,25-47 rhgb quiet