Bug 5968 - [anolis8][4.19][nightly][x86_64 && aarch64]kernel-selftests测试套新增的用例bpf.test_netcnt失败,报错Unexpected packet count: 10003
Summary: [anolis8][4.19][nightly][x86_64 && aarch64]kernel-selftests测试套新增的用例bpf.test_n...
Status: NEW
Alias: None
Product: Antest
Classification: Infrastructures
Component: 测试用例 (show other bugs) 测试用例
Version: unspecified
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: shuming
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-24 11:16 UTC by zhixin01
Modified: 2023-07-24 11:17 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zhixin01 alibaba_cloud_group 2023-07-24 11:16:48 UTC
[缺陷描述]:
kernel-selftests测试套新增的用例bpf.test_netcnt失败,报错Unexpected packet count: 10003

该用例只在物理机上测试失败,在ecs上测试是成功的

物理机上执行测试日志如下:
# ./test_netcnt
Unexpected packet count: 10003


复现环境:
anck 4.19 x86_64物理机

复现概率:
必现

内核信息:
# uname -r
4.19.91-793.git.7662d90bc.an8.x86_64

操作系统信息:
# cat /etc/os-release
NAME="Anolis OS"
VERSION="8.8"
ID="anolis"
ID_LIKE="rhel fedora centos"
VERSION_ID="8.8"
PLATFORM_ID="platform:an8"
PRETTY_NAME="Anolis OS 8.8"
ANSI_COLOR="0;31"
HOME_URL="https://openanolis.cn/"

cpu信息:
# lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              96
On-line CPU(s) list: 0-95
Thread(s) per core:  2
Core(s) per socket:  24
Socket(s):           2
NUMA node(s):        1
Vendor ID:           GenuineIntel
BIOS Vendor ID:      Intel(R) Corporation
CPU family:          6
Model:               85
Model name:          Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
BIOS Model name:     Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
Stepping:            4
CPU MHz:             1001.334
CPU max MHz:         3100.0000
CPU min MHz:         1000.0000
BogoMIPS:            5000.00
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            1024K
L3 cache:            33792K
NUMA node0 CPU(s):   0-95
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke md_clear flush_l1d arch_capabilities

内存信息:
# free -h
              total        used        free      shared  buff/cache   available
Mem:          755Gi       3.5Gi       747Gi        10Mi       4.4Gi       747Gi
Swap:         2.0Gi          0B       2.0Gi

[复现步骤]:
测试用例代码路径:
tools/testing/selftests/bpf/test_netcnt.c

测试用例分析:
源码:
        if (system("which ping6 &>/dev/null") == 0)
                assert(!system("ping6 localhost -c 10000 -f -q > /dev/null"));
        else
                assert(!system("ping -6 localhost -c 10000 -f -q > /dev/null"));


        /* No packets should be lost */
        if (packets != 10000) {
                printf("Unexpected packet count: %lu\n", packets);
                goto err;
        }

分析:
总共ping6或ping -6了10000次,期望最终收到10000个包,但是实际收到10003个包导致失败

手动执行步骤:
下载当前内核对应的kernel源码包
rpm -ivh xxx.src.rpm  默认安装到/root下
yum-builddep -y rpmbuild/SPECS/kernel.spec   自动安装前置依赖包,需要yum-utils
rpmbuild -bp ./rpmbuild/SPECS/kernel.spec   # 这个步骤会打相关的patch, 解压缩tar包,生成BUILD目录
cd rpmbuild/BUILD/kernel-xxx/linux-xxx/  

接下来就可以编译测试了
cd  /tools/testing/selftests/bpf/
make

执行测试用例
./test_netcnt

[期望结果]:
用例pass,收发包数量一致

[实际结果]:
用例fail,收发包数量不一致