For problems or questions, please e-mail lkst-develop@lists.sourceforge.net For bugs, please submit a bug via the project page: http://sourceforge.net/projects/lkst/ Prerequisites ============= 1. Linux Kernel State Tracer software: lkst-2.3.1.tar.gz can be downloaded from the project page. 2. Linux kernel version 2.6.9 (*) linux-2.6.9.tar.bz2 can be downloaded from ftp://ftp.kernel.org/pub/linux/kernel/v2.6/ (*) This version of LKST is including a set of patches for linux-2.6.12. If you want to install it, please see Appendix B. !ATTENTION! For kernel modules of Linux 2.6, you need new module-init-tools. The latest version of module-init-tools can be downloaded from ftp://ftp.kernel.org/pub/linux/utils/kernel/module-init-tools/ Installation ============ 0) Prepare archives ------------------------------------------------------------ 1. cd $(SOMEWHERE_LKST) 2. Untar the LKST archive tar -xzf lkst-2.3.1.tar.gz 3. cd $(SOMEWHERE_KERNEL) 4. Untar Linux kernel source tar -xjf linux-2.6.9.tar.bz2 1) Build and Install Kernel patch for kernel versions 2.6.9 ----------------------------------------------------------------- 1. Login as root 2. Issue a command to apply a series of patches to the kernel source. cd $(SOMEWHERE_LKST)/lkst-2.3.1/ make patch KPRESRC=$(SOMEWHERE_KERNEL)/linux-2.6.9 or ./scripts/enpatch.sh $(SOMEWHERE_KERNEL)/linux-2.6.9 After that, answer following questions. Apply preassigned page table patch (if not, apply vmsync patch automatically) (Y)es/(N)o? [Y] Apply performace analyzing patch(recommend) (Y)es/(N)o? [Y] Apply early boot-time tracing patch(optional) (Y)es/(N)o? [N] Apply extra event set patch(optional) (Y)es/(N)o? [N] Apply ignore hooks placed in inline-functions patch(optional) (Y)es/(N)o? [N] If you'd like fullset of LKST, answer "y" for all questions. (*) The order of patches and details are described in Appendix A. 3. Build kernel a. Kernel Configuration cd $(SOMEWHERE_KERNEL)/linux-2.6.9 make menuconfig b. (i386 only) Under "Processor type and features" i. Select "64GB" for "High Memory Support" or i. Select "y" for "Assign page tables for non-contiguous mapped area on boot" c. Under "Kernel hacking", select the following: i. Select "y" for "Kernel debugging". ii. Select "y" for "Kernel Hook Support". iii. Select "y" for "Magic SysRq key". (optional) iv. Select "m" for "Kernel State Tracing (LKST)". v. Configure other kernel config settings as needed. d. Save and Exit e. make modules bzImage 4. Install kernel modules and the kernel make modules_install make install 5. If you use lilo, run /sbin/lilo to read modified lilo.conf or If you use the Fedora Core or the Red Hat distributions, you may fix grub.conf to give the new kernel a root partition as a device file path (ex. /dev/hda1 ) instead of a label format (ex. "LABEL=/") . 6. reboot !ATTENTION! You must build 2)-4) after the kernel was built. 2) Prepare to install tools --------------------------- 1. Log in as root 2. cd $(SOMEWHERE_LKST)/lkst-2.3.1/ 3. make config (Or, if you have to specify kernel-source directory, do as following make config KSRC=$(SOMEWHERE_KERNEL)/linux-2.6.9 ) !EXPERIMENTAL! If you'd like to use LKST with LKCD, Specify lkcdutils' source directory as following. make config LKCDDIR=$(SOMEWHERE_LKCDUTILS)/lkcdutils 3.a) Install the userspace tools -------------------------------- 1. Log in as root 2. cd $(SOMEWHERE_LKST)/lkst-2.3.1/lkstutils 3. Build userspace tools a. make b. make install 3.b) Or, install the userspace tools from the rpm package --------------------------------------------------------- 1. Download lkstutils-2.3.1-1.i386.rpm from the project page. 2. Log in as root 3. Issue the following command: rpm -Uvh lkstutils-2.3.1-1.i386.rpm 4) Install addon tools [Optional] --------------------------------- 1. Log in as root 2. cd $(SOMEWHERE_LKST)/lkst-2.3.1/lkstaddons 3. Build and install a. make b. make install 5) Install lkst log tools [Optional] --------------------------------- 1. Log in as root 2. cd $(SOMEWHERE_LKST)/lkst-2.3.1/lkstlogtools 3. Build and install a. make b. make install Configure your system ====================== 5) Load lkst module ------------------- To load lkst module, issue following command: modprobe lkst 6) Kernel parameter ------------------- The following kernel parameter can be passed: lkst_maxvm= Use integer value for LKST available memory size. Users can limit the amount of memory size for LKST. If LKST is embedded in kernel, you can pass following parameter: lkst_init_maskset= Use integer value for maskset id. You can choose between 0, 1, or 2. Default value is 2. If you choose any value except values described above, the value is set as default value. 7) Module parameter --------------------- The following module parameter can be passed: lkst_init_buffer_size= Use integer value for logging buffer size(in byte). You can use the value larger than 8192. Default value is 65536. If amount of buffer size is larger than LKST available memory described above, the size is set as default value. example: modprobe lkst lkst_init_buffer_size=1048576 NOTE!!! If you specify a value, kernel memory will be used by the value. So you may avoid specifying large value. Also you can pass following module parameter: lkst_init_maskset= This parameter is the same meaning as kernel parameter's one. This available if you make LKST as module. example: modprobe lkst lkst_init_maskset=0 If you want to configure lkst module, you will need to add the following lines to /etc/modprobe.conf: alias lkst lkst options lkst lkst_init_buffer_size=65536 -------------------------------------------------------------------------- Appendix A Details of patching the kernel manually --------------------------------------- 1.a. Issue command to patch kernel for preassigned-pagetable cd $(SOMEWHERE_KERNEL)/linux-2.6.9 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/preassign-2.6.9.patch 1.b. (OPTIONAL) Or if you would like to use vmsync(*) instead of preassigned-pagetable, do following. cd $(SOMEWHERE_KERNEL)/linux-2.6.9 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/vmsync-2.6.9.patch (*) vmsync() is an API to synchronize the pagetable entries of a region of non-contiguous memory area between all processes. It avoids page-fault exception on that region. If you choose 1.b., you must do 8.b. If unsure, do step 1.a. 2. Issue command to patch kernel for KernelHooks (as following order) cd $(SOMEWHERE_KERNEL)/linux-2.6.9 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/kernelhooks-v1.8-269-base.patch patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/kernelhooks-v1.8-fix_kconfig.patch patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/kernelhooks-v1.8-fix_kmakefile.patch patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/kernelhooks-v1.8-resolve_dependency.patch patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/kernelhooks-v1.8-support_ia64.patch patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/kernelhooks-v1.8-support_x86_64.patch 3. Issue command to patch kernel for LKST core patch cd $(SOMEWHERE_KERNEL)/linux-2.6.9 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/lkst-core.patch 4. Issue command to patch kernel for LKST standerd event-set patch cd $(SOMEWHERE_KERNEL)/linux-2.6.9 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/lkst-events-std.patch 5. Issue command to patch for LKST performance analysis event set patch cd $(SOMEWHERE_KERNEL)/linux-2.6.9 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/lkst-events-perf.patch 6. (OPTIONAL) Issue command to patch kernel for LKST early boot-time tracing patch cd $(SOMEWHERE_KERNEL)/linux-2.6.9 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/lkst-earlylog.patch 7. (OPTIONAL) Issue command to patch kernel for LKST extra event set patch cd $(SOMEWHERE_KERNEL)/linux-2.6.9 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/lkst-events-ext1.patch 8. (OPTIONAL) Issue command to patch kernel for LKST ignore hooks placed in inline-functions patch cd $(SOMEWHERE_KERNEL)/linux-2.6.9 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/lkst-ign-inline.patch 9. (OPTIONAL) If you choose using vmsync, you should patch an additional patch after step 3. cd $(SOMEWHERE_KERNEL)/linux-2.6.9 patch -p 1 < $(SOMEWHERE_LKST)/lkst-2.3.1/patches/lkst_use_vmsync.patch Appendix B Use LKST on the linux-2.6.12 ---------------------------- 1. Linux kernel version 2.6.12 linux-2.6.12.tar.bz2 can be download from ftp://ftp.kernel.org/pub/linux/kernel/v2.6/ 2. Untar Linux kernel source tar -xjf linux-2.6.12.tar.bz2 3. Apply LKST for linux-2.6.12 patch set to the kernel cd $(SOMEWHERE_LKST)/lkst-2.3.1 ./scripts/enpatch.sh $(SOMEWHERE_KERNEL)/linux-2.6.12 patches/2.6.12 4. Build and Install the kernel See Installion 1) 3 - 6 for details. ============================================================== COPYRIGHT (C) HITACHI,LTD. 2001-2004,2005 COPYRIGHT (C) FUJITSU,LTD. 2001-2004 ==============================================================