User Guide

Intel® VTune™ Profiler User Guide

ID 766319
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Rebuild and Install Module i915 for GPU Analysis on CentOS*

NOTE:
Profiling support for CentOS* 7 is deprecated and will be removed in a future release.

To collect i915 ftrace events required to analyze the GPU utilization, your Linux kernel should be properly configured. If the Intel® VTune™ Profiler cannot start an analysis and provides an error message: Collection of GPU usage events cannot be enabled. i915 ftrace events are not available. You need to rebuild and install the re-configured i915 module. For example, for kernel 4.14 and higher, these settings should be enabled: CONFIG_EXPERT=y and CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS=y.

If you update the kernel often, make sure to build the special kernel for GPU analysis.

NOTE:

Installing the kernel requires root permissions.

On CentOS* systems, if you update the kernel rarely, you can configure and rebuild only module i915 as follows:

  1. Install build dependencies:

    sudo yum install flex bison elfutils-libelf-devel

  2. Create a folder for kernel source:

    mkdir -p /tmp/kernel
    cd !$

  3. Get your kernel version:

    uname -r

    This is an example of the command output:

    4.18.0-80.11.2.el8_0.x86_64

  4. Get source code for the kernel:

    wget http://vault.centos.org/8.0.1905/BaseOS/Source/SPackages/kernel-4.18.0-80.11.2.el8_0.src.rpm

    rpm --define "_topdir /tmp/kernel/rpmbuild" -i kernel-4.18.0-80.11.2.el8_0.src.rpm

    tar -xf ./rpmbuild/SOURCES/linux-4.18.0-80.11.2.el8_0.tar.xz

  5. Change the current directory:

    cd linux-*

  6. Configure the kernel modules:

    cp /usr/src/kernels/$(uname -r)/.config ./

    cp /usr/src/kernels/$(uname -r)/Module.symvers ./

  7. Update the version in Makefile in the current directory.

    The version value must be the same as in the uname -r command output. For example, if uname -r prints 4.18.0-80.11.2.el8_0.x86_64, the values in the Makefile should be:

    VERSION = 4

    PATCHLEVEL = 18

    SUBLEVEL = 0

    EXTRAVERSION = -80.11.2.el8_0.x86_64

    Update the file, if required, and save it.

  8. Make sure the kernel version is set correctly in the Makefile:

    make kernelversion

    The command output for the example above is the following:

    4.18.0-80.11.2.el8_0.x86_64

  9. In the new .config file, make sure the following settings are enabled:

    CONFIG_EXPERT=y

    CONFIG_FTRACE=y

    CONFIG_DEBUG_FS=y

    CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS=y

    Update the file, if required, and save it.

  10. Create a full config file for the kernel:

    make olddefconfig

  11. Build module i915:

    make -j$(getconf _NPROCESSORS_ONLN) modules_prepare

    make -j$(getconf _NPROCESSORS_ONLN) M=./drivers/gpu/drm/i915 modules

    If you get the following error:

    LD [M] drivers/gpu/drm/i915/i915.o
    ld: no input files

    you need to replace the following lines in scripts/Makefile.build:

    link_multi_deps = \
    $(filter $(addprefix $(obj)/, \
    $($(subst $(obj)/,,$(@:.o=-objs)) \
    $($(subst $(obj)/,,$(@:.o=-y))) \
    $($(subst $(obj)/,,$(@:.o=-m)))),$^)

    with the line:

    link_multi_deps = $(filter %.o,$^)

  12. Install the new module:

    sudo make M=./drivers/gpu/drm/i915 modules_install

  13. Make sure the folder with the new driver is present in /etc/depmod.d/* files, or just add it:

    echo "search extradrivers" | sudo tee /etc/depmod.d/00-extra.conf

  14. Update initramfs:

    sudo depmod 
    sudo dracut --force

  15. Reboot the machine:

    sudo reboot

  16. Make sure the new driver is loaded:

    modinfo i915 | grep filename

    The command output should be the following:

    filename: /lib/modules/4.18.0-80.11.2.el8_0.x86_64/extradrivers/gpu/drm/i915/i915.ko

To roll back the changes and load the original module i915:

  1. Remove the folder with the new driver from /etc/depmod.d/* files:

    sudo rm /etc/depmod.d/00-extra.conf

  2. Update initramfs:

    sudo depmod
    sudo update-initramfs -u

  3. Reboot the machine:

    sudo reboot