From owner-freebsd-current@FreeBSD.ORG Thu Mar 31 22:33:39 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 1CE661065672; Thu, 31 Mar 2011 22:33:39 +0000 (UTC) Date: Thu, 31 Mar 2011 22:33:39 +0000 From: Alexander Best To: freebsd-current@freebsd.org Message-ID: <20110331223339.GA13682@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: multiple issues with devstat_*(9) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2011 22:33:39 -0000 hi there, i think there are multiple issues with devstat. i found the following in devicestat.h: /* * These types are intended to aid statistics gathering/display programs. * The first 13 types (up to the 'target' flag) are identical numerically * to the SCSI device type numbers. The next 3 types designate the device * interface. Currently the choices are IDE, SCSI, and 'other'. The last * flag specifies whether or not the given device is a passthrough device * or not. If it is a passthrough device, the lower 4 bits specify which * type of physical device lies under the passthrough device, and the next * 4 bits specify the interface. */ typedef enum { DEVSTAT_TYPE_DIRECT = 0x000, DEVSTAT_TYPE_SEQUENTIAL = 0x001, DEVSTAT_TYPE_PRINTER = 0x002, DEVSTAT_TYPE_PROCESSOR = 0x003, DEVSTAT_TYPE_WORM = 0x004, DEVSTAT_TYPE_CDROM = 0x005, DEVSTAT_TYPE_SCANNER = 0x006, DEVSTAT_TYPE_OPTICAL = 0x007, DEVSTAT_TYPE_CHANGER = 0x008, DEVSTAT_TYPE_COMM = 0x009, DEVSTAT_TYPE_ASC0 = 0x00a, DEVSTAT_TYPE_ASC1 = 0x00b, DEVSTAT_TYPE_STORARRAY = 0x00c, DEVSTAT_TYPE_ENCLOSURE = 0x00d, DEVSTAT_TYPE_FLOPPY = 0x00e, DEVSTAT_TYPE_MASK = 0x00f, DEVSTAT_TYPE_IF_SCSI = 0x010, DEVSTAT_TYPE_IF_IDE = 0x020, DEVSTAT_TYPE_IF_OTHER = 0x030, DEVSTAT_TYPE_IF_MASK = 0x0f0, DEVSTAT_TYPE_PASS = 0x100 } devstat_type_flags; also the devstat(9) man page says: 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: ...so let's get started: otaku% iostat -n100 tty ada0 ada1 md0 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 KB/t tps MB/s us ni sy in id 1 92 21.18 0 0.01 24.37 12 0.29 0.00 0 0.00 60.27 0 0.01 0.37 0 0.00 0.37 0 0.00 0.00 0 0.00 5 0 4 0 90 ..so far so good otaku% iostat -t da tty ada0 ada1 md0 cpu tin tout KB/t tps MB/s KB/t tps MB/s KB/t tps MB/s us ni sy in id 1 92 21.18 0 0.01 24.37 12 0.29 0.00 0 0.00 5 0 4 0 90 ...not good! this should include two pass devices! otaku% iostat -t scsi tty cd0 cpu tin tout KB/t tps MB/s us ni sy in id 1 92 60.27 0 0.01 5 0 4 0 90 ..what? otaku% iostat -t ide tty cpu tin tout us ni sy in id 1 92 5 0 4 0 90 otaku% iostat -t other tty cpu tin tout us ni sy in id 1 92 5 0 4 0 90 ...what about md0? ada0? ada1? md0? otaku% iostat -t cd0 tty cd0 cpu tin tout KB/t tps MB/s us ni sy in id 1 92 60.27 0 0.01 5 0 4 0 90 ...this should also include a pass device 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 1 92 0.37 0 0.00 0.37 0 0.00 0.00 0 0.00 5 0 4 0 90 ...this one's working as expected. 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. this is all very weird. it seems the DEVSTAT_TYPE_IF_* stuff has some major problems. also the pass* devices aren't beeing aasigned to DEVSTAT_TYPE_DIRECT and DEVSTAT_TYPE_CDROM, as devstat(9) suggests. cheers. alex -- a13x