Message ID | 20220812204553.2202539-1-bvanassche@acm.org |
---|---|
Headers | show |
Series | Remove procfs support | expand |
On 2022-08-12 16:45, Bart Van Assche wrote: > There are equivalents for all /proc/scsi functionality in sysfs. The most > prominent user of /proc/scsi is the sg3_utils software package. Support > for systems without /proc/scsi was added to sg3_utils in 2008. Hence > remove procfs support from the SCSI core. Perhaps it is just me but I find 'cat /proc/scsi/sg/debug' very useful when something goes wrong with the sg driver or something that it depends on. Part of my sg driver rewrite (3 years and still pending) was to transfer the output that formerly went to /proc/scsi/sg/debug to debugfs instead (or as well). The most recent version of that procfs-->debugfs work for the sg driver can be found in a post to this list titled: "[PATCH v24 35/46] sg: first debugfs support" on 20220410. Put another way, there are many hours of debugging experience that will be lost by: drivers/scsi/sg.c | 358 --------------------------- Doug Gilbert > Cc: Christoph Hellwig <hch@lst.de> > Cc: Ming Lei <ming.lei@redhat.com> > Cc: Hannes Reinecke <hare@suse.de> > Cc: John Garry <john.garry@huawei.com> > Cc: Mike Christie <michael.christie@oracle.com> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > --- > drivers/scsi/Kconfig | 11 - > drivers/scsi/Makefile | 1 - > drivers/scsi/hosts.c | 5 - > drivers/scsi/scsi.c | 8 +- > drivers/scsi/scsi_devinfo.c | 146 ----------- > drivers/scsi/scsi_priv.h | 17 -- > drivers/scsi/scsi_proc.c | 477 ------------------------------------ > drivers/scsi/sg.c | 358 --------------------------- > include/scsi/scsi_host.h | 6 - > 9 files changed, 1 insertion(+), 1028 deletions(-) > delete mode 100644 drivers/scsi/scsi_proc.c > <snip>
On 8/12/22 14:17, Douglas Gilbert wrote: > On 2022-08-12 16:45, Bart Van Assche wrote: >> There are equivalents for all /proc/scsi functionality in sysfs. The most >> prominent user of /proc/scsi is the sg3_utils software package. Support >> for systems without /proc/scsi was added to sg3_utils in 2008. Hence >> remove procfs support from the SCSI core. > > Perhaps it is just me but I find 'cat /proc/scsi/sg/debug' very useful > when something goes wrong with the sg driver or something that it depends > on. Part of my sg driver rewrite (3 years and still pending) was to > transfer the output that formerly went to /proc/scsi/sg/debug to > debugfs instead (or as well). > > The most recent version of that procfs-->debugfs work for the sg driver > can be found in a post to this list titled: "[PATCH v24 35/46] sg: first > debugfs support" on 20220410. > > Put another way, there are many hours of debugging experience that will be > lost by: > drivers/scsi/sg.c | 358 --------------------------- Hi Doug, How about extracting patch "[PATCH v24 35/46] sg: first debugfs support" from that 46 patch series and including it in this patch series? Thanks, Bart.
> > Hi Martin, > > The SCSI sysfs interface made the procfs interface superfluous. sysfs support Field application engineers are using #cat /proc/scsi/scsi to get the devices's fw version - Rev: xxx Where should they look for that now? Thanks, Avri
On 8/14/22 05:54, Avri Altman wrote: >> The SCSI sysfs interface made the procfs interface superfluous. sysfs support > > Field application engineers are using #cat /proc/scsi/scsi to get the devices's fw version - Rev: xxx > Where should they look for that now? Hi Avri, Please take a look at the output of the following command: find /sys -name inquiry | xargs grep -aH . Thanks, Bart.
On 2022-08-14 10:27, Bart Van Assche wrote: > On 8/14/22 05:54, Avri Altman wrote: >>> The SCSI sysfs interface made the procfs interface superfluous. sysfs support > > >> Field application engineers are using #cat /proc/scsi/scsi to get the >> devices's fw version - Rev: xxx >> Where should they look for that now? > > Hi Avri, > > Please take a look at the output of the following command: > > find /sys -name inquiry | xargs grep -aH . # find /sys -name inquiry | xargs grep -aH . /sys/devices/pseudo_0/adapter1/host1/target1:0:0/1:0:0:0/inquiry:[ /sys/devices/pseudo_0/adapter1/host1/target1:0:0/1:0:0:0/inquiry:Linux scsi_debug 019120210520��! /sys/devices/pseudo_0/adapter2/host2/target2:0:0/2:0:0:0/inquiry:[ /sys/devices/pseudo_0/adapter2/host2/target2:0:0/2:0:0:0/inquiry:Linux scsi_debug 019120210520��! /sys/devices/pseudo_0/adapter0/host0/target0:0:0/0:0:0:0/inquiry:[ /sys/devices/pseudo_0/adapter0/host0/target0:0:0/0:0:0:0/inquiry:Linux scsi_debug 019120210520��! That is on Fedora 36, lk 5.18.16-200.fc36.x86_64 . Not exactly informative unless you already know what you are looking for. How about lsscsi ? # lsscsi [0:0:0:0] disk Linux scsi_debug 0191 /dev/sda [1:0:0:0] disk Linux scsi_debug 0191 /dev/sdb [2:0:0:0] disk Linux scsi_debug 0191 /dev/sdc [N:0:1:1] disk SKHynix_HFS512GDE9X081N__1 /dev/nvme0n1 I plan to add JSON output to lsscsi in the near future. Doug Gilbert
On 8/14/22 16:27, Bart Van Assche wrote: > On 8/14/22 05:54, Avri Altman wrote: >>> The SCSI sysfs interface made the procfs interface superfluous. sysfs >>> support > > >> Field application engineers are using #cat /proc/scsi/scsi to get the >> devices's fw version - Rev: xxx >> Where should they look for that now? > > Hi Avri, > > Please take a look at the output of the following command: > > find /sys -name inquiry | xargs grep -aH . > The canonical method would 'lsscsi'; _slightly_ more convenient :-) Cheers, Hannes
On 8/14/22 14:07, Douglas Gilbert wrote: > How about lsscsi ? > # lsscsi > [0:0:0:0] disk Linux scsi_debug 0191 /dev/sda > [1:0:0:0] disk Linux scsi_debug 0191 /dev/sdb > [2:0:0:0] disk Linux scsi_debug 0191 /dev/sdc > [N:0:1:1] disk SKHynix_HFS512GDE9X081N__1 > /dev/nvme0n1 > > I plan to add JSON output to lsscsi in the near future. Hi Doug, It was not clear to me whether or not Avri needs to retrieve the version information on an Android system. Neither /proc/scsi nor lsscsi are available on recent Android systems. I will see whether I can include the sg3_utils package in Android. Thanks, Bart.
You want to *remove* a user-visible interface that has been there for decades (granted, /proc has its issues and sysfs could replace it) because you want to make a kernel data structure a const structure? Many other things in the kernel still provide a procfs interface. -Ewan On Fri, Aug 12, 2022 at 4:46 PM Bart Van Assche <bvanassche@acm.org> wrote: > > Hi Martin, > > The SCSI sysfs interface made the procfs interface superfluous. sysfs support was > added in the most prominent user of the procfs interface (sg3_utils) in 2008. The > implementation of the procfs interface makes it harder than necessary to constify > the SCSI host templates. Hence this patch series that removes the procfs interface. > > Please consider this patch series for the next merge window. > > Thanks, > > Bart. > > Bart Van Assche (4): > scsi: esas2r: Rename two functions and two variables > scsi: esas2r: Remove procfs support > scsi: core: Remove procfs support > scsi: core: Update a source code comment > > drivers/scsi/Kconfig | 11 - > drivers/scsi/Makefile | 1 - > drivers/scsi/esas2r/esas2r.h | 4 +- > drivers/scsi/esas2r/esas2r_ioctl.c | 2 +- > drivers/scsi/esas2r/esas2r_main.c | 43 +-- > drivers/scsi/hosts.c | 5 - > drivers/scsi/scsi.c | 8 +- > drivers/scsi/scsi_devinfo.c | 146 --------- > drivers/scsi/scsi_priv.h | 17 - > drivers/scsi/scsi_proc.c | 477 ----------------------------- > drivers/scsi/sg.c | 358 ---------------------- > include/scsi/scsi_host.h | 8 +- > 12 files changed, 14 insertions(+), 1066 deletions(-) > delete mode 100644 drivers/scsi/scsi_proc.c >
On 2022-08-15 09:38, Bart Van Assche wrote: > On 8/14/22 14:07, Douglas Gilbert wrote: >> How about lsscsi ? >> # lsscsi >> [0:0:0:0] disk Linux scsi_debug 0191 /dev/sda >> [1:0:0:0] disk Linux scsi_debug 0191 /dev/sdb >> [2:0:0:0] disk Linux scsi_debug 0191 /dev/sdc >> [N:0:1:1] disk SKHynix_HFS512GDE9X081N__1 /dev/nvme0n1 >> >> I plan to add JSON output to lsscsi in the near future. > > Hi Doug, > > It was not clear to me whether or not Avri needs to retrieve the version > information on an Android system. Neither /proc/scsi nor lsscsi are available on > recent Android systems. I will see whether I can include the sg3_utils package > in Android. The lsscsi utility is in a package by itself. It is Linux specific and does sysfs datamining so it does not need: - root access, - to issue SCSI commands, nor - any support from libsgutils Adding JSON complicates that picture a little as I use a slightly modified https://github.com/json-parser/json-builder (license: BSD-2-Clause) in sg3_utils. Smaller bits of libsgutils have been spun off (e.g. sg_unaligned.h is used as-is in smartmontools) and I will probably do something similar for JSON support in lsscsi. Doug Gilbert
On 8/15/22 08:26, Ewan Milne wrote: > You want to *remove* a user-visible interface that has been there > for decades (granted, /proc has its issues and sysfs could replace it) > because you want to make a kernel data structure a const structure? Hi Ewan, I want to remove this interface because this interface is obsolete, because there is a better alternative (sysfs) and because the primary user of this interface (sg3_utils) gained sysfs support 14 years ago. Thanks, Bart.
> On 8/14/22 14:07, Douglas Gilbert wrote: > > How about lsscsi ? > > # lsscsi > > [0:0:0:0] disk Linux scsi_debug 0191 /dev/sda > > [1:0:0:0] disk Linux scsi_debug 0191 /dev/sdb > > [2:0:0:0] disk Linux scsi_debug 0191 /dev/sdc > > [N:0:1:1] disk SKHynix_HFS512GDE9X081N__1 > > /dev/nvme0n1 > > > > I plan to add JSON output to lsscsi in the near future. > > Hi Doug, > > It was not clear to me whether or not Avri needs to retrieve the version > information on an Android system. Neither /proc/scsi nor lsscsi are available > on recent Android systems. I will see whether I can include the sg3_utils > package in Android. > > Thanks, > > Bart. Either way Bart, the solution you proposed works for us, As well as other ways to obtain that info. Thanks, Avri