Page MenuHomeFreeBSD

smartpqi: Add runtime debug_level sysctl and log device state changes
ClosedPublic

Authored by john.hall_microchip.com on Tue, May 5, 2:19 PM.
Tags
None
Referenced Files
F156905708: D56832.diff
Sun, May 17, 6:15 AM
Unknown Object (File)
Fri, May 15, 10:26 AM
Unknown Object (File)
Fri, May 15, 4:32 AM
Unknown Object (File)
Fri, May 15, 3:53 AM
Unknown Object (File)
Wed, May 13, 3:11 PM
Unknown Object (File)
Wed, May 13, 7:11 AM
Unknown Object (File)
Tue, May 12, 10:43 PM
Unknown Object (File)
Tue, May 12, 12:02 PM
Subscribers

Details

Summary
The smartpqi(4) driver previously did not log device addition, removal, or controller events to the kernel message buffer, and the hw.smartpqi.debug_level tunable could only be
configured at boot time via loader.conf. This matched neither the behavior of the older ciss(4) driver nor user expectations for a production storage driver.

This change adds:

- A read-write dev.smartpqi.<unit>.debug_level sysctl for modifying the debug level at runtime without a reboot.
- device_printf calls for device additions, device removals, and controller-raised events (hotplug, hardware, physical/logical device, AIO state/config changes) so state transitions
always appear in dmesg regardless of the debug level.
- DBG_DISC logging for discovery state transitions (DEVICE_NOT_FOUND, DEVICE_CHANGED, DEVICE_IN_REMOVE), gated by the discovery debug flag.
- Spelling corrections in user-visible strings and comments.
- Updated man page documenting the new sysctl and logging behavior.

Reported as FreeBSD Bugzilla 294161.
Test Plan

Build verification:

  • make buildkernel KERNCONF=GENERIC — clean build with no new warnings
  • make -C sys/modules/smartpqi — module builds cleanly

    Sysctl runtime debug_level:
  • Load driver, verify sysctl dev.smartpqi.0.debug_level exists and reads default value 0x60
  • sysctl dev.smartpqi.0.debug_level=0xff — confirm it accepts the new value
  • sysctl dev.smartpqi.0.debug_level=0x60 — confirm reset works
  • Verify debug output appears in dmesg after enabling higher levels during device activity

    Device add/remove logging (default debug_level 0x60):
  • Hot-remove a physical disk — verify "device removed: vendor=... model=... B:T:L type=physical" appears in dmesg
  • Hot-insert the disk — verify "device added: vendor=... model=..." appears in dmesg
  • Create/delete a logical drive via arcconf — verify messages with type=logical

    Event logging:
  • Hot-plug a disk — verify "event: hotplug (type=0x1)" appears in dmesg
  • Create/delete a logical drive — verify "event: logical device (type=0x5)"
  • Verify all six event types (hotplug, hardware, physical device, logical device, AIO state change, AIO config change) render with human-readable names

    Discovery state logging (debug_level 0x70 = WARN|ERROR|DISC):
  • Hot-plug a disk — verify [DISC] messages for "new device found" and state transitions
  • Hot-remove — verify "device in removal ... scheduling rescan" message
  • Reset level to default — confirm [DISC] messages stop

    Regression:
  • Run sustained block I/O (dd or fio) during hotplug tests — no panics or hangs
  • Verify existing sysctl-based tunables (stream_disable, queue_depth, etc.) still function
  • Man page renders correctly: man 4 smartpqi — new DEBUGGING section and SEE ALSO additions visible

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable