Re: [PATCH v13 28/45] sg: rework debug info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021-01-14 2:12 a.m., Hannes Reinecke wrote:
On 1/13/21 11:45 PM, Douglas Gilbert wrote:
Since the version 2 driver, the state of the driver can be found
with 'cat /proc/scsi/sg/debug'. As the driver becomes more
threaded and IO faster (e.g. scsi_debug with a command timer
of 5 microseconds), the existing state dump can become
misleading as the state can change during the "snapshot". The
new approach in this patch is to allocate a buffer of
SG_PROC_DEBUG_SZ bytes and use scnprintf() to populate it. Only
when the whole state is captured (or the buffer fills) is the
output to the caller's terminal performed. The previous
approach was line based: assemble a line of information and
then output it.

Hmm. The whole '/proc' business is considered deprecated, and new
(or updated) drivers should be moving to debugfs.
Wouldn't it be better to do that, and deprecate /proc/sg, seeing that
you are rewriting the entire driver anyway?

Well '/proc/scsi/sg/*' is in the public interface, so to remove it
represents a breakage. Like many developers I run lots of virtual
terminals with as few as possible logged in as 'root'. So I consider
it a definite advantage that cat /proc/scsi/sg/debug does not need
elevated permissions like the debugfs equivalent does. The security
folks would probably take the opposite view.

It is in debugfs: cat /sys/kernel/debug/scsi_generic/snapshot
is equivalent to cat /proc/scsi/sg/debug.

So currently we have both. Well not quite as this first series
hasn't been accepted after more than a year of attempts. IMO it
is a bit early to deprecate before the replacement is even in place.


New features are only being placed in debugfs. For example, there
is a new feature in patch 59 of series 2 using the new
ioctl(SG_SET_GET_EXTENDED) and the SG_CTL_FLAGM_SNAP_DEV flag to
programmatically send a snapshot of the sg object tree to
/sys/kernel/debug/scsi_generic/snapped .

Doug Gilbert






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux