Bookmark this page

Guided Exercise: Managing Kernel Modules

Configure parameters for a kernel module.

Outcomes

You should be able to configure module options for loadable kernel modules.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

[student@workstation ~]# lab start hardware-kernelmodules

This command confirms that your systems are reachable.

Instructions

The servera system has an attached SAS RAID array that uses the megaraid_sas.ko kernel module. Unfortunately, performance is unpredictable, and sometimes error messages about MSI-X interrupts appear in the logs.

After opening a support case, you are asked to disable MSI-X interrupt handling in the driver to test whether this configuration fixes the issue.

  1. Log in to servera and switch to the root user.

    [student@workstation ~]$ ssh student@servera
    ...output omitted...
    [student@servera ~]$ sudo -i
    [sudo] password for student: student
    [root@servera ~]#
  2. View the kernel module options for the megaraid_sas.ko kernel module. Locate the option for MSI-X interrupt handling, load the module, and verify that this option is applied. Unload the module before continuing.

    1. View the options for the megaraid_sas.ko kernel module:

      [root@servera ~]# modinfo -p megaraid_sas
      lb_pending_cmds:Change raid-1 load balancing outstanding threshold. Valid Values are 1-128. Default: 4 (int)
      max_sectors:Maximum number of sectors per IO command (int)
      msix_disable:Disable MSI-X interrupt handling. Default: 0 (int)
      msix_vectors:MSI-X max vector count. Default: Set by FW (int)
      allow_vf_ioctls:Allow ioctls in SR-IOV VF mode. Default: 0 (int)
      ...output omitted...
    2. Locate the MSI-X interrupt handling option.

      [root@servera ~]# modinfo -p megaraid_sas | grep -i msi
      msix_disable:Disable MSI-X interrupt handling. Default: 0 (int)
      msix_vectors:MSI-X max vector count. Default: Set by FW (int)

      The msix_disable option is the relevant choice.

    3. Load the megaraid_sas.ko kernel module manually.

      [root@servera ~]# modprobe -v megaraid_sas
      insmod /lib/modules/4.18.0-305.el8.x86_64/kernel/drivers/scsi/megaraid/megaraid_sas.ko.xz
    4. Verify that the msix_disable default (value 0) is the current value.

      [root@servera ~]# cat /sys/module/megaraid_sas/parameters/msix_disable
      0
    5. Unload the megaraid_sas.ko module.

      [root@servera ~]# modprobe -rv megaraid_sas
      rmmod megaraid_sas
  3. Configure the megaraid_sas.ko module to always set msix_disable=1. This option is applied whether the module is loaded manually or automatically. For easy copying of this configuration to other systems, use a separate configuration file. Verify that the new configuration is applied correctly.

    1. Create a file called /etc/modprobe.d/megaraid.conf with the following entry:

      options megaraid_sas msix_disable=1
    2. Load the megaraid_sas.ko kernel module.

      [root@servera ~]# modprobe -v megaraid_sas
      insmod /lib/modules/4.18.0-305.el8.x86_64/kernel/drivers/scsi/megaraid/megaraid_sas.ko.xz msix_disable=1
    3. Verify that your new setting is applied correctly.

      [root@servera ~]# cat /sys/module/megaraid_sas/parameters/msix_disable
      1
  4. Return to workstation as the student user.

    [root@servera ~]# exit
    [student@servera ~]$ exit
    [student@workstation ~]$

Finish

On the workstation machine, use the lab command to complete this exercise. This is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish hardware-kernelmodules

Revision: rh342-8.4-6dd89bd