Subject: WCE bit in SCSI mode pages and "scsi" utility - caveat emptor
To: None <current-users@NetBSD.ORG, netbsd-users@NetBSD.ORG>
From: Laine Stump <laine@MorningStar.Com>
List: netbsd-users
Date: 03/25/1997 02:00:48
(Sorry for duplicating this mail to two lists - I finally found the
original message was to current-users, not netbsd-users (where I sent my
previous followups on the subject), and I want to make sure everyone who
might try turning on the WCE bit sees this).

So when I used the "scsi" utility to turn on the WCE bit of my striped
ST15150W SCSI drives, the raw read performance dropped from 12MB/sec
down to 6.5MB/sec. Turning WCE off again didn't correct this behavior

After a bit of searching, I found a description of the SCSI mode page
bits from a DOS program at:

I then moved /usr/share/misc/scsi_modes out of the way, and did:

	scsi -f /dev/rsd0a -m 8 -P 3

on a "slow" drive and a "fast" drive (one that I hadn't modified).
Seeing a difference in the very first byte (00 vs 10), I looked in the
docs I had found, which said that bit was called DISC (discontinuous),
and when on it allows the disk to perform read-aheads across head and
cylinder boundaries. It also said that the bit was always on, and could
not be changed (haha).

I then modified the page 8 section of scsi_modes to look like this (the
first 4 bits had been a single 4 bit reserved field):

   0x08 {
	   {IC} t1
	   {ABPF} t1
	   {CAP} t1
	   {DISC} t1
	   {WCE} t1
	   {MF} t1
	   {RCD} t1
	   {Demand Retention Priority} t4
	   {Write Retention Priority} t4
	   {Disable Pre-fetch Transfer Length} i2
	   {Minumum Pre-fetch} i2
	   {Maximum Pre-fetch} i2
	   {Maximum Pre-fetch Ceiling} i2

used scsi to turn the DISC bit back on, and now my old performance is
back. Yay!

I have 3 conclusions:

1) scsi_modes should be updated to fill in some of these values which
   have been left out>

2) The scsi utility (in all its incarnations) should not brashly set
   bits marked as "reserved" to 0. It should be careful to preserve
   anything it does not allow you to set. (I trust there are people
   reading these mailing lists who will inform the proper souls at
   FreeBSD and OpenBSD).

3) After all this trouble, the write performance on these drives
   with this OS was not noticeably improved by turning on WCE, so I
   turned it back off anyway.