Rate This Document
Findability
Accuracy
Completeness
Readability

Configuring the SPE Environment

Table 1 Recommended versions

OS

Version

Kernel Version

openEuler

openEuler 20.03 LTS

4.19.90-2003.4.0.0036.oe1.aarch64

openEuler 22.03 LTS

5.10.0-60.18.0.50.oe2203.aarch64

openEuler 20.03 LTS-SP2

4.19.90-2106.3.0.0095.oe1.aarch64

openEuler 22.03 LTS-SP1

5.10.0-136.24.0.100.oe2203sp1.aarch64

Kylin

Kylin V10 (SP03)/(Lance)

4.19.90-52.15.v2207.ky10.aarch64

Kylin 3.4-5

4.19.90-2112.8.0.0131.kb8.ky3.aarch64

UOS

UOS 1020e

4.19.90-2201.4.0135.up1.uel20.aarch64

Configuring the SPE Environment for openEuler

TaiShan 200 series servers support Statistical Profiling Extensions (SPE) since BIOS V159. This option can be configured only for the following versions:

  1. BIOS V159 and later on TaiShan 200 servers (models 2280, 5280, and 2180) and TaiShan 200K servers (models 2280K, 5280K, and 2180K)
  2. BIOS V169 and later on TaiShan 200 servers (model 2280E)
  3. BIOS V168 and later on TaiShan 200 servers (model 1280)
  4. All BIOS versions on TaiShan 200 servers (models 2280M and 5180)
  1. Check the status of MISC Config--> SPE in the BIOS. If the status is Disabled, change it to Enabled.

  2. Use an SSH tool to remotely log in to the Linux CLI as the root user.
  3. Configure system boot parameters.
    1. Run the following command to open the configuration file:
      1
      vim /etc/grub2-efi.cfg
      
    2. Locate the boot option corresponding to the kernel version and add kpti=off at the end of the option.
      1
              linux   /vmlinuz-4.19.90-2003.4.0.0036.oe1.aarch64 root=/dev/mapper/openeuler-root ro rd.lvm.lv=openeuler/root rd.lvm.lv=openeuler/swap video=VGA-1:640x480-32@60me rhgb quiet  smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 crashkernel=1024M,high video=efifb:off video=VGA-1:640x480-32@60me kpti=off
      

      Setting kpti to off poses security risks on x86 servers. Do not use this setting in a production environment.

    3. Press Esc, type :wq, and press Enter to save the change and exit.
    4. Run the reboot command to reboot the server.
  4. After installing the System Profiler, run the following command to check whether the SPE function is enabled:
    1
    perf list | grep arm_spe
    

    If the following information is displayed, the SPE function is enabled.

    1
    arm_spe_0//                                        [Kernel PMU event]
    

Configuring the SPE Environment for CentOS 7.6

  • TaiShan 200 series servers support Statistical Profiling Extensions (SPE) since BIOS V159. This option can be configured only for the following versions:
    1. BIOS V159 and later on TaiShan 200 servers (models 2280, 5280, and 2180) and TaiShan 200K servers (models 2280K, 5280K, and 2180K)
    2. BIOS V169 and later on TaiShan 200 servers (model 2280E)
    3. BIOS V168 and later on TaiShan 200 servers (model 1280)
    4. All BIOS versions on TaiShan 200 servers (models 2280M and 5180)
  • To perform a miss event analysis, configure the SPE environment to support SPE collection.
  1. Check the status of MISC Config--> SPE in the BIOS. If the status is Disabled, change it to Enabled.

  2. Use an SSH tool to remotely log in to the Linux CLI as the root user.
  3. Configure system boot parameters.
    1. Run the following command to open the configuration file:
      1
      vim /boot/efi/EFI/centos/grub.cfg
      
    2. Locate the boot option corresponding to the kernel version and add kpti=off at the end of the option.
      1
              linux   /vmlinuz-4.14.0-115.el7a.0.1.aarch64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8 kpti=off
      

      Setting kpti to off poses security risks on x86 servers. Do not use this setting in a production environment.

    3. Press Esc, type :wq, and press Enter to save the change and exit.
    4. Run the reboot command to reboot the server.
    5. Run the following command to obtain system boot parameters and check whether kpti=off is successfully added:
      1
      cat /proc/cmdline
      
  4. After installing the System Profiler, run the following command to check whether the SPE function is enabled:
    1
    perf list | grep arm_spe
    

    If the following information is displayed, the SPE function is enabled.

    1
    arm_spe_0//                                        [Kernel PMU event]
    

Installing the Driver for CentOS 7.6

During miss events collection on CentOS 7.6, use any of the following kernel versions for kernel driver compilation.

Table 2 Kernel versions supported

OS

Kernel Version

CentOS 7.6

4.14.0-115.el7a.0.1

4.14.0-115.2.2.el7a

4.14.0-115.5.1.el7a

4.14.0-115.6.1.el7a

4.14.0-115.7.1.el7a

4.14.0-115.8.2.el7a

4.14.0-115.10.1.el7a

  1. Download the kernel driver to the /home/spe_ko directory.

    Download URL: https://github.com/kunpengcompute/devkitdriver/tree/main

    Figure 1 Download page

    Copy the files in the devkitdriver-main/SPEdriver directory in the downloaded package to the /home/spe_ko directory. The following uses 4.14.0-115.el7a.0.1 as an example. For other minor versions, you need to download the RPM package of the corresponding kernel version and upgrade the system to this kernel version.

  2. Compile the driver.
    1
    2
    3
    4
    cd /home/spe_ko/arm_spe_pmu
    make
    cd /home/spe_ko/spe_device
    make
    
  3. Query the driver files.
    1
    2
    ls -l /home/spe_ko/arm_spe_pmu/arm_spe_pmu.ko
    ls -l /home/spe_ko/arm_spe_pmu/spe_device.ko
    
  4. Load the KO files.
    1
    2
    insmod /home/spe_ko/arm_spe_pmu/arm_spe_pmu.ko
    insmod /home/spe_ko/arm_spe_pmu/spe_device.ko
    

Compiling Perf for CentOS

  1. Download the kernel source code to the /home/spe_perf/kernel-alt-4.14.0-115.el7a.0.1 directory.

    Kernel source code address: https://archive.kernel.org/centos-vault/7.6.1810/os/Source/SPackages/

    Figure 2 RPM source package
  2. Check the flex and bison dependencies.
    1
    2
    rpm -qa |grep bison
    rpm -qa |grep flex
    

    If there are no such dependencies, install them.

    1
    2
    yum install flex
    yum install bison
    
  3. Decompress the RPM package.
    1
    2
    3
    4
    cd /home/spe_perf/kernel-alt-4.14.0-115.el7a.0.1
    rpm2cpio kernel-alt-4.14.0-115.el7a.0.1.src.rpm | cpio -divm
    xz -d linux-4.14.0-115.el7a.tar.xz
    tar -xvf linux-4.14.0-115.el7a.tar -C ..
    
  4. Apply the patch.

    Download the patch from https://github.com/kunpengcompute/devkitdriver/tree/main.

    Figure 3 Download page

    Copy files in the perfpatch directory in the downloaded package to the /home/spe_perf directory.

    1
    2
    3
    cd /home/spe_perf
    chmod +x build_perf.sh
    ./build_perf.sh
    
  5. Query the arm_spe event.

    Run perf list in the directory of the newly generated perf (/home/spe_perf/linux-4.14.0-115.el7a/tools/perf).

    1
    2
    cd /home/spe_perf/linux-4.14.0-115.el7a/tools/perf
    ./perf list | grep arm_spe
    
  6. Copy the compiled perf and modify the permission.
    1
    2
    3
    mkdir -p /usr/bin/devkit/spe/4.14.0-115.el7a.0.1
    cp perf /usr/bin/devkit/spe/4.14.0-115.el7a.0.1
    chmod -R 500  /usr/bin/devkit/spe