I tryed to install PAPI in a Cent OS 5.5 PC box.
The Linux kernel supported in Cent OS 5.5 is rather old kernel 2.6.18. Since PAPI(Performance API) requires hardware performance monitoring functionality, PerfCtr or Perf Events for Linux on Intel CPUs, Thus I installed the Linux kernel version 2.6.37 which officially supports Perf Events system, and we need not patch the perfctr patch, contained in PAPI source dirs, to the kernel source.
In order to upgrade Linux kernel for the Cent OS 5.5, there ware a couple of pitfalls to work with.
Check whether the updated system/kernel works or not by rebooting the system.
At this point we have the fllowing packages (checked by "rpm -qa | grep kernel").We need "/usr/src/kernels/2.6.18-194.32.1.el5-x86_64/.config" to compile and set up the new kernel "linux-2.6.37.tar.bz2".
# cd /usr/src # tar -xjvf ${your_source_path}/linux-2.6.37.tar.bz2
# cd /usr/src/linux-2.5.37 # make mrproper # cp ../kernels/2.6.18-194.32.1.el5.centos.plus-x86_64/.config ./ # make oldconfig"make oldconfig" returns huge amount of kernel setting questions. I simply type many returns for default settings.
# make menuconfig
At this point we have to enable,
I have the following results for the sysfs related settings.
# grep SYSFS .config CONFIG_SYSFS_DEPRECATED=y CONFIG_SYSFS_DEPRECATED_V2=y CONFIG_WIRELESS_EXT_SYSFS=y CONFIG_ISCSI_BOOT_SYSFS=m CONFIG_RTC_INTF_SYSFS=y CONFIG_SYSFS=y # grep PERF .config | sed '/^#/d' CONFIG_HAVE_PERF_EVENTS=y CONFIG_PERF_EVENTS=y CONFIG_HAVE_PERF_EVENTS_NMI=y CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CLS_U32_PERF=y
If you use iptables (net filtering, firwall, NAT,...) functions, the related kerenl options should be properly selected. I have checked all the non experimental options in
# make rpm
The kernel rpm file is generated at /usr/src/redhat/RPMS/x86_64/kernel-2.6.37-1.x86_64.rpm
In order to make PAPI we need the corresponding kernel headers.
# make headers_install
This produces the kernel header tree in /usr/src/linux-2.6.37/usr/include. It is convenient to make tar.gz file for this tree to install them manually.
# cd usr # tar cvf kernel-headers-2.6.37.1.tar ./include # gzip kernel-headers-2.6.37.1.tar
Install new kernel, kernel boot image disk, and kernel headers.
Note: The following descriptions may have a risk destroying your system. Please do it your own risk.
# cd /usr/src/linux-2.6.37 # rpm -ivh /usr/src/redhat/RPMS/x86_64/kernel-2.6.37-1.x86_64.rpmThe kernel files are installed in /boot:
# ls /boot/*37* /boot/System.map-2.6.37 /boot/config-2.6.37 /boot/vmlinux-2.6.37.bz2 /boot/vmlinuz-2.6.37
# rpm -e --nodeps kernel-headers-2.6.18-194.32.1.el5
# cd /usr # tar xzvf /usr/src/linux-2.6.37/usr/kernel-headers-2.6.37.1.tar.gz
# /sbin/mkinitrd /boot/initrd-2.6.37.img 2.6.37
# cd /boot/grub # vi grub.confMy grub.conf is:
# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,1) # kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00 # initrd /initrd-version.img #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,1)/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.37) root (hd0,1) kernel /vmlinuz-2.6.37 ro root=/dev/VolGroup00/LogVol00 rhgb quiet ipv6.disable=1 initrd /initrd-2.6.37.img title CentOS (2.6.18-194.32.1.el5.centos.plus) root (hd0,1) kernel /vmlinuz-2.6.18-194.32.1.el5.centos.plus ro root=/dev/VolGroup00/LogVol00 rhgb quiet initrd /initrd-2.6.18-194.32.1.el5.centos.plus.img title Other rootnoverify (hd0,0) chainloader +1
ipv6.disable=1 option in the grub.conf is required to avoid "svc: failed to register lockdv1 RPC service (errno 97)." error message for new kernel.
If you need IPv6 functionality, the option ipv6.disable=1 should not be indicated, but the RPC problem will occur. I do not know how to avoid this issue.
When you reboot the system, network ifup scripts may return warnings relating to IPv6 configurations in the boot up sequence.
The new kerenel rtc (hardware clock) module uses rtc_cmos module and produces /dev/rtc0 device file. The CentOS and its hwclock command assume the device should be /dev/rtc. (it seems /dev/rtc0 is automatically generated) When reboot the system with new kernel, the system cannot recover the system time from the hardware clock and shows incorrect time (time zone) without /dev/rtc file. The boot up script /etc/rc.sysinit should be properly modified to avoid this issue before reboot the system as follows. (Be sure to back up original files)
The original lines of /etc/rc.sysinit:(Line#) 268 echo -en $"\t\tPress 'I' to enter interactive startup." 269 echo 270 fi 271 272 # Set the system clock. 273 update_boot_stage RCclock 274 ARC=0is modified to:
(Line#) 268 echo -en $"\t\tPress 'I' to enter interactive startup." 269 echo 270 fi 271 272 ##################################################### 273 # Added for kernel 2.6.37 274 if [ ! -f /proc/driver/rtc ]; then 275 action $"Loading rtc_cmos driver: " /sbin/modprobe rtc_cmos 276 fi 277 278 ### ELREPO: Make the newer device nodes to accomodate hwclock 279 RTC_MAJOR_NO=`/bin/awk '/rtc/ { print $1 }' /proc/devices` 280 if [ -n "$RTC_MAJOR_NO" ]; then 281 action $"Creating /dev/rtc0: " /bin/mknod /dev/rtc0 c $RTC_MAJOR_NO 0 282 action $"Creating /dev/rtc: " /bin/ln -sf /dev/rtc0 /dev/rtc 283 fi 284 # end add 285 ##################################################### 286 287 # Set the system clock. 288 update_boot_stage RCclock 289 ARC=0
If /dev/rtc0 is automatically generated by modprobe, the line 280 can be commented out.
The new kernel has an inconsistency to the original CentOS udev rules (at leaset in my case), and may produce the "wait_for_sysfs: waiting for '/sys/devices/pci0000:00/0000:00:10.0/host0/ioerr_cnt' failed" errors when rebooting the system. I modified the udev set up rules.
The original lines of /etc/udev/rules.d/05-udev-early.rules:
(Line#) 1 # sysfs is populated after the event is sent 2 ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" 3 ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" 4 ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt"is modified to:
(Line#) 1 # sysfs is populated after the event is sent 2 ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" 3 ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" 4 #ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" 5 ACTION=="add", SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", WAIT_FOR_SYSFS="ioerr_cnt"
Refs. on kernel compilation and installation. [1], [2], [3], [4].
Ref. on rtc. [5].
Ref. on wait_for_sysfs errors. [6].
After upgrading the CentOS kernel. PAPI can be installed using Perf Event functionality of the new kernel.
Refs. on PAPI. [http://icl.cs.utk.edu/papi/], [papi@mikiwiki].