Bug 255998 - CAM_DEBUG_LUN=-1 doesn't work as expected
Summary: CAM_DEBUG_LUN=-1 doesn't work as expected
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2021-05-19 12:34 UTC by Leandro Lupori
Modified: 2021-05-19 12:34 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Leandro Lupori freebsd_committer 2021-05-19 12:34:54 UTC
According to CAM(4), setting CAM_DEBUG_LUN to -1 should enable debug of all luns. However, it usually results in no CAM debug messages at all.

This happens because CAM_LUN_WILDCARD is defined as (~(u_int)0), but the type of the field where CAM_DEBUG_LUN gets stored is lun_id_t, that is an u_int64_t.

If CAM_DEBUG_LUN is not defined, or if it is set to 0xffffffff in the kernel config, then it works as expected, selecting all luns.

Changing CAM_LUN_WILDCARD to (~(lun_id_t)0) breaks the build, as some drivers use it with 32-bit types, but defining it as (-1) seems to work for me, in some tests with aacraid on PowerPC64.