本文主要是給自己看的,以便日後查閱。
yum grouplistyum groupinstall "GNOME Desktop"yum groupinstall "Development Tools"yum install cscopeyum install ctagsyum install screenyum install grub-customizeryum install ncurses-develyum install openssl-develyum install gccyum install gcc-c++yum install tmux cscope ctags screen grub-customizer ncurses-devel openssl-devel gcc gcc-c++ patch *lzo* *elf* vim-enhanced git bison readline-devel snappy-devel wget tcl tcl-devel tk tk-devel git-email autoconf automakewget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.10.1.tar.xzxz -dk llinux-4.10.1.tar.xz (decompress and keep)tar xf linux-4.10.1.tarcd linux-4.10.1cp /boot/config-3.10.0-514.el7.x86_64 .configmake menuconfig (load, save, exit)CONFIG_STRICT_DEVMEM=n # for crashCONFIG_MODVERSIONS=nCONFIG_UPROBE_EVENTS=yCONFIG_ARCH_SUPPORTS_UPROBES=yCONFIG_UPROBES=ymakemake modules_installmake install# for crashhttp://people.redhat.com/anderson/yum install patchyum install *lzo*yum install bisonyum install readline-devel snappy-develCONFIG_STRICT_DEVMEM=ncrash> mod -s e1000ecrash> net NET_DEVICE NAME IP ADDRESS(ES)ffff88017e9da000 lo 127.0.0.1ffff880207b98000 enp0s25 192.168.31.190ffff88020a918000 wlp3s0 192.168.31.245ffff880214aea000 virbr0 192.168.122.1ffff88020c730000 virbr0-nic crash> net_device...SIZE: 2304crash> px 2304$4 = 0x900crash> e1000_adapter.napi ffff880207b98900 napi = { poll_list = { next = 0xffff880207b98c90, prev = 0xffff880207b98c90 }, state = 8, weight = 64, gro_count = 0, poll = 0xffffffffa01d94d0 <e1000e_poll>, poll_owner = -1, dev = 0xffff880207b98000, gro_list = 0x0, skb = 0x0, timer = { node = { node = { __rb_parent_color = 18446612141033753816, rb_right = 0x0, rb_left = 0x0 }, expires = 0 }, _softexpires = 0, function = 0xffffffff816155a0 <napi_watchdog>, base = 0xffff88021e2525c0, state = 0 '\000', is_rel = 0 '\000', start_pid = -1, start_site = 0x0, start_comm = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" }, dev_list = { next = 0xffff880207b98060, prev = 0xffff880207b98060 }, napi_hash_node = { next = 0x0, pprev = 0xffffffff81d7e288 <napi_hash+8> }, napi_id = 8193 }# for systemtaphttps://sourceware.org/systemtap/getinvolved.htmlyum install *elf*stap -ve 'probe begin { log("hello world") exit () }'stap -c df -e 'probe syscall.* { if (target()==pid()) log(name." ".argstr) }'
function stm{ if [[ $# == 1 ]]; then module=mlx5_core function=$1 file=$dir/$1.stp elif [[ $# == 2 ]]; then module=$1 function=$2 file=$dir/$2.stp else return fi dir=/root/stap mkdir -p $dir cat << EOF > $file#!/usr/local/bin/stap -vglobal startfunction timestamp:long() { return gettimeofday_us() - start }probe begin { start = gettimeofday_us() }global i=0;probe module("$module").function("$function"){ print_backtrace() printf("parms: %s\n", \$\$parms); printf("execname: %s\n", execname()); printf("ts: %d\n", timestamp() / 1000000); print_ubacktrace() printf("%d\n", i++);}EOFset -x cat $file cd $dir chmod +x $file stap -v -k -d act_gact -d cls_flower -d act_mirred -d /usr/sbin/ethtool -d cls_flower -d udp_tunnel -d sch_ingress -d /home1/chrism/iproute2/tc/tc -d 8021q -d /usr/sbin/ip -d /usr/sbin/ifconfig -d /usr/sbin/tc -d devlink -d mlx5_core -d /usr/sbin/devlink -d vhost -d vhost_net -d tun -d kernel -d openvswitch -d vport_vxlan -d vxlan -d /usr/lib64/libpthread-2.17.so -d /usr/sbin/ovs-vswitchd -d /usr/lib64/libc-2.17.so $fileset +x}
function str{ [[ $# != 1 ]] && return dir=/root/stap file=$dir/$1.stp mkdir -p $dir mod=$(grep -w $1 /proc/kallsyms | awk '{print $4}' | tr -d ] | tr -d [) echo $mod if [[ "$mod" == "" ]]; then cat << EOF > $file#!/usr/local/bin/stapglobal startfunction timestamp:long() { return gettimeofday_us() - start }probe begin { start = gettimeofday_us() }probe kernel.function("$1").return{/* print_backtrace() */ printf("%x\t%d\n", \$return, \$return); printf("ts: %d\n", timestamp()/1000000);}EOF else cat << EOF > $file#!/usr/local/bin/stapglobal startfunction timestamp:long() { return gettimeofday_us() - start }probe begin { start = gettimeofday_us() }probe module("$mod").function("$1").return{/* print_backtrace() */ printf("%x\t%d\n", \$return, \$return); printf("ts: %d\n", timestamp()/1000000);}EOF fiset -x cat $file cd $dir chmod +x $file stap -v -k -d vhost -d vhost_net -d tun -d kernel -d openvswitch -d vport_vxlan -d vxlan -d /usr/lib64/libpthread-2.17.so -d /usr/local/sbin/ovs-vswitchd -d /usr/lib64/libc-2.17.so $fileset +x}mybuild () {set -x; ver=4.10.1 module=e1000e; linux_dir=/home/mishuang/linux-$ver; src_dir=$linux_dir/drivers/net/ethernet/intel/$module; cd $dir_dir; sudo make CONFIG_E1000E=m -C $linux_dir M=$src_dir modules; sudo cp $src_dir/$module.ko /lib/modules/$ver/kernel/drivers/net/ethernet/intel/$module; sudo rmmod $module; sudo modprobe $module;set +x}$ yum provides /etc/passwd$ rpm -qf /etc/passwd