Re: multiple issues with devstat_*(9)

From: Alexander Best <arundel_at_freebsd.org>
Date: Mon, 11 Apr 2011 16:51:34 +0000
On Mon Apr 11 11, Kenneth D. Merry wrote:
> On Sun, Apr 10, 2011 at 23:19:31 +0300, Alexander Motin wrote:
> > Alexander Best wrote:
> > > On Thu Apr  7 11, Alexander Motin wrote:
> > >> Alexander Best wrote:
> > >>> On Fri Apr  1 11, John Baldwin wrote:
> > >>>> On Thursday, March 31, 2011 6:33:39 pm Alexander Best wrote:
> > >>>>> i think there are multiple issues with devstat. i found the following in
> > >>>>> devicestat.h:
> > >> ...
> > >>
> > >>>>> funny thing is i found the following in scsi_pass.c:
> > >>>>>
> > >>>>>         softc->device_stats = devstat_new_entry("pass",
> > >>>>>                           periph->unit_number, 0,
> > >>>>>                           DEVSTAT_NO_BLOCKSIZE
> > >>>>>                           | (no_tags ? DEVSTAT_NO_ORDERED_TAGS : 0),
> > >>>>>                           softc->pd_type |
> > >>>>>                           DEVSTAT_TYPE_IF_SCSI |
> > >>>>>                           DEVSTAT_TYPE_PASS,
> > >>>>>                           DEVSTAT_PRIORITY_PASS);
> > >>>>>
> > >>>>> ...so pass* *should* show up under iostat -t scsi.
> > >> As I can see, this is a bug (or feature) of the libdevstat /
> > >> devstat_selectdevs(). If you specify any -t, then pass devices will be
> > >> reported only if you request "pass" specifically.
> > >>
> > >>>> Hmm, pass devices for adaX should not be SCSI though, they should be ide I
> > >>>> think.
> > >>> i think the situation with ATA_CAM should be discussed further. still besides
> > >>> this issue there are many more with devstat(3).
> > >>>
> > >>> i'll try to track all the "devstat_new_entry()" occurrences and see if some
> > >>> issues can be fixed. maybe only the proper DEVSTAT_* args were forgotten.
> > >> Assuming that SCSI and IDE in -t option means transport type, and
> > >> assuming that we count everything except ATA and SATA as SCSI, I've made
> > >> following patch, that should fix issues from the CAM side:
> > >> http://people.freebsd.org/~mav/cam.devstat.patch
> > > 
> > > with your patch i get the following output:
> > > 
> > > otaku% iostat -t ide
> > >        tty            ada0             ada1             cpu
> > >  tin  tout  KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
> > >    6   144 14.21   6  0.09  20.46  40  0.81   2  0  3  0 95
> > > otaku% iostat -t scsi
> > >        tty             cd0             cpu
> > >  tin  tout  KB/t tps  MB/s  us ni sy in id
> > >    6   146  2.32   0  0.00   2  0  3  0 95
> > > otaku% iostat -t pass
> > >        tty           pass0            pass1            pass2             cpu
> > >  tin  tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
> > >    6   147  0.36   0  0.00   0.36   0  0.00   0.00   0  0.00   2  0  3  0 95
> > > otaku% iostat -t da  
> > >        tty            ada0             ada1             cpu
> > >  tin  tout  KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
> > >    6   147 14.21   6  0.08  20.46  37  0.75   1  0  3  0 95
> > > otaku% iostat -t cd
> > >        tty             cd0             cpu
> > >  tin  tout  KB/t tps  MB/s  us ni sy in id
> > >    7   147  2.32   0  0.00   1  0  3  0 95
> > > otaku% iostat -t other
> > >        tty            cpu
> > >  tin  tout us ni sy in id
> > >    7   149  1  0  3  0 95
> > > otaku% iostat -n 100  
> > >        tty            ada0             ada1              cd0            pass0            pass1            pass2             cpu
> > >  tin  tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
> > >    6   135 14.21   5  0.07  20.44  32  0.64   2.32   0  0.00   0.36   0  0.00   0.36   0  0.00   0.00   0  0.00   1  0  3  0 96
> > > 
> > > the the remaining issues imho are:
> > > 
> > > 1) ada* and cd* are SATA/ATA devices. so i think they should show up together
> > >    either under ide *or* scsi. i don't have any *real* scsi devices.
> > 
> > I've just retested the patch and haven't reproduced your problem:
> > %iostat -d
> >              da0             ada0              da1              cd0
> >   KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s
> >   0.01   0  0.00   3.27   1  0.00   2.65   1  0.00   0.00   0  0.00
> > %iostat -d -t ide
> >              da0             ada0              cd0
> >   KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s
> >   0.01   0  0.00   3.27   1  0.00   0.00   0  0.00
> > %iostat -d -t scsi
> >              da1
> >   KB/t tps  MB/s
> >   2.65   1  0.00
> > %iostat -d -t pass
> >            pass0            pass1            pass2            pass3
> >   KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s
> >   0.00   0  0.00   0.00   0  0.00   0.00   0  0.00   0.00   0  0.00
> > %iostat -d -t ide,pass
> >            pass0            pass1            pass2
> >   KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s
> >   0.00   0  0.00   0.00   0  0.00   0.00   0  0.00
> > %iostat -d -t scsi,pass
> >            pass3
> >   KB/t tps  MB/s
> >   0.00   0  0.00
> > 
> > da0 is an PATA ATAPI ZIP, da1 - USB floppy, ada0 - SATA HDD, cd0 - PATA
> > ATAPI CD-ROM.
> > 
> > Just an idea, aren't you are using legacy ata(4) + atapicam for your
> > cd0? atapicam lies that it's buses are SPI (SCSI).
> > 
> > > 2) the pass* devices still don't show up under ide/scsi/other. that's ok, but
> > >    then the src comments and manual pages need to be changed accordingly.
> > 
> > As I have told - it is a bug/feature of libdevstat. It should not be
> > difficult to fix, if it is really a bug.
> 
> That was intentional, if I can remember what I intended in 1997/1998.
> 
> The reason was that since there is one passthrough device created for every
> device that CAM manages, you don't want to show pass(4) devices when the
> user says 'iostat -t scsi'.  Otherwise he might get all pass(4) devices,
> depending on the order of devices in the system.

i understand. however i think then we are being faced with a few doc bugs.
have a look at this passage from devstat(9) e.g.:

"     Each device is given a device type.  Pass-through devices have the same
     underlying device type and interface as the device they provide an inter-
     face for, but they also have the pass-through flag set.  The base device
     types are identical to the SCSI device type numbers, so with SCSI periph-
     erals, the device type returned from an inquiry is usually ORed with the
     SCSI interface type and the pass-through flag if appropriate.  The device
     type flags are as follows:"

...i also found some comments in the source mentioning the above behavior.

cheers.
alex

> 
> But, if it's pass(4) devices you want, you can ask for them specifically,
> or for all SCSI/IDE pass(4) devices, as mav did above.
> 
> Ken
> -- 
> Kenneth Merry
> ken_at_FreeBSD.ORG

-- 
a13x
Received on Mon Apr 11 2011 - 14:51:34 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:13 UTC