Logging using the SCSI logging feature

The SCSI logging feature is of interest primarily for software developers who are debugging software problems. It can also be useful for administrators who track down hardware or configuration problems.

The SCSI logging feature can log information such as:
  • Initiation of commands
  • Completion of commands
  • Error conditions
  • Sense data for SCSI commands
The information is written into the Linux log buffer and usually appears in /var/log/messages.

The SCSI logging feature is controlled by a 32-bit value - the SCSI logging level. This value is divided into 3-bit fields that describe the log level of a specific log area. Due to the 3-bit subdivision, setting levels or interpreting the meaning of current levels of the SCSI logging feature is not trivial.

The following logging areas are provided with the SCSI logging feature:

SCSI LOG ERROR RECOVERY
Messages regarding error recovery.
SCSI LOG TIMEOUT
Messages regarding timeout handling of SCSI commands.
SCSI LOG SCAN BUS
Messages regarding bus scanning.
SCSI LOG MLQUEUE
Messages regarding command handling in SCSI mid-level handling of SCSI commands.
SCSI LOG MLCOMPLETE
Messages regarding command completion in SCSI mid layer.
SCSI LOG LLQUEUE
Messages regarding command handling in low-level drivers (for example, sd, sg, or sr). (Not used in current vanilla kernel).
SCSI LOG LLCOMPLETE
Messages regarding command completion in low-level drivers. (Not used in current vanilla kernel).
SCSI LOG HLQUEUE
Messages regarding command handling in high-level drivers (for example, sd, sg, or sr).
SCSI LOG HLCOMPLETE
Messages regarding command completion in high-level drivers.
SCSI LOG IOCTL
Messages regarding handling of IOCTLs.
Each area has its own logging level. The logging levels can be changed by using a logging word, which can be passed from and to the kernel with a sysctl. The logging levels can easily be read and set with the scsi_logging_level command (part of s390-tools). For a detailed description of the scsi_logging_level tool, see Device Drivers, Features, and Commands, SC33-8411 available on the developerWorks® website at:
www.ibm.com/developerworks/linux/linux390/documentation_dev.html
The following logging levels might be of interest for administrators:
  • SCSI LOG MLQUEUE=2 traces opcodes of all initiated SCSI commands
  • SCSI LOG MLCOMPLETE=1 traces completion (opcode, result, sense data) of SCSI commands that did not complete successfully in terms of the SCSI stack. Such commands either timed out, or need to be retried.
  • SCSI LOG MLCOMPLETE=2 traces completion (opcode, result, sense data) of all SCSI commands
  • SCSI LOG IOCTL=2 traces initiation of IOCTLs for SCSI disks (device, ioctl-command)

Examples

These examples show how to set the logging level for various problems.