├── README.md ├── pkg-builds ├── deb │ ├── 0001-5.10-base-packaging.patch │ ├── 0001-base-packaging.patch │ └── ampere-lts-ubuntu-build.sh └── rpm │ ├── README.md │ ├── SOURCES │ ├── Module.kabi_aarch64 │ ├── Module.kabi_dup_aarch64 │ ├── Module.kabi_dup_ppc64le │ ├── Module.kabi_dup_s390x │ ├── Module.kabi_dup_x86_64 │ ├── Module.kabi_ppc64le │ ├── Module.kabi_s390x │ ├── Module.kabi_x86_64 │ ├── check-kabi │ ├── cpupower.config │ ├── cpupower.service │ ├── filter-aarch64.sh │ ├── filter-modules.sh │ ├── filter-ppc64le.sh │ ├── filter-s390x.sh │ ├── filter-x86_64.sh │ ├── generate_all_configs.sh │ ├── generate_bls_conf.sh │ ├── kernel-aarch64-debug.config │ ├── kernel-aarch64.config │ ├── kernel-abi-whitelists-5.10.27-amp_lts.tar.bz2 │ ├── kernel-abi-whitelists-5.4.93-amp_lts.tar.bz2 │ ├── kernel-kabi-dw-5.10.27-amp_lts.tar.bz2 │ ├── kernel-kabi-dw-5.4.93-amp_lts.tar.bz2 │ ├── kernel-ppc64le-debug.config │ ├── kernel-ppc64le.config │ ├── kernel-s390x-debug.config │ ├── kernel-s390x-zfcpdump.config │ ├── kernel-s390x.config │ ├── kernel-x86_64-debug.config │ ├── kernel-x86_64.config │ ├── linux-kernel-test.patch │ ├── mod-extra-blacklist.sh │ ├── mod-extra.list │ ├── mod-extra.sh │ ├── mod-sign.sh │ ├── process_configs.sh │ ├── secureboot.cer │ ├── securebootca.cer │ └── x509.genkey │ ├── SPECS │ ├── kernel-ampere-lts-5.10.spec │ └── kernel-ampere-lts-5.4.spec │ └── ampere-lts-centos-build.sh ├── tests ├── .gitignore ├── README.md ├── ampere_functions │ ├── cpuectlr_el1 │ │ └── altra_cpuectlr_el1.sh │ ├── exec │ │ ├── clock_test.sh │ │ ├── exec.sh │ │ ├── read_tsc │ │ └── test_32bit │ ├── hw_monitor │ │ └── altra_hw_monitor.sh │ ├── leds │ │ └── altra_leds.sh │ ├── numa │ │ ├── numa.sh │ │ └── srat_overlap_check.py │ ├── perf_kvm_stat │ │ └── perf_kvm_stat.sh │ ├── pmu │ │ └── altra_pmu.sh │ ├── ras │ │ └── ras.sh │ └── smmu_filter_fix │ │ └── smmu_filter_fix.sh ├── bin │ └── arm64 │ │ └── skipgen ├── lib │ └── sh-test-lib ├── lkft │ ├── README.md │ ├── kselftest │ │ ├── kselftest-skipfile │ │ ├── kselftest.sh │ │ ├── parse_result.py │ │ └── skipfile-lkft.yaml │ └── ltp │ │ ├── ltp.sh │ │ ├── ltp.yaml │ │ ├── ltp_cmdfile │ │ ├── parse_result.sh │ │ └── skipfile-lkft.yaml ├── patches │ ├── 0001-kselftests-add-skipfile-check-in-test-runner.patch │ └── ltp-aiodio-help-aiodio-test-work-normally.diff └── runall.sh └── tools └── trace-irqoff ├── LICENSE ├── Makefile ├── README.md ├── readme.txt └── trace_irqoff.c /README.md: -------------------------------------------------------------------------------- 1 | # ampere-lts-kernel - DEPRECATED 2 | ## This repository is deprecated and set to archive status. It will eventually be deleted. 3 | Ampere back ported kernel patches for Longterm 5.4 kernel and Longterm 5.10 kernel. 4 | * linux-5.4.y branch: https://github.com/AmpereComputing/ampere-lts-kernel/tree/linux-5.4.y 5 | * linux-5.10.y branch: https://github.com/AmpereComputing/ampere-lts-kernel/tree/linux-5.10.y 6 | 7 | Each patch is indexed by wiki: 8 | * 5.4 kernel patches: https://github.com/AmpereComputing/ampere-lts-kernel/wiki/5.4-LTS-kernel-patches 9 | * 5.10 kernel patches: https://github.com/AmpereComputing/ampere-lts-kernel/wiki/5.10-LTS-kernel-patches 10 | 11 | Patch details are also tracked as issue: 12 | * 5.4 kernel patch: https://github.com/AmpereComputing/ampere-lts-kernel/issues?q=label%3A%225.4+kernel%22 13 | * 5.10 kernel patch: https://github.com/AmpereComputing/ampere-lts-kernel/issues?q=label%3A%225.10+kernel%22 14 | 15 | Tests cases for ampere-lts-kernel: https://github.com/AmpereComputing/ampere-lts-kernel/tree/main/tests 16 | 17 | # Tools - DEPRECATED 18 | 1.) Patches about the Crash tool: 19 | https://github.com/AmpereComputing/ampere-lts-kernel/wiki/The-patches-about-Crash-tool 20 | 21 | 2.) Patches about the lscpu: 22 | https://github.com/AmpereComputing/ampere-lts-kernel/wiki/The-patches-about-lscpu 23 | 24 | -------------------------------------------------------------------------------- /pkg-builds/deb/ampere-lts-ubuntu-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ ! -d ampere-lts-kernel ] && git clone https://github.com/AmpereComputing/ampere-lts-kernel.git 4 | cd ampere-lts-kernel 5 | 6 | git clean -fd && git reset --hard HEAD && git checkout origin/linux-5.4.y 7 | rm -rf debian 8 | git am ../0001-base-packaging.patch || exit 1 9 | 10 | # modify changelog 11 | FILE_CHANGE_LOG=debian.master/changelog 12 | source <(cat Makefile | head -4 | sed 's/ \= /\=/g') 13 | echo "linux (${VERSION}.${PATCHLEVEL}.${SUBLEVEL}-amperelts) focal; urgency=low" > ${FILE_CHANGE_LOG} 14 | echo >> ${FILE_CHANGE_LOG} 15 | echo " ampere-lts-kernel build at commit: $(git rev-parse HEAD)" >> ${FILE_CHANGE_LOG} 16 | echo >> ${FILE_CHANGE_LOG} 17 | echo " -- Bobo $(date -R)" >> ${FILE_CHANGE_LOG} 18 | 19 | # adjust defconfig 20 | sed -i 's/^defconfig.*=.*defconfig/defconfig = altra_5.4_defconfig/g' debian.master/rules.d/arm64.mk 21 | 22 | # start building debs 23 | LANG=C fakeroot debian/rules clean || exit 1 24 | LANG=C fakeroot debian/rules binary || exit 1 25 | 26 | # copy debs 27 | rm -rf ../5.4_debs 28 | mkdir -pv ../5.4_debs 29 | mv ../*.deb ../*.udeb ../5.4_debs 30 | echo "build ampere-lts 5.4 debs success" 31 | 32 | git clean -fd && git reset --hard HEAD && git checkout origin/linux-5.10.y 33 | rm -rf debian 34 | git am ../0001-5.10-base-packaging.patch || exit 1 35 | 36 | # modify changelog 37 | FILE_CHANGE_LOG=debian.master/changelog 38 | source <(cat Makefile | head -4 | sed 's/ \= /\=/g') 39 | echo "linux (${VERSION}.${PATCHLEVEL}.${SUBLEVEL}-amperelts) focal; urgency=low" > ${FILE_CHANGE_LOG} 40 | echo >> ${FILE_CHANGE_LOG} 41 | echo " ampere-lts-kernel build at commit: $(git rev-parse HEAD)" >> ${FILE_CHANGE_LOG} 42 | echo >> ${FILE_CHANGE_LOG} 43 | echo " -- Bobo $(date -R)" >> ${FILE_CHANGE_LOG} 44 | 45 | # adjust defconfig 46 | sed -i 's/^defconfig.*=.*defconfig/defconfig = altra_5.10_defconfig/g' debian.master/rules.d/arm64.mk 47 | 48 | # start building debs 49 | LANG=C fakeroot debian/rules clean || exit 1 50 | LANG=C fakeroot debian/rules binary || exit 1 51 | 52 | rm -rf ../5.10_debs 53 | mkdir -pv ../5.10_debs 54 | mv ../*.deb ../*.udeb ../5.10_debs 55 | echo "build ampere-lts 5.10 debs success" 56 | 57 | -------------------------------------------------------------------------------- /pkg-builds/rpm/README.md: -------------------------------------------------------------------------------- 1 | ## How to build 2 | 3 | cd pkg-builds/rpm 4 | ./ampere-lts-centos-build.sh 5 | 6 | ## How to install 7 | 8 | tar xvf amp_sw_centos_8.0-20210510-5.4.93.tar.xz 9 | cd aarch64 10 | yum -y localinstall kernel* 11 | 12 | ## How to activate new kernel 13 | 14 | grubby --set-default /boot/vmlinuz-5.4.93-amp_lts.el8.20210510+amp.aarch64 15 | 16 | ## How to upgrade kernel version 17 | 18 | To upgrade kernel sublevel in 5.4 and 5.10. E.g. upgrading from v5.4.93 to v5.4.100, Change "rpmversion" in SPECS/kernel-ampere-lts-5.4.spec is enough. 19 | 20 | To upgrade to a new PATCHLEVEL, you should copy a new spec file from the closest spec file. And change "rpmversion" and "kversion" in spec file. Besides this, the shebang patchfix list in spec file need to update as well. -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/Module.kabi_aarch64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmpereComputing/ampere-lts-kernel---DEPRECATED/66a3ee3aa113a8e4e48b41fd21880a56c8ad6109/pkg-builds/rpm/SOURCES/Module.kabi_aarch64 -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/Module.kabi_dup_aarch64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmpereComputing/ampere-lts-kernel---DEPRECATED/66a3ee3aa113a8e4e48b41fd21880a56c8ad6109/pkg-builds/rpm/SOURCES/Module.kabi_dup_aarch64 -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/Module.kabi_dup_ppc64le: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmpereComputing/ampere-lts-kernel---DEPRECATED/66a3ee3aa113a8e4e48b41fd21880a56c8ad6109/pkg-builds/rpm/SOURCES/Module.kabi_dup_ppc64le -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/Module.kabi_dup_s390x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmpereComputing/ampere-lts-kernel---DEPRECATED/66a3ee3aa113a8e4e48b41fd21880a56c8ad6109/pkg-builds/rpm/SOURCES/Module.kabi_dup_s390x -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/Module.kabi_dup_x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmpereComputing/ampere-lts-kernel---DEPRECATED/66a3ee3aa113a8e4e48b41fd21880a56c8ad6109/pkg-builds/rpm/SOURCES/Module.kabi_dup_x86_64 -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/Module.kabi_s390x: -------------------------------------------------------------------------------- 1 | 0x353525e2 __alloc_pages_nodemask vmlinux EXPORT_SYMBOL 2 | 0x08c6f12f __alloc_skb vmlinux EXPORT_SYMBOL 3 | 0x43a53735 __alloc_workqueue_key vmlinux EXPORT_SYMBOL_GPL 4 | 0x39b52d19 __bitmap_and vmlinux EXPORT_SYMBOL 5 | 0xadfdfcef __bitmap_andnot vmlinux EXPORT_SYMBOL 6 | 0xf3e6402e __bitmap_equal vmlinux EXPORT_SYMBOL 7 | 0xbb35675b __bitmap_intersects vmlinux EXPORT_SYMBOL 8 | 0x4df119fa __bitmap_parse vmlinux EXPORT_SYMBOL 9 | 0x63c4d61f __bitmap_weight vmlinux EXPORT_SYMBOL 10 | 0x88db9f48 __check_object_size vmlinux EXPORT_SYMBOL 11 | 0xef23e5f2 __class_register vmlinux EXPORT_SYMBOL_GPL 12 | 0x477e59a3 __cpu_online_mask vmlinux EXPORT_SYMBOL 13 | 0xeab12d78 __cpu_possible_mask vmlinux EXPORT_SYMBOL 14 | 0x123fe020 __cpu_present_mask vmlinux EXPORT_SYMBOL 15 | 0x0e4ba049 __cpuhp_remove_state vmlinux EXPORT_SYMBOL 16 | 0xf66a486e __cpuhp_setup_state vmlinux EXPORT_SYMBOL 17 | 0xf487d506 __free_pages vmlinux EXPORT_SYMBOL 18 | 0x93fca811 __get_free_pages vmlinux EXPORT_SYMBOL 19 | 0xb206a404 __init_rwsem vmlinux EXPORT_SYMBOL 20 | 0x66b98575 __init_waitqueue_head vmlinux EXPORT_SYMBOL 21 | 0x5a34a45c __kmalloc vmlinux EXPORT_SYMBOL 22 | 0x68f31cbd __list_add_valid vmlinux EXPORT_SYMBOL 23 | 0xe1537255 __list_del_entry_valid vmlinux EXPORT_SYMBOL 24 | 0x3c3fce39 __local_bh_enable_ip vmlinux EXPORT_SYMBOL 25 | 0xc299db1e __lock_page vmlinux EXPORT_SYMBOL 26 | 0x0f3efd7e __module_get vmlinux EXPORT_SYMBOL 27 | 0x7f02188f __msecs_to_jiffies vmlinux EXPORT_SYMBOL 28 | 0x7de16fd2 __mutex_init vmlinux EXPORT_SYMBOL 29 | 0xd9eacad1 __napi_schedule vmlinux EXPORT_SYMBOL 30 | 0x338bbef8 __ndelay vmlinux EXPORT_SYMBOL 31 | 0xb0fab9b6 __page_file_index vmlinux EXPORT_SYMBOL_GPL 32 | 0xa9f7f0c8 __page_mapcount vmlinux EXPORT_SYMBOL_GPL 33 | 0xea10ef73 __pagevec_release vmlinux EXPORT_SYMBOL 34 | 0x5ecfeec6 __per_cpu_offset vmlinux EXPORT_SYMBOL 35 | 0x6128b5fc __printk_ratelimit vmlinux EXPORT_SYMBOL 36 | 0xd5e51fa6 __pskb_pull_tail vmlinux EXPORT_SYMBOL 37 | 0x25207859 __put_cred vmlinux EXPORT_SYMBOL 38 | 0xbd1b113a __put_page vmlinux EXPORT_SYMBOL 39 | 0x8a2e5412 __put_task_struct vmlinux EXPORT_SYMBOL_GPL 40 | 0xe45c1b14 __release_region vmlinux EXPORT_SYMBOL 41 | 0x5eba9410 __request_region vmlinux EXPORT_SYMBOL 42 | 0x60b53515 __skb_gso_segment vmlinux EXPORT_SYMBOL 43 | 0xfcbb0506 __task_pid_nr_ns vmlinux EXPORT_SYMBOL 44 | 0x0faef0ed __tasklet_schedule vmlinux EXPORT_SYMBOL 45 | 0xf1969a8e __usecs_to_jiffies vmlinux EXPORT_SYMBOL 46 | 0x8e879bb7 __vmalloc vmlinux EXPORT_SYMBOL 47 | 0x1bf301c3 __wake_up vmlinux EXPORT_SYMBOL 48 | 0xad27f361 __warn_printk vmlinux EXPORT_SYMBOL 49 | 0xdac97957 _atomic_dec_and_lock vmlinux EXPORT_SYMBOL 50 | 0xa1c76e0a _cond_resched vmlinux EXPORT_SYMBOL 51 | 0x11089ac7 _ctype vmlinux EXPORT_SYMBOL 52 | 0x318f7969 add_timer vmlinux EXPORT_SYMBOL 53 | 0xdd1cdbcb add_wait_queue vmlinux EXPORT_SYMBOL 54 | 0xbc7bede7 add_wait_queue_exclusive vmlinux EXPORT_SYMBOL 55 | 0xf680ff75 alloc_netdev_mqs vmlinux EXPORT_SYMBOL 56 | 0x55943cc5 alloc_pages_current vmlinux EXPORT_SYMBOL 57 | 0x27545244 atomic_notifier_chain_register vmlinux EXPORT_SYMBOL_GPL 58 | 0xb80506b4 atomic_notifier_chain_unregister vmlinux EXPORT_SYMBOL_GPL 59 | 0xad73041f autoremove_wake_function vmlinux EXPORT_SYMBOL 60 | 0xcffc7760 bdevname vmlinux EXPORT_SYMBOL 61 | 0x67299c43 bdget_disk vmlinux EXPORT_SYMBOL 62 | 0x5ae9fa97 bio_add_page vmlinux EXPORT_SYMBOL 63 | 0x1eba2de8 bio_alloc_bioset vmlinux EXPORT_SYMBOL 64 | 0x062d91c7 bio_endio vmlinux EXPORT_SYMBOL 65 | 0xe1d7d1f7 bio_put vmlinux EXPORT_SYMBOL 66 | 0x16e297c3 bit_wait vmlinux EXPORT_SYMBOL 67 | 0x63a7c28c bitmap_find_free_region vmlinux EXPORT_SYMBOL 68 | 0xf474c21c bitmap_print_to_pagebuf vmlinux EXPORT_SYMBOL 69 | 0x574c2e74 bitmap_release_region vmlinux EXPORT_SYMBOL 70 | 0xaaedfec1 blk_alloc_queue vmlinux EXPORT_SYMBOL 71 | 0xd6f7e808 blk_cleanup_queue vmlinux EXPORT_SYMBOL 72 | 0x15fb0bd6 blk_execute_rq vmlinux EXPORT_SYMBOL 73 | 0xf2215f74 blk_finish_plug vmlinux EXPORT_SYMBOL 74 | 0x64da1f92 blk_get_request vmlinux EXPORT_SYMBOL 75 | 0x18434dad blk_mq_unique_tag vmlinux EXPORT_SYMBOL 76 | 0x1b441442 blk_queue_bounce_limit vmlinux EXPORT_SYMBOL 77 | 0xa4839f18 blk_queue_io_min vmlinux EXPORT_SYMBOL 78 | 0x01067a1f blk_queue_io_opt vmlinux EXPORT_SYMBOL 79 | 0xa77b78b2 blk_queue_logical_block_size vmlinux EXPORT_SYMBOL 80 | 0x4518bc30 blk_queue_make_request vmlinux EXPORT_SYMBOL 81 | 0x91dc3731 blk_queue_max_discard_sectors vmlinux EXPORT_SYMBOL 82 | 0x74b89c90 blk_queue_max_hw_sectors vmlinux EXPORT_SYMBOL 83 | 0xea78fb00 blk_queue_max_segment_size vmlinux EXPORT_SYMBOL 84 | 0x44e0f93b blk_queue_max_segments vmlinux EXPORT_SYMBOL 85 | 0x920be4ae blk_queue_physical_block_size vmlinux EXPORT_SYMBOL 86 | 0xd288ad49 blk_queue_segment_boundary vmlinux EXPORT_SYMBOL 87 | 0x53f29ada blk_rq_map_kern vmlinux EXPORT_SYMBOL 88 | 0x7a9b37e8 blk_start_plug vmlinux EXPORT_SYMBOL 89 | 0xc11480a1 blocking_notifier_call_chain vmlinux EXPORT_SYMBOL_GPL 90 | 0x24fc4e18 blocking_notifier_chain_register vmlinux EXPORT_SYMBOL_GPL 91 | 0x9511b62e blocking_notifier_chain_unregister vmlinux EXPORT_SYMBOL_GPL 92 | 0xa7eedcc4 call_usermodehelper vmlinux EXPORT_SYMBOL 93 | 0xb5a8d234 cancel_delayed_work vmlinux EXPORT_SYMBOL 94 | 0x68f927fb cancel_delayed_work_sync vmlinux EXPORT_SYMBOL 95 | 0x81b1b255 cancel_work_sync vmlinux EXPORT_SYMBOL_GPL 96 | 0xc6cbbc89 capable vmlinux EXPORT_SYMBOL 97 | 0xd0b990c6 class_unregister vmlinux EXPORT_SYMBOL_GPL 98 | 0x0f366a31 commit_creds vmlinux EXPORT_SYMBOL 99 | 0x6642d348 complete vmlinux EXPORT_SYMBOL 100 | 0xb408061b complete_and_exit vmlinux EXPORT_SYMBOL 101 | 0x509c53ae consume_skb vmlinux EXPORT_SYMBOL 102 | 0x55181725 cpu_bit_bitmap vmlinux EXPORT_SYMBOL_GPL 103 | 0xd6e64975 cpumask_next vmlinux EXPORT_SYMBOL 104 | 0x4234f096 cpumask_next_and vmlinux EXPORT_SYMBOL 105 | 0xa04f945a cpus_read_lock vmlinux EXPORT_SYMBOL_GPL 106 | 0x18fb2caf cpus_read_unlock vmlinux EXPORT_SYMBOL_GPL 107 | 0x077ee26b crypto_ahash_digest vmlinux EXPORT_SYMBOL_GPL 108 | 0xcd89af16 crypto_ahash_final vmlinux EXPORT_SYMBOL_GPL 109 | 0xb77cd6c7 crypto_ahash_setkey vmlinux EXPORT_SYMBOL_GPL 110 | 0x8e338eb3 crypto_alloc_ahash vmlinux EXPORT_SYMBOL_GPL 111 | 0xc619f5bb crypto_destroy_tfm vmlinux EXPORT_SYMBOL_GPL 112 | 0x76a48e88 crypto_register_shash vmlinux EXPORT_SYMBOL_GPL 113 | 0x603702cd crypto_unregister_shash vmlinux EXPORT_SYMBOL_GPL 114 | 0x4d65cbd5 csum_ipv6_magic vmlinux EXPORT_SYMBOL 115 | 0xaad8c7d6 default_wake_function vmlinux EXPORT_SYMBOL 116 | 0x88d17e92 del_gendisk vmlinux EXPORT_SYMBOL 117 | 0xfa5223cc del_timer vmlinux EXPORT_SYMBOL 118 | 0xec02a35f del_timer_sync vmlinux EXPORT_SYMBOL 119 | 0x0c1c794e delayed_work_timer_fn vmlinux EXPORT_SYMBOL 120 | 0x8c03d20c destroy_workqueue vmlinux EXPORT_SYMBOL_GPL 121 | 0xc4d675c0 dev_get_by_index vmlinux EXPORT_SYMBOL 122 | 0x7197f660 dev_get_by_name vmlinux EXPORT_SYMBOL 123 | 0x4f68e5c9 do_gettimeofday vmlinux EXPORT_SYMBOL 124 | 0x792d7f0f down vmlinux EXPORT_SYMBOL 125 | 0x8c8c6e38 down_interruptible vmlinux EXPORT_SYMBOL 126 | 0xb3e36bf8 down_read vmlinux EXPORT_SYMBOL 127 | 0x918e3f5c down_read_trylock vmlinux EXPORT_SYMBOL 128 | 0xa96f184a down_trylock vmlinux EXPORT_SYMBOL 129 | 0x340cd476 down_write vmlinux EXPORT_SYMBOL 130 | 0x7a975418 down_write_trylock vmlinux EXPORT_SYMBOL 131 | 0x909b6ce3 downgrade_write vmlinux EXPORT_SYMBOL 132 | 0x6b2dc060 dump_stack vmlinux EXPORT_SYMBOL 133 | 0x6229afcd eth_type_trans vmlinux EXPORT_SYMBOL 134 | 0x6871deb1 ethtool_op_get_link vmlinux EXPORT_SYMBOL 135 | 0xc85dc1e1 fc_remove_host drivers/scsi/scsi_transport_fc EXPORT_SYMBOL 136 | 0xcb8d3ac5 filemap_fault vmlinux EXPORT_SYMBOL 137 | 0xb352177e find_first_bit vmlinux EXPORT_SYMBOL 138 | 0xf11543ff find_first_zero_bit vmlinux EXPORT_SYMBOL 139 | 0xc0a3d105 find_next_bit vmlinux EXPORT_SYMBOL 140 | 0x479c3c86 find_next_zero_bit vmlinux EXPORT_SYMBOL 141 | 0xfeaa46b3 find_pid_ns vmlinux EXPORT_SYMBOL_GPL 142 | 0x92060f73 find_vma vmlinux EXPORT_SYMBOL 143 | 0x848d22b6 finish_wait vmlinux EXPORT_SYMBOL 144 | 0x1c4b1496 flush_signals vmlinux EXPORT_SYMBOL 145 | 0x42160169 flush_workqueue vmlinux EXPORT_SYMBOL 146 | 0xc32e7dec force_sig vmlinux EXPORT_SYMBOL 147 | 0xcbd4898c fortify_panic vmlinux EXPORT_SYMBOL 148 | 0xc1514a3b free_irq vmlinux EXPORT_SYMBOL 149 | 0x80143ea4 free_netdev vmlinux EXPORT_SYMBOL 150 | 0x4302d0eb free_pages vmlinux EXPORT_SYMBOL 151 | 0x705b4edc from_kgid vmlinux EXPORT_SYMBOL 152 | 0x8f257cbf from_kuid vmlinux EXPORT_SYMBOL 153 | 0x8f2c4377 fs_bio_set vmlinux EXPORT_SYMBOL 154 | 0x79aa04a2 get_random_bytes vmlinux EXPORT_SYMBOL 155 | 0x405c1144 get_seconds vmlinux EXPORT_SYMBOL 156 | 0x97a6fbda get_task_mm vmlinux EXPORT_SYMBOL_GPL 157 | 0x09381fa9 get_user_pages vmlinux EXPORT_SYMBOL 158 | 0x5cb2e61e get_user_pages_remote vmlinux EXPORT_SYMBOL 159 | 0x9b388444 get_zeroed_page vmlinux EXPORT_SYMBOL 160 | 0x3e2b0ba6 groups_alloc vmlinux EXPORT_SYMBOL 161 | 0x643d9ba1 groups_free vmlinux EXPORT_SYMBOL 162 | 0xbc892ee0 hrtimer_cancel vmlinux EXPORT_SYMBOL_GPL 163 | 0x93c9f0ef hrtimer_forward vmlinux EXPORT_SYMBOL_GPL 164 | 0x4ffec467 hrtimer_init vmlinux EXPORT_SYMBOL_GPL 165 | 0xbcb562c2 hrtimer_start_range_ns vmlinux EXPORT_SYMBOL_GPL 166 | 0xf5a20811 hrtimer_try_to_cancel vmlinux EXPORT_SYMBOL_GPL 167 | 0x39461d6a in_egroup_p vmlinux EXPORT_SYMBOL 168 | 0x8b8059bd in_group_p vmlinux EXPORT_SYMBOL 169 | 0x4cc8f9c8 init_timer_key vmlinux EXPORT_SYMBOL 170 | 0x40bcb35a init_uts_ns vmlinux EXPORT_SYMBOL_GPL 171 | 0xfe487975 init_wait_entry vmlinux EXPORT_SYMBOL 172 | 0x5778b8b4 invalidate_partition vmlinux EXPORT_SYMBOL 173 | 0x93a6e0b2 io_schedule vmlinux EXPORT_SYMBOL 174 | 0xfbc4f89e io_schedule_timeout vmlinux EXPORT_SYMBOL 175 | 0x8e82828e iomem_resource vmlinux EXPORT_SYMBOL 176 | 0xca7903a1 irq_set_affinity_hint vmlinux EXPORT_SYMBOL_GPL 177 | 0xe798236d jiffies vmlinux EXPORT_SYMBOL 178 | 0x402a960a jiffies_64 vmlinux EXPORT_SYMBOL 179 | 0x37befc70 jiffies_to_msecs vmlinux EXPORT_SYMBOL 180 | 0x188ea314 jiffies_to_timespec64 vmlinux EXPORT_SYMBOL 181 | 0x7f24de73 jiffies_to_usecs vmlinux EXPORT_SYMBOL 182 | 0x44b5ee9a kasprintf vmlinux EXPORT_SYMBOL 183 | 0x037a0cba kfree vmlinux EXPORT_SYMBOL 184 | 0x19f462ab kfree_call_rcu vmlinux EXPORT_SYMBOL_GPL 185 | 0x0a9ea67d kfree_skb vmlinux EXPORT_SYMBOL 186 | 0x4b5814ef kmalloc_order_trace vmlinux EXPORT_SYMBOL 187 | 0x44398388 kmem_cache_alloc vmlinux EXPORT_SYMBOL 188 | 0x8c614986 kmem_cache_alloc_node vmlinux EXPORT_SYMBOL 189 | 0x050db715 kmem_cache_alloc_node_trace vmlinux EXPORT_SYMBOL 190 | 0x6551695d kmem_cache_alloc_trace vmlinux EXPORT_SYMBOL 191 | 0x6907a3da kmem_cache_create vmlinux EXPORT_SYMBOL 192 | 0x048d3705 kmem_cache_create_usercopy vmlinux EXPORT_SYMBOL 193 | 0x871c2dda kmem_cache_destroy vmlinux EXPORT_SYMBOL 194 | 0xd1bff658 kmem_cache_free vmlinux EXPORT_SYMBOL 195 | 0x5ea32613 kmem_cache_shrink vmlinux EXPORT_SYMBOL 196 | 0x1eff77ac kobject_add vmlinux EXPORT_SYMBOL 197 | 0x8d10ed44 kobject_create_and_add vmlinux EXPORT_SYMBOL_GPL 198 | 0x56d88374 kobject_del vmlinux EXPORT_SYMBOL 199 | 0x28f397f9 kobject_init vmlinux EXPORT_SYMBOL 200 | 0x16f03e4d kobject_init_and_add vmlinux EXPORT_SYMBOL_GPL 201 | 0xa11e7937 kobject_put vmlinux EXPORT_SYMBOL 202 | 0x08ad68b8 kobject_set_name vmlinux EXPORT_SYMBOL 203 | 0xfe3d4f3d kobject_uevent_env vmlinux EXPORT_SYMBOL_GPL 204 | 0x059baffc krealloc vmlinux EXPORT_SYMBOL 205 | 0x62ce9b64 kset_create_and_add vmlinux EXPORT_SYMBOL_GPL 206 | 0x33d78331 kset_find_obj vmlinux EXPORT_SYMBOL_GPL 207 | 0xe6cc05c5 kset_register vmlinux EXPORT_SYMBOL 208 | 0xb1f83e12 kset_unregister vmlinux EXPORT_SYMBOL 209 | 0xc499ae1e kstrdup vmlinux EXPORT_SYMBOL 210 | 0xbaa2782a kstrndup vmlinux EXPORT_SYMBOL 211 | 0x752d5f5b kstrtobool vmlinux EXPORT_SYMBOL 212 | 0x1cd387a7 kstrtobool_from_user vmlinux EXPORT_SYMBOL 213 | 0x373db350 kstrtoint vmlinux EXPORT_SYMBOL 214 | 0x333ec789 kstrtoint_from_user vmlinux EXPORT_SYMBOL 215 | 0x1b17e06c kstrtoll vmlinux EXPORT_SYMBOL 216 | 0xc76c9ada kstrtoll_from_user vmlinux EXPORT_SYMBOL 217 | 0x3fa0d062 kstrtou16 vmlinux EXPORT_SYMBOL 218 | 0xa46f2f1b kstrtouint vmlinux EXPORT_SYMBOL 219 | 0x84d98e20 kstrtouint_from_user vmlinux EXPORT_SYMBOL 220 | 0x2cc31f4c kstrtoul_from_user vmlinux EXPORT_SYMBOL 221 | 0x060ea2d6 kstrtoull vmlinux EXPORT_SYMBOL 222 | 0x4b26f3b4 kstrtoull_from_user vmlinux EXPORT_SYMBOL 223 | 0x3661c7b9 kthread_bind vmlinux EXPORT_SYMBOL 224 | 0x2a81fc4a kthread_create_on_node vmlinux EXPORT_SYMBOL 225 | 0xb3f7646e kthread_should_stop vmlinux EXPORT_SYMBOL 226 | 0xa0f77f57 kthread_stop vmlinux EXPORT_SYMBOL 227 | 0xb43f9365 ktime_get vmlinux EXPORT_SYMBOL_GPL 228 | 0x484f6edf ktime_get_coarse_real_ts64 vmlinux EXPORT_SYMBOL 229 | 0x1edb69d6 ktime_get_raw_ts64 vmlinux EXPORT_SYMBOL 230 | 0x953e1b9e ktime_get_real_seconds vmlinux EXPORT_SYMBOL_GPL 231 | 0x9ec6ca96 ktime_get_real_ts64 vmlinux EXPORT_SYMBOL 232 | 0xa9320d27 ktime_get_seconds vmlinux EXPORT_SYMBOL_GPL 233 | 0x5e515be6 ktime_get_ts64 vmlinux EXPORT_SYMBOL_GPL 234 | 0xc4f0da12 ktime_get_with_offset vmlinux EXPORT_SYMBOL_GPL 235 | 0x5c017464 kvasprintf vmlinux EXPORT_SYMBOL 236 | 0x7aa1756e kvfree vmlinux EXPORT_SYMBOL 237 | 0x7a4497db kzfree vmlinux EXPORT_SYMBOL 238 | 0xbdf38a1b lock_page_memcg vmlinux EXPORT_SYMBOL 239 | 0x3c171488 lock_sock_nested vmlinux EXPORT_SYMBOL 240 | 0xa8dedb50 make_kgid vmlinux EXPORT_SYMBOL 241 | 0x970a0bd5 make_kuid vmlinux EXPORT_SYMBOL 242 | 0x2679ee7d mark_page_accessed vmlinux EXPORT_SYMBOL 243 | 0xacf4d843 match_strdup vmlinux EXPORT_SYMBOL 244 | 0x44e9a829 match_token vmlinux EXPORT_SYMBOL 245 | 0x54c99fac mem_section vmlinux EXPORT_SYMBOL 246 | 0x2fa5a500 memcmp vmlinux EXPORT_SYMBOL 247 | 0x236c8c64 memcpy vmlinux EXPORT_SYMBOL 248 | 0xa3a5be95 memmove vmlinux EXPORT_SYMBOL 249 | 0x27864d57 memparse vmlinux EXPORT_SYMBOL 250 | 0x9e435279 mempool_alloc vmlinux EXPORT_SYMBOL 251 | 0x183fa88b mempool_alloc_slab vmlinux EXPORT_SYMBOL 252 | 0x3aae4146 mempool_create vmlinux EXPORT_SYMBOL 253 | 0xdace5a22 mempool_destroy vmlinux EXPORT_SYMBOL 254 | 0x8e4fe33d mempool_free vmlinux EXPORT_SYMBOL 255 | 0x8a99a016 mempool_free_slab vmlinux EXPORT_SYMBOL 256 | 0x9a906daf memscan vmlinux EXPORT_SYMBOL 257 | 0xde0bdcff memset vmlinux EXPORT_SYMBOL 258 | 0xe0612783 mmput vmlinux EXPORT_SYMBOL_GPL 259 | 0xebca8b54 mod_delayed_work_on vmlinux EXPORT_SYMBOL_GPL 260 | 0x28985b9f mod_timer vmlinux EXPORT_SYMBOL 261 | 0xaac80d5b mod_timer_pending vmlinux EXPORT_SYMBOL 262 | 0xee7e6c8f module_put vmlinux EXPORT_SYMBOL 263 | 0x4135e5b0 module_refcount vmlinux EXPORT_SYMBOL 264 | 0xf9a482f9 msleep vmlinux EXPORT_SYMBOL 265 | 0x2f4c06f2 mutex_lock vmlinux EXPORT_SYMBOL 266 | 0x19d3ab4f mutex_lock_killable vmlinux EXPORT_SYMBOL 267 | 0xe7a21d62 mutex_trylock vmlinux EXPORT_SYMBOL 268 | 0xe1718bab mutex_unlock vmlinux EXPORT_SYMBOL 269 | 0x4351da74 napi_complete_done vmlinux EXPORT_SYMBOL 270 | 0x3e3bd342 napi_disable vmlinux EXPORT_SYMBOL 271 | 0x0654039b napi_gro_receive vmlinux EXPORT_SYMBOL 272 | 0xb61d9399 napi_schedule_prep vmlinux EXPORT_SYMBOL 273 | 0x898a4843 netif_napi_add vmlinux EXPORT_SYMBOL 274 | 0x263ef35a netif_napi_del vmlinux EXPORT_SYMBOL 275 | 0x6387a356 netif_receive_skb vmlinux EXPORT_SYMBOL 276 | 0xd0c1d4a8 netif_rx vmlinux EXPORT_SYMBOL 277 | 0xfdc1bd61 nla_put vmlinux EXPORT_SYMBOL 278 | 0x5c223e9e node_data vmlinux EXPORT_SYMBOL 279 | 0xfd1a7baf node_to_cpumask_map vmlinux EXPORT_SYMBOL 280 | 0x017de3d5 nr_cpu_ids vmlinux EXPORT_SYMBOL 281 | 0xfe26fc7c nr_node_ids vmlinux EXPORT_SYMBOL 282 | 0x1e1e140e ns_to_timespec64 vmlinux EXPORT_SYMBOL 283 | 0x2f548802 ns_to_timeval vmlinux EXPORT_SYMBOL 284 | 0xffae8e8b nsecs_to_jiffies vmlinux EXPORT_SYMBOL_GPL 285 | 0x5541ea93 on_each_cpu vmlinux EXPORT_SYMBOL 286 | 0x1984d421 out_of_line_wait_on_bit vmlinux EXPORT_SYMBOL 287 | 0xab121906 override_creds vmlinux EXPORT_SYMBOL 288 | 0x3dd76852 page_mapped vmlinux EXPORT_SYMBOL 289 | 0x04d2bd9d pagevec_lookup_range vmlinux EXPORT_SYMBOL 290 | 0xf5e3a770 pagevec_lookup_range_tag vmlinux EXPORT_SYMBOL 291 | 0x7c1372e8 panic vmlinux EXPORT_SYMBOL 292 | 0x75fcdd6f panic_notifier_list vmlinux EXPORT_SYMBOL 293 | 0xac4cade1 param_array_ops vmlinux EXPORT_SYMBOL 294 | 0xac825c5c param_get_int vmlinux EXPORT_SYMBOL 295 | 0x1ed0638a param_ops_bool vmlinux EXPORT_SYMBOL 296 | 0xaa139c11 param_ops_byte vmlinux EXPORT_SYMBOL 297 | 0xd1bfdeb0 param_ops_charp vmlinux EXPORT_SYMBOL 298 | 0xde64b983 param_ops_int vmlinux EXPORT_SYMBOL 299 | 0x43d66e17 param_ops_long vmlinux EXPORT_SYMBOL 300 | 0x56da6e1c param_ops_short vmlinux EXPORT_SYMBOL 301 | 0x38cef74d param_ops_string vmlinux EXPORT_SYMBOL 302 | 0x6aa285aa param_ops_uint vmlinux EXPORT_SYMBOL 303 | 0x01d03047 param_ops_ulong vmlinux EXPORT_SYMBOL 304 | 0x463627fa param_set_bool vmlinux EXPORT_SYMBOL 305 | 0xb56e72c4 param_set_int vmlinux EXPORT_SYMBOL 306 | 0x4a22634b pid_task vmlinux EXPORT_SYMBOL 307 | 0xd9b716d5 prepare_creds vmlinux EXPORT_SYMBOL 308 | 0x86838a09 prepare_to_wait vmlinux EXPORT_SYMBOL 309 | 0x8f96fdf4 prepare_to_wait_event vmlinux EXPORT_SYMBOL 310 | 0xb6bcdaa5 prepare_to_wait_exclusive vmlinux EXPORT_SYMBOL 311 | 0x86e03c0a print_stack_trace vmlinux EXPORT_SYMBOL_GPL 312 | 0x27e1a049 printk vmlinux EXPORT_SYMBOL 313 | 0xc12efe98 pskb_expand_head vmlinux EXPORT_SYMBOL 314 | 0xb5e6ea9c put_disk vmlinux EXPORT_SYMBOL 315 | 0xd1e4ec46 queue_delayed_work_on vmlinux EXPORT_SYMBOL 316 | 0x121da905 queue_work_on vmlinux EXPORT_SYMBOL 317 | 0x60a13e90 rcu_barrier vmlinux EXPORT_SYMBOL_GPL 318 | 0xbeabc0e4 read_cache_pages vmlinux EXPORT_SYMBOL 319 | 0xfb6af58d recalc_sigpending vmlinux EXPORT_SYMBOL 320 | 0x71a50dbc register_blkdev vmlinux EXPORT_SYMBOL 321 | 0xd2da1048 register_netdevice_notifier vmlinux EXPORT_SYMBOL 322 | 0x3517383e register_reboot_notifier vmlinux EXPORT_SYMBOL 323 | 0xb286f9d0 release_sock vmlinux EXPORT_SYMBOL 324 | 0x58525886 remap_pfn_range vmlinux EXPORT_SYMBOL 325 | 0x6c60994e remove_wait_queue vmlinux EXPORT_SYMBOL 326 | 0xd6b8e852 request_threaded_irq vmlinux EXPORT_SYMBOL 327 | 0x2402fab5 revert_creds vmlinux EXPORT_SYMBOL 328 | 0xc7a4fbed rtnl_lock vmlinux EXPORT_SYMBOL 329 | 0x6e720ff2 rtnl_unlock vmlinux EXPORT_SYMBOL 330 | 0x8f2920bc save_stack_trace_tsk vmlinux EXPORT_SYMBOL_GPL 331 | 0x01000e51 schedule vmlinux EXPORT_SYMBOL 332 | 0x1f37cca7 schedule_hrtimeout_range vmlinux EXPORT_SYMBOL_GPL 333 | 0x8ddd8aad schedule_timeout vmlinux EXPORT_SYMBOL 334 | 0x054496b4 schedule_timeout_interruptible vmlinux EXPORT_SYMBOL 335 | 0x151f4898 schedule_timeout_uninterruptible vmlinux EXPORT_SYMBOL 336 | 0x28343bad scnprintf vmlinux EXPORT_SYMBOL 337 | 0x315500e6 scsi_add_host_with_dma vmlinux EXPORT_SYMBOL 338 | 0x70f35646 scsi_host_alloc vmlinux EXPORT_SYMBOL 339 | 0xfeab2430 scsi_host_put vmlinux EXPORT_SYMBOL 340 | 0x200ccc33 scsi_is_host_device vmlinux EXPORT_SYMBOL 341 | 0x69f1af50 scsi_is_sdev_device vmlinux EXPORT_SYMBOL 342 | 0x9a802be1 scsi_remove_device vmlinux EXPORT_SYMBOL 343 | 0x521b0ae7 scsi_remove_host vmlinux EXPORT_SYMBOL 344 | 0x55e93b1e scsi_scan_host vmlinux EXPORT_SYMBOL 345 | 0x5d2d73fa send_sig vmlinux EXPORT_SYMBOL 346 | 0x7cf2c1c6 set_cpus_allowed_ptr vmlinux EXPORT_SYMBOL_GPL 347 | 0x025483b1 set_current_groups vmlinux EXPORT_SYMBOL 348 | 0xbd0f0cde set_device_ro vmlinux EXPORT_SYMBOL 349 | 0x65ab4529 set_disk_ro vmlinux EXPORT_SYMBOL 350 | 0x9e61bb05 set_freezable vmlinux EXPORT_SYMBOL 351 | 0x365acda7 set_normalized_timespec64 vmlinux EXPORT_SYMBOL 352 | 0xa9a12085 set_page_dirty vmlinux EXPORT_SYMBOL 353 | 0x2f0d7375 set_page_dirty_lock vmlinux EXPORT_SYMBOL 354 | 0xab5ce002 set_user_nice vmlinux EXPORT_SYMBOL 355 | 0x40c7247c si_meminfo vmlinux EXPORT_SYMBOL 356 | 0x6a5fa363 sigprocmask vmlinux EXPORT_SYMBOL 357 | 0x0b742fd7 simple_strtol vmlinux EXPORT_SYMBOL 358 | 0x20000329 simple_strtoul vmlinux EXPORT_SYMBOL 359 | 0x61b7b126 simple_strtoull vmlinux EXPORT_SYMBOL 360 | 0x694aba15 skb_checksum_help vmlinux EXPORT_SYMBOL 361 | 0x4439cb03 skb_dequeue vmlinux EXPORT_SYMBOL 362 | 0xafaa19c4 skb_pull vmlinux EXPORT_SYMBOL 363 | 0xe93c2569 skb_push vmlinux EXPORT_SYMBOL 364 | 0xaa1bd062 skb_queue_purge vmlinux EXPORT_SYMBOL 365 | 0x6b702c4a skb_queue_tail vmlinux EXPORT_SYMBOL 366 | 0x04b197f2 smp_call_function_many vmlinux EXPORT_SYMBOL 367 | 0x6228c21f smp_call_function_single vmlinux EXPORT_SYMBOL 368 | 0x50720c5f snprintf vmlinux EXPORT_SYMBOL 369 | 0x91715312 sprintf vmlinux EXPORT_SYMBOL 370 | 0x20c55ae0 sscanf vmlinux EXPORT_SYMBOL 371 | 0xaafdc258 strcasecmp vmlinux EXPORT_SYMBOL 372 | 0x061651be strcat vmlinux EXPORT_SYMBOL 373 | 0x349cba85 strchr vmlinux EXPORT_SYMBOL 374 | 0xe2d5255a strcmp vmlinux EXPORT_SYMBOL 375 | 0xe914e41e strcpy vmlinux EXPORT_SYMBOL 376 | 0xafe82e10 strcspn vmlinux EXPORT_SYMBOL 377 | 0x77bc13a0 strim vmlinux EXPORT_SYMBOL 378 | 0x6d1ea6ec strlcat vmlinux EXPORT_SYMBOL 379 | 0x672144bd strlcpy vmlinux EXPORT_SYMBOL 380 | 0x25ec1b28 strlen vmlinux EXPORT_SYMBOL 381 | 0xebbf1dba strncasecmp vmlinux EXPORT_SYMBOL 382 | 0x85abc85f strncmp vmlinux EXPORT_SYMBOL 383 | 0xad4aee39 strncpy vmlinux EXPORT_SYMBOL 384 | 0x9b8d07aa strnlen vmlinux EXPORT_SYMBOL 385 | 0x5fd2298e strnstr vmlinux EXPORT_SYMBOL 386 | 0x9a1dfd65 strpbrk vmlinux EXPORT_SYMBOL 387 | 0x9f984513 strrchr vmlinux EXPORT_SYMBOL 388 | 0x3fa913da strspn vmlinux EXPORT_SYMBOL 389 | 0x1e6d26a8 strstr vmlinux EXPORT_SYMBOL 390 | 0x2d3385d3 system_wq vmlinux EXPORT_SYMBOL 391 | 0x9545af6d tasklet_init vmlinux EXPORT_SYMBOL 392 | 0x0ae979fd try_module_get vmlinux EXPORT_SYMBOL 393 | 0x9bc62df2 try_wait_for_completion vmlinux EXPORT_SYMBOL 394 | 0x968c5208 unlock_page vmlinux EXPORT_SYMBOL 395 | 0x6b0e21b4 unlock_page_memcg vmlinux EXPORT_SYMBOL 396 | 0xb34392eb unmap_mapping_range vmlinux EXPORT_SYMBOL 397 | 0xb5a459dc unregister_blkdev vmlinux EXPORT_SYMBOL 398 | 0x5fa27294 unregister_netdev vmlinux EXPORT_SYMBOL 399 | 0x9d0d6206 unregister_netdevice_notifier vmlinux EXPORT_SYMBOL 400 | 0xac1a55be unregister_reboot_notifier vmlinux EXPORT_SYMBOL 401 | 0x2ab3699d unuse_mm vmlinux EXPORT_SYMBOL_GPL 402 | 0xc6b443e8 up vmlinux EXPORT_SYMBOL 403 | 0xd04fd10e up_read vmlinux EXPORT_SYMBOL 404 | 0x60b12fe5 up_write vmlinux EXPORT_SYMBOL 405 | 0x971439a2 use_mm vmlinux EXPORT_SYMBOL_GPL 406 | 0x12a38747 usleep_range vmlinux EXPORT_SYMBOL 407 | 0x999e8297 vfree vmlinux EXPORT_SYMBOL 408 | 0x4903aa79 vm_mmap vmlinux EXPORT_SYMBOL 409 | 0x29391e7d vm_munmap vmlinux EXPORT_SYMBOL 410 | 0xd6ee688f vmalloc vmlinux EXPORT_SYMBOL 411 | 0xaff5fb27 vmalloc_to_page vmlinux EXPORT_SYMBOL 412 | 0x481e535e vmap vmlinux EXPORT_SYMBOL 413 | 0x4b8b3239 vprintk vmlinux EXPORT_SYMBOL 414 | 0x3cec9b17 vsnprintf vmlinux EXPORT_SYMBOL 415 | 0x5c7574a1 vsprintf vmlinux EXPORT_SYMBOL 416 | 0x94961283 vunmap vmlinux EXPORT_SYMBOL 417 | 0x40a9b349 vzalloc vmlinux EXPORT_SYMBOL 418 | 0x9e0c711d vzalloc_node vmlinux EXPORT_SYMBOL 419 | 0x8bdb7a0e wait_for_completion vmlinux EXPORT_SYMBOL 420 | 0x28914cbf wait_on_page_bit vmlinux EXPORT_SYMBOL 421 | 0xa0fbac79 wake_up_bit vmlinux EXPORT_SYMBOL 422 | 0x08d39e7d wake_up_process vmlinux EXPORT_SYMBOL 423 | 0xcf64b4bb write_cache_pages vmlinux EXPORT_SYMBOL 424 | 0x760a0f4f yield vmlinux EXPORT_SYMBOL 425 | 0x2185519c zap_vma_ptes vmlinux EXPORT_SYMBOL_GPL 426 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/check-kabi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | # check-kabi - Red Hat kABI reference checking tool 4 | # 5 | # We use this script to check against reference Module.kabi files. 6 | # 7 | # Author: Jon Masters 8 | # Copyright (C) 2007-2009 Red Hat, Inc. 9 | # 10 | # This software may be freely redistributed under the terms of the GNU 11 | # General Public License (GPL). 12 | 13 | # Changelog: 14 | # 15 | # 2018/06/01 - Update for python3 by Petr Oros. 16 | # 2009/08/15 - Updated for use in RHEL6. 17 | # 2007/06/13 - Initial rewrite in python by Jon Masters. 18 | 19 | __author__ = "Jon Masters " 20 | __version__ = "2.0" 21 | __date__ = "2009/08/15" 22 | __copyright__ = "Copyright (C) 2007-2009 Red Hat, Inc" 23 | __license__ = "GPL" 24 | 25 | import getopt 26 | import string 27 | import sys 28 | 29 | true = 1 30 | false = 0 31 | 32 | 33 | def load_symvers(symvers, filename): 34 | """Load a Module.symvers file.""" 35 | 36 | symvers_file = open(filename, "r") 37 | 38 | while true: 39 | in_line = symvers_file.readline() 40 | if in_line == "": 41 | break 42 | if in_line == "\n": 43 | continue 44 | checksum, symbol, directory, type = in_line.split()[:4] 45 | 46 | symvers[symbol] = in_line[0:-1] 47 | 48 | 49 | def load_kabi(kabi, filename): 50 | """Load a Module.kabi file.""" 51 | 52 | kabi_file = open(filename, "r") 53 | 54 | while true: 55 | in_line = kabi_file.readline() 56 | if in_line == "": 57 | break 58 | if in_line == "\n": 59 | continue 60 | checksum, symbol, directory, type = in_line.split() 61 | 62 | kabi[symbol] = in_line[0:-1] 63 | 64 | 65 | def check_kabi(symvers, kabi): 66 | """Check Module.kabi and Module.symvers files.""" 67 | 68 | fail = 0 69 | warn = 0 70 | changed_symbols = [] 71 | moved_symbols = [] 72 | 73 | for symbol in kabi: 74 | abi_hash, abi_sym, abi_dir, abi_type = kabi[symbol].split() 75 | if symbol in symvers: 76 | sym_hash, sym_sym, sym_dir, sym_type = symvers[symbol].split() 77 | if abi_hash != sym_hash: 78 | fail = 1 79 | changed_symbols.append(symbol) 80 | 81 | if abi_dir != sym_dir: 82 | warn = 1 83 | moved_symbols.append(symbol) 84 | else: 85 | fail = 1 86 | changed_symbols.append(symbol) 87 | 88 | if fail: 89 | print("*** ERROR - ABI BREAKAGE WAS DETECTED ***") 90 | print("") 91 | print("The following symbols have been changed (this will cause an ABI breakage):") 92 | print("") 93 | for symbol in changed_symbols: 94 | print(symbol) 95 | print("") 96 | 97 | if warn: 98 | print("*** WARNING - ABI SYMBOLS MOVED ***") 99 | print("") 100 | print("The following symbols moved (typically caused by moving a symbol from being") 101 | print("provided by the kernel vmlinux out to a loadable module):") 102 | print("") 103 | for symbol in moved_symbols: 104 | print(symbol) 105 | print("") 106 | 107 | """Halt the build, if we got errors and/or warnings. In either case, 108 | double-checkig is required to avoid introducing / concealing 109 | KABI inconsistencies.""" 110 | if fail or warn: 111 | sys.exit(1) 112 | sys.exit(0) 113 | 114 | 115 | def usage(): 116 | print(""" 117 | check-kabi: check Module.kabi and Module.symvers files. 118 | 119 | check-kabi [ -k Module.kabi ] [ -s Module.symvers ] 120 | 121 | """) 122 | 123 | 124 | if __name__ == "__main__": 125 | 126 | symvers_file = "" 127 | kabi_file = "" 128 | 129 | opts, args = getopt.getopt(sys.argv[1:], 'hk:s:') 130 | 131 | for o, v in opts: 132 | if o == "-s": 133 | symvers_file = v 134 | if o == "-h": 135 | usage() 136 | sys.exit(0) 137 | if o == "-k": 138 | kabi_file = v 139 | 140 | if (symvers_file == "") or (kabi_file == ""): 141 | usage() 142 | sys.exit(1) 143 | 144 | symvers = {} 145 | kabi = {} 146 | 147 | load_symvers(symvers, symvers_file) 148 | load_kabi(kabi, kabi_file) 149 | check_kabi(symvers, kabi) 150 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/cpupower.config: -------------------------------------------------------------------------------- 1 | # See 'cpupower help' and cpupower(1) for more info 2 | CPUPOWER_START_OPTS="frequency-set -g performance" 3 | CPUPOWER_STOP_OPTS="frequency-set -g ondemand" 4 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/cpupower.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Configure CPU power related settings 3 | After=syslog.target 4 | 5 | [Service] 6 | Type=oneshot 7 | RemainAfterExit=yes 8 | EnvironmentFile=/etc/sysconfig/cpupower 9 | ExecStart=/usr/bin/cpupower $CPUPOWER_START_OPTS 10 | ExecStop=/usr/bin/cpupower $CPUPOWER_STOP_OPTS 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/filter-aarch64.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # This is the aarch64 override file for the core/drivers package split. The 4 | # module directories listed here and in the generic list in filter-modules.sh 5 | # will be moved to the resulting kernel-modules package for this arch. 6 | # Anything not listed in those files will be in the kernel-core package. 7 | # 8 | # Please review the default list in filter-modules.sh before making 9 | # modifications to the overrides below. If something should be removed across 10 | # all arches, remove it in the default instead of per-arch. 11 | 12 | driverdirs="atm auxdisplay bcma bluetooth firewire fmc infiniband isdn leds media memstick message mmc mtd mwave nfc ntb pcmcia platform power ssb staging tty uio uwb w1" 13 | 14 | ethdrvs="3com adaptec arc alteon atheros broadcom cadence calxeda chelsio cisco dec dlink emulex icplus marvell micrel myricom neterion nvidia oki-semi packetengines qlogic rdc renesas sfc silan sis smsc stmicro sun tehuti ti via wiznet xircom" 15 | 16 | drmdrvs="amd arm bridge ast exynos hisilicon i2c imx mgag200 meson msm nouveau panel radeon rockchip tegra sun4i tinydrm vc4" 17 | 18 | singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwa-hc hwpoison-inject target_core_user sbp_target cxgbit iw_cxgb3 iw_cxgb4 cxgb3i cxgb3i cxgb3i_ddp cxgb4i chcr" 19 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/filter-modules.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # 3 | # Called as filter-modules.sh list-of-modules Arch 4 | 5 | # This script filters the modules into the kernel-core and kernel-modules 6 | # subpackages. We list out subsystems/subdirs to prune from the installed 7 | # module directory. What is left is put into the kernel-core package. What is 8 | # pruned is contained in the kernel-modules package. 9 | # 10 | # This file contains the default subsys/subdirs to prune from all architectures. 11 | # If an architecture needs to differ, we source a per-arch filter-.sh file 12 | # that contains the set of override lists to be used instead. If a module or 13 | # subsys should be in kernel-modules on all arches, please change the defaults 14 | # listed here. 15 | 16 | # Set the default dirs/modules to filter out 17 | driverdirs="atm auxdisplay bcma bluetooth firewire fmc iio infiniband isdn leds media memstick mfd mmc mtd nfc ntb pcmcia platform power ssb staging tty uio uwb w1" 18 | 19 | chardrvs="mwave pcmcia" 20 | 21 | netdrvs="appletalk can dsa hamradio ieee802154 irda ppp slip usb wireless" 22 | 23 | ethdrvs="3com adaptec alteon amd aquantia atheros broadcom cadence calxeda chelsio cisco dec dlink emulex icplus marvell neterion nvidia oki-semi packetengines qlogic rdc renesas sfc silan sis smsc stmicro sun tehuti ti wiznet xircom" 24 | 25 | inputdrvs="gameport tablet touchscreen" 26 | 27 | scsidrvs="aacraid aic7xxx aic94xx be2iscsi bfa bnx2i bnx2fc csiostor cxgbi esas2r fcoe fnic hisi_sas isci libsas lpfc megaraid mpt2sas mpt3sas mvsas pm8001 qla2xxx qla4xxx sym53c8xx_2 ufs qedf" 28 | 29 | usbdrvs="atm image misc serial wusbcore" 30 | 31 | fsdrvs="affs befs coda cramfs ecryptfs hfs hfsplus jfs minix ncpfs nilfs2 ocfs2 reiserfs romfs squashfs sysv ubifs ufs" 32 | 33 | netprots="6lowpan appletalk atm ax25 batman-adv bluetooth can dccp dsa ieee802154 irda l2tp mac80211 mac802154 mpls netrom nfc rds rfkill rose sctp smc wireless" 34 | 35 | drmdrvs="amd ast gma500 i2c i915 mgag200 nouveau radeon via " 36 | 37 | singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwa-hc hwpoison-inject hid-sensor-hub target_core_user sbp_target cxgbit iw_cxgb3 iw_cxgb4 cxgb3i cxgb3i cxgb3i_ddp cxgb4i chcr parport_serial ism" 38 | 39 | # Grab the arch-specific filter list overrides 40 | source ./filter-$2.sh 41 | 42 | filter_dir() { 43 | filelist=$1 44 | dir=$2 45 | 46 | grep -v -e "${dir}/" ${filelist} > ${filelist}.tmp 47 | 48 | if [ $? -ne 0 ] 49 | then 50 | echo "Couldn't remove ${dir}. Skipping." 51 | else 52 | grep -e "${dir}/" ${filelist} >> k-d.list 53 | mv ${filelist}.tmp $filelist 54 | fi 55 | 56 | return 0 57 | } 58 | 59 | filter_ko() { 60 | filelist=$1 61 | mod=$2 62 | 63 | grep -v -e "${mod}.ko" ${filelist} > ${filelist}.tmp 64 | 65 | if [ $? -ne 0 ] 66 | then 67 | echo "Couldn't remove ${mod}.ko Skipping." 68 | else 69 | grep -e "${mod}.ko" ${filelist} >> k-d.list 70 | mv ${filelist}.tmp $filelist 71 | fi 72 | 73 | return 0 74 | } 75 | 76 | # Filter the drivers/ subsystems 77 | for subsys in ${driverdirs} 78 | do 79 | filter_dir $1 drivers/${subsys} 80 | done 81 | 82 | # Filter the networking drivers 83 | for netdrv in ${netdrvs} 84 | do 85 | filter_dir $1 drivers/net/${netdrv} 86 | done 87 | 88 | # Filter the char drivers 89 | for char in ${chardrvs} 90 | do 91 | filter_dir $1 drivers/char/${input} 92 | done 93 | 94 | # Filter the ethernet drivers 95 | for eth in ${ethdrvs} 96 | do 97 | filter_dir $1 drivers/net/ethernet/${eth} 98 | done 99 | 100 | # SCSI 101 | for scsi in ${scsidrvs} 102 | do 103 | filter_dir $1 drivers/scsi/${scsi} 104 | done 105 | 106 | # Input 107 | for input in ${inputdrvs} 108 | do 109 | filter_dir $1 drivers/input/${input} 110 | done 111 | 112 | # USB 113 | for usb in ${usbdrvs} 114 | do 115 | filter_dir $1 drivers/usb/${usb} 116 | done 117 | 118 | # Filesystems 119 | for fs in ${fsdrvs} 120 | do 121 | filter_dir $1 fs/${fs} 122 | done 123 | 124 | # Network protocols 125 | for prot in ${netprots} 126 | do 127 | filter_dir $1 kernel/net/${prot} 128 | done 129 | 130 | # DRM 131 | for drm in ${drmdrvs} 132 | do 133 | filter_dir $1 drivers/gpu/drm/${drm} 134 | done 135 | 136 | # Just kill sound. 137 | filter_dir $1 kernel/sound 138 | 139 | # Now go through and filter any single .ko files that might have deps on the 140 | # things we filtered above 141 | for mod in ${singlemods} 142 | do 143 | filter_ko $1 ${mod} 144 | done 145 | 146 | # Go through our generated drivers list and remove the .ko files. We'll 147 | # restore them later. 148 | for mod in `cat k-d.list` 149 | do 150 | rm -rf $mod 151 | done 152 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/filter-ppc64le.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # This is the ppc64le override file for the core/drivers package split. The 4 | # module directories listed here and in the generic list in filter-modules.sh 5 | # will be moved to the resulting kernel-modules package for this arch. 6 | # Anything not listed in those files will be in the kernel-core package. 7 | # 8 | # Please review the default list in filter-modules.sh before making 9 | # modifications to the overrides below. If something should be removed across 10 | # all arches, remove it in the default instead of per-arch. 11 | 12 | driverdirs="atm auxdisplay bcma bluetooth firewire fmc infiniband isdn leds media memstick message mmc mtd mwave nfc ntb pcmcia platform power ssb staging tty uio uwb w1" 13 | 14 | singlemods="ntb_netdev iscsi_ibft iscsi_boot_sysfs megaraid pmcraid qedi qla1280 9pnet_rdma rpcrdma nvmet-rdma nvme-rdma hid-picolcd hid-prodikeys hwa-hc hwpoison-inject target_core_user sbp_target cxgbit iw_cxgb3 iw_cxgb4 cxgb3i cxgb3i cxgb3i_ddp cxgb4i chcr" 15 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/filter-s390x.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # This is the s390x override file for the core/drivers package split. The 4 | # module directories listed here and in the generic list in filter-modules.sh 5 | # will be moved to the resulting kernel-modules package for this arch. 6 | # Anything not listed in those files will be in the kernel-core package. 7 | # 8 | # Please review the default list in filter-modules.sh before making 9 | # modifications to the overrides below. If something should be removed across 10 | # all arches, remove it in the default instead of per-arch. 11 | 12 | # Defaults work so no need to override 13 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/filter-x86_64.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # This is the x86_64 override file for the core/drivers package split. The 4 | # module directories listed here and in the generic list in filter-modules.sh 5 | # will be moved to the resulting kernel-modules package for this arch. 6 | # Anything not listed in those files will be in the kernel-core package. 7 | # 8 | # Please review the default list in filter-modules.sh before making 9 | # modifications to the overrides below. If something should be removed across 10 | # all arches, remove it in the default instead of per-arch. 11 | 12 | # Defaults work so no need to override 13 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/generate_all_configs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in kernel-*.config; do 4 | NEW=kernel-$VERSION-`echo $i | cut -d - -f2-` 5 | mv $i $NEW 6 | done 7 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/generate_bls_conf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | . /etc/os-release 5 | 6 | kernelver=$1 && shift 7 | rootfs=$1 && shift 8 | variant=$1 && shift 9 | 10 | output="${rootfs}/lib/modules/${kernelver}/bls.conf" 11 | date=$(date -u +%Y%m%d%H%M%S) 12 | 13 | if [ "${variant:-5}" = "debug" ]; then 14 | debugname=" with debugging" 15 | debugid="-debug" 16 | else 17 | debugname="" 18 | debugid="" 19 | fi 20 | 21 | cat >${output} < "$buildroot/etc/modprobe.d/$1-blacklist.conf" <<-__EOF__ 9 | # This kernel module can be automatically loaded by non-root users. To 10 | # enhance system security, the module is blacklisted by default to ensure 11 | # system administrators make the module available for use as needed. 12 | # See https://access.redhat.com/articles/3760101 for more details. 13 | # 14 | # Remove the blacklist by adding a comment # at the start of the line. 15 | blacklist $1 16 | __EOF__ 17 | } 18 | 19 | check_blacklist() 20 | { 21 | if modinfo "$buildroot/$1" | grep -q '^alias:\s\+net-'; then 22 | mod="${1##*/}" 23 | mod="${mod%.ko*}" 24 | echo "$mod has an alias that allows auto-loading. Blacklisting." 25 | blacklist "$mod" 26 | fi 27 | } 28 | 29 | foreachp() 30 | { 31 | P=$(nproc) 32 | bgcount=0 33 | while read mod; do 34 | $1 "$mod" & 35 | 36 | bgcount=$((bgcount + 1)) 37 | if [ $bgcount -eq $P ]; then 38 | wait -n 39 | bgcount=$((bgcount - 1)) 40 | fi 41 | done 42 | 43 | wait 44 | } 45 | 46 | [ -d "$buildroot/etc/modprobe.d/" ] || mkdir -p "$buildroot/etc/modprobe.d/" 47 | 48 | if [ -s $list ]; then 49 | cat $list | foreachp check_blacklist 50 | if ls $buildroot/etc/modprobe.d/* >& /dev/null ; then 51 | echo "%defattr(-,root,root)" >> $list 52 | echo "%config(noreplace) /etc/modprobe.d/*-blacklist.conf" >> $list 53 | fi 54 | else 55 | # If modules-extra.list is empty the %files section will throw an 56 | # error. Add a dummy entry to workaround the problem. 57 | echo "%defattr(-,root,root)" >> $list 58 | fi 59 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/mod-extra.list: -------------------------------------------------------------------------------- 1 | 6pack.ko 2 | a3d.ko 3 | act200l-sir.ko 4 | actisys-sir.ko 5 | adi.ko 6 | aer_inject.ko 7 | af_802154.ko 8 | affs.ko 9 | ali-ircc.ko 10 | analog.ko 11 | appletalk.ko 12 | atm.ko 13 | avma1_cs.ko 14 | avm_cs.ko 15 | avmfritz.ko 16 | ax25.ko 17 | b1.ko 18 | bas_gigaset.ko 19 | batman-adv.ko 20 | baycom_par.ko 21 | baycom_ser_fdx.ko 22 | baycom_ser_hdx.ko 23 | befs.ko 24 | bpqether.ko 25 | br2684.ko 26 | capi.ko 27 | c_can.ko 28 | c_can_platform.ko 29 | clip.ko 30 | cobra.ko 31 | coda.ko 32 | cuse.ko 33 | db9.ko 34 | dccp_diag.ko 35 | dccp_ipv4.ko 36 | dccp_ipv6.ko 37 | dccp.ko 38 | dccp_probe.ko 39 | diva_idi.ko 40 | divas.ko 41 | ds1wm.ko 42 | ds2482.ko 43 | ds2490.ko 44 | dss1_divert.ko 45 | elsa_cs.ko 46 | ems_pci.ko 47 | ems_usb.ko 48 | esd_usb2.ko 49 | esi-sir.ko 50 | gamecon.ko 51 | gf2k.ko 52 | gigaset.ko 53 | girbil-sir.ko 54 | grip.ko 55 | grip_mp.ko 56 | guillemot.ko 57 | hdlcdrv.ko 58 | hfc4s8s_l1.ko 59 | hfcmulti.ko 60 | hfcpci.ko 61 | hisax.ko 62 | hwa-rc.ko 63 | hysdn.ko 64 | i2400m.ko 65 | i2400m-sdio.ko 66 | i2400m-usb.ko 67 | ieee802154.ko 68 | iforce.ko 69 | interact.ko 70 | ipddp.ko 71 | ipx.ko 72 | isdn.ko 73 | joydump.ko 74 | kingsun-sir.ko 75 | ks959-sir.ko 76 | ksdazzle-sir.ko 77 | kvaser_pci.ko 78 | l2tp_core.ko 79 | l2tp_debugfs.ko 80 | l2tp_eth.ko 81 | l2tp_ip.ko 82 | l2tp_netlink.ko 83 | l2tp_ppp.ko 84 | lec.ko 85 | ma600-sir.ko 86 | magellan.ko 87 | mcp2120-sir.ko 88 | mISDN_core.ko 89 | mISDN_dsp.ko 90 | mkiss.ko 91 | mptbase.ko 92 | mptctl.ko 93 | mptfc.ko 94 | nci.ko 95 | ncpfs.ko 96 | netjet.ko 97 | netrom.ko 98 | nfc.ko 99 | nilfs2.ko 100 | ocfs2_dlmfs.ko 101 | ocfs2_dlm.ko 102 | ocfs2.ko 103 | ocfs2_nodemanager.ko 104 | ocfs2_stackglue.ko 105 | ocfs2_stack_o2cb.ko 106 | ocfs2_stack_user.ko 107 | old_belkin-sir.ko 108 | orinoco_cs.ko 109 | orinoco.ko 110 | orinoco_nortel.ko 111 | orinoco_pci.ko 112 | orinoco_plx.ko 113 | orinoco_usb.ko 114 | plx_pci.ko 115 | pn_pep.ko 116 | pppoatm.ko 117 | rds.ko 118 | rds_rdma.ko 119 | rds_tcp.ko 120 | rose.ko 121 | sch_atm.ko 122 | sch_cbq.ko 123 | sch_choke.ko 124 | sch_drr.ko 125 | sch_dsmark.ko 126 | sch_gred.ko 127 | sch_mqprio.ko 128 | sch_multiq.ko 129 | sch_netem.ko 130 | sch_qfq.ko 131 | sch_red.ko 132 | sch_sfb.ko 133 | sch_teql.ko 134 | sctp.ko 135 | sctp_diag.ko 136 | sidewinder.ko 137 | sja1000.ko 138 | sja1000_platform.ko 139 | slcan.ko 140 | slip.ko 141 | softing_cs.ko 142 | softing.ko 143 | spaceball.ko 144 | spaceorb.ko 145 | stinger.ko 146 | sysv.ko 147 | tcp_bic.ko 148 | tcp_highspeed.ko 149 | tcp_htcp.ko 150 | tcp_hybla.ko 151 | tcp_illinois.ko 152 | tcp_lp.ko 153 | tcp_scalable.ko 154 | tcp_vegas.ko 155 | tcp_veno.ko 156 | tcp_westwood.ko 157 | tcp_yeah.ko 158 | tekram-sir.ko 159 | tmdc.ko 160 | toim3232-sir.ko 161 | trancevibrator.ko 162 | turbografx.ko 163 | twidjoy.ko 164 | ubifs.ko 165 | ufs.ko 166 | umc.ko 167 | usbip-core.ko 168 | usbip-host.ko 169 | uwb.ko 170 | vcan.ko 171 | vhci-hcd.ko 172 | w1_bq27000.ko 173 | w1_ds2408.ko 174 | w1_ds2423.ko 175 | w1_ds2431.ko 176 | w1_ds2433.ko 177 | w1_ds2760.ko 178 | w1_ds2780.ko 179 | w1_ds2781.ko 180 | w1_ds28e04.ko 181 | w1_smem.ko 182 | w1_therm.ko 183 | w6692.ko 184 | walkera0701.ko 185 | wanrouter.ko 186 | warrior.ko 187 | whci.ko 188 | wire.ko 189 | xpad.ko 190 | yam.ko 191 | zhenhua.ko 192 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/mod-extra.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | Rpmdir=$1 4 | Dir=$Rpmdir/$2 5 | List=$3 6 | 7 | pushd $Dir 8 | rm -rf modnames 9 | find . -name "*.ko" -type f > modnames 10 | # Look through all of the modules, and throw any that have a dependency in 11 | # our list into the list as well. 12 | rm -rf dep.list 13 | rm -rf req.list req2.list 14 | touch dep.list req.list 15 | cp $List . 16 | 17 | for dep in `cat modnames` 18 | do 19 | depends=`modinfo $dep | grep depends| cut -f2 -d":" | sed -e 's/^[ \t]*//'` 20 | [ -z "$depends" ] && continue; 21 | for mod in `echo $depends | sed -e 's/,/ /g'` 22 | do 23 | match=`grep "^$mod.ko" mod-extra.list` ||: 24 | if [ -z "$match" ] 25 | then 26 | continue 27 | else 28 | # check if the module we're looking at is in mod-extra too. if so 29 | # we don't need to mark the dep as required 30 | mod2=`basename $dep` 31 | match2=`grep "^$mod2" mod-extra.list` ||: 32 | if [ -n "$match2" ] 33 | then 34 | continue 35 | #echo $mod2 >> notreq.list 36 | else 37 | echo $mod.ko >> req.list 38 | fi 39 | fi 40 | done 41 | done 42 | 43 | sort -u req.list > req2.list 44 | sort -u mod-extra.list > mod-extra2.list 45 | join -v 1 mod-extra2.list req2.list > mod-extra3.list 46 | 47 | for mod in `cat mod-extra3.list` 48 | do 49 | # get the path for the module 50 | modpath=`grep /$mod modnames` ||: 51 | [ -z "$modpath" ] && continue; 52 | echo /lib/modules/$(basename $Dir)/${modpath#"./"} >> dep.list 53 | done 54 | 55 | sort -u dep.list > $Rpmdir/modules-extra.list 56 | rm modnames dep.list req.list req2.list 57 | rm mod-extra.list mod-extra2.list mod-extra3.list 58 | popd 59 | 60 | sed -i "s|^\/||g" $Rpmdir/modules-extra.list 61 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/mod-sign.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # The modules_sign target checks for corresponding .o files for every .ko that 4 | # is signed. This doesn't work for package builds which re-use the same build 5 | # directory for every flavour, and the .config may change between flavours. 6 | # So instead of using this script to just sign lib/modules/$KernelVer/extra, 7 | # sign all .ko in the buildroot. 8 | 9 | # This essentially duplicates the 'modules_sign' Kbuild target and runs the 10 | # same commands for those modules. 11 | 12 | MODSECKEY=$1 13 | MODPUBKEY=$2 14 | 15 | moddir=$3 16 | 17 | modules=`find $moddir -name *.ko` 18 | 19 | for mod in $modules 20 | do 21 | dir=`dirname $mod` 22 | file=`basename $mod` 23 | 24 | ./scripts/sign-file sha256 ${MODSECKEY} ${MODPUBKEY} ${dir}/${file} 25 | rm -f ${dir}/${file}.{sig,dig} 26 | done 27 | 28 | RANDOMMOD=$(find $moddir -type f -name '*.ko' | sort -R | head -n 1) 29 | if [ "~Module signature appended~" != "$(tail -c 28 $RANDOMMOD)" ]; then 30 | echo "*****************************" 31 | echo "*** Modules are unsigned! ***" 32 | echo "*****************************" 33 | exit 1 34 | fi 35 | 36 | exit 0 37 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/process_configs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script takes the merged config files and processes them through oldconfig 4 | # and listnewconfig 5 | # 6 | 7 | usage() 8 | { 9 | echo "process_configs.sh [ -n|-c|-t ] package_name kernel_version" 10 | echo " -n: error on unset config options" 11 | echo " -c: error on mismatched config options" 12 | echo " -t: test run, do not overwrite original config" 13 | echo " -w: error on misconfigured config options" 14 | exit 1 15 | } 16 | 17 | die() 18 | { 19 | echo "$1" 20 | exit 1 21 | } 22 | 23 | # stupid function to find top of tree to do kernel make configs 24 | switch_to_toplevel() 25 | { 26 | path="$(pwd)" 27 | while test -n "$path" 28 | do 29 | test -d $path/kernel && \ 30 | test -e $path/MAINTAINERS && \ 31 | test -d $path/drivers && \ 32 | break 33 | 34 | path="$(dirname $path)" 35 | done 36 | 37 | test -n "$path" || die "Can't find toplevel" 38 | echo "$path" 39 | } 40 | 41 | checkoptions() 42 | { 43 | /usr/bin/awk ' 44 | 45 | /is not set/ { 46 | split ($0, a, "#"); 47 | split(a[2], b); 48 | if (NR==FNR) { 49 | configs[b[1]]="is not set"; 50 | } else { 51 | if (configs[b[1]] != "" && configs[b[1]] != "is not set") 52 | print "Found # "b[1] " is not set, after generation, had " b[1] " " configs[b[1]] " in Source tree"; 53 | } 54 | } 55 | 56 | /=/ { 57 | split ($0, a, "="); 58 | if (NR==FNR) { 59 | configs[a[1]]=a[2]; 60 | } else { 61 | if (configs[a[1]] != "" && configs[a[1]] != a[2]) 62 | print "Found "a[1]"="a[2]" after generation, had " a[1]"="configs[a[1]]" in Source tree"; 63 | } 64 | } 65 | ' $1 $2 > .mismatches 66 | 67 | if test -s .mismatches 68 | then 69 | echo "Error: Mismatches found in configuration files" 70 | cat .mismatches 71 | exit 1 72 | fi 73 | } 74 | 75 | function process_configs() 76 | { 77 | # assume we are in $source_tree/configs, need to get to top level 78 | pushd $(switch_to_toplevel) &>/dev/null 79 | 80 | for cfg in $SCRIPT_DIR/${PACKAGE_NAME}${KVERREL}${SUBARCH}*.config 81 | do 82 | arch=$(head -1 $cfg | cut -b 3-) 83 | cfgtmp="${cfg}.tmp" 84 | cfgorig="${cfg}.orig" 85 | cat $cfg > $cfgorig 86 | 87 | echo -n "Processing $cfg ... " 88 | 89 | make ARCH=$arch KCONFIG_CONFIG=$cfgorig listnewconfig >& .listnewconfig 90 | grep -E 'CONFIG_' .listnewconfig > .newoptions 91 | if test -n "$NEWOPTIONS" && test -s .newoptions 92 | then 93 | echo "Found unset config items, please set them to an appropriate value" 94 | cat .newoptions 95 | rm .newoptions 96 | exit 1 97 | fi 98 | rm .newoptions 99 | 100 | grep -E 'config.*warning' .listnewconfig > .warnings 101 | if test -n "$CHECKWARNINGS" && test -s .warnings 102 | then 103 | echo "Found misconfigured config items, please set them to an appropriate value" 104 | cat .warnings 105 | rm .warnings 106 | exit 1 107 | fi 108 | rm .warnings 109 | 110 | rm .listnewconfig 111 | 112 | make ARCH=$arch KCONFIG_CONFIG=$cfgorig olddefconfig > /dev/null || exit 1 113 | echo "# $arch" > ${cfgtmp} 114 | cat "${cfgorig}" >> ${cfgtmp} 115 | if test -n "$CHECKOPTIONS" 116 | then 117 | checkoptions $cfg $cfgtmp 118 | fi 119 | # if test run, don't overwrite original 120 | if test -n "$TESTRUN" 121 | then 122 | rm ${cfgtmp} 123 | else 124 | mv ${cfgtmp} ${cfg} 125 | fi 126 | rm ${cfgorig} 127 | echo "done" 128 | done 129 | rm "$SCRIPT_DIR"/*.config*.old 130 | popd > /dev/null 131 | 132 | echo "Processed config files are in $SCRIPT_DIR" 133 | } 134 | 135 | NEWOPTIONS="" 136 | CHECKOPTIONS="" 137 | CHECKWARNINGS="" 138 | TESTRUN="" 139 | 140 | while [[ $# -gt 0 ]] 141 | do 142 | key="$1" 143 | case $key in 144 | -h) 145 | usage 146 | ;; 147 | -n) 148 | NEWOPTIONS="x" 149 | ;; 150 | -c) 151 | CHECKOPTIONS="x" 152 | ;; 153 | -t) 154 | TESTRUN="x" 155 | ;; 156 | -w) 157 | CHECKWARNINGS="x" 158 | ;; 159 | *) 160 | break;; 161 | esac 162 | shift 163 | done 164 | 165 | PACKAGE_NAME="${1:-kernel}" # defines the package name used 166 | KVERREL="$(test -n "$2" && echo "-$2" || echo "")" 167 | SUBARCH="$(test -n "$3" && echo "-$3" || echo "")" 168 | SCRIPT="$(readlink -f $0)" 169 | OUTPUT_DIR="$PWD" 170 | SCRIPT_DIR="$(dirname $SCRIPT)" 171 | 172 | # to handle this script being a symlink 173 | cd $SCRIPT_DIR 174 | 175 | process_configs 176 | -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/secureboot.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmpereComputing/ampere-lts-kernel---DEPRECATED/66a3ee3aa113a8e4e48b41fd21880a56c8ad6109/pkg-builds/rpm/SOURCES/secureboot.cer -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/securebootca.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmpereComputing/ampere-lts-kernel---DEPRECATED/66a3ee3aa113a8e4e48b41fd21880a56c8ad6109/pkg-builds/rpm/SOURCES/securebootca.cer -------------------------------------------------------------------------------- /pkg-builds/rpm/SOURCES/x509.genkey: -------------------------------------------------------------------------------- 1 | [ req ] 2 | default_bits = 3072 3 | distinguished_name = req_distinguished_name 4 | prompt = no 5 | x509_extensions = myexts 6 | 7 | [ req_distinguished_name ] 8 | O = Red Hat 9 | CN = Red Hat Enterprise Linux kernel signing key 10 | emailAddress = secalert@redhat.com 11 | 12 | [ myexts ] 13 | basicConstraints=critical,CA:FALSE 14 | keyUsage=digitalSignature 15 | subjectKeyIdentifier=hash 16 | authorityKeyIdentifier=keyid 17 | -------------------------------------------------------------------------------- /pkg-builds/rpm/ampere-lts-centos-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Usage: ampere-lts-centos-build.sh 4 | # 5 | # where the build-tag format is YYMMDD where YY is last year digit, MM is month, and DD is day 6 | # 7 | # NOTE: build-tag is auto generated by date if not provided. 8 | # 9 | # These need to match with the definition in .spec file 10 | # 11 | set -x 12 | 13 | which rpmbuild &> /dev/null 14 | [ $? -ne 0 ] && echo "rpmbuild tool not found !!!" && exit 1 15 | 16 | AMP_TOOLCHAIN_VER=ampere-8.3.0-20191025-dynamic-nosysroot 17 | AMP_COMPILER_LOCALPATH=/opt/amp/${AMP_TOOLCHAIN_VER}/bin 18 | CROSS_COMPILER_NFSPATH=/tools/theobroma/gcc/${AMP_TOOLCHAIN_VER}/bin 19 | NATIVE_COMPILER_NFSPATH=/tools/theobroma/gcc/${AMP_TOOLCHAIN_VER}/native/${AMP_TOOLCHAIN_VER}/bin 20 | 21 | MACHINE_TYPE=`uname -m` 22 | 23 | if [ ${MACHINE_TYPE} = 'aarch64' ]; then 24 | export -n CROSS_COMPILE 25 | if [ -d "$AMP_COMPILER_LOCALPATH" ]; then 26 | PATH=${AMP_COMPILER_LOCALPATH}:$PATH 27 | export PATH 28 | elif [ -d "$NATIVE_COMPILER_NFSPATH" ]; then 29 | PATH=${NATIVE_COMPILER_NFSPATH}:$PATH 30 | export PATH 31 | fi 32 | else 33 | export CROSS_COMPILE=aarch64-ampere-linux-gnu- 34 | fi 35 | 36 | GCC_VERSION=$(${CROSS_COMPILE}gcc -dumpfullversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$/&00/') 37 | 38 | export XZ_OPT="--threads=0" 39 | TODAY=`date +%Y%m%d` 40 | RELBUILD="${TODAY}" 41 | if [ -n "${1}" ]; then 42 | RELBUILD=${1} 43 | fi 44 | 45 | CENTOSNAMEPREFIX=amp_sw_centos_8.0 46 | 47 | 48 | CENTOSSPECFILE=SPECS/kernel-ampere-lts-5.4.spec 49 | RPMVERSION=`grep -e "^%define rpmversion" ${CENTOSSPECFILE} | cut -d' ' -f3` 50 | PKGRELEASE=`grep -e "^%define pkgrelease" ${CENTOSSPECFILE} | cut -d' ' -f3` 51 | 52 | rpmversion=${RPMVERSION} 53 | pkgrelease=${PKGRELEASE} 54 | 55 | # Prepare Linux 5.4 source in SOURCES/ 56 | [ ! -f ./linux-5.4.y.zip ] && wget https://github.com/AmpereComputing/ampere-lts-kernel/archive/refs/heads/linux-5.4.y.zip 57 | LINUX_SRC=linux-${rpmversion}-${pkgrelease} 58 | rm -fr ${LINUX_SRC} SOURCES/linux-${rpmversion}-${pkgrelease}.tar.xz 59 | unzip -q linux-5.4.y.zip; mv ampere-lts-kernel-linux-5.4.y ${LINUX_SRC} 60 | echo "# arm64" > SOURCES/kernel-aarch64-altra.config 61 | echo "CONFIG_GCC_VERSION=${GCC_VERSION}" >> SOURCES/kernel-aarch64-altra.config 62 | echo "CONFIG_LOCALVERSION=\"\"" >> SOURCES/kernel-aarch64-altra.config 63 | cat ${LINUX_SRC}/arch/arm64/configs/altra_5.4_defconfig >> SOURCES/kernel-aarch64-altra.config 64 | tar -cJf SOURCES/linux-${rpmversion}-${pkgrelease}.tar.xz ${LINUX_SRC} 65 | rm -fr ${LINUX_SRC} RPMS SRPMS 66 | 67 | echo "Building for Linux 5.4 release tag ${RELBUILD}" 68 | 69 | #Update build release tag to spec file 70 | #sed -i "s/ buildid \..*/ buildid \.${RELBUILD}+amp/g" ${CENTOSSPECFILE} 71 | 72 | rpmbuild --target aarch64 --define "%_topdir `pwd`" --define "buildid .${RELBUILD}+amp" --without debug --with debuginfo --without tools --without perf -ba ${CENTOSSPECFILE} 73 | if [ $? -ne 0 ]; then 74 | exit $? 75 | fi 76 | 77 | cd RPMS/aarch64; md5sum *.rpm > ${CENTOSNAMEPREFIX}-${RELBUILD}_md5sum.txt; cd - 78 | cd RPMS/; tar -cJf ../${CENTOSNAMEPREFIX}-${RELBUILD}-${rpmversion}.tar.xz aarch64;cd - 79 | tar -cJf ${CENTOSNAMEPREFIX}-${RELBUILD}-${rpmversion}.src.tar.xz SRPMS 80 | 81 | rm -rf RPMS SRPMS 82 | 83 | 84 | CENTOSSPECFILE=SPECS/kernel-ampere-lts-5.10.spec 85 | RPMVERSION=`grep -e "^%define rpmversion" ${CENTOSSPECFILE} | cut -d' ' -f3` 86 | PKGRELEASE=`grep -e "^%define pkgrelease" ${CENTOSSPECFILE} | cut -d' ' -f3` 87 | 88 | rpmversion=${RPMVERSION} 89 | pkgrelease=${PKGRELEASE} 90 | 91 | # Prepare Linux 5.10 source in SOURCES/ 92 | [ ! -f ./linux-5.10.y.zip ] && wget https://github.com/AmpereComputing/ampere-lts-kernel/archive/refs/heads/linux-5.10.y.zip 93 | LINUX_SRC=linux-${rpmversion}-${pkgrelease} 94 | rm -fr ${LINUX_SRC} SOURCES/linux-${rpmversion}-${pkgrelease}.tar.xz 95 | unzip -q ./linux-5.10.y.zip; mv ampere-lts-kernel-linux-5.10.y ${LINUX_SRC} 96 | echo "# arm64" > SOURCES/kernel-aarch64-altra.config 97 | echo "CONFIG_GCC_VERSION=${GCC_VERSION}" >> SOURCES/kernel-aarch64-altra.config 98 | echo "CONFIG_LOCALVERSION=\"\"" >> SOURCES/kernel-aarch64-altra.config 99 | cat ${LINUX_SRC}/arch/arm64/configs/altra_5.10_defconfig >> SOURCES/kernel-aarch64-altra.config 100 | tar -cJf SOURCES/linux-${rpmversion}-${pkgrelease}.tar.xz ${LINUX_SRC} 101 | rm -fr ${LINUX_SRC} RPMS SRPMS 102 | 103 | echo "Building for Linux 5.10 release tag ${RELBUILD}" 104 | 105 | #Update build release tag to spec file 106 | #sed -i "s/ buildid \..*/ buildid \.${RELBUILD}+amp/g" ${CENTOSSPECFILE} 107 | 108 | rpmbuild --target aarch64 --define "%_topdir `pwd`" --define "buildid .${RELBUILD}+amp" --without debug --with debuginfo --without tools --without perf -ba ${CENTOSSPECFILE} 109 | if [ $? -ne 0 ]; then 110 | exit $? 111 | fi 112 | 113 | cd RPMS/aarch64; md5sum *.rpm > ${CENTOSNAMEPREFIX}-${RELBUILD}_md5sum.txt; cd - 114 | cd RPMS/; tar -cJf ../${CENTOSNAMEPREFIX}-${RELBUILD}-${rpmversion}.tar.xz aarch64;cd - 115 | tar -cJf ${CENTOSNAMEPREFIX}-${RELBUILD}-${rpmversion}.src.tar.xz SRPMS 116 | 117 | rm -rf RPMS SRPMS 118 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | generated_skipfile 2 | output* 3 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | DEPRECATED 2 | This repository is deprecated and set to archive status. It will eventually be deleted. 3 | 4 | Test cases for ampere-lts-kernel. 5 | 6 | * lkft: Linaro's Linux Kernel Functional Testing test suites. Currently ported LTP and Kselftest scripts. 7 | 8 | * ampere_functions: Ampere kernel patch functional test cases. 9 | 10 | * runall.sh: Invoke all test cases. The test case can also run independently. 11 | 12 | 13 | Sample test result: 14 | 15 | * LTP: https://github.com/AmpereComputing/ampere-lts-kernel/issues/2 16 | * Kselftest: https://github.com/AmpereComputing/ampere-lts-kernel/issues/3 17 | -------------------------------------------------------------------------------- /tests/ampere_functions/cpuectlr_el1/altra_cpuectlr_el1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ../../lib/sh-test-lib 4 | OUTPUT="$(pwd)/output" 5 | RESULT_FILE="${OUTPUT}/result.txt" 6 | LOGFILE="${OUTPUT}/cpuectlr_el1.txt" 7 | 8 | ! check_root && error_msg "You need to be root to run this script." 9 | create_out_dir "${OUTPUT}" 10 | 11 | function cpuectlr_el1_driver_check { 12 | modprobe altra_cpuectlr_el1 || return 1 13 | [ ! -f /sys/firmware/altra_cpuectlr/cpuectlr_el1_value ] && echo "/sys/firmware/altra_cpuectlr not exist" && return 1 14 | 15 | signature=`cat /sys/firmware/altra_cpuectlr/signature` 16 | [ "$signature" != "0x43504d41" ] && echo "signature not match" && return 1 17 | 18 | echo 0xffff > /sys/firmware/altra_cpuectlr/cpuectlr_el1_wen_mask 19 | mask=`cat /sys/firmware/altra_cpuectlr/cpuectlr_el1_wen_mask` 20 | [ "$mask" != "0xb1a0" ] && echo "cpuectlr_el1_wen_mask should only allow prefetcher bits" && return 1 21 | 22 | echo 0xff > /sys/firmware/altra_cpuectlr/cpuectlr_el1_value 23 | value=`cat /sys/firmware/altra_cpuectlr/cpuectlr_el1_value` 24 | [ "$value" != "0xff" ] && echo "cpuectlr_el1_value not match" && return 1 25 | 26 | return 0 27 | } 28 | 29 | cpuectlr_el1_driver_check 30 | check_return altra:cpuectlr_el1 31 | -------------------------------------------------------------------------------- /tests/ampere_functions/exec/clock_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sys_time=`TIME="%S" time ./read_tsc 2>&1` 4 | [ 1 -eq "$(echo "${sys_time} != 0" | bc)" ] && echo "non-zero systime in CNTVCT_EL1 reading before test" && exit 1 5 | 6 | ./test_32bit > /dev/null 7 | 8 | sys_time=`TIME="%S" time ./read_tsc 2>&1` 9 | [ 1 -eq "$(echo "${sys_time} != 0" | bc)" ] && echo "non-zero systime in CNTVCT_EL1 reading" && exit 1 10 | 11 | exit 0 12 | -------------------------------------------------------------------------------- /tests/ampere_functions/exec/exec.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ../../lib/sh-test-lib 4 | OUTPUT="$(pwd)/output" 5 | RESULT_FILE="${OUTPUT}/result.txt" 6 | LOGFILE="${OUTPUT}/exec.txt" 7 | 8 | ! check_root && error_msg "You need to be root to run this script." 9 | create_out_dir "${OUTPUT}" 10 | 11 | # Test patch https://github.com/torvalds/linux/commit/38e0257e0e6f4fef2aa2966b089b56a8b1cfb75c 12 | exec_erratum_1418040_check() 13 | { 14 | numactl -C 2 ./clock_test.sh 15 | return $? 16 | } 17 | 18 | exec_erratum_1418040_check 19 | check_return altra:exec 20 | 21 | -------------------------------------------------------------------------------- /tests/ampere_functions/exec/read_tsc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmpereComputing/ampere-lts-kernel---DEPRECATED/66a3ee3aa113a8e4e48b41fd21880a56c8ad6109/tests/ampere_functions/exec/read_tsc -------------------------------------------------------------------------------- /tests/ampere_functions/exec/test_32bit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmpereComputing/ampere-lts-kernel---DEPRECATED/66a3ee3aa113a8e4e48b41fd21880a56c8ad6109/tests/ampere_functions/exec/test_32bit -------------------------------------------------------------------------------- /tests/ampere_functions/hw_monitor/altra_hw_monitor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ../../lib/sh-test-lib 4 | OUTPUT="$(pwd)/output" 5 | RESULT_FILE="${OUTPUT}/result.txt" 6 | LOGFILE="${OUTPUT}/altra_hwmon.txt" 7 | 8 | ! check_root && error_msg "You need to be root to run this script." 9 | create_out_dir "${OUTPUT}" 10 | 11 | function hw_monitor_check_hwmon { 12 | echo "Found hw monitor modules: $(lsmod | grep hwmon | awk '{printf $1" "}')" 13 | hwmon_devices=$(ls -l /sys/class/hwmon | wc -l) 14 | [ ${hwmon_devices} -lt 1 ] && return 1 15 | for hwmon_path in /sys/class/hwmon/hwmon*; do 16 | mod_name=$(cat ${hwmon_path}/name) 17 | temp_label=$(cat ${hwmon_path}/temp1_label) 18 | temp=$(cat ${hwmon_path}/temp1_input) 19 | echo "${temp_label}(${mod_name}): ${temp}" 20 | done 21 | return 0 22 | } 23 | 24 | function hw_monitor_check_perm { 25 | hwmon_list=`find /sys/devices/platform -name "hwmon[0-9]"` 26 | for hwmon in $hwmon_list 27 | do 28 | echo "check permission in $hwmon" 29 | check_list=`find $hwmon -type f \( -name "power[0-9]_input" -o -name "energy*" \)` 30 | for file in $check_list 31 | do 32 | perm=`stat -c '%a' $file` 33 | [ "$perm" != "400" ] && echo "Wrong file permission in $file" && return 1 34 | done 35 | done 36 | return 0 37 | } 38 | 39 | # Verify patches in https://github.com/AmpereComputing/ampere-lts-kernel/issues/106" 40 | 41 | hw_monitor_check_hwmon 42 | check_return altra:hwmon 43 | 44 | hw_monitor_check_perm 45 | check_return altra:hwmon_perm 46 | -------------------------------------------------------------------------------- /tests/ampere_functions/leds/altra_leds.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ../../lib/sh-test-lib 4 | OUTPUT="$(pwd)/output" 5 | RESULT_FILE="${OUTPUT}/result.txt" 6 | LOGFILE="${OUTPUT}/altra_leds.txt" 7 | 8 | ! check_root && error_msg "You need to be root to run this script." 9 | create_out_dir "${OUTPUT}" 10 | 11 | function write_note { 12 | echo $1 > $2 13 | } 14 | 15 | function leds_check_led { 16 | # blink test 17 | write_note 000b:03 /sys/class/leds/altra:led/address || return 1 18 | write_note 4 /sys/class/leds/altra:led/blink || return 1 19 | write_note 0 /sys/class/leds/altra:led/shot || return 1 20 | sleep 1 21 | # on/off test 22 | write_note 000b:03 /sys/class/leds/altra:led/address || return 1 23 | write_note 1 /sys/class/leds/altra:led/brightness || return 1 24 | write_note 0 /sys/class/leds/altra:led/brightness || return 1 25 | return 0 26 | } 27 | 28 | # Verify https://github.com/AmpereComputing/ampere-lts-kernel/commit/ab93b7ce6ea637a0d581431b012118cfe45fad7f" 29 | leds_check_led 30 | check_return altra:led 31 | -------------------------------------------------------------------------------- /tests/ampere_functions/numa/numa.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ../../lib/sh-test-lib 4 | OUTPUT="$(pwd)/output" 5 | RESULT_FILE="${OUTPUT}/result.txt" 6 | LOGFILE="${OUTPUT}/altra_leds.txt" 7 | 8 | create_out_dir "${OUTPUT}" 9 | 10 | function numa_check_node { 11 | #cat /boot/config-`uname -r` | grep -q "CONFIG_NODES_SHIFT=6" 12 | zcat /proc/config.gz | grep -q "CONFIG_NODES_SHIFT=6" 13 | [ $? -ne 0 ] && echo "CONFIG_NODES_SHIFT not set in current kernel" && return 1 14 | node_cnt=$(numactl -H | grep "node .* cpus:" | wc -l) 15 | info_msg "Found $node_cnt numa node" 16 | [ $node_cnt -lt 8 ] && echo "This test expected more than 8 numa nodes. In BIOS please set: Chipset -> CPU Configuration -> ANC mode -> Quadrant" && return 1 17 | return 0 18 | } 19 | 20 | function numa_device_alloc { 21 | echo "Remote fio read test on /dev/nvme1n1p1. Make sure this NVME disk is on Node0" 22 | umount /mnt/fiotest 23 | mount /dev/nvme1n1p1 /mnt/fiotest/ 24 | echo 3 > /proc/sys/vm/drop_caches 25 | tmplog=`mktemp` 26 | numactl -N 1 -m 1 fio --ioengine=libaio --randrepeat=0 --norandommap --thread --direct=0 --buffered=1 --group_reporting --name=seqdztest --ramp_time=5 --runtime=20 --time_based --numjobs=5 --iodepth=32 --directory=/mnt/fiotest --size=50G --rw=read --bs=256k --output=${tmplog} 27 | echo 28 | bw=`cat ${tmplog} | grep -oP '(?<=READ: bw=)(\d+)(?=MiB/s )'` 29 | rm -f ${tmplog} 30 | [ $bw -lt 2000 ] && echo "Failed: '${bw} >= 2000 MiB/s' not true, please check #95 in github" && return 1 31 | return 0 32 | } 33 | 34 | numa_check_node 35 | check_return altra:numa 36 | 37 | ./srat_overlap_check.py 38 | check_return altra:srat_overlap_check 39 | 40 | numa_device_alloc 41 | check_return altra:device_alloc 42 | -------------------------------------------------------------------------------- /tests/ampere_functions/numa/srat_overlap_check.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | 3 | import subprocess 4 | import sys 5 | import re 6 | 7 | def get_sysfs_node_size(idx): 8 | cmd_out = subprocess.check_output("cat /sys/devices/system/node/node%d/meminfo | grep MemTotal" % idx, shell=True).decode('utf-8') 9 | mem_total = cmd_out.split()[3] 10 | return int(mem_total) * 1024 11 | 12 | def MB(size): 13 | return size / 1024 / 1024 14 | 15 | # CONFIG_NODES_SPAN_OTHER_NODES is removed in v5.8 16 | # ret = subprocess.run('cat /boot/config-`uname -r` | grep -q "CONFIG_NODES_SPAN_OTHER_NODES=y"', shell=True) 17 | ret = subprocess.run('zcat /proc/config.gz | grep -q "CONFIG_NODES_SPAN_OTHER_NODES=y"', shell=True) 18 | if ret.returncode != 0: 19 | print("CONFIG_NODES_SPAN_OTHER_NODES is not set") 20 | 21 | srat_out = subprocess.check_output('dmesg | grep "SRAT: Node"', shell=True).decode('utf-8') 22 | nodes_size = {} 23 | for line in srat_out.split('\n'): 24 | matched = re.match(".*ACPI: SRAT: Node (\d+) PXM \d+ \[mem 0x([0-9a-fA-F]+)-0x([0-9a-fA-F]+)\]$", line) 25 | if matched: 26 | node_num = int(matched.group(1)) 27 | start_addr = int(matched.group(2), 16) 28 | end_addr = int(matched.group(3), 16) 29 | if node_num not in nodes_size: 30 | nodes_size[node_num] = end_addr - start_addr 31 | else: 32 | nodes_size[node_num] += end_addr - start_addr 33 | 34 | for idx, nsize in sorted(nodes_size.items()): 35 | sysfs_size = get_sysfs_node_size(idx) 36 | delta = abs(nsize - sysfs_size) 37 | print("Numa Node %d: ACPI SRAT size %d MB, Kernel Reported %d MB, Delta %d MB" % (idx, MB(nsize), MB(sysfs_size), MB(delta))) 38 | 39 | sys.exit(0) 40 | -------------------------------------------------------------------------------- /tests/ampere_functions/perf_kvm_stat/perf_kvm_stat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ../../lib/sh-test-lib 4 | OUTPUT="$(pwd)/output" 5 | RESULT_FILE="${OUTPUT}/result.txt" 6 | LOGFILE="${OUTPUT}/perf_kvm_stat.txt" 7 | 8 | ! check_root && error_msg "You need to be root to run this script." 9 | create_out_dir "${OUTPUT}" 10 | 11 | # check if perf kvm stat command is supported in arm64 12 | function perf_kvm_stat_check { 13 | perf kvm stat record -a sleep 1 > /dev/null 2>&1 14 | [ $? -ne 0 ] && echo "perf kvm stat is not supported" && return 1 15 | return 0 16 | } 17 | 18 | perf_kvm_stat_check 19 | check_return altra:perf_kvm_stat 20 | -------------------------------------------------------------------------------- /tests/ampere_functions/pmu/altra_pmu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ../../lib/sh-test-lib 4 | OUTPUT="$(pwd)/output" 5 | RESULT_FILE="${OUTPUT}/result.txt" 6 | LOGFILE="${OUTPUT}/altra_pmu.txt" 7 | 8 | ! check_root && error_msg "You need to be root to run this script." 9 | create_out_dir "${OUTPUT}" 10 | 11 | function pmu_check_arm_cmn { 12 | tmpresult=/tmp/pmu_check_arm_cmn.log 13 | rm -f $tmpresult 14 | perf stat -I 1000 --interval-count 1 -D 200 -C 0 -e 'arm_cmn/dtc_cycles/' &> $tmpresult || return 1 15 | grep "not supported" $tmpresult && return 1 16 | dct_cycles=$(cat $tmpresult | grep "arm_cmn\/dtc_cycles\/" | awk '{print $2}' | sed "s/,//g") 17 | mesh_freq_in_GHz=$(echo "scale=2; $dct_cycles/1000000000" | bc) 18 | echo "Mesh Freq: ${mesh_freq_in_GHz} GHz" 19 | } 20 | 21 | function pmu_check_arm_dmc { 22 | tmpresult=/tmp/pmu_check_arm_dmc.log 23 | rm -f $tmpresult 24 | 25 | dmclist=() 26 | for i in `perf list | grep dmc620 | grep clkdiv2_rdwr | awk '{print $1}'` 27 | do 28 | dmclist+=($i) 29 | done 30 | dmc_name_0=`echo ${dmclist[0]} | awk -F '/' '{print $1}'` 31 | dmc_name_8=`echo ${dmclist[8]} | awk -F '/' '{print $1}'` 32 | 33 | events_list="${dmc_name_0}/clk_cycle_count/,${dmc_name_8}/clk_cycle_count/" 34 | for (( i=0; i<${#dmclist[@]}; i++ )); 35 | do 36 | events_list="${events_list},${dmclist[$i]}" 37 | done 38 | 39 | perf stat -I 1000 --interval-count 1 -D 200 -C 0 -e $events_list &> $tmpresult || return 1 40 | grep "not supported" $tmpresult && return 1 41 | 42 | dct_0_cycle=$(cat $tmpresult | grep "${dmc_name_0}\/clk_cycle_count\/" | awk '{print $2}' | sed "s/,//g") 43 | node_0_DIMM_freq_in_GHz=$(echo "scale=1; $dct_0_cycle/1000000000*2" | bc) 44 | echo "Node 0 Mem Freq: ${node_0_DIMM_freq_in_GHz} GHz" 45 | 46 | dct_8_cycle=$(cat $tmpresult | grep "${dmc_name_8}\/clk_cycle_count\/" | awk '{print $2}' | sed "s/,//g") 47 | node_1_DIMM_freq_in_GHz=$(echo "scale=1; $dct_8_cycle/1000000000*2" | bc) 48 | echo "Node 1 Mem Freq: ${node_1_DIMM_freq_in_GHz} GHz" 49 | 50 | chan_sum=$(for i in $(seq 0 7); do 51 | cat $tmpresult | grep "${dmclist[$i]}" | awk '{print $2}' | sed "s/,//g" 52 | done | awk '{s+=$1}END{print s}') 53 | node_0_mem_bw=$(echo "scale=1; $chan_sum * 64 / 1000000" | bc) 54 | echo "Node 0 Mem BW: $node_0_mem_bw MB/sec" 55 | 56 | chan_sum=$(for i in $(seq 8 15); do 57 | cat $tmpresult | grep "${dmclist[$i]}" | awk '{print $2}' | sed "s/,//g" 58 | done | awk '{s+=$1}END{print s}') 59 | node_1_mem_bw=$(echo "scale=1; $chan_sum * 64 / 1000000" | bc) 60 | echo "Node 1 Mem BW: $node_1_mem_bw MB/sec" 61 | } 62 | 63 | function pmu_check_arm_dsu { 64 | tmpresult=/tmp/pmu_check_arm_dsu.log 65 | rm -f $tmpresult 66 | dsu_events_count=$(perf list | grep 'arm_dsu_.*/cycles' | wc -l) 67 | [ $dsu_events_count -eq 0 ] && return 1 68 | dsu_events=$(perf list | grep 'arm_dsu_.*/cycles' | awk '{print $1}' | tr '\n' ',') 69 | perf stat -a -e "${dsu_events%?}" -- sleep 1 &> $tmpresult || return 1 70 | grep "not supported" $tmpresult && return 1 71 | return 0 72 | } 73 | 74 | function pmu_check_arm_smmuv3 { 75 | tmpresult=/tmp/pmu_check_arm_smmuv3.log 76 | rm -f $tmpresult 77 | smmu_events_count=$(perf list | grep 'smmuv3_pmcg_.*/cycles' | wc -l) 78 | [ $smmu_events_count -eq 0 ] && return 1 79 | smmu_events=$(perf list | grep 'smmuv3_pmcg_.*/cycles' | awk '{print $1}' | tr '\n' ',') 80 | perf stat -a -e "${smmu_events%?}" -- sleep 1 &> $tmpresult || return 1 81 | grep "not supported" $tmpresult && return 1 82 | return 0 83 | } 84 | 85 | function pmu_check_arm_spe { 86 | spe_events=$(perf list | grep arm_spe | wc -l) 87 | [ $spe_events -eq 0 ] && return 1 88 | perf record -e arm_spe/ts_enable=1,pa_enable=1/ dd if=/dev/zero of=/dev/null count=10000 &> /dev/null 89 | perf report --dump-raw-trace | grep "ARM SPE" 90 | [ $? -ne 0 ] && return 1 91 | return 0 92 | } 93 | 94 | pmu_check_arm_cmn 95 | check_return altra:pmu:arm_cmn 96 | 97 | pmu_check_arm_dmc 98 | check_return altra:pmu:arm_dmc 99 | 100 | pmu_check_arm_dsu 101 | check_return altra:pmu:arm_dsu 102 | 103 | pmu_check_arm_smmuv3 104 | check_return altra:pmu:arm_smmuv3 105 | 106 | pmu_check_arm_spe 107 | check_return altra:pmu:arm_spe 108 | 109 | rm -f /tmp/pmu_check_* 110 | -------------------------------------------------------------------------------- /tests/ampere_functions/ras/ras.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ../../lib/sh-test-lib 4 | OUTPUT="$(pwd)/output" 5 | RESULT_FILE="${OUTPUT}/result.txt" 6 | LOGFILE="${OUTPUT}/ras.txt" 7 | 8 | ! check_root && error_msg "You need to be root to run this script." 9 | create_out_dir "${OUTPUT}" 10 | 11 | function ras_check_errors { 12 | dmesg -C 13 | modprobe einj || return 1 14 | # start record 15 | trace-cmd start -e mc_event -e non_standard_event -e arm_event || return 1 16 | # inject cpu errors 17 | echo 0x1 > /sys/kernel/debug/apei/einj/error_type || return 1 18 | echo 0x1 > /sys/kernel/debug/apei/einj/error_inject || return 1 19 | trace-cmd show | grep "ARM Processor Err" 20 | if [ $? -ne 0 ]; then 21 | # Hardware EINJ enabled in BIOS 22 | dmesg | egrep "CPU[0-9]+: ERR" 23 | [ $? -ne 0 ] && return 1 24 | fi 25 | trace-cmd stop 26 | return 0 27 | } 28 | 29 | # verify patch https://github.com/AmpereComputing/ampere-lts-kernel/issues/97 30 | function ras_check_ext_errors { 31 | dmesg -C 32 | modprobe einj || return 1 33 | # start record 34 | trace-cmd start -e mc_event -e non_standard_event -e arm_event -e arm_ras_ext_event || return 1 35 | # inject cpu errors 36 | echo 0x1 > /sys/kernel/debug/apei/einj/error_type || return 1 37 | echo 0x0 > /sys/kernel/debug/apei/einj/param3 || return 1 38 | echo 0x1 > /sys/kernel/debug/apei/einj/flags || return 1 39 | echo 0x1 > /sys/kernel/debug/apei/einj/error_inject || return 1 40 | trace-cmd show | grep "ARM Processor Err" 41 | if [ $? -ne 0 ]; then 42 | # Hardware EINJ enabled in BIOS 43 | dmesg | egrep "CPU[0-9]+: ERR" 44 | [ $? -ne 0 ] && return 1 45 | fi 46 | trace-cmd stop 47 | return 0 48 | } 49 | 50 | ras_check_errors 51 | check_return altra:ras 52 | 53 | ras_check_ext_errors 54 | check_return altra:ras_ext 55 | -------------------------------------------------------------------------------- /tests/ampere_functions/smmu_filter_fix/smmu_filter_fix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ../../lib/sh-test-lib 4 | OUTPUT="$(pwd)/output" 5 | RESULT_FILE="${OUTPUT}/result.txt" 6 | LOGFILE="${OUTPUT}/smmu_filter_fix.txt" 7 | 8 | ! check_root && error_msg "You need to be root to run this script." 9 | create_out_dir "${OUTPUT}" 10 | 11 | # check https://github.com/AmpereComputing/ampere-lts-kernel/issues/53 if test failed 12 | function smmuv3_global_filter_check { 13 | result=$(perf stat -e smmuv3_pmcg_27ffe0202/transaction/,smmuv3_pmcg_27ffe0202/tlb_miss/ -a sleep 5 2>&1 | grep smmuv3_pmcg | awk '{print $1}') 14 | for i in $result 15 | do 16 | [ $i -ne 0 ] && echo "Except zero counter" && return 1 17 | done 18 | return 0 19 | } 20 | 21 | smmuv3_global_filter_check 22 | check_return altra:smmu_filter_fix 23 | -------------------------------------------------------------------------------- /tests/bin/arm64/skipgen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmpereComputing/ampere-lts-kernel---DEPRECATED/66a3ee3aa113a8e4e48b41fd21880a56c8ad6109/tests/bin/arm64/skipgen -------------------------------------------------------------------------------- /tests/lib/sh-test-lib: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | LANG=C 4 | export LANG 5 | 6 | error_fatal() { 7 | # shellcheck disable=SC2039 8 | local msg="$1" 9 | [ -z "${msg}" ] && msg="Unknown error" 10 | if command -v lava-test-raise; then 11 | lava-test-raise "${msg}" 12 | else 13 | printf "FATAL ERROR: %s\n" "${msg}" >&2 14 | fi 15 | exit 1 16 | } 17 | 18 | error_msg() { 19 | # shellcheck disable=SC2039 20 | local msg="$1" 21 | [ -z "${msg}" ] && msg="Unknown error" 22 | printf "ERROR: %s\n" "${msg}" >&2 23 | exit 1 24 | } 25 | 26 | warn_msg() { 27 | # shellcheck disable=SC2039 28 | local msg="$1" 29 | [ -z "${msg}" ] && msg="Unknown error" 30 | printf "WARNING: %s\n" "${msg}" >&2 31 | } 32 | 33 | info_msg() { 34 | # shellcheck disable=SC2039 35 | local msg="$1" 36 | [ -z "${msg}" ] && msg="Unknown info" 37 | printf "INFO: %s\n" "${msg}" >&1 38 | } 39 | 40 | check_root() { 41 | if [ "$(id -ru)" -eq 0 ]; then 42 | return 0 43 | else 44 | return 1 45 | fi 46 | } 47 | 48 | exit_on_fail() { 49 | # shellcheck disable=SC2039 50 | local exit_code="$?" 51 | [ "$#" -lt 1 ] && error_msg "Usage: exit_on_fail test_case [skip_list]" 52 | # shellcheck disable=SC2039 53 | local test_case="$1" 54 | # shellcheck disable=SC2039 55 | local skip_list="$2" 56 | 57 | if [ "${exit_code}" -ne 0 ]; then 58 | echo "${test_case} fail" | tee -a "${RESULT_FILE}" 59 | 60 | # skip_list is a list of tests sepereated by space. This might be 61 | # useful when exiting on prerequisite not met. 62 | if [ -n "${skip_list}" ]; then 63 | for i in ${skip_list}; do 64 | echo "$i skip" | tee -a "${RESULT_FILE}" 65 | done 66 | fi 67 | 68 | # Exit normally to continue to run the following steps defined in test 69 | # definition file. 70 | exit 0 71 | else 72 | echo "${test_case} pass" | tee -a "${RESULT_FILE}" 73 | return 0 74 | fi 75 | } 76 | 77 | exit_on_skip() { 78 | # shellcheck disable=SC2039 79 | local exit_code="$?" 80 | [ "$#" -lt 1 ] && error_msg "Usage: exit_on_skip test_case [msg]" 81 | # shellcheck disable=SC2039 82 | local test_case="$1" 83 | # shellcheck disable=SC2039 84 | local msg="$2" 85 | 86 | if [ "${exit_code}" -ne 0 ]; then 87 | echo "${test_case} skip" | tee -a "${RESULT_FILE}" 88 | 89 | if [ -n "${msg}" ]; then 90 | warn_msg "${msg}" 91 | fi 92 | 93 | # Exit normally to continue to run the following steps defined in test 94 | # definition file. 95 | exit 0 96 | else 97 | echo "${test_case} pass" | tee -a "${RESULT_FILE}" 98 | return 0 99 | fi 100 | } 101 | 102 | check_return() { 103 | # shellcheck disable=SC2039 104 | local exit_code="$?" 105 | [ "$#" -ne 1 ] && error_msg "Usage: check_return test_case" 106 | # shellcheck disable=SC2039 107 | local test_case="$1" 108 | 109 | if [ "${exit_code}" -ne 0 ]; then 110 | echo "${test_case} fail" | tee -a "${RESULT_FILE}" 111 | return "${exit_code}" 112 | else 113 | echo "${test_case} pass" | tee -a "${RESULT_FILE}" 114 | return 0 115 | fi 116 | } 117 | 118 | # When shell argument "-e" set in test script, check_return and exit_on_fail 119 | # would NOT work. run_test_case should be used instead. 120 | run_test_case() { 121 | [ "$#" -lt 2 ] && error_msg "Usage: run_test_case [skip_list]" 122 | # shellcheck disable=SC2039 123 | local test_command="$1" 124 | # shellcheck disable=SC2039 125 | local test_case_id="$2" 126 | # shellcheck disable=SC2039 127 | local skip_list="$3" 128 | 129 | if eval "${test_command}"; then 130 | echo "${test_case_id} pass" | tee -a "${RESULT_FILE}" 131 | else 132 | echo "${test_case_id} fail" | tee -a "${RESULT_FILE}" 133 | # When skip_list isn't empty, skip the tests and exit. 134 | if [ -n "${skip_list}" ]; then 135 | for i in ${skip_list}; do 136 | echo "$i skip" | tee -a "${RESULT_FILE}" 137 | done 138 | exit 0 139 | fi 140 | fi 141 | 142 | return 0 143 | } 144 | 145 | report_pass() { 146 | [ "$#" -ne 1 ] && error_msg "Usage: report_pass test_case" 147 | # shellcheck disable=SC2039 148 | local test_case="$1" 149 | echo "${test_case} pass" | tee -a "${RESULT_FILE}" 150 | } 151 | 152 | report_fail() { 153 | [ "$#" -ne 1 ] && error_msg "Usage: report_fail test_case" 154 | # shellcheck disable=SC2039 155 | local test_case="$1" 156 | echo "${test_case} fail" | tee -a "${RESULT_FILE}" 157 | } 158 | 159 | report_skip() { 160 | [ "$#" -ne 1 ] && error_msg "Usage: report_skip test_case" 161 | # shellcheck disable=SC2039 162 | local test_case="$1" 163 | echo "${test_case} skip" | tee -a "${RESULT_FILE}" 164 | } 165 | 166 | report_unknown() { 167 | [ "$#" -ne 1 ] && error_msg "Usage: report_unknown test_case" 168 | # shellcheck disable=SC2039 169 | local test_case="$1" 170 | echo "${test_case} unknown" | tee -a "${RESULT_FILE}" 171 | } 172 | 173 | report_set_start() { 174 | [ "$#" -ne 1 ] && error_msg "Usage: report_set_start " 175 | # shellcheck disable=SC2039 176 | local test_set_name="$1" 177 | echo "lava-test-set start ${test_set_name}" | tee -a "${RESULT_FILE}" 178 | } 179 | 180 | report_set_stop() { 181 | [ "$#" -ne 0 ] && error_msg "Usage: report_set_stop" 182 | echo "lava-test-set stop" | tee -a "${RESULT_FILE}" 183 | } 184 | 185 | add_metric() { 186 | if [ "$#" -lt 3 ]; then 187 | warn_msg "The number of parameters less then 3" 188 | error_msg "Usage: add_metric test_case result measurement [units]" 189 | fi 190 | # shellcheck disable=SC2039 191 | local test_case="$1" 192 | # shellcheck disable=SC2039 193 | local result="$2" 194 | # shellcheck disable=SC2039 195 | local measurement="$3" 196 | # shellcheck disable=SC2039 197 | local units="$4" 198 | 199 | echo "${test_case} ${result} ${measurement} ${units}" | tee -a "${RESULT_FILE}" 200 | } 201 | 202 | detect_abi() { 203 | abi=$(uname -m) 204 | case "${abi}" in 205 | armv7|armv7l|armv7el|armv7lh) abi="armeabi" ;; 206 | arm64|armv8|arm64-v8a|aarch64) abi="arm64" ;; 207 | i386|i686) abi="i386" ;; 208 | x86_64) abi="x86_64" ;; 209 | *) error_msg "Unsupported architecture: ${abi}" ;; 210 | esac 211 | } 212 | 213 | dist_name() { 214 | if [ -f /etc/os-release ]; then 215 | # shellcheck disable=SC1091 216 | dist=$(. /etc/os-release && echo "${ID}") 217 | elif [ -x /usr/bin/lsb_release ]; then 218 | dist="$(lsb_release -si)" 219 | elif [ -f /etc/lsb-release ]; then 220 | # shellcheck disable=SC1091 221 | dist="$(. /etc/lsb-release && echo "${DISTRIB_ID}")" 222 | elif [ -f /etc/debian_version ]; then 223 | dist="debian" 224 | elif [ -f /etc/fedora-release ]; then 225 | dist="fedora" 226 | elif [ -f /etc/centos-release ]; then 227 | dist="centos" 228 | else 229 | dist="unknown" 230 | warn_msg "Unsupported distro: cannot determine distribution name" 231 | fi 232 | 233 | # convert dist to lower case 234 | dist=$(echo ${dist} | tr '[:upper:]' '[:lower:]') 235 | case "${dist}" in 236 | rpb*) dist="oe-rpb" ;; 237 | esac 238 | } 239 | 240 | install_deps() { 241 | # shellcheck disable=SC2039 242 | local pkgs="$1" 243 | [ -z "${pkgs}" ] && error_msg "Usage: install_deps pkgs" 244 | # skip_install parmater is optional. 245 | # shellcheck disable=SC2039 246 | local skip_install="${2:-false}" 247 | 248 | if [ "${skip_install}" = "True" ] || [ "${skip_install}" = "true" ]; then 249 | info_msg "install_deps skipped" 250 | else 251 | ! check_root && \ 252 | error_msg "About to install packages, please run this script as root." 253 | info_msg "Installing ${pkgs}" 254 | dist_name 255 | case "${dist}" in 256 | debian|ubuntu) 257 | last_apt_time=/tmp/apt-get-updated.last 258 | apt_cache_time=21600 # 6 hours 259 | # Only run apt-get update if it hasn't been run in $apt_cache_time seconds 260 | if [ ! -e ${last_apt_time} ] || \ 261 | [ "$(stat --format=%Y ${last_apt_time})" -lt $(( $(date +%s) - apt_cache_time )) ]; then 262 | DEBIAN_FRONTEND=noninteractive apt-get update -q -y && touch ${last_apt_time} 263 | fi 264 | # shellcheck disable=SC2086 265 | DEBIAN_FRONTEND=noninteractive apt-get install -q -y ${pkgs} 266 | ;; 267 | centos) 268 | # shellcheck disable=SC2086 269 | yum -e 0 -y install ${pkgs} 270 | ;; 271 | fedora) 272 | # shellcheck disable=SC2086 273 | dnf -e 0 -y install ${pkgs} 274 | ;; 275 | *) 276 | warn_msg "Unsupported distro: ${dist}! Package installation skipped." 277 | ;; 278 | esac 279 | # shellcheck disable=SC2181 280 | if [ $? -ne 0 ]; then 281 | error_msg "Failed to install dependencies, exiting..." 282 | fi 283 | fi 284 | } 285 | 286 | remove_pkgs() { 287 | pkgs="$1" 288 | [ -z "${pkgs}" ] && error_msg "Usage: remove_pkgs pkgs" 289 | ! check_root && error_msg "remove_pkgs() requires root permission." 290 | info_msg "Removing ${pkgs} ..." 291 | dist_name 292 | case "${dist}" in 293 | debian|ubuntu) 294 | # shellcheck disable=SC2086 295 | DEBIAN_FRONTEND=noninteractive apt-get -y purge ${pkgs} 296 | ;; 297 | centos) 298 | # shellcheck disable=SC2086 299 | yum -y remove ${pkgs} 300 | ;; 301 | fedora) 302 | # shellcheck disable=SC2086 303 | dnf -y remove ${pkgs} 304 | ;; 305 | *) 306 | warn_msg "Unsupported distro: ${dist}! Package uninstallation skipped." 307 | ;; 308 | esac 309 | } 310 | 311 | # Return the exit code of the first command when using pipe. 312 | pipe0_status() { 313 | [ "$#" -ne 2 ] && error_msg "Usage: pipe0_status cmd1 cmd2" 314 | # shellcheck disable=SC2039 315 | local cmd1="$1" 316 | # shellcheck disable=SC2039 317 | local cmd2="$2" 318 | 319 | exec 4>&1 320 | # shellcheck disable=SC2039 321 | local ret_val 322 | ret_val=$({ { eval "${cmd1}" 3>&-; echo "$?" 1>&3; } 4>&- \ 323 | | eval "${cmd2}" 1>&4; } 3>&1) 324 | exec 4>&- 325 | 326 | return "${ret_val}" 327 | } 328 | 329 | validate_check_sum() { 330 | if [ "$#" -ne 2 ]; then 331 | warn_msg "The number of parameters should be 2" 332 | error_msg "Usage: validate_check_sum filename known_sha256sum" 333 | return 1 334 | fi 335 | # shellcheck disable=SC2039 336 | local OUTPUT_FILE_NAME="$1" 337 | # shellcheck disable=SC2039 338 | local SHA256SUM_CHECK="$2" 339 | # Get sha256sum of output_file 340 | # shellcheck disable=SC2039 341 | local GET_SHA256SUM 342 | GET_SHA256SUM=$(sha256sum "${OUTPUT_FILE_NAME}" | awk '{print $1}') 343 | echo "GET_SHA256SUM is ${GET_SHA256SUM}" 344 | if [ "${SHA256SUM_CHECK}" = "${GET_SHA256SUM}" ] ; then 345 | return 0 346 | else 347 | echo "checksum did not match" 348 | return 1 349 | fi 350 | } 351 | 352 | convert_to_mb() { 353 | [ "$#" -ne 2 ] && error_msg "Usage: convert_to_mb value units" 354 | if ! echo "$1" | grep -E -q "^[0-9.]+$"; then 355 | error_msg "The first argument isn't a number" 356 | fi 357 | # shellcheck disable=SC2039 358 | local value="$1" 359 | # shellcheck disable=SC2039 360 | local units="$2" 361 | 362 | case "${units}" in 363 | KB|kb) value=$(echo "${value}" | awk '{print $1/1024}') ;; 364 | MB|mb) ;; 365 | GB|gb) value=$(echo "${value}" | awk '{print $1*1024}') ;; 366 | TB|tb) value=$(echo "${value}" | awk '{print $1*1024*1024}') ;; 367 | *) error_msg "Unsupported units" ;; 368 | esac 369 | 370 | echo "${value}" 371 | } 372 | 373 | convert_to_sec() { 374 | [ "$#" -ne 1 ] && error_msg "Usage: convert_to_sec value (including unit)" 375 | 376 | # shellcheck disable=SC2039,SC2155 377 | local value=$(echo "$1" | sed 's/[smhdSMHD]$//') 378 | # shellcheck disable=SC2039,SC2155 379 | local unit=$(echo "$1" | sed -n 's/^[0-9]*\([smhdSMHD]\)/\1/p' ) 380 | 381 | if ! echo "$value" | grep -E -q "^[0-9.]+$"; then 382 | error_msg "The argument isn't a valid (number optionally with unit)" 383 | fi 384 | 385 | case "${unit}" in 386 | S|s|"") ;; 387 | M|m) value=$(echo "${value}" | awk '{print $1 * 60}') ;; 388 | H|h) value=$(echo "${value}" | awk '{print $1 * 60 * 60}') ;; 389 | D|d) value=$(echo "${value}" | awk '{print $1 * 60 * 60 * 24}') ;; 390 | *) error_msg "Unsupported time unit \"${unit}\"" ;; 391 | esac 392 | 393 | echo "${value}" 394 | } 395 | 396 | dist_info() { 397 | if ! command -v lsb_release > /dev/null; then 398 | dist_name 399 | case "${dist}" in 400 | debian|ubuntu) install_deps "lsb-release" ;; 401 | centos|fedora) install_deps "redhat-lsb-core" ;; 402 | *) warn_msg "Unsupported distro: dist_info skipped" 403 | esac 404 | fi 405 | 406 | # shellcheck disable=SC2034 407 | Release=$(lsb_release -r | awk '{print $2}') 408 | Codename=$(lsb_release -c | awk '{print $2}') 409 | } 410 | 411 | add_key() { 412 | [ "$#" -ne 1 ] && error_msg "Usage: add_key url" 413 | # shellcheck disable=SC2039 414 | local url="$1" 415 | 416 | ! check_root && \ 417 | error_msg "About to use apt-key, please run this script as root." 418 | dist_name 419 | case "${dist}" in 420 | debian|ubuntu) wget -O - "${url}" | apt-key add - ;; 421 | centos|fedora) infor_msg "add_key isn't needed on ${dist}" ;; 422 | *) warn_msg "Unsupported distro: add_key skipped" 423 | esac 424 | } 425 | 426 | add_repo() { 427 | [ "$#" -lt 1 ] && error_msg "Usage: add_repo [backports]" 428 | # shellcheck disable=SC2039 429 | local url="$1" 430 | 431 | ! check_root && \ 432 | error_msg "About to add a repo, please run this script as root." 433 | dist_name 434 | case "${dist}" in 435 | # Detect Debian/Ubuntu codename and add repo automatically. The same url 436 | # should work on all distributions supported by the repo. 437 | debian|ubuntu) 438 | dist_info 439 | if [ -z "$2" ]; then 440 | # shellcheck disable=SC2039 441 | local backports="" 442 | elif [ "$2" = "backports" ]; then 443 | # shellcheck disable=SC2039 444 | local backports="-backports" 445 | else 446 | echo "Usage: add_repo [backports]" 447 | error_msg "$2 is not a supported argument, should be 'backports'" 448 | fi 449 | echo "deb ${url} ${Codename}${backports} main" \ 450 | >> "/etc/apt/sources.list.d/3rd-party-repo.list" 451 | ;; 452 | # It is not easy to amend url with distro version as its format may vary 453 | # by repo. Test definition/plan should provide a correct repo url. 454 | centos|fedora) 455 | wget -O - "${url}" >> "/etc/yum.repos.d/3rd-party.repo" 456 | ;; 457 | *) 458 | warn_msg "Unsupported distro: ${dist}! add_repo skipped" 459 | ;; 460 | esac 461 | } 462 | 463 | create_out_dir() { 464 | [ -z "$1" ] && error_msg "Usage: create_out_dir output_dir" 465 | # shellcheck disable=SC2039 466 | local OUTPUT=$1 467 | [ -d "${OUTPUT}" ] && 468 | mv "${OUTPUT}" "${OUTPUT}_$(date -r "${OUTPUT}" +%Y%m%d%H%M%S)" 469 | mkdir -p "${OUTPUT}" 470 | [ -d "${OUTPUT}" ] || error_msg "Could not create output directory ${OUTPUT}" 471 | } 472 | 473 | generate_skipfile() { 474 | # Generate a skipfile and set the SKIPFILE variable based on SKIPFILE_YAML, 475 | # BOARD, BRANCH, and ENVIRONMENT. 476 | # 477 | # In: 478 | # SKIPFILE_YAML: (required) skipgen/yaml formatted skipfile 479 | # SKIPFILE_PATH: (required) destination file for generated skipfile 480 | # BOARD: (optional) board name to pass to skipgen 481 | # BRANCH: (optional) branch name to pass to skipgen 482 | # ENVIRONMENT: (optional) environment name to pass to skipgen 483 | # 484 | info_msg "Generating a skipfile based on ${SKIPFILE_YAML}" 485 | detect_abi 486 | # shellcheck disable=SC2039 487 | local SKIPGEN_ARGS="" 488 | test -n "${BOARD}" && SKIPGEN_ARGS="${SKIPGEN_ARGS} --board ${BOARD}" 489 | test -n "${BRANCH}" && SKIPGEN_ARGS="${SKIPGEN_ARGS} --branch ${BRANCH}" 490 | test -n "${ENVIRONMENT}" && SKIPGEN_ARGS="${SKIPGEN_ARGS} --environment ${ENVIRONMENT}" 491 | # shellcheck disable=SC2086 492 | ../../bin/${abi}/skipgen ${SKIPGEN_ARGS} "${SKIPFILE_YAML}" > "${SKIPFILE_PATH}" 493 | test $? -eq 0 || error_msg "skipgen failed to generate a skipfile" 494 | info_msg "Using the following generated skipfile contents (until EOF):" 495 | cat "${SKIPFILE_PATH}" 496 | info_msg "EOF" 497 | } 498 | 499 | # Description: parted is not working on SSD (Solid-State Drives) this is the 500 | # reason to use fdisk instead. 501 | # Dependency packages for fdisk and mkfs are "fdisk e2fsprogs dosfstools" 502 | # fdisk and mkfs commands might be in $PATH /sbin or /usr/sbin or 503 | # /usr/local/sbin export PATH for better usage. 504 | export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin 505 | 506 | 507 | # Usage: 508 | # partition_disk "/dev/sdb" "+5G +10G" 509 | # shellcheck disable=SC2039 510 | partition_disk() { 511 | # when sizes is empty it creates single partitions with total disk size 512 | [ "$#" -ne 1 ] && error_msg "Usage: " 513 | local device="$1" 514 | local sizes="$2" 515 | 516 | command -v fdisk 517 | exit_on_fail "fdisk not in ${PATH} or not installed" 518 | 519 | # Create a new empty DOS partition table 520 | ( 521 | echo o 522 | echo w) | fdisk "${device}" 523 | 524 | if [ -n "${sizes}" ]; then 525 | # Create partitions as per sizes 526 | for size in ${sizes}; do 527 | # Create patitions with ${size} 528 | ( 529 | echo n 530 | echo p 531 | echo 532 | echo 533 | echo "${size}" 534 | echo w) | fdisk "${device}" 535 | check_return "fdisk-${device}-${size}-partition" 536 | # sync and wait 5 sec 537 | sync 538 | sleep 5 539 | done 540 | fi 541 | 542 | # Create a partition at the end. 543 | # Use the rest of the disk. 544 | ( 545 | echo n 546 | echo p 547 | echo 548 | echo 549 | echo 550 | echo w) | fdisk "${device}" 551 | check_return "fdisk-${device}-end-partition" 552 | # sync and wait 5 sec 553 | sync 554 | sleep 5 555 | } 556 | # Usage: 557 | # format_partitions "/dev/sdb" "ext4" 558 | # shellcheck disable=SC2039 559 | format_partitions() { 560 | [ "$#" -ne 2 ] && error_msg "Usage: " 561 | local device="$1" 562 | local filesystem="$2" 563 | local partition="" 564 | local total_partitions="" 565 | 566 | command -v mkfs 567 | exit_on_fail "mkfs not in ${PATH} or not installed" 568 | 569 | # Total partitions in a block device 570 | total_partitions=$(find "${device}"* | grep "[0-9]" | tr '\n' ' ' ) 571 | 572 | # Format each partition in a given block device 573 | for partition in ${total_partitions} ; do 574 | echo "Formatting ${partition} to ${filesystem}" 575 | if [ "${filesystem}" = "fat32" ]; then 576 | echo "y" | mkfs -t vfat -F 32 "${partition}" 577 | check_return " mkfs-t-vfat-F-32-${partition}" 578 | else 579 | echo "y" | mkfs -t "${filesystem}" "${partition}" 580 | check_return "mkfs-${filesystem}-${partition}" 581 | fi 582 | # sync and wait 5 sec 583 | sync 584 | sleep 5 585 | done 586 | } 587 | 588 | background_process_start() { 589 | NAME="$1" 590 | shift 591 | if [ -z "$NAME" ]; then 592 | err_msg "Usage: background-process-start NAME --cmd PROCESS" 593 | fi 594 | 595 | while [ $# -gt 0 ]; do 596 | case $1 in 597 | --cmd) 598 | shift 599 | PROCESS="$*" 600 | shift 601 | ;; 602 | *) 603 | err_msg "Unhandled argument" 604 | ;; 605 | esac 606 | done 607 | 608 | if [ -z "${PROCESS}" ]; then 609 | return 610 | fi 611 | 612 | result_dir="${OUTPUT}/results/$NAME" 613 | mkdir -p "${result_dir}" 614 | 615 | cat < "${result_dir}/bg_run.sh" 616 | set -e 617 | trap "exit" SIGHUP SIGINT SIGTERM 618 | while true; do 619 | $PROCESS > /dev/null 620 | sleep 1 621 | done 622 | EOF 623 | 624 | /bin/bash "${result_dir}/bg_run.sh" & 625 | echo $! > "${result_dir}/pid" 626 | } 627 | 628 | background_process_stop() { 629 | NAME="$1" 630 | shift 631 | if [ -z "${NAME}" ]; then 632 | err_msg "Usage: background-process-stop NAME" 633 | fi 634 | 635 | result_dir="${OUTPUT}/results/${NAME}" 636 | 637 | if [ ! -d "${result_dir}" ] ; then 638 | return 639 | fi 640 | 641 | PID=$(cat "${result_dir}/pid") 642 | 643 | if ps -p "${PID}" > /dev/null; 644 | then 645 | kill "${PID}" > /dev/null 2>&1 646 | fi 647 | } 648 | 649 | # register the current dmesg 650 | dmesg_capture_start() 651 | { 652 | dmesg --console-off 653 | dmesg > "$OUTPUT/dmesg.test.start" 654 | } 655 | 656 | # Print all kernel messages that appears since last dmesg_capture_start 657 | dmesg_capture_result() { 658 | echo "==============================================" 659 | dmesg > "$OUTPUT/dmesg.test.result" 660 | diff -u "$OUTPUT/dmesg.test.start" "$OUTPUT/dmesg.test.result" 661 | # restore normal dmesg behavour 662 | dmesg --console-on 663 | echo "==============================================" 664 | } 665 | 666 | # shellcheck disable=SC2039 667 | get_test_program() { 668 | local test_git_url="$1" 669 | local test_dir="$2" 670 | local test_prog_version="$3" 671 | local test_program="$4" 672 | if [ ! -d "$test_dir" ] || [ -d "$test_dir"/.git ]; then 673 | if [ "$test_prog_version" != "" ]; then 674 | if [ -d "$test_dir"/.git ]; then 675 | echo Using repository "$PATH" 676 | else 677 | git clone "$test_git_url" "$test_dir" 678 | fi 679 | 680 | cd "$test_dir" || exit 1 681 | if [ "$test_prog_version" != "" ]; then 682 | if ! git reset --hard "$test_prog_version"; then 683 | echo Failed to set "${test_program}" to commit "$test_prog_version", sorry 684 | exit 1 685 | fi 686 | else 687 | echo Using "$PATH" 688 | fi 689 | else 690 | echo Assuming "${test_program}" is pre-installed in "$test_dir" 691 | cd "$test_dir" || exit 1 692 | fi 693 | else 694 | if [ ! -d "$test_dir" ]; then 695 | echo No "${test_program}" suite in "$test_dir", sorry 696 | exit 1 697 | fi 698 | echo Assuming "${test_program}" is pre-installed in "$test_dir" 699 | cd "$test_dir" || exit 1 700 | fi 701 | } 702 | -------------------------------------------------------------------------------- /tests/lkft/README.md: -------------------------------------------------------------------------------- 1 | Test cases ported from: https://lkft.linaro.org/tests/ 2 | -------------------------------------------------------------------------------- /tests/lkft/kselftest/kselftest-skipfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmpereComputing/ampere-lts-kernel---DEPRECATED/66a3ee3aa113a8e4e48b41fd21880a56c8ad6109/tests/lkft/kselftest/kselftest-skipfile -------------------------------------------------------------------------------- /tests/lkft/kselftest/kselftest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Linux kernel self test 3 | 4 | # shellcheck disable=SC1091 5 | . ../../lib/sh-test-lib 6 | OUTPUT="$(pwd)/output" 7 | RESULT_FILE="${OUTPUT}/result.txt" 8 | RESULT_CSV="${OUTPUT}/result.csv" 9 | LOGFILE="${OUTPUT}/kselftest.txt" 10 | KSELFTEST_PATH="/opt/kselftests/mainline/" 11 | 12 | SCRIPT="$(readlink -f "${0}")" 13 | SCRIPTPATH="$(dirname "${SCRIPT}")" 14 | # List of known unsupported test cases to be skipped 15 | SKIPFILE="" 16 | # List of test cases to be skipped in yaml/skipgen format 17 | SKIPFILE_YAML="" 18 | BOARD="" 19 | BRANCH="" 20 | ENVIRONMENT="" 21 | SKIPLIST="" 22 | TESTPROG_URL="" 23 | TST_CMDFILES="" 24 | TST_CASENAME="" 25 | 26 | # Architecture-specific tarball name defaults. 27 | if [ "$(uname -m)" = "aarch64" ]; then 28 | TESTPROG="kselftest_aarch64.tar.gz" 29 | else 30 | TESTPROG="kselftest_armhf.tar.gz" 31 | fi 32 | 33 | usage() { 34 | echo "Usage: $0 [-c bpf cpufreq net timers] 35 | [-T cpu-hotplug:cpu-on-off-test.sh] 36 | [-t kselftest_aarch64.tar.gz | kselftest_armhf.tar.gz] 37 | [-s True|False] 38 | [-u url] 39 | [-p path] 40 | [-L List of skip test cases] 41 | [-S kselftest-skipfile] 42 | [-b board] 43 | [-g branch] 44 | [-e environment]" 1>&2 45 | exit 1 46 | } 47 | 48 | while getopts "c:T:t:s:u:p:L:S:b:g:e:h" opt; do 49 | case "${opt}" in 50 | c) TST_CMDFILES="${OPTARG}" ;; 51 | T) TST_CASENAME="${OPTARG}" ;; 52 | t) TESTPROG="${OPTARG}" ;; 53 | s) SKIP_INSTALL="${OPTARG}" ;; 54 | # Download kselftest tarball from given URL 55 | u) TESTPROG_URL="${OPTARG}" ;; 56 | # List of known unsupported test cases to be skipped 57 | L) SKIPLIST="${OPTARG}" ;; 58 | p) KSELFTEST_PATH="${OPTARG}" ;; 59 | S) 60 | 61 | #OPT=$(echo "${OPTARG}" | grep "http") 62 | #if [ -z "${OPT}" ] ; then 63 | ## kselftest skipfile 64 | # SKIPFILE="${SCRIPTPATH}/${OPTARG}" 65 | #else 66 | ## Download kselftest skipfile from speficied URL 67 | # wget "${OPTARG}" -O "skipfile" 68 | # SKIPFILE="skipfile" 69 | # SKIPFILE="${SCRIPTPATH}/${SKIPFILE}" 70 | #fi 71 | 72 | if [ -z "${OPTARG##*http*}" ]; then 73 | if [ -z "${OPTARG##*yaml*}" ]; then 74 | # Skipfile is of type yaml 75 | SKIPFILE_TMP="http-skipfile.yaml" 76 | SKIPFILE_YAML="${SCRIPTPATH}/${SKIPFILE_TMP}" 77 | else 78 | # Skipfile is normal skipfile 79 | SKIPFILE_TMP="http-skipfile" 80 | SKIPFILE="${SCRIPTPATH}/${SKIPFILE_TMP}" 81 | fi 82 | # Download LTP skipfile from specified URL 83 | if ! wget "${OPTARG}" -O "${SKIPFILE_TMP}"; then 84 | error_msg "Failed to fetch ${OPTARG}" 85 | exit 1 86 | fi 87 | elif [ "${OPTARG##*.}" = "yaml" ]; then 88 | # yaml skipfile; use skipgen to generate a skipfile 89 | SKIPFILE_YAML="${SCRIPTPATH}/${OPTARG}" 90 | else 91 | # Regular LTP skipfile 92 | SKIPFILE="${SCRIPTPATH}/${OPTARG}" 93 | fi 94 | ;; 95 | 96 | b) 97 | export BOARD="${OPTARG}" 98 | ;; 99 | g) 100 | export BRANCH="${OPTARG}" 101 | ;; 102 | e) 103 | export ENVIRONMENT="${OPTARG}" 104 | ;; 105 | h|*) usage ;; 106 | esac 107 | done 108 | 109 | # If no explicit URL given, use the default URL for the kselftest tarball. 110 | if [ -z "${TESTPROG_URL}" ]; then 111 | TESTPROG_URL=http://testdata.validation.linaro.org/tests/kselftest/"${TESTPROG}" 112 | fi 113 | 114 | if [ -n "${SKIPFILE_YAML}" ]; then 115 | export SKIPFILE_PATH="${SCRIPTPATH}/generated_skipfile" 116 | generate_skipfile 117 | if [ ! -f "${SKIPFILE_PATH}" ]; then 118 | error_msg "Skipfile ${SKIPFILE} does not exist"; 119 | exit 1 120 | fi 121 | SKIPFILE="${SKIPFILE_PATH}" 122 | fi 123 | 124 | 125 | parse_output() { 126 | perl -ne ' 127 | if (m|^# selftests: (.*)$|) { 128 | $testdir = $1; 129 | $testdir =~ s|[:/]\s*|.|g; 130 | } elsif (m|^(?:# )*(not )?ok (?:\d+) ([^#]+)(# (SKIP)?)?|) { 131 | $not = $1; 132 | $test = $2; 133 | $skip = $4; 134 | $test =~ s|\s+$||; 135 | # If the test name starts with "selftests: " it is "fully qualified". 136 | if ($test =~ /selftests: (.*)/) { 137 | $test = $1; 138 | $test =~ s|[:/]\s*|.|g; 139 | } else { 140 | # Otherwise, it likely needs the testdir prepended. 141 | $test = "$testdir.$test"; 142 | } 143 | # Any appearance of the SKIP is a skip. 144 | if ($skip eq "SKIP") { 145 | $result="skip"; 146 | } elsif ($not eq "not ") { 147 | $result="fail"; 148 | } else { 149 | $result="pass"; 150 | } 151 | print "$test $result\n"; 152 | } 153 | ' "${LOGFILE}" >> "${RESULT_FILE}" 154 | } 155 | 156 | install() { 157 | dist_name 158 | # shellcheck disable=SC2154 159 | case "${dist}" in 160 | debian|ubuntu) install_deps "sed perl wget xz-utils iproute2" "${SKIP_INSTALL}" ;; 161 | centos|fedora) install_deps "sed perl wget xz iproute" "${SKIP_INSTALL}" ;; 162 | unknown) warn_msg "Unsupported distro: package install skipped" ;; 163 | esac 164 | } 165 | 166 | ! check_root && error_msg "You need to be root to run this script." 167 | create_out_dir "${OUTPUT}" 168 | # shellcheck disable=SC2164 169 | cd "${OUTPUT}" 170 | 171 | install 172 | 173 | if [ -d "${KSELFTEST_PATH}" ]; then 174 | echo "kselftests found on rootfs" 175 | # shellcheck disable=SC2164 176 | cd "${KSELFTEST_PATH}" 177 | else 178 | # Fetch whatever we have been aimed at, assuming only that it can 179 | # be handled by "tar". Do not assume anything about the compression. 180 | wget "${TESTPROG_URL}" 181 | tar -xaf "$(basename "${TESTPROG_URL}")" 182 | # shellcheck disable=SC2164 183 | if [ ! -e "run_kselftest.sh" ]; then cd "kselftest"; fi 184 | fi 185 | 186 | skips=$(mktemp -p . -t skip-XXXXXX) 187 | 188 | if [ -n "${SKIPLIST}" ]; then 189 | # shellcheck disable=SC2086 190 | for skip_regex in ${SKIPLIST}; do 191 | echo "${skip_regex}" >> "$skips" 192 | done 193 | fi 194 | 195 | # Ignore SKIPFILE when SKIPLIST provided 196 | if [ -f "${SKIPFILE}" ] && [ -z "${SKIPLIST}" ]; then 197 | while read -r skip_regex; do 198 | case "${skip_regex}" in \#*) continue ;; esac 199 | echo "${skip_regex}" >> "$skips" 200 | done < "${SKIPFILE}" 201 | fi 202 | 203 | # let kselftest/runner.sh access this skipfile 204 | export SKIPFILE="$SKIPFILE" 205 | 206 | cp kselftest-list.txt kselftest-list.txt.orig 207 | echo "skiplist:" 208 | echo "========================================" 209 | while read -r skip_regex; do 210 | echo "$skip_regex" 211 | # Remove matching tests from list of tests to run and report it as skipped 212 | perl -i -ne 'if (s|^('"${skip_regex}"')$|\1 skip|) { print STDERR; } else { print; }' kselftest-list.txt 2>>"${RESULT_FILE}" 213 | done < "${skips}" 214 | echo "========================================" 215 | rm -f "${skips}" 216 | 217 | if [ -n "${TST_CASENAME}" ]; then 218 | ./run_kselftest.sh -t "${TST_CASENAME}" 2>&1 | tee -a "${LOGFILE}" 219 | elif [ -n "${TST_CMDFILES}" ]; then 220 | # shellcheck disable=SC2086 221 | for test in ${TST_CMDFILES}; do 222 | ./run_kselftest.sh -c ${test} 2>&1 | tee -a "${LOGFILE}" 223 | done 224 | else 225 | ./run_kselftest.sh 2>&1 | tee "${LOGFILE}" 226 | fi 227 | parse_output 228 | ${SCRIPTPATH}/parse_result.py ${LOGFILE} ${RESULT_CSV} 229 | -------------------------------------------------------------------------------- /tests/lkft/kselftest/parse_result.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | 3 | import argparse 4 | import re 5 | import sys 6 | 7 | 8 | def main() -> int: 9 | args = parse_args() 10 | 11 | with open(args.output_csv_file, "w") as csv_output: 12 | tests_sum = 0 13 | tests_ok = 0 14 | tests_skip = 0 15 | tests_fail = 0 16 | with open(args.kselftest_log, "r", encoding="utf-8", errors="replace") as fp_in: 17 | for line in fp_in: 18 | if re.match("^# selftests: (.+: .+)$", line): 19 | tests_sum += 1 20 | continue 21 | 22 | match_notok = re.match( 23 | "^not ok \d+ selftests: (.+): (.+) # (.+)$", line 24 | ) 25 | if match_notok: 26 | csv_output.write("{},{},{}\n".format(*match_notok.groups())) 27 | if "SKIP" in match_notok.group(3): 28 | tests_skip += 1 29 | else: 30 | tests_fail += 1 31 | continue 32 | 33 | # match 5.10 skip output 34 | match_skip = re.match("^.*ok \d+ selftests: (.+): (.+) # SKIP$", line) 35 | if match_skip: 36 | csv_output.write("{},{},{}\n".format(*match_skip.groups(), "SKIP")) 37 | tests_skip += 1 38 | continue 39 | 40 | match_ok = re.match("^.*ok \d+ selftests: (.+): (.+)$", line) 41 | if match_ok: 42 | csv_output.write("{},{},{}\n".format(*match_ok.groups(), "OK")) 43 | tests_ok += 1 44 | 45 | csv_output.write( 46 | "kselftests: total {} pass {} skip {} fail {}".format( 47 | tests_sum, tests_ok, tests_skip, tests_fail 48 | ) 49 | ) 50 | return 0 51 | 52 | 53 | def parse_args() -> argparse.Namespace: 54 | parser = argparse.ArgumentParser() 55 | 56 | parser.add_argument( 57 | "kselftest_log", 58 | help="kselftest.txt log file", 59 | metavar="kselftest.txt", 60 | ) 61 | parser.add_argument( 62 | "output_csv_file", 63 | help="Name of the CSV file to save the output to", 64 | metavar="output.csv", 65 | ) 66 | 67 | args = parser.parse_args() 68 | return args 69 | 70 | 71 | if "__main__" == __name__: 72 | sys.exit(main()) 73 | -------------------------------------------------------------------------------- /tests/lkft/kselftest/skipfile-lkft.yaml: -------------------------------------------------------------------------------- 1 | # This skipfile is consumable using skipgen 2 | # (https://github.com/Linaro/skipgen), included in this repo in 3 | # /automated/bin//skipgen. 4 | # 5 | # reason: 6 | # Please provide a human readable explanation of the reason for the skip. 7 | # url: 8 | # A url referencing the issue. Often a link to the bug. Only one url may be 9 | # specified. 10 | # environments: 11 | # Should be 'production', 'staging', or 'all' for both. Our 12 | # staging environment contains a very minimal skiplist. Only tests which make 13 | # testing unstable should include staging. 14 | # boards: 15 | # Should match a list of board names, or 'all' to include all boards. 16 | # branches: 17 | # Should match a list of branch names, or 'all' to include all branches. 18 | # tests: 19 | # List of tests to skip 20 | 21 | skiplist: 22 | 23 | - reason: > 24 | LKFT: linux-next: x15: kselftest: ftracetest hangs forever 25 | LKFT: linux-mainline: kernel panic on X15 when running ftrace kseltest 26 | https://bugs.linaro.org/show_bug.cgi?id=3304 27 | url: https://bugs.linaro.org/show_bug.cgi?id=3297 28 | environments: all 29 | boards: all 30 | branches: 31 | - next 32 | - mainline 33 | - 5.11 34 | - 5.10 35 | - 5.9 36 | - 5.8 37 | - 5.7 38 | - 5.6 39 | - 5.4 40 | - 4.19 41 | - 4.14 42 | - 4.9 43 | - 4.4 44 | - master 45 | - linux-5.8.y 46 | - linux-5.7.y 47 | - linux-5.6.y 48 | - linux-5.4.y 49 | - linux-4.19.y 50 | - linux-4.14.y 51 | - linux-4.9.y 52 | - linux-4.4.y 53 | - v5.4-rt 54 | - v4.19-rt 55 | - v4.14-rt 56 | - v4.9-rt 57 | - v4.4-rt 58 | tests: 59 | - ftrace:ftracetest 60 | 61 | - reason: "LKFT: linux-next: kselftest: breakpoint_test_arm64 build failed" 62 | url: https://bugs.linaro.org/show_bug.cgi?id=3208 63 | environments: all 64 | boards: 65 | - dragonboard-410c 66 | - hi6220-hikey 67 | - juno-r2 68 | - qemu_arm64 69 | - x15 70 | - nxp-ls2088 71 | branches: all 72 | tests: 73 | - breakpoints:breakpoint_test_arm64 74 | 75 | - reason: 76 | url: 77 | environments: all 78 | boards: all 79 | branches: all 80 | tests: 81 | - breakpoints:step_after_suspend_test 82 | 83 | - reason: 84 | url: 85 | environments: all 86 | boards: all 87 | branches: all 88 | tests: 89 | - breakpoints:breakpoint_test 90 | 91 | - reason: 92 | url: 93 | environments: all 94 | boards: 95 | - qemu_arm 96 | - qemu_arm64 97 | branches: all 98 | tests: 99 | - mqueue:mq_open_tests 100 | - mqueue:mq_perf_tests 101 | 102 | - reason: 103 | mq_perf_tests runs long so skipping 104 | url: 105 | environments: all 106 | boards: 107 | - dragonboard-410c 108 | - hi6220-hikey 109 | - juno-r2 110 | - x15 111 | - nxp-ls2088 112 | branches: all 113 | tests: 114 | - mqueue:mq_perf_tests 115 | 116 | - reason: > 117 | LKFT: Kselftest: rseq: Warning: file basic_test is not executable 118 | url: https://bugs.linaro.org/show_bug.cgi?id=3923 119 | environments: all 120 | boards: 121 | - dragonboard-410c 122 | - hi6220-hikey 123 | - juno-r2 124 | - qemu_arm64 125 | - qemu_arm 126 | - x15 127 | - nxp-ls2088 128 | branches: 129 | - all 130 | tests: 131 | - rseq:run_param_test.sh 132 | 133 | - reason: > 134 | LKFT: next: bpf: test_kmod.sh hangs on all devices 135 | url: https://bugs.linaro.org/show_bug.cgi?id=4006 136 | environments: all 137 | boards: all 138 | branches: 139 | - mainline 140 | tests: 141 | - kmod:test_kmod.sh 142 | 143 | - reason: > 144 | net: udpgro.sh hangs on i386 running next 145 | url: https://bugs.linaro.org/show_bug.cgi?id=4078 146 | environments: all 147 | boards: 148 | - i386 149 | branches: 150 | - next 151 | - mainline 152 | tests: 153 | - net:udpgro.sh 154 | 155 | - reason: > 156 | net: xfrm_policy.sh hangs on i386 running next 157 | url: https://bugs.linaro.org/show_bug.cgi?id=5342 158 | environments: all 159 | boards: 160 | - i386 161 | branches: all 162 | tests: 163 | - net:xfrm_policy.sh 164 | 165 | - reason: > 166 | net: run_afpackettests hangs on hikey running 4.19 mainline 167 | url: https://bugs.linaro.org/show_bug.cgi?id=4049 168 | environments: all 169 | boards: all 170 | branches: 171 | - mainline 172 | tests: 173 | - net:run_afpackettests 174 | 175 | - reason: > 176 | proc: proc-pid-vm hangs on x86_64 running next 177 | url: https://bugs.linaro.org/show_bug.cgi?id=5332 178 | environments: all 179 | boards: 180 | - qemu_x86_64 181 | - x86 182 | branches: all 183 | tests: 184 | - proc:proc-pid-vm 185 | 186 | - reason: > 187 | LKFT: arm64/arm: selftest sync_test hangs on 4.9 188 | url: https://bugs.linaro.org/show_bug.cgi?id=4080 189 | environments: production 190 | boards: 191 | - dragonboard-410c 192 | - hi6220-hikey 193 | - juno-r2 194 | - qemu_arm64 195 | - x15 196 | - qemu_arm 197 | - nxp-ls2088 198 | branches: 199 | - 4.9 200 | - linux-4.9.y 201 | - v4.9-rt 202 | tests: 203 | - sync:sync_test 204 | 205 | - reason: > 206 | LKFT: next: next: msg_zerocopy.sh hangs on all devices 207 | url: TBD 208 | environments: all 209 | boards: all 210 | branches: 211 | - next 212 | tests: 213 | - net:msg_zerocopy.sh 214 | 215 | - reason: > 216 | LKFT: next: next: zram.sh hangs on all devices 217 | url: TBD 218 | environments: all 219 | boards: all 220 | branches: 221 | - next 222 | tests: 223 | - zram:zram.sh 224 | 225 | - reason: > 226 | LKFT: next: test_btf hangs on all devices 227 | url: TBD 228 | environments: all 229 | boards: all 230 | branches: 231 | - next 232 | - mainline 233 | - default 234 | - master 235 | tests: 236 | - bpf:test_btf 237 | 238 | - reason: > 239 | LKFT: 4.19: test_progs hangs on all devices 240 | url: TBD 241 | environments: all 242 | boards: 243 | - dragonboard-410c 244 | - hi6220-hikey 245 | - juno-r2 246 | - qemu_arm64 247 | - nxp-ls2088 248 | branches: 249 | - 4.19 250 | - linux-4.19.y 251 | - v4.19-rt 252 | tests: 253 | - bpf:test_progs 254 | 255 | - reason: > 256 | Newly added selftests netfilter nft_nat.sh hangs on x86_64. 257 | x86_64 is using NFS root file system the net and netfilter tests performing 258 | network interfaces up and down causing network failure and system hang. 259 | url: https://bugs.linaro.org/show_bug.cgi?id=5337 260 | environments: all 261 | boards: 262 | - qemu_x86_64 263 | - x86 264 | - i386 265 | branches: 266 | - all 267 | tests: 268 | - netfilter:nft_nat.sh 269 | 270 | - reason: > 271 | Newly added test case selftests netfilter conntrack_icmp_related.sh hangs on qemu_x86_64. 272 | url: https://bugs.linaro.org/show_bug.cgi?id=5338 273 | environments: all 274 | boards: 275 | - qemu_x86_64 276 | - x86 277 | - i386 278 | branches: 279 | - all 280 | tests: 281 | - netfilter:conntrack_icmp_related.sh 282 | 283 | - reason: > 284 | next: i386: selftests net rtnetlink.sh test hangs intermittently 285 | url: https://bugs.linaro.org/show_bug.cgi?id=5339 286 | environments: all 287 | boards: 288 | - all 289 | branches: 290 | - all 291 | tests: 292 | - net:rtnetlink.sh 293 | 294 | - reason: > 295 | x86_64 is using NFS root file system the net and netfilter tests performing 296 | network interfaces up and down causing network failure and system hang. 297 | url: https://bugs.linaro.org/show_bug.cgi?id=5341 298 | environments: all 299 | boards: 300 | - all 301 | branches: 302 | - all 303 | tests: 304 | - netfilter:nft_trans_stress.sh 305 | - netfilter:bridge_brouter.sh 306 | - netfilter:nft_flowtable.sh 307 | - reason: > 308 | pidfd: pidfd_wait hangs on linux next on all devices 309 | pidfd_wait.c:208:wait_nonblock:Expected sys_waitid(P_PIDFD, pidfd, &info, WSTOPPED, NULL) (-1) == 0 (0) 310 | wait_nonblock: Test terminated by assertion 311 | url: https://bugs.linaro.org/show_bug.cgi?id=5680 312 | environments: all 313 | boards: 314 | - all 315 | branches: 316 | - all 317 | tests: 318 | - pidfd:pidfd_wait 319 | - reason: > 320 | ptrace vmaccess hangs on all devices on stable rc 4.19 branch and lower 321 | kernel versions 322 | url: https://bugs.linaro.org/show_bug.cgi?id=5683 323 | environments: all 324 | boards: 325 | - all 326 | branches: 327 | - 5.4 328 | - 4.4 329 | - 4.9 330 | - 4.14 331 | - 4.19 332 | - linux-4.4.y 333 | - linux-4.9.y 334 | - linux-4.14.y 335 | - linux-4.19.y 336 | - v4.4-rt 337 | - v4.9-rt 338 | - v4.14-rt 339 | - v4.19-rt 340 | tests: 341 | - ptrace:vmaccess 342 | - reason: > 343 | net fib_nexthops.sh test cases hangs on nfs mounted devices 344 | url: https://bugs.linaro.org/show_bug.cgi?id=5725 345 | environments: all 346 | boards: 347 | - i386 348 | - x86 349 | - juno-r2 350 | branches: 351 | - all 352 | tests: 353 | - net:fib_nexthops.sh 354 | - reason: > 355 | vm: run_vmtests hangs on arm64 juno-r2, db410c and hikey 356 | url: https://bugs.linaro.org/show_bug.cgi?id=5728 357 | environments: all 358 | boards: 359 | - dragonboard-410c 360 | - hi6220-hikey 361 | - juno-r2 362 | branches: 363 | - all 364 | tests: 365 | - vm:run_vmtests 366 | - reason: > 367 | kvm: kvm_create_max_vcpus hang on arm64 devices for stable rc 5.4 and below 368 | url: https://bugs.linaro.org/show_bug.cgi?id=5729 369 | environments: all 370 | boards: 371 | - dragonboard-410c 372 | - hi6220-hikey 373 | - juno-r2 374 | branches: 375 | - 5.4 376 | - 4.19 377 | - 4.14 378 | - 4.9 379 | - 4.4 380 | - linux-5.4.y 381 | - linux-4.19.y 382 | - linux-4.14.y 383 | - linux-4.9.y 384 | - linux-4.4.y 385 | - v5.4-rt 386 | - v4.19-rt 387 | - v4.14-rt 388 | - v4.9-rt 389 | - v4.4-rt 390 | tests: 391 | - kvm:kvm_create_max_vcpus 392 | -------------------------------------------------------------------------------- /tests/lkft/ltp/ltp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | 5 | # shellcheck disable=SC1091 6 | . ../../lib/sh-test-lib 7 | OUTPUT="$(pwd)/output" 8 | RESULT_FILE="${OUTPUT}/result.txt" 9 | # Absolute path to this script. /home/user/bin/foo.sh 10 | SCRIPT="$(readlink -f "${0}")" 11 | # Absolute path this script is in. /home/user/bin 12 | SCRIPTPATH="$(dirname "${SCRIPT}")" 13 | echo "Script path is: ${SCRIPTPATH}" 14 | # List of test cases 15 | TST_CMDFILES="" 16 | # List of test cases to be skipped 17 | SKIPFILE="" 18 | # List of test cases to be skipped in yaml/skipgen format 19 | SKIPFILE_YAML="" 20 | BOARD="" 21 | BRANCH="" 22 | ENVIRONMENT="" 23 | # LTP version 24 | LTP_VERSION="20180926" 25 | TEST_PROGRAM=ltp 26 | # https://github.com/linux-test-project/ltp.git 27 | TEST_GIT_URL="" 28 | TEST_DIR="$(pwd)/${TEST_PROGRAM}" 29 | BUILD_FROM_TAR="false" 30 | 31 | LTP_TMPDIR=/ltp-tmp 32 | 33 | LTP_INSTALL_PATH=/opt/ltp 34 | 35 | usage() { 36 | echo "Usage: ${0} [-T mm,math,syscalls] 37 | [-S skipfile-lsk-juno] 38 | [-b board] 39 | [-d temp directory] 40 | [-g branch] 41 | [-e environment] 42 | [-i install path] 43 | [-s True|False] 44 | [-v LTP_VERSION] 45 | [-M Timeout_Multiplier] 46 | [-R root_password] 47 | [-u git url] 48 | [-p build directory] 49 | [-t build from tarfile ] 50 | " 1>&2 51 | exit 0 52 | } 53 | 54 | while getopts "M:T:S:b:d:g:e:i:s:v:R:u:p:t:" arg; do 55 | case "$arg" in 56 | T) 57 | TST_CMDFILES="${OPTARG}" 58 | # shellcheck disable=SC2001 59 | LOG_FILE=$(echo "${OPTARG}"| sed 's,\/,_,') 60 | ;; 61 | S) 62 | if [ -z "${OPTARG##*http*}" ]; then 63 | if [ -z "${OPTARG##*yaml*}" ]; then 64 | # Skipfile is of type yaml 65 | SKIPFILE_TMP="http-skipfile.yaml" 66 | SKIPFILE_YAML="${SCRIPTPATH}/${SKIPFILE_TMP}" 67 | else 68 | # Skipfile is normal skipfile 69 | SKIPFILE_TMP="http-skipfile" 70 | SKIPFILE="-S ${SCRIPTPATH}/${SKIPFILE_TMP}" 71 | fi 72 | # Download LTP skipfile from specified URL 73 | if ! wget "${OPTARG}" -O "${SKIPFILE_TMP}"; then 74 | error_msg "Failed to fetch ${OPTARG}" 75 | fi 76 | elif [ "${OPTARG##*.}" = "yaml" ]; then 77 | # yaml skipfile; use skipgen to generate a skipfile 78 | SKIPFILE_YAML="${SCRIPTPATH}/${OPTARG}" 79 | else 80 | # Regular LTP skipfile. Absolute or relative path? 81 | if [ "${OPTARG:0:1}" == "/" ]; then 82 | SKIPFILE="-S ${OPTARG}" 83 | else 84 | SKIPFILE="-S ${SCRIPTPATH}/${OPTARG}" 85 | fi 86 | fi 87 | ;; 88 | b) 89 | export BOARD="${OPTARG}" 90 | ;; 91 | d) 92 | export LTP_TMPDIR="${OPTARG}" 93 | ;; 94 | g) 95 | export BRANCH="${OPTARG}" 96 | ;; 97 | e) 98 | export ENVIRONMENT="${OPTARG}" 99 | ;; 100 | i) 101 | export LTP_INSTALL_PATH="${OPTARG}" 102 | ;; 103 | # SKIP_INSTALL is true in case of Open Embedded builds 104 | # SKIP_INSTALL is flase in case of Debian builds 105 | s) SKIP_INSTALL="${OPTARG}";; 106 | v) LTP_VERSION="${OPTARG}";; 107 | # Slow machines need more timeout Default is 5min and multiply * MINUTES 108 | M) export LTP_TIMEOUT_MUL="${OPTARG}";; 109 | R) export PASSWD="${OPTARG}";; 110 | u) 111 | if [[ "$OPTARG" != '' ]]; then 112 | TEST_GIT_URL="$OPTARG" 113 | TEST_TARFILE="" 114 | fi 115 | ;; 116 | p) 117 | if [[ "$OPTARG" != '' ]]; then 118 | TEST_DIR="$OPTARG" 119 | fi 120 | ;; 121 | t) 122 | BUILD_FROM_TAR="$OPTARG" 123 | ;; 124 | *) 125 | usage 126 | error_msg "No flag ${OPTARG}" 127 | ;; 128 | esac 129 | done 130 | 131 | TEST_TARFILE=https://github.com/linux-test-project/ltp/releases/download/"${LTP_VERSION}"/ltp-full-"${LTP_VERSION}".tar.xz 132 | 133 | if [ -n "${SKIPFILE_YAML}" ]; then 134 | export SKIPFILE_PATH="${SCRIPTPATH}/generated_skipfile" 135 | generate_skipfile 136 | if [ ! -f "${SKIPFILE_PATH}" ]; then 137 | error_msg "Skipfile ${SKIPFILE} does not exist"; 138 | fi 139 | SKIPFILE="-S ${SKIPFILE_PATH}" 140 | fi 141 | 142 | # Parse LTP output 143 | parse_ltp_output() { 144 | grep -E "PASS|FAIL|CONF" "$1" \ 145 | | awk '{print $1" "$2}' \ 146 | | sed 's/PASS/pass/; s/FAIL/fail/; s/CONF/skip/' >> "${RESULT_FILE}" 147 | } 148 | 149 | # Run LTP test suite 150 | run_ltp() { 151 | # shellcheck disable=SC2164 152 | cd "${LTP_INSTALL_PATH}" 153 | # shellcheck disable=SC2174 154 | mkdir -m 777 -p "${LTP_TMPDIR}" 155 | 156 | # default run all tests 157 | TST_OPTION="" 158 | TST_CMDFILES=$(cat ${SCRIPTPATH}/ltp_cmdfile) 159 | [ ! -z "${TST_CMDFILES}" ] && TST_OPTION="-f ${TST_CMDFILES}" 160 | 161 | # create files for aiodio test 162 | mkdir -pv ${LTP_TMPDIR}/aiodio 163 | mkdir -pv ${LTP_TMPDIR}/aiodio/junkdir 164 | dd if=/dev/zero of=${LTP_TMPDIR}/aiodio/largefile bs=1MB count=100 165 | file1=${LTP_TMPDIR}/aiodio/largefile 166 | dd if=$file1 of=${LTP_TMPDIR}/aiodio/junkfile bs=8192 conv=block,sync 167 | dd if=$file1 of=${LTP_TMPDIR}/aiodio/junkfile.aiocp.src1 bs=8192 conv=block,sync 168 | dd if=$file1 of=${LTP_TMPDIR}/aiodio/junkfile.aiocp.dst1 bs=4096 conv=block,sync 169 | dd if=$file1 of=${LTP_TMPDIR}/aiodio/junkfile.aiocp.src2 bs=4096 conv=block,sync 170 | dd if=$file1 of=${LTP_TMPDIR}/aiodio/junkfile.aiocp.src3 bs=2048 conv=block,sync 171 | dd if=$file1 of=${LTP_TMPDIR}/aiodio/junkfile.aiocp.src4 bs=1024 conv=block,sync 172 | dd if=$file1 of=${LTP_TMPDIR}/aiodio/junkfile.aiocp.src5 bs=512 conv=block,sync 173 | dd if=$file1 of=${LTP_TMPDIR}/aiodio/junkfile.append1 bs=8192 conv=block,sync 174 | dd if=$file1 of=${LTP_TMPDIR}/aiodio/junkfile.diorh1 bs=2048 conv=block,sync 175 | dd if=$file1 of=${LTP_TMPDIR}/aiodio/junkfile.diorh2 bs=1024 conv=block,sync 176 | dd if=$file1 of=${LTP_TMPDIR}/aiodio/junkfile.diorh3 bs=512 conv=block,sync 177 | dd if=$file1 of=${LTP_TMPDIR}/aiodio/junkfile.diorh4 bs=4096 conv=block,sync 178 | 179 | # create big device for fs test 180 | [ -f ltp_testfile ] && rm -f testfile 181 | dd if=/dev/zero of=${LTP_TMPDIR}/ltp_testfile bs=1MB count=600 182 | 183 | pipe0_status "./runltp -p -q ${TST_OPTION} \ 184 | -l ${OUTPUT}/LTP_${LOG_FILE}.log \ 185 | -C ${OUTPUT}/LTP_${LOG_FILE}.failed \ 186 | -T ${OUTPUT}/LTP_${LOG_FILE}.tconf \ 187 | -z ${LTP_TMPDIR}/ltp_testfile -Z ext3 \ 188 | -d ${LTP_TMPDIR} \ 189 | ${SKIPFILE}" "tee ${OUTPUT}/LTP_${LOG_FILE}.out" 190 | # check_return "runltp_${LOG_FILE}" 191 | 192 | parse_ltp_output "${OUTPUT}/LTP_${LOG_FILE}.log" 193 | ${SCRIPTPATH}/parse_result.sh "${OUTPUT}/LTP_${LOG_FILE}.log" "${OUTPUT}/result.csv" 194 | # Cleanup 195 | # don't fail the whole test job if rm fails 196 | rm -f ltp_testfile 197 | rm -rf "${LTP_TMPDIR}" || true 198 | } 199 | 200 | # Prepare system 201 | prep_system() { 202 | # Stop systemd-timesyncd if running 203 | if systemctl is-active systemd-timesyncd 2>/dev/null; then 204 | info_msg "Stopping systemd-timesyncd" 205 | systemctl stop systemd-timesyncd 206 | fi 207 | # userns07 requires kernel.unprivileged_userns_clone 208 | if [ -f "/proc/sys/kernel/unprivileged_userns_clone" ]; then 209 | info_msg "Enabling kernel.unprivileged_userns_clone" 210 | sysctl -w kernel.unprivileged_userns_clone=1 211 | else 212 | info_msg "Kernel has no support of unprivileged_userns_clone" 213 | fi 214 | } 215 | 216 | get_tarfile() { 217 | local test_tarfile="$1" 218 | mkdir "${TEST_DIR}" 219 | pushd "${TEST_DIR}" || exit 1 220 | 221 | wget "${test_tarfile}" 222 | tar --strip-components=1 -Jxf "$(basename "${test_tarfile}")" 223 | popd || exit 1 224 | } 225 | 226 | build_install_tests() { 227 | rm -rf "${LTP_INSTALL_PATH}" 228 | pushd "${TEST_DIR}" || exit 1 229 | [[ -n "${TEST_GIT_URL}" ]] && make autotools 230 | ./configure 231 | make -j"$(proc)" all 232 | make SKIP_IDCHECK=1 install 233 | popd || exit 1 234 | } 235 | 236 | install() { 237 | dist= 238 | dist_name 239 | # shellcheck disable=SC2154 240 | case "${dist}" in 241 | debian|ubuntu) 242 | [[ -n "${TEST_GIT_URL}" ]] && pkgs="git" 243 | pkgs="${pkgs} xz-utils flex bison build-essential wget curl net-tools quota genisoimage sudo libaio-dev libattr1-dev libcap-dev expect automake acl autotools-dev autoconf m4 pkgconf" 244 | install_deps "${pkgs}" "${SKIP_INSTALL}" 245 | ;; 246 | centos|fedora) 247 | [[ -n "${TEST_GIT_URL}" ]] && pkgs="git-core" 248 | pkgs="${pkgs} xz flex bison make automake gcc gcc-c++ kernel-devel wget curl net-tools quota genisoimage sudo libaio-devel libattr-devel libcap-devel m4 au expect acl pkgconf" 249 | install_deps "${pkgs}" "${SKIP_INSTALL}" 250 | ;; 251 | *) 252 | warn_msg "Unsupported distribution: package install skipped" 253 | esac 254 | 255 | # Check if mkisofs or genisoimage installed for isofs test. 256 | if echo "${TST_CMDFILES}" | grep 'fs'; then 257 | # link mkisofs to genisoimage on distributions that have replaced mkisofs with genisoimage. 258 | if ! which mkisofs; then 259 | if which genisoimage; then 260 | ln -s "$(which genisoimage)" /usr/bin/mkisofs 261 | else 262 | warn_msg "Neither mkisofs nor genisoimage found! Either of them is required by isofs test." 263 | fi 264 | fi 265 | fi 266 | } 267 | 268 | # Test run. 269 | ! check_root && error_msg "This script must be run as root" 270 | create_out_dir "${OUTPUT}" 271 | 272 | info_msg "About to run ltp test..." 273 | info_msg "Output directory: ${OUTPUT}" 274 | 275 | if [ "${SKIP_INSTALL}" = "true" ] || [ "${SKIP_INSTALL}" = "True" ]; then 276 | info_msg "${TEST_PROGRAM} installation skipped altogether" 277 | else 278 | install 279 | fi 280 | 281 | if [ ! -d "${LTP_INSTALL_PATH}" ]; then 282 | if [ "${BUILD_FROM_TAR}" = "true" ] || [ "${BUILD_FROM_TAR}" = "True" ]; then 283 | get_tarfile "${TEST_TARFILE}" 284 | elif [ -n "${TEST_GIT_URL}" ]; then 285 | get_test_program "${TEST_GIT_URL}" "${TEST_DIR}" "${LTP_VERSION}" "${TEST_PROGRAM}" 286 | else 287 | error_msg "I'm confused, get me out of here, can't fetch tar or test version." 288 | fi 289 | build_install_tests 290 | fi 291 | info_msg "Running prep_system" 292 | prep_system 293 | info_msg "Running run_ltp" 294 | run_ltp 295 | -------------------------------------------------------------------------------- /tests/lkft/ltp/ltp.yaml: -------------------------------------------------------------------------------- 1 | metadata: 2 | name: ltp 3 | format: "Lava-Test Test Definition 1.0" 4 | description: "Run LTP test suite on Ubuntu" 5 | maintainer: 6 | - milosz.wasilewski@linaro.org 7 | - fathi.boudra@linaro.org 8 | os: 9 | - ubuntu 10 | scope: 11 | - functional 12 | devices: 13 | - panda 14 | - panda-es 15 | - arndale 16 | - vexpress-a9 17 | - vexpress-tc2 18 | - ifc6410 19 | params: 20 | TST_CMDFILES: syscalls,mm,math,timers,fcntl-locktests,ipc,fsx,fs,hugetlb,io,nptl,pty,containers,fs_bind,filecaps,admin_tools,connectors 21 | 22 | # SKIPFILE can be a filename from dir ./automated/linux/ltp/, an http URL, 23 | # or a skipgen style yaml file. 24 | # Examples: 25 | # SKIPFILE: "skipfile-lsk-juno" # is a known file present in 26 | # # dir ./automated/linux/ltp/ 27 | # SKIPFILE: "http://people.linaro.org/~naresh.kamboju/skipfile" 28 | # SKIPFILE: "skipfile-lkft.yaml" # yaml file that will be parsed with 29 | # # skipgen. Must use "yaml" extention. 30 | # NOTE: busybox wget may not work with https link so prefer to use http 31 | SKIPFILE: "" 32 | 33 | # BOARD, BRANCH, and ENVIRONMENT may be specified and may be used when 34 | # generating a skipfile using a yaml skipfile and skipgen. 35 | BOARD: "" 36 | BRANCH: "" 37 | LTP_TMPDIR: "/ltp-tmp" 38 | LTP_INSTALL_PATH: "/opt/ltp" 39 | ENVIRONMENT: "" 40 | 41 | SKIP_INSTALL: false 42 | # Slow machines need more timeout Default is 5min and multiply * TIMEOUT_MULTIPLIER 43 | TIMEOUT_MULTIPLIER: 3 44 | # root's password. Needed by ltp/su01. 45 | ROOT_PASSWD: root 46 | 47 | # If the following parameter is set, then the LTP suite is 48 | # cloned and used unconditionally. In particular, the version 49 | # of the suite is set to the commit pointed to by the 50 | # parameter. A simple choice for the value of the parameter 51 | # is, e.g., HEAD. If, instead, the parameter is 52 | # not set, then the suite present in TEST_DIR is used. 53 | # LTP version 54 | LTP_VERSION: "" 55 | 56 | # If next parameter is set, then the LTP suite is cloned 57 | # from the URL in TEST_GIT_URL. Otherwise it is cloned from the 58 | # standard repository for the suite. Note that cloning is done 59 | # only if LTP_VERSION is not empty 60 | TEST_GIT_URL: "" 61 | 62 | # If next parameter is set, then the LTP suite is cloned to or 63 | # looked for in TEST_DIR. Otherwise it is cloned to $(pwd)/ltp 64 | TEST_DIR: "" 65 | 66 | # BUILD_FROM_TAR, if you want to download and build LTP from 67 | # a released tarball, set BUILD_FROM_TAR to 'true'. You have to 68 | # specify the LTP_VERSION to a release e.g., 20180926. 69 | BUILD_FROM_TAR: "false" 70 | run: 71 | steps: 72 | - cd ./automated/linux/ltp/ 73 | - ./ltp.sh -T "${TST_CMDFILES}" -s "${SKIP_INSTALL}" -v "${LTP_VERSION}" -M "${TIMEOUT_MULTIPLIER}" -R "${ROOT_PASSWD}" -b "${BOARD}" -d "${LTP_TMPDIR}" -g "${BRANCH}" -e "${ENVIRONMENT}" -i "${LTP_INSTALL_PATH}" -S "${SKIPFILE}" -p "${TEST_DIR}" -u "${TEST_GIT_URL}" -t "${BUILD_FROM_TAR}" 74 | - ../../utils/send-to-lava.sh ./output/result.txt 75 | -------------------------------------------------------------------------------- /tests/lkft/ltp/ltp_cmdfile: -------------------------------------------------------------------------------- 1 | can,cap_bounds,commands,connectors,containers,controllers,cpuhotplug,crypto,cve,dio,dma_thread_diotest,fcntl-locktests,filecaps,fs,fs_bind,fs_perms_simple,fs_readonly,fsx,hugetlb,hyperthreading,ima,input,io,ipc,kernel_misc,ltp-aiodio.part1,ltp-aiodio.part2,ltp-aiodio.part3,ltp-aiodio.part4,ltp-aio-stress.part1,ltp-aio-stress.part2,math,mm,net.features,net.ipv6,net.ipv6_lib,net.multicast,net.nfs,net.rpc,net.rpc_tests,net.sctp,net_stress.appl,net_stress.broken_ip,net_stress.interface,net_stress.ipsec_dccp,net_stress.ipsec_icmp,net_stress.ipsec_sctp,net_stress.ipsec_tcp,net_stress.ipsec_udp,net_stress.multicast,net_stress.route,net.tcp_cmds,net.tirpc_tests,nptl,numa,pty,sched,scsi_debug.part1,securebits,smack,smoketest,syscalls,syscalls-ipc,tpm_tools,tracing,uevent 2 | -------------------------------------------------------------------------------- /tests/lkft/ltp/parse_result.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | usage() { 4 | echo "Usage:\n\t./parse_result.sh input.log output.csv" 5 | } 6 | 7 | [ ! -f $1 ] && usage && exit 1 8 | [ -z $2 ] && usage && exit 1 9 | 10 | tmpresult=`mktemp -u` 11 | cat $1 | egrep "PASS|CONF|FAIL" | sed 's/CONF/SKIP/' | awk '{print $1","$2","$3}' > $tmpresult 12 | echo "Class,Testcase,Result,Exit Value" > $2 13 | while read -r rline; do 14 | test_name=$(echo $rline | awk -F , '{printf $1}') 15 | class_path=$(grep -r "^$test_name" /opt/ltp/runtest/ | head -1 | awk -F : '{printf $1}') 16 | echo "$(basename $class_path),$rline" >> $2 17 | done < $tmpresult 18 | rm -f $tmpresult 19 | 20 | echo -n "LTP TESTS: " >> $2 21 | cat $1 | grep "Total Tests:" | awk '{printf "total %d ",$3}' >> $2 22 | cat $1 | grep "Total Skipped Tests:" | awk '{printf "skip %d ",$4}' >> $2 23 | cat $1 | grep "Total Failures:" | awk '{printf "fail %d",$3}' >> $2 24 | 25 | -------------------------------------------------------------------------------- /tests/lkft/ltp/skipfile-lkft.yaml: -------------------------------------------------------------------------------- 1 | # This skipfile is consumable using skipgen 2 | # (https://github.com/Linaro/skipgen), included in this repo in 3 | # /automated/bin//skipgen. 4 | # 5 | # reason: 6 | # Please provide a human readable explanation of the reason for the skip. 7 | # url: 8 | # A url referencing the issue. Often a link to the bug. Only one url may be 9 | # specified. 10 | # environments: 11 | # Should be 'production', 'staging', or 'all' for both. Our 12 | # staging environment contains a very minimal skiplist. Only tests which make 13 | # testing unstable should include staging. 14 | # boards: 15 | # Should match a list of board names, or 'all' to include all boards. 16 | # branches: 17 | # Should match a list of branch names, or 'all' to include all branches. 18 | # tests: 19 | # List of tests to skip 20 | 21 | skiplist: 22 | - reason: > 23 | those tests will cause system crash on Mt. Jade Server 24 | url: 25 | environments: production 26 | boards: 27 | - mt.jade 28 | branches: 29 | - all 30 | tests: 31 | - oom01 32 | - oom02 33 | - oom03 34 | - oom04 35 | - oom05 36 | - min_free_kbytes 37 | - memcg_regression 38 | - memcg_stress 39 | - crashme 40 | - cpuhotplug04 41 | 42 | - reason: > 43 | those tests will cause system hung on Mt. Jade Server 44 | url: 45 | environments: production 46 | boards: 47 | - mt.jade 48 | branches: 49 | - all 50 | tests: 51 | - fork09 52 | - ftp 53 | - nfslock3 54 | - ssh4-stress 55 | - ssh6-stress 56 | - Filecaps 57 | 58 | - reason: > 59 | those tests can not run on arm/arm64 architect 60 | url: 61 | environments: production 62 | boards: 63 | - mt.jade 64 | branches: 65 | - all 66 | tests: 67 | - cve-2015-3290 68 | - cve-2017-15537 69 | - cve-2017-5754 70 | - cve-2017-17053 71 | - cve-2018-8897 72 | - cve-2018-1000199 73 | - umip_basic_test 74 | - mmapstress08 75 | - ptrace07 76 | - ptrace08 77 | - ptrace09 78 | - ptrace10 79 | - sbrk03 80 | - signal06 81 | - pt_full_trace_basic 82 | - pt_snapshot_trace_basic 83 | - pt_ex_user 84 | - pt_ex_kernel 85 | - pt_disable_branch 86 | - ioperm01 87 | - ioperm02 88 | - iopl01 89 | - iopl02 90 | 91 | - reason: > 92 | those tests can not run on 64bit system 93 | url: 94 | environments: production 95 | boards: 96 | - mt.jade 97 | branches: 98 | - all 99 | tests: 100 | - setgroups01_16 101 | - setgroups02_16 102 | - setgroups03_16 103 | - setgroups04_16 104 | - setregid01_16 105 | - setregid02_16 106 | - setregid03_16 107 | - setregid04_16 108 | - setresgid01_16 109 | - setresgid02_16 110 | - setresgid03_16 111 | - setresgid04_16 112 | - setresuid01_16 113 | - setresuid02_16 114 | - setresuid03_16 115 | - setresuid04_16 116 | - setresuid05_16 117 | - setreuid01_16 118 | - setreuid02_16 119 | - setreuid03_16 120 | - setreuid04_16 121 | - setreuid05_16 122 | - setreuid06_16 123 | - setreuid07_16 124 | - setuid01_16 125 | - setuid03_16 126 | - setuid04_16 127 | - setfsgid01_16 128 | - setfsgid02_16 129 | - setfsgid03_16 130 | - setfsuid01_16 131 | - setfsuid02_16 132 | - setfsuid03_16 133 | - setfsuid04_16 134 | - setgid01_16 135 | - setgid02_16 136 | - setgid03_16 137 | - lchown01_16 138 | - lchown02_16 139 | - lchown03_16 140 | - getegid01_16 141 | - getegid02_16 142 | - geteuid01_16 143 | - geteuid02_16 144 | - getgid01_16 145 | - getgid03_16 146 | - getgroups01_16 147 | - getgroups03_16 148 | - getresgid01_16 149 | - getresgid02_16 150 | - getresgid03_16 151 | - getresuid01_16 152 | - getresuid02_16 153 | - getresuid03_16 154 | - getuid01_16 155 | - getuid03_16 156 | - fchown01_16 157 | - fchown02_16 158 | - fchown03_16 159 | - fchown04_16 160 | - fchown05_16 161 | - chown01_16 162 | - chown02_16 163 | - chown03_16 164 | - chown04_16 165 | - chown05_16 166 | 167 | - reason: > 168 | Could not find any usable SCSI device 169 | url: 170 | environments: production 171 | boards: 172 | - mt.jade 173 | branches: 174 | - all 175 | tests: 176 | - cve-2018-1000204 177 | - ioctl_sg01 178 | 179 | - reason: > 180 | Could not find any cd media or floppy disk 181 | url: 182 | environments: production 183 | boards: 184 | - mt.jade 185 | branches: 186 | - all 187 | tests: 188 | - stress_cd 189 | - stress_floppy 190 | - read_all_sys 191 | 192 | -------------------------------------------------------------------------------- /tests/patches/0001-kselftests-add-skipfile-check-in-test-runner.patch: -------------------------------------------------------------------------------- 1 | From e16bead833e8adfb62ff8ec56eb790721b656b30 Mon Sep 17 00:00:00 2001 2 | From: Bobo 3 | Date: Sun, 11 Apr 2021 05:02:08 +0000 4 | Subject: [PATCH] kselftests: add skipfile check in test runner 5 | 6 | Signed-off-by: Bobo 7 | --- 8 | tools/testing/selftests/kselftest/runner.sh | 4 +++- 9 | 1 file changed, 3 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh 12 | index e84d901f8567..137e3ae33ce5 100644 13 | --- a/tools/testing/selftests/kselftest/runner.sh 14 | +++ b/tools/testing/selftests/kselftest/runner.sh 15 | @@ -61,7 +61,9 @@ run_one() 16 | 17 | TEST_HDR_MSG="selftests: $DIR: $BASENAME_TEST" 18 | echo "# $TEST_HDR_MSG" 19 | - if [ ! -x "$TEST" ]; then 20 | + if egrep -q "^$DIR:$BASENAME_TEST$" "$SKIPFILE"; then 21 | + echo "not ok $test_num $TEST_HDR_MSG # SKIP" 22 | + elif [ ! -x "$TEST" ]; then 23 | echo -n "# Warning: file $TEST is " 24 | if [ ! -e "$TEST" ]; then 25 | echo "missing!" 26 | -- 27 | 2.25.1 28 | 29 | -------------------------------------------------------------------------------- /tests/runall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" 4 | TMPDIR="/tmp/ampere_tests_tmp" 5 | 6 | . lib/sh-test-lib 7 | 8 | ! check_root && echo "Should run as root" && exit 1 9 | 10 | # clean last tmp dir 11 | rm -rf ${TMPDIR} 12 | mkdir -pv ${TMPDIR} 13 | 14 | kversion=$(uname -r | awk -F . '{print $1 "." $2}') 15 | 16 | amp_functions_test() { 17 | echo "==============================" 18 | echo " Start ampere function tests" 19 | echo "==============================" 20 | 21 | cd ${SCRIPTPATH}/ampere_functions/hw_monitor 22 | ./altra_hw_monitor.sh 23 | cd ${SCRIPTPATH}/ampere_functions/leds 24 | ./altra_leds.sh 25 | cd ${SCRIPTPATH}/ampere_functions/pmu 26 | ./altra_pmu.sh 27 | cd ${SCRIPTPATH}/ampere_functions/numa 28 | ./numa.sh 29 | cd ${SCRIPTPATH}/ampere_functions/smmu_filter_fix 30 | ./smmu_filter_fix.sh 31 | cd ${SCRIPTPATH}/ampere_functions/perf_kvm_stat 32 | ./perf_kvm_stat.sh 33 | cd ${SCRIPTPATH}/ampere_functions/ras 34 | ./ras.sh 35 | cd ${SCRIPTPATH}/ampere_functions/cpuectlr_el1 36 | ./altra_cpuectlr_el1.sh 37 | cd ${SCRIPTPATH}/ampere_functions/exec 38 | ./exec.sh 39 | } 40 | 41 | install_ltp_deps() { 42 | dist_name 43 | case "${dist}" in 44 | debian|ubuntu) 45 | apt-get install -y keyutils exfat-utils exfat-fuse quota kexec-tools dump wireguard-tools inetutils-traceroute isc-dhcp-server nftables expect xinetd libaio1 libaio-dev libmnl0 libmnl-dev 46 | ;; 47 | centos) 48 | yum install -y clang llvm libmount libmount-devel libaio libaio-devel libtirpc libtirpc-devel iproute-tc psmisc exfatprogs ntfsprogs btrfs-progs wireguard-tools keyutils dump sysstat traceroute nfs-utils bind dhcp-server telnet dnsmasq fuse expect kexec-tools nftables xinetd libmnl libmnl-devel quotatool quota quota-devel xfsprogs xfsprogs-devel libattr libattr-devel libacl libacl-devel lksctp-tools lksctp-tools-devel perl-JSON perl-libwww-perl libhugetlbfs libhugetlbfs-devel telnet-server 49 | rpm -q btrfs-progs || rpm -i http://mirror.centos.org/altarch/7/os/aarch64/Packages/btrfs-progs-4.9.1-1.el7.aarch64.rpm 50 | ps aux | grep "[r]pc.mountd" || systemctl enable nfs-server.service && systemctl start nfs-server.service 51 | ;; 52 | *) 53 | echo "Unsupported distro: ${dist}!" 54 | ;; 55 | esac 56 | } 57 | 58 | run_kselftest() { 59 | if [ ! -f /opt/kselftests/version_${kversion} ]; then 60 | apt-get install libhugetlbfs-dev jq ipvsadm conntrack netsniff-ng tshark smcroute libteam-utils -y 61 | rm -rf /opt/kselftests && mkdir -pv /opt/kselftests 62 | cd ${TMPDIR} && git clone --depth 1 https://github.com/AmpereComputing/ampere-lts-kernel.git -b linux-${kversion}.y || exit 1 63 | cd ampere-lts-kernel 64 | # root don't have a .gitconfig 65 | git config user.email "local@local.com" 66 | git config user.name "local" 67 | git am ${SCRIPTPATH}/patches/0001-kselftests-add-skipfile-check-in-test-runner.patch 68 | cd tools/testing/selftests && ./kselftest_install.sh /opt/kselftests && touch /opt/kselftests/version_${kversion} 69 | [ $? -ne 0 ] && echo "Install kselftests failed !!!" && exit 1 70 | cp -f /opt/kselftests/net/forwarding/forwarding.config.sample /opt/kselftests/net/forwarding/forwarding.config 71 | fi 72 | 73 | cd ${SCRIPTPATH}/lkft/kselftest 74 | ./kselftest.sh -p /opt/kselftests -g ${kversion} -S skipfile-lkft.yaml -s true 75 | echo "Test lkft/kselftest finished, please check lkft/kselftest/output/result.csv" 76 | } 77 | 78 | run_ltp() { 79 | if [ ! -f /opt/ltp/version_${kversion} ]; then 80 | install_ltp_deps 81 | rm -rf /opt/ltp 82 | cd ${TMPDIR} && git clone --depth 1 https://github.com/linux-test-project/ltp.git -b 20210524 || exit 1 83 | cd ltp 84 | # To fix broken aiodio tests, see https://patchwork.ozlabs.org/project/ltp/patch/20210601155427.996321-1-zlang@redhat.com/ 85 | git apply ${SCRIPTPATH}/patches/ltp-aiodio-help-aiodio-test-work-normally.diff || exit 1 86 | make autotools && ./configure --prefix=/opt/ltp --with-linux-dir=/lib/modules/`uname -r`/build && make -j && make install && touch /opt/ltp/version_${kversion} 87 | [ $? -ne 0 ] && echo "Install ltp failed !!!" && exit 1 88 | fi 89 | 90 | cd ${SCRIPTPATH}/lkft/ltp 91 | ./ltp.sh -S skipfile-lkft.yaml -g ${kversion} -s true -i /opt/ltp -d `pwd`/ltptmp 92 | echo "Test lkft/ltp finished, please check lkft/ltp/output/result.csv" 93 | } 94 | 95 | amp_functions_test 96 | run_kselftest 97 | run_ltp 98 | -------------------------------------------------------------------------------- /tools/trace-irqoff/LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /tools/trace-irqoff/Makefile: -------------------------------------------------------------------------------- 1 | obj-m += trace_irqoff.o 2 | 3 | KERNELDIR := /lib/modules/$(shell uname -r)/build 4 | PWD := $(shell pwd) 5 | all: 6 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 7 | 8 | clean: 9 | rm -rf *.ko *.mod* *.o modules.* Module.symvers 10 | 11 | install: 12 | insmod trace_irqoff.ko 13 | 14 | remove: 15 | rmmod trace_irqoff 16 | -------------------------------------------------------------------------------- /tools/trace-irqoff/README.md: -------------------------------------------------------------------------------- 1 | Upstream project: https://github.com/bytedance/trace-irqoff 2 | 3 | # Trace-irqoff 4 | 5 | ## 我们的需求是什么 6 | 7 | 在实际问题中,业务经常会遇到网络延迟高问题,这种问题分析下来。基本是如下几种可能原因: 8 | 9 | - 中断关闭时间太长 10 | - softirq 关闭时间太长 11 | 12 | 以上是我们根据经验猜测可能出现的原因,实际问题中,我迫切的需要确定是否以上原因导致问题。如果是的话,具体是什么原因导致以上两种情况发生呢?因此,我们迫切需要定位具体的元凶,使其现形。所以,我们的需求是开发一个工具可以追踪和定位中断或者软中断关闭的时间。**这款工具现在已经开发完成,名为:Interrupts-off or softirqs-off latency tracer,简称 trace-irqoff。** 13 | 14 | ## 如何安装 15 | 16 | 安装 trace-irqoff 工具很简单,git clone代码后执行如下命令即可安装。 17 | 18 | ```bash 19 | make -j8 20 | make install 21 | ``` 22 | 23 | ## 如何使用 24 | 25 | 安装 trace-irqoff 工具成功后。会创建如下 **/proc/trace_irqoff** 目录。 26 | 27 | ```bash 28 | root@n18-061-206:/proc/trace_irqoff# ls 29 | distribute enable sampling_period trace_latency 30 | ``` 31 | 32 | /proc/trace_irqoff 目录下存在 4 个文件,分别:distribute, enable, sampling_period 和 trace_latency。工具安装后,默认是关闭状态,我们需要手动打开 trace。 33 | 34 | ##### 1. 打开 trace 35 | 36 | ```bash 37 | echo 1 > /proc/trace_irqoff/enable 38 | ``` 39 | 40 | ##### 2. 关闭 trace 41 | 42 | ```bash 43 | echo 0 > /proc/trace_irqoff/enable 44 | ``` 45 | 46 | ##### 3. 设置 trace 阈值 47 | 48 | trace-irqoff 工具只会针对关闭中断或者软中断时间超过阈值的情况下记录堆栈信息。因此我们可以通过如下命令查看当前 trace 的阈值: 49 | 50 | ```bash 51 | cat /proc/trace_irqoff/trace_latency 52 | trace_irqoff_latency: 50ms 53 | hardirq: 54 | softirq: 55 | ``` 56 | 57 | 默认阈值是 50ms,如第 2 行所示。第 4 行输出 hardirq: 代表下面的栈是可能关闭中断超过阈值的栈。同理,第 6 行是软中断关闭时间超过阈值的栈。 58 | 59 | 如果需要修改阈值至 100ms 可通过如下命令(写入值单位是 ms): 60 | 61 | ```bash 62 | echo 100 > /proc/trace_irqoff/trace_latency 63 | ``` 64 | 65 | ##### 4. 清除栈信息 66 | 67 | 当然如果需要清除 /proc/trace_irqoff 记录的栈信息。可以执行如下命令(不会修改阈值为 0): 68 | 69 | ```bash 70 | echo 0 > /proc/trace_irqoff/trace_latency 71 | ``` 72 | 73 | ##### 5. 查看中断关闭次数的统计信息 74 | 75 | 如果我们需要知道中断被关闭一定的时间的次数,可以通过如下命令获取统计信息。 76 | 77 | ```bash 78 | root@n18-061-206:/proc/trace_irqoff# cat distribute 79 | hardirq-off: 80 | msecs : count distribution 81 | 20 -> 39 : 1 |********** | 82 | 40 -> 79 : 0 | | 83 | 80 -> 159 : 4 |****************************************| 84 | 160 -> 319 : 2 |******************** | 85 | 320 -> 639 : 1 |********** | 86 | softirq-off: 87 | msecs : count distribution 88 | 20 -> 39 : 0 | | 89 | 40 -> 79 : 0 | | 90 | 80 -> 159 : 0 | | 91 | 160 -> 319 : 1 |****************************************| 92 | ``` 93 | 94 | > 在这个例子中,我们看到hardirq被关闭时间x ∈ [80, 159] ms,次数4次。softirq被关闭时间x ∈ [160, 319] ms,次数1次 95 | 96 | 如果没有任何信息输出,这说明没有任何地方关闭中断时间超过20ms。 97 | 98 | ##### 6. 修改采样周期 99 | 100 | 从上面一节我们可以看到,中断关闭时间分布图最小粒度是 20ms。这是因为采样周期是 10ms。根据采样定理,大于等于 2 倍采样周期时间才能反映真实情况。如果需要提高统计粒度,可修改采样周期时间。例如修改采样周期为 1ms,可执行如下命令(必须在 tracer 关闭的情况下操作有效): 101 | 102 | ```bash 103 | # 单位 ms,可设置最小的采样周期是 1ms。 104 | echo 1 > /proc/trace_irqoff/sampling_period 105 | ``` 106 | 107 | ## 案例分析 108 | 109 | ##### 1. hardirq 关闭 110 | 111 | 我们使用如下示意测试程序,关闭中断 100ms。查看 trace_irqoff 文件内容。 112 | 113 | ```c 114 | static void disable_hardirq(unsigned long latency) 115 | { 116 | local_irq_disable(); 117 | mdelay(latency); 118 | local_irq_enable(); 119 | } 120 | ``` 121 | 122 | 通过模块测试以上代码,然后查看栈信息。 123 | 124 | ```bash 125 | cat /proc/trace_irqoff/trace_latency 126 | trace_irqoff_latency: 50ms 127 | hardirq: 128 | cpu: 17 129 | COMMAND: bash PID: 22840 LATENCY: 107ms 130 | trace_irqoff_hrtimer_handler+0x39/0x99 [trace_irqoff] 131 | __hrtimer_run_queues+0xfa/0x270 132 | hrtimer_interrupt+0x101/0x240 133 | smp_apic_timer_interrupt+0x5e/0x120 134 | apic_timer_interrupt+0xf/0x20 135 | disable_hardirq+0x5b/0x70 136 | proc_reg_write+0x36/0x60 137 | __vfs_write+0x33/0x190 138 | vfs_write+0xb0/0x190 139 | ksys_write+0x52/0xc0 140 | do_syscall_64+0x4f/0xe0 141 | entry_SYSCALL_64_after_hwframe+0x44/0xa9 142 | softirq: 143 | ``` 144 | 145 | 我们可以看到 hardirq 一栏记录 cpu17 执行 bash 命令,关闭中断 107ms(误差 10ms 之内)。其栈信息对应disable_hardirq() 函数中。第 20 行 softirq 一栏没有信息,说明没有记录 softirq 被关闭的栈。 146 | 147 | ##### 2. softirq 关闭 148 | 149 | 我们使用如下示意测试程序,关闭 softirq 100ms。查看 trace_irqoff 文件内容。 150 | 151 | ```c 152 | static void disable_softirq(unsigned long latency) 153 | { 154 | local_bh_disable(); 155 | mdelay(latency); 156 | local_bh_enable(); 157 | } 158 | ``` 159 | 160 | 通过模块测试以上代码,然后查看栈信息。 161 | 162 | ```bash 163 | cat /proc/trace_irqoff/trace_latency 164 | trace_irqoff_latency: 50ms 165 | hardirq: 166 | softirq: 167 | cpu: 17 168 | COMMAND: bash PID: 22840 LATENCY: 51+ms 169 | trace_irqoff_hrtimer_handler+0x97/0x99 [trace_irqoff] 170 | __hrtimer_run_queues+0xfa/0x270 171 | hrtimer_interrupt+0x101/0x240 172 | smp_apic_timer_interrupt+0x5e/0x120 173 | apic_timer_interrupt+0xf/0x20 174 | delay_tsc+0x3c/0x50 175 | disable_softirq+0x4b/0x80 176 | proc_reg_write+0x36/0x60 177 | __vfs_write+0x33/0x190 178 | vfs_write+0xb0/0x190 179 | ksys_write+0x52/0xc0 180 | do_syscall_64+0x4f/0xe0 181 | entry_SYSCALL_64_after_hwframe+0x44/0xa9 182 | 183 | COMMAND: bash PID: 22840 LATENCY: 106ms 184 | trace_irqoff_timer_handler+0x3a/0x60 [trace_irqoff] 185 | call_timer_fn+0x29/0x120 186 | run_timer_softirq+0x16c/0x400 187 | __do_softirq+0x108/0x2b8 188 | do_softirq_own_stack+0x2a/0x40 189 | do_softirq.part.21+0x56/0x60 190 | __local_bh_enable_ip+0x60/0x70 191 | disable_softirq+0x62/0x80 192 | proc_reg_write+0x36/0x60 193 | __vfs_write+0x33/0x190 194 | vfs_write+0xb0/0x190 195 | ksys_write+0x52/0xc0 196 | do_syscall_64+0x4f/0xe0 197 | entry_SYSCALL_64_after_hwframe+0x44/0xa9 198 | ``` 199 | 200 | 针对 softirq 关闭情况,有 2 个栈与之对应。我们注意到第 9 行的函数名称和第 24 行的函数名称是不一样的。第 9 行的栈是硬件中断 handler 捕捉到软中断关闭,第 24 行是软中断 handler 捕捉到软中断被关闭。正常情况下,我们以 24 行开始的栈为分析目标即可。当 24 行的栈是无效的时候,可以看第 9 行的栈。这里注意:第 9 行的 lantency 提示信息 **51+ms** 是阈值信息。并非实际 latency(所以我在后面添加一个'+'字符,表示latency大于51ms)。实际的 latency 是第 24 行显示的 106ms。下面就看下为什么 2 个栈是有必要的。 201 | 202 | ##### 3. ksoftirqd 延迟 203 | 204 | 我们看一个曾经处理的一个实际问题。 205 | 206 | ```bash 207 | cat /proc/trace_irqoff/trace_latency 208 | trace_irqoff_latency: 300ms 209 | hardirq: 210 | softirq: 211 | cpu: 4 212 | COMMAND: lxcfs PID: 4058797 LATENCY: 303+ms 213 | trace_irqoff_record+0x12b/0x1b0 [trace_irqoff] 214 | trace_irqoff_hrtimer_handler+0x97/0x99 [trace_irqoff] 215 | __hrtimer_run_queues+0xdc/0x220 216 | hrtimer_interrupt+0xa6/0x1f0 217 | smp_apic_timer_interrupt+0x62/0x120 218 | apic_timer_interrupt+0x7d/0x90 219 | memcg_sum_events.isra.26+0x3f/0x60 220 | memcg_stat_show+0x323/0x460 221 | seq_read+0x11f/0x3f0 222 | __vfs_read+0x33/0x160 223 | vfs_read+0x91/0x130 224 | SyS_read+0x52/0xc0 225 | do_syscall_64+0x68/0x100 226 | entry_SYSCALL_64_after_hwframe+0x3d/0xa2 227 | 228 | COMMAND: ksoftirqd/4 PID: 34 LATENCY: 409ms 229 | trace_irqoff_record+0x12b/0x1b0 [trace_irqoff] 230 | trace_irqoff_timer_handler+0x3a/0x60 [trace_irqoff] 231 | call_timer_fn+0x2e/0x130 232 | run_timer_softirq+0x1d4/0x420 233 | __do_softirq+0x108/0x2a9 234 | run_ksoftirqd+0x1e/0x40 235 | smpboot_thread_fn+0xfe/0x150 236 | kthread+0xfc/0x130 237 | ret_from_fork+0x1f/0x30 238 | ``` 239 | 240 | 我们看到下面的进程 ksoftirqd/4 的栈,延迟时间是 409ms。ksoftirqd 进程是 kernel 中处理 softirq 的进程。因此这段栈对我们是没有意义的,因为元凶已经错过了。所以此时,我们可以借鉴上面的栈信息,我们看到当 softirq 被延迟 303ms 的时候,当前 CPU 正在执行的进程是 lxcfs。并且栈是 memory cgroup 相关。因此,我们基本可以判断 lxcfs 进程执行时间过长,由于 kernel 态不支持抢占,因此导致 ksoftirqd 进程没有机会得到运行。 241 | 242 | -------------------------------------------------------------------------------- /tools/trace-irqoff/readme.txt: -------------------------------------------------------------------------------- 1 | cd tools/trace-irqoff/ 2 | make 3 | sudo make install 4 | 5 | cd /proc/trade-irqoff 6 | ls 7 | distribute enable sampling_period trace_latency 8 | 9 | I used mdelay in the code to simulate IRQ timeout. 10 | 11 | --- a/trace_irqoff.c 12 | +++ b/trace_irqoff.c 13 | @@ -700,10 +700,18 @@ static const struct proc_ops enable_fops = { 14 | .proc_release = single_release, 15 | }; 16 | #endif 17 | +#include 18 | +static void test_hardirq(int latency) 19 | +{ 20 | + local_irq_disable(); 21 | + mdelay(latency); 22 | + local_irq_enable(); 23 | +} 24 | 25 | static int sampling_period_show(struct seq_file *m, void *ptr) 26 | { 27 | seq_printf(m, "%llums\n", sampling_period / (1000 * 1000UL)); 28 | + test_hardirq(1000); 29 | 30 | return 0; 31 | } 32 | 33 | make 34 | sudo make remove 35 | sudo make install 36 | 37 | cd /proc/trace_irqoff/ 38 | cat sampling_period 39 | 10ms 40 | 41 | 42 | cat distribute 43 | hardirq-off: 44 | msecs : count distribution 45 | 10 -> 19 : 0 | | 46 | 20 -> 39 : 0 | | 47 | 40 -> 79 : 0 | | 48 | 80 -> 159 : 0 | | 49 | 160 -> 319 : 0 | | 50 | 320 -> 639 : 0 | | 51 | 640 -> 1279 : 1 |****************************************| 52 | softirq-off: 53 | msecs : count distribution 54 | 10 -> 19 : 477100 |****************************************| 55 | 20 -> 39 : 14559 |* | 56 | 57 | Because I set 1000ms mdelay,the count between 640 to 1279 is 1. 58 | 59 | cat trace_latency 60 | trace_irqoff_latency: 50ms 61 | 62 | hardirq: 63 | cpu: 148 64 | COMMAND: cat PID: 35333 LATENCY: 995ms 65 | save_trace.isra.0+0x178/0x1c0 [trace_irqoff] 66 | trace_irqoff_record+0x100/0x110 [trace_irqoff] 67 | trace_irqoff_hrtimer_handler+0x58/0x138 [trace_irqoff] 68 | __hrtimer_run_queues+0x148/0x324 69 | hrtimer_interrupt+0xfc/0x270 70 | arch_timer_handler_phys+0x40/0x50 71 | handle_percpu_devid_irq+0x94/0x1c0 72 | handle_domain_irq+0x6c/0x9c 73 | gic_handle_irq+0xec/0x184 74 | call_on_irq_stack+0x2c/0x38 75 | do_interrupt_handler+0x5c/0x70 76 | el1_interrupt+0x30/0x50 77 | el1h_64_irq_handler+0x18/0x24 78 | el1h_64_irq+0x78/0x7c 79 | sampling_period_show+0x7c/0xbc [trace_irqoff] 80 | seq_read_iter+0x1dc/0x4f0 81 | seq_read+0xe4/0x140 82 | proc_reg_read+0xb4/0xf0 83 | vfs_read+0xb8/0x1f0 84 | ksys_read+0x74/0x100 85 | __arm64_sys_read+0x28/0x34 86 | invoke_syscall+0x50/0x120 87 | el0_svc_common.constprop.0+0x54/0x184 88 | do_el0_svc+0x34/0x9c 89 | el0_svc+0x30/0x100 90 | el0t_64_sync_handler+0xa4/0x130 91 | el0t_64_sync+0x1a0/0x1a4 92 | 93 | 94 | softirq: 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /tools/trace-irqoff/trace_irqoff.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0 2 | /* 3 | * Trace Irqsoff 4 | * 5 | * Copyright (C) 2020 Bytedance, Inc., Muchun Song 6 | * 7 | * The main authors of the trace irqsoff code are: 8 | * 9 | * Muchun Song 10 | */ 11 | #define pr_fmt(fmt) "trace-irqoff: " fmt 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) 30 | #include 31 | #else 32 | #include 33 | #endif 34 | 35 | #define MAX_TRACE_ENTRIES (SZ_1K / sizeof(unsigned long)) 36 | #define PER_TRACE_ENTRIES_AVERAGE (8 + 8) 37 | 38 | #define MAX_STACE_TRACE_ENTRIES \ 39 | (MAX_TRACE_ENTRIES / PER_TRACE_ENTRIES_AVERAGE) 40 | 41 | #define MAX_LATENCY_RECORD 10 42 | 43 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0) 44 | #ifndef DEFINE_SHOW_ATTRIBUTE 45 | #define DEFINE_SHOW_ATTRIBUTE(__name) \ 46 | static int __name ## _open(struct inode *inode, struct file *file) \ 47 | { \ 48 | return single_open(file, __name ## _show, inode->i_private); \ 49 | } \ 50 | \ 51 | static const struct file_operations __name ## _fops = { \ 52 | .owner = THIS_MODULE, \ 53 | .open = __name ## _open, \ 54 | .read = seq_read, \ 55 | .llseek = seq_lseek, \ 56 | .release = single_release, \ 57 | } 58 | #endif /* DEFINE_SHOW_ATTRIBUTE */ 59 | #define IRQ_OFF_DEFINE_SHOW_ATTRIBUTE DEFINE_SHOW_ATTRIBUTE 60 | 61 | #else /* LINUX_VERSION_CODE */ 62 | #define IRQ_OFF_DEFINE_SHOW_ATTRIBUTE(__name) \ 63 | static int __name ## _open(struct inode *inode, struct file *file) \ 64 | { \ 65 | return single_open(file, __name ## _show, inode->i_private); \ 66 | } \ 67 | \ 68 | static const struct proc_ops __name ## _fops = { \ 69 | .proc_open = __name ## _open, \ 70 | .proc_read = seq_read, \ 71 | .proc_lseek = seq_lseek, \ 72 | .proc_release = single_release, \ 73 | } 74 | #endif /* LINUX_VERSION_CODE */ 75 | 76 | static bool trace_enable; 77 | 78 | /** 79 | * Default sampling period is 10000000ns. The minimum value is 1000000ns. 80 | */ 81 | static u64 sampling_period = 10 * 1000 * 1000UL; 82 | 83 | /** 84 | * How many times should we record the stack trace. 85 | * Default is 50000000ns. 86 | */ 87 | static u64 trace_irqoff_latency = 50 * 1000 * 1000UL; 88 | 89 | struct irqoff_trace { 90 | unsigned int nr_entries; 91 | unsigned long *entries; 92 | }; 93 | 94 | struct stack_trace_metadata { 95 | u64 last_timestamp; 96 | unsigned long nr_irqoff_trace; 97 | struct irqoff_trace trace[MAX_STACE_TRACE_ENTRIES]; 98 | unsigned long nr_entries; 99 | unsigned long entries[MAX_TRACE_ENTRIES]; 100 | unsigned long latency_count[MAX_LATENCY_RECORD]; 101 | 102 | /* Task command names*/ 103 | char comms[MAX_STACE_TRACE_ENTRIES][TASK_COMM_LEN]; 104 | 105 | /* Task pids*/ 106 | pid_t pids[MAX_STACE_TRACE_ENTRIES]; 107 | 108 | struct { 109 | u64 nsecs:63; 110 | u64 more:1; 111 | } latency[MAX_STACE_TRACE_ENTRIES]; 112 | }; 113 | 114 | struct per_cpu_stack_trace { 115 | struct timer_list timer; 116 | struct hrtimer hrtimer; 117 | struct stack_trace_metadata hardirq_trace; 118 | struct stack_trace_metadata softirq_trace; 119 | 120 | bool softirq_delayed; 121 | }; 122 | 123 | static struct per_cpu_stack_trace __percpu *cpu_stack_trace; 124 | 125 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) 126 | static void (*save_stack_trace_skip_hardirq)(struct pt_regs *regs, 127 | struct stack_trace *trace); 128 | 129 | static inline void stack_trace_skip_hardirq_init(void) 130 | { 131 | save_stack_trace_skip_hardirq = 132 | (void *)kallsyms_lookup_name("save_stack_trace_regs"); 133 | } 134 | 135 | static inline void store_stack_trace(struct pt_regs *regs, 136 | struct irqoff_trace *trace, 137 | unsigned long *entries, 138 | unsigned int max_entries, int skip) 139 | { 140 | struct stack_trace stack_trace; 141 | 142 | stack_trace.nr_entries = 0; 143 | stack_trace.max_entries = max_entries; 144 | stack_trace.entries = entries; 145 | stack_trace.skip = skip; 146 | 147 | if (regs && save_stack_trace_skip_hardirq) 148 | save_stack_trace_skip_hardirq(regs, &stack_trace); 149 | else 150 | save_stack_trace(&stack_trace); 151 | 152 | trace->entries = entries; 153 | trace->nr_entries = stack_trace.nr_entries; 154 | 155 | /* 156 | * Some daft arches put -1 at the end to indicate its a full trace. 157 | * 158 | * this is buggy anyway, since it takes a whole extra entry so a 159 | * complete trace that maxes out the entries provided will be reported 160 | * as incomplete, friggin useless . 161 | */ 162 | if (trace->nr_entries != 0 && 163 | trace->entries[trace->nr_entries - 1] == ULONG_MAX) 164 | trace->nr_entries--; 165 | } 166 | #else 167 | static unsigned int (*stack_trace_save_skip_hardirq)(struct pt_regs *regs, 168 | unsigned long *store, 169 | unsigned int size, 170 | unsigned int skipnr); 171 | 172 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0) 173 | static inline void stack_trace_skip_hardirq_init(void) 174 | { 175 | stack_trace_save_skip_hardirq = 176 | (void *)kallsyms_lookup_name("stack_trace_save_regs"); 177 | } 178 | #else /* LINUX_VERSION_CODE */ 179 | 180 | static int noop_pre_handler(struct kprobe *p, struct pt_regs *regs){ 181 | return 0; 182 | } 183 | 184 | /** 185 | * Since commit 0bd476e6c671 ("kallsyms: unexport kallsyms_lookup_name() 186 | * and kallsyms_on_each_symbol()"), kallsyms_lookup_name is unexported. 187 | * 188 | * We can only find the kallsyms_lookup_name's addr by using kprobes, then use 189 | * the unexported kallsyms_lookup_name to find symbols. 190 | */ 191 | static void stack_trace_skip_hardirq_init(void) 192 | { 193 | int ret; 194 | struct kprobe kp; 195 | unsigned long (*kallsyms_lookup_name_fun)(const char *name); 196 | 197 | 198 | ret = -1; 199 | kp.symbol_name = "kallsyms_lookup_name"; 200 | kp.pre_handler = noop_pre_handler; 201 | stack_trace_save_skip_hardirq = NULL; 202 | 203 | ret = register_kprobe(&kp); 204 | if (ret < 0) { 205 | return; 206 | } 207 | 208 | kallsyms_lookup_name_fun = (void*)kp.addr; 209 | unregister_kprobe(&kp); 210 | 211 | stack_trace_save_skip_hardirq = 212 | (void *)kallsyms_lookup_name_fun("stack_trace_save_regs"); 213 | } 214 | #endif /* LINUX_VERSION_CODE */ 215 | 216 | static inline void store_stack_trace(struct pt_regs *regs, 217 | struct irqoff_trace *trace, 218 | unsigned long *entries, 219 | unsigned int max_entries, int skip) 220 | { 221 | trace->entries = entries; 222 | if (regs && stack_trace_save_skip_hardirq) 223 | trace->nr_entries = stack_trace_save_skip_hardirq(regs, entries, 224 | max_entries, 225 | skip); 226 | else 227 | trace->nr_entries = stack_trace_save(entries, max_entries, 228 | skip); 229 | } 230 | #endif 231 | 232 | /** 233 | * Note: Must be called with irq disabled. 234 | */ 235 | static bool save_trace(struct pt_regs *regs, bool hardirq, u64 latency) 236 | { 237 | unsigned long nr_entries, nr_irqoff_trace; 238 | struct irqoff_trace *trace; 239 | struct stack_trace_metadata *stack_trace; 240 | 241 | stack_trace = hardirq ? this_cpu_ptr(&cpu_stack_trace->hardirq_trace) : 242 | this_cpu_ptr(&cpu_stack_trace->softirq_trace); 243 | 244 | nr_irqoff_trace = stack_trace->nr_irqoff_trace; 245 | if (unlikely(nr_irqoff_trace >= MAX_STACE_TRACE_ENTRIES)) 246 | return false; 247 | 248 | nr_entries = stack_trace->nr_entries; 249 | if (unlikely(nr_entries >= MAX_TRACE_ENTRIES - 1)) 250 | return false; 251 | 252 | strlcpy(stack_trace->comms[nr_irqoff_trace], current->comm, 253 | TASK_COMM_LEN); 254 | stack_trace->pids[nr_irqoff_trace] = current->pid; 255 | stack_trace->latency[nr_irqoff_trace].nsecs = latency; 256 | stack_trace->latency[nr_irqoff_trace].more = !hardirq && regs; 257 | 258 | trace = stack_trace->trace + nr_irqoff_trace; 259 | store_stack_trace(regs, trace, stack_trace->entries + nr_entries, 260 | MAX_TRACE_ENTRIES - nr_entries, 0); 261 | stack_trace->nr_entries += trace->nr_entries; 262 | 263 | /** 264 | * Ensure that the initialisation of @trace is complete before we 265 | * update the @nr_irqoff_trace. 266 | */ 267 | smp_store_release(&stack_trace->nr_irqoff_trace, nr_irqoff_trace + 1); 268 | 269 | if (unlikely(stack_trace->nr_entries >= MAX_TRACE_ENTRIES - 1)) { 270 | pr_info("BUG: MAX_TRACE_ENTRIES too low!"); 271 | 272 | return false; 273 | } 274 | 275 | return true; 276 | } 277 | 278 | static bool trace_irqoff_record(u64 delta, bool hardirq, bool skip) 279 | { 280 | int index = 0; 281 | u64 throttle = sampling_period << 1; 282 | u64 delta_old; 283 | 284 | if (delta < throttle) 285 | return false; 286 | 287 | delta -= sampling_period; 288 | delta_old = delta; 289 | delta >>= 1; 290 | while (delta > sampling_period) { 291 | index++; 292 | delta >>= 1; 293 | } 294 | 295 | if (unlikely(index >= MAX_LATENCY_RECORD)) 296 | index = MAX_LATENCY_RECORD - 1; 297 | 298 | if (hardirq) 299 | __this_cpu_inc(cpu_stack_trace->hardirq_trace.latency_count[index]); 300 | else if (!skip) 301 | __this_cpu_inc(cpu_stack_trace->softirq_trace.latency_count[index]); 302 | 303 | if (unlikely(delta_old >= trace_irqoff_latency)) 304 | save_trace(skip ? get_irq_regs() : NULL, hardirq, delta_old); 305 | 306 | return true; 307 | } 308 | 309 | static enum hrtimer_restart trace_irqoff_hrtimer_handler(struct hrtimer *hrtimer) 310 | { 311 | u64 now = local_clock(), delta; 312 | 313 | delta = now - __this_cpu_read(cpu_stack_trace->hardirq_trace.last_timestamp); 314 | __this_cpu_write(cpu_stack_trace->hardirq_trace.last_timestamp, now); 315 | 316 | if (trace_irqoff_record(delta, true, true)) { 317 | __this_cpu_write(cpu_stack_trace->softirq_trace.last_timestamp, 318 | now); 319 | } else if (!__this_cpu_read(cpu_stack_trace->softirq_delayed)) { 320 | u64 delta_soft; 321 | 322 | delta_soft = now - 323 | __this_cpu_read(cpu_stack_trace->softirq_trace.last_timestamp); 324 | 325 | if (unlikely(delta_soft >= trace_irqoff_latency + sampling_period)) { 326 | __this_cpu_write(cpu_stack_trace->softirq_delayed, true); 327 | trace_irqoff_record(delta_soft, false, true); 328 | } 329 | } 330 | 331 | hrtimer_forward_now(hrtimer, ns_to_ktime(sampling_period)); 332 | 333 | return HRTIMER_RESTART; 334 | } 335 | 336 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) 337 | static void trace_irqoff_timer_handler(unsigned long data) 338 | #else 339 | static void trace_irqoff_timer_handler(struct timer_list *timer) 340 | #endif 341 | { 342 | u64 now = local_clock(), delta; 343 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) 344 | struct timer_list *timer = (struct timer_list *)data; 345 | #endif 346 | 347 | delta = now - __this_cpu_read(cpu_stack_trace->softirq_trace.last_timestamp); 348 | __this_cpu_write(cpu_stack_trace->softirq_trace.last_timestamp, now); 349 | 350 | __this_cpu_write(cpu_stack_trace->softirq_delayed, false); 351 | 352 | trace_irqoff_record(delta, false, false); 353 | 354 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) 355 | mod_timer_pinned(timer, 356 | jiffies + msecs_to_jiffies(sampling_period / 1000000UL)); 357 | #else 358 | mod_timer(timer, 359 | jiffies + msecs_to_jiffies(sampling_period / 1000000UL)); 360 | #endif 361 | } 362 | 363 | static void smp_clear_stack_trace(void *info) 364 | { 365 | int i; 366 | struct per_cpu_stack_trace *stack_trace = info; 367 | 368 | stack_trace->hardirq_trace.nr_entries = 0; 369 | stack_trace->hardirq_trace.nr_irqoff_trace = 0; 370 | stack_trace->softirq_trace.nr_entries = 0; 371 | stack_trace->softirq_trace.nr_irqoff_trace = 0; 372 | 373 | for (i = 0; i < MAX_LATENCY_RECORD; i++) { 374 | stack_trace->hardirq_trace.latency_count[i] = 0; 375 | stack_trace->softirq_trace.latency_count[i] = 0; 376 | } 377 | } 378 | 379 | static void smp_timers_start(void *info) 380 | { 381 | u64 now = local_clock(); 382 | struct per_cpu_stack_trace *stack_trace = info; 383 | struct hrtimer *hrtimer = &stack_trace->hrtimer; 384 | struct timer_list *timer = &stack_trace->timer; 385 | 386 | stack_trace->hardirq_trace.last_timestamp = now; 387 | stack_trace->softirq_trace.last_timestamp = now; 388 | 389 | hrtimer_start_range_ns(hrtimer, ns_to_ktime(sampling_period), 390 | 0, HRTIMER_MODE_REL_PINNED); 391 | 392 | timer->expires = jiffies + msecs_to_jiffies(sampling_period / 1000000UL); 393 | add_timer_on(timer, smp_processor_id()); 394 | } 395 | 396 | #define NUMBER_CHARACTER 40 397 | 398 | static bool histogram_show(struct seq_file *m, const char *header, 399 | const unsigned long *hist, unsigned long size, 400 | unsigned int factor) 401 | { 402 | int i, zero_index = 0; 403 | unsigned long count_max = 0; 404 | 405 | for (i = 0; i < size; i++) { 406 | unsigned long count = hist[i]; 407 | 408 | if (count > count_max) 409 | count_max = count; 410 | 411 | if (count) 412 | zero_index = i + 1; 413 | } 414 | if (count_max == 0) 415 | return false; 416 | 417 | /* print header */ 418 | if (header) 419 | seq_printf(m, "%s\n", header); 420 | seq_printf(m, "%*c%s%*c : %-9s %s\n", 9, ' ', "msecs", 10, ' ', "count", 421 | "distribution"); 422 | 423 | for (i = 0; i < zero_index; i++) { 424 | int num; 425 | int scale_min, scale_max; 426 | char str[NUMBER_CHARACTER + 1]; 427 | 428 | scale_max = 2 << i; 429 | scale_min = unlikely(i == 0) ? 1 : scale_max / 2; 430 | 431 | num = hist[i] * NUMBER_CHARACTER / count_max; 432 | memset(str, '*', num); 433 | memset(str + num, ' ', NUMBER_CHARACTER - num); 434 | str[NUMBER_CHARACTER] = '\0'; 435 | 436 | seq_printf(m, "%10d -> %-10d : %-8lu |%s|\n", 437 | scale_min * factor, scale_max * factor - 1, 438 | hist[i], str); 439 | } 440 | 441 | return true; 442 | } 443 | 444 | static void distribute_show_one(struct seq_file *m, void *v, bool hardirq) 445 | { 446 | int cpu; 447 | unsigned long latency_count[MAX_LATENCY_RECORD] = { 0 }; 448 | 449 | for_each_online_cpu(cpu) { 450 | int i; 451 | unsigned long *count; 452 | 453 | count = hardirq ? 454 | per_cpu_ptr(cpu_stack_trace->hardirq_trace.latency_count, cpu) : 455 | per_cpu_ptr(cpu_stack_trace->softirq_trace.latency_count, cpu); 456 | 457 | for (i = 0; i < MAX_LATENCY_RECORD; i++) 458 | latency_count[i] += count[i]; 459 | } 460 | 461 | histogram_show(m, hardirq ? "hardirq-off:" : "softirq-off:", 462 | latency_count, MAX_LATENCY_RECORD, 463 | sampling_period / (1000 * 1000UL)); 464 | } 465 | 466 | static int distribute_show(struct seq_file *m, void *v) 467 | { 468 | distribute_show_one(m, v, true); 469 | distribute_show_one(m, v, false); 470 | 471 | return 0; 472 | } 473 | 474 | IRQ_OFF_DEFINE_SHOW_ATTRIBUTE(distribute); 475 | 476 | static void seq_print_stack_trace(struct seq_file *m, struct irqoff_trace *trace) 477 | { 478 | int i; 479 | 480 | if (WARN_ON(!trace->entries)) 481 | return; 482 | 483 | for (i = 0; i < trace->nr_entries; i++) 484 | seq_printf(m, "%*c%pS\n", 5, ' ', (void *)trace->entries[i]); 485 | } 486 | 487 | static ssize_t trace_latency_write(struct file *file, const char __user *buf, 488 | size_t count, loff_t *ppos) 489 | { 490 | unsigned long latency; 491 | 492 | if (kstrtoul_from_user(buf, count, 0, &latency)) 493 | return -EINVAL; 494 | 495 | if (latency == 0) { 496 | int cpu; 497 | 498 | for_each_online_cpu(cpu) 499 | smp_call_function_single(cpu, smp_clear_stack_trace, 500 | per_cpu_ptr(cpu_stack_trace, cpu), 501 | true); 502 | return count; 503 | } else if (latency < (sampling_period << 1) / (1000 * 1000UL)) 504 | return -EINVAL; 505 | 506 | trace_irqoff_latency = latency * 1000 * 1000UL; 507 | 508 | return count; 509 | } 510 | 511 | static void trace_latency_show_one(struct seq_file *m, void *v, bool hardirq) 512 | { 513 | int cpu; 514 | 515 | for_each_online_cpu(cpu) { 516 | int i; 517 | unsigned long nr_irqoff_trace; 518 | struct stack_trace_metadata *stack_trace; 519 | 520 | stack_trace = hardirq ? 521 | per_cpu_ptr(&cpu_stack_trace->hardirq_trace, cpu) : 522 | per_cpu_ptr(&cpu_stack_trace->softirq_trace, cpu); 523 | 524 | /** 525 | * Paired with smp_store_release() in the save_trace(). 526 | */ 527 | nr_irqoff_trace = smp_load_acquire(&stack_trace->nr_irqoff_trace); 528 | 529 | if (!nr_irqoff_trace) 530 | continue; 531 | 532 | seq_printf(m, " cpu: %d\n", cpu); 533 | 534 | for (i = 0; i < nr_irqoff_trace; i++) { 535 | struct irqoff_trace *trace = stack_trace->trace + i; 536 | 537 | seq_printf(m, "%*cCOMMAND: %s PID: %d LATENCY: %lu%s\n", 538 | 5, ' ', stack_trace->comms[i], 539 | stack_trace->pids[i], 540 | stack_trace->latency[i].nsecs / (1000 * 1000UL), 541 | stack_trace->latency[i].more ? "+ms" : "ms"); 542 | seq_print_stack_trace(m, trace); 543 | seq_putc(m, '\n'); 544 | 545 | cond_resched(); 546 | } 547 | } 548 | } 549 | 550 | static int trace_latency_show(struct seq_file *m, void *v) 551 | { 552 | seq_printf(m, "trace_irqoff_latency: %llums\n\n", 553 | trace_irqoff_latency / (1000 * 1000UL)); 554 | 555 | seq_puts(m, " hardirq:\n"); 556 | trace_latency_show_one(m, v, true); 557 | 558 | seq_putc(m, '\n'); 559 | 560 | seq_puts(m, " softirq:\n"); 561 | trace_latency_show_one(m, v, false); 562 | 563 | return 0; 564 | } 565 | 566 | static int trace_latency_open(struct inode *inode, struct file *file) 567 | { 568 | return single_open(file, trace_latency_show, inode->i_private); 569 | } 570 | 571 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0) 572 | static const struct file_operations trace_latency_fops = { 573 | .owner = THIS_MODULE, 574 | .open = trace_latency_open, 575 | .read = seq_read, 576 | .write = trace_latency_write, 577 | .llseek = seq_lseek, 578 | .release = single_release, 579 | }; 580 | #else 581 | static const struct proc_ops trace_latency_fops = { 582 | .proc_open = trace_latency_open, 583 | .proc_read = seq_read, 584 | .proc_write = trace_latency_write, 585 | .proc_lseek = seq_lseek, 586 | .proc_release = single_release, 587 | }; 588 | #endif 589 | 590 | static int enable_show(struct seq_file *m, void *ptr) 591 | { 592 | seq_printf(m, "%s\n", trace_enable ? "enabled" : "disabled"); 593 | 594 | return 0; 595 | } 596 | 597 | static int enable_open(struct inode *inode, struct file *file) 598 | { 599 | return single_open(file, enable_show, inode->i_private); 600 | } 601 | 602 | static void trace_irqoff_start_timers(void) 603 | { 604 | int cpu; 605 | 606 | for_each_online_cpu(cpu) { 607 | struct hrtimer *hrtimer; 608 | struct timer_list *timer; 609 | 610 | hrtimer = per_cpu_ptr(&cpu_stack_trace->hrtimer, cpu); 611 | hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_PINNED); 612 | hrtimer->function = trace_irqoff_hrtimer_handler; 613 | 614 | timer = per_cpu_ptr(&cpu_stack_trace->timer, cpu); 615 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) 616 | __setup_timer(timer, trace_irqoff_timer_handler, 617 | (unsigned long)timer, TIMER_IRQSAFE); 618 | #elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) 619 | timer->flags = TIMER_PINNED | TIMER_IRQSAFE; 620 | setup_timer(timer, trace_irqoff_timer_handler, 621 | (unsigned long)timer); 622 | #else 623 | timer_setup(timer, trace_irqoff_timer_handler, 624 | TIMER_PINNED | TIMER_IRQSAFE); 625 | #endif 626 | 627 | smp_call_function_single(cpu, smp_timers_start, 628 | per_cpu_ptr(cpu_stack_trace, cpu), 629 | true); 630 | } 631 | } 632 | 633 | static void trace_irqoff_cancel_timers(void) 634 | { 635 | int cpu; 636 | 637 | for_each_online_cpu(cpu) { 638 | struct hrtimer *hrtimer; 639 | struct timer_list *timer; 640 | 641 | hrtimer = per_cpu_ptr(&cpu_stack_trace->hrtimer, cpu); 642 | hrtimer_cancel(hrtimer); 643 | 644 | timer = per_cpu_ptr(&cpu_stack_trace->timer, cpu); 645 | del_timer_sync(timer); 646 | } 647 | } 648 | 649 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) 650 | #include 651 | 652 | static int kstrtobool_from_user(const char __user *s, size_t count, bool *res) 653 | { 654 | /* Longest string needed to differentiate, newline, terminator */ 655 | char buf[4]; 656 | 657 | count = min(count, sizeof(buf) - 1); 658 | if (copy_from_user(buf, s, count)) 659 | return -EFAULT; 660 | buf[count] = '\0'; 661 | return strtobool(buf, res); 662 | } 663 | #endif 664 | 665 | static ssize_t enable_write(struct file *file, const char __user *buf, 666 | size_t count, loff_t *ppos) 667 | { 668 | bool enable; 669 | 670 | if (kstrtobool_from_user(buf, count, &enable)) 671 | return -EINVAL; 672 | 673 | if (!!enable == !!trace_enable) 674 | return count; 675 | 676 | if (enable) 677 | trace_irqoff_start_timers(); 678 | else 679 | trace_irqoff_cancel_timers(); 680 | 681 | trace_enable = enable; 682 | 683 | return count; 684 | } 685 | 686 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0) 687 | static const struct file_operations enable_fops = { 688 | .open = enable_open, 689 | .read = seq_read, 690 | .write = enable_write, 691 | .llseek = seq_lseek, 692 | .release = single_release, 693 | }; 694 | #else 695 | static const struct proc_ops enable_fops = { 696 | .proc_open = enable_open, 697 | .proc_read = seq_read, 698 | .proc_write = enable_write, 699 | .proc_lseek = seq_lseek, 700 | .proc_release = single_release, 701 | }; 702 | #endif 703 | 704 | static int sampling_period_show(struct seq_file *m, void *ptr) 705 | { 706 | seq_printf(m, "%llums\n", sampling_period / (1000 * 1000UL)); 707 | 708 | return 0; 709 | } 710 | 711 | static int sampling_period_open(struct inode *inode, struct file *file) 712 | { 713 | return single_open(file, sampling_period_show, inode->i_private); 714 | } 715 | 716 | static ssize_t sampling_period_write(struct file *file, const char __user *buf, 717 | size_t count, loff_t *ppos) 718 | { 719 | unsigned long period; 720 | 721 | if (trace_enable) 722 | return -EINVAL; 723 | 724 | if (kstrtoul_from_user(buf, count, 0, &period)) 725 | return -EINVAL; 726 | 727 | period *= 1000 * 1000UL; 728 | if (period > (trace_irqoff_latency >> 1)) 729 | trace_irqoff_latency = period << 1; 730 | 731 | sampling_period = period; 732 | 733 | return count; 734 | } 735 | 736 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0) 737 | static const struct file_operations sampling_period_fops = { 738 | .open = sampling_period_open, 739 | .read = seq_read, 740 | .write = sampling_period_write, 741 | .llseek = seq_lseek, 742 | .release = single_release, 743 | }; 744 | #else 745 | static const struct proc_ops sampling_period_fops = { 746 | .proc_open = sampling_period_open, 747 | .proc_read = seq_read, 748 | .proc_write = sampling_period_write, 749 | .proc_lseek = seq_lseek, 750 | .proc_release = single_release, 751 | }; 752 | #endif 753 | 754 | static int __init trace_irqoff_init(void) 755 | { 756 | struct proc_dir_entry *parent_dir; 757 | 758 | cpu_stack_trace = alloc_percpu(struct per_cpu_stack_trace); 759 | if (!cpu_stack_trace) 760 | return -ENOMEM; 761 | 762 | stack_trace_skip_hardirq_init(); 763 | 764 | parent_dir = proc_mkdir("trace_irqoff", NULL); 765 | if (!parent_dir) 766 | goto free_percpu; 767 | 768 | if (!proc_create("distribute", S_IRUSR, parent_dir, &distribute_fops)) 769 | goto remove_proc; 770 | 771 | if (!proc_create("trace_latency", S_IRUSR | S_IWUSR, parent_dir, 772 | &trace_latency_fops)) 773 | goto remove_proc; 774 | 775 | if (!proc_create("enable", S_IRUSR | S_IWUSR, parent_dir, &enable_fops)) 776 | goto remove_proc; 777 | 778 | if (!proc_create("sampling_period", S_IRUSR | S_IWUSR, parent_dir, 779 | &sampling_period_fops)) 780 | goto remove_proc; 781 | 782 | return 0; 783 | 784 | remove_proc: 785 | remove_proc_subtree("trace_irqoff", NULL); 786 | free_percpu: 787 | free_percpu(cpu_stack_trace); 788 | 789 | return -ENOMEM; 790 | } 791 | 792 | static void __exit trace_irqoff_exit(void) 793 | { 794 | if (trace_enable) 795 | trace_irqoff_cancel_timers(); 796 | remove_proc_subtree("trace_irqoff", NULL); 797 | free_percpu(cpu_stack_trace); 798 | } 799 | 800 | module_init(trace_irqoff_init); 801 | module_exit(trace_irqoff_exit); 802 | MODULE_LICENSE("GPL v2"); 803 | MODULE_AUTHOR("Muchun Song "); 804 | --------------------------------------------------------------------------------