Subject: port bio(4) and bioctl(8) from openbsd ?
To: None <tech-kern@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 04/07/2007 18:00:14
--qDbXVdCdHGoSgWSk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
do we want to port the bio(4) interface and associated bioctl(8) tool
from openbsd ? The man pages are attached; basically it allows control
of hardware RAID controllers in a generic way (get states, add hot-spare,
start rebuilds, etc ...). On OpenBSD it's currently supported on ami(4),
arc(4), ciss(4), mfi(4). I won't go into the softraid stuff, at last not yet.
In kernel, there's a pseudo-device (bio) to which RAID controllers registers
(note that we can use the controllers without bio(4) in the kernel).
This pseudo-device keeps a list of raid controllers, and dispatch the
IOCTLs. This avoids having one major device per controller driver type.
OpenBSD has added sensors for the drives: SENSOR_DRIVE, with the states:
#define SENSOR_DRIVE_EMPTY 1
#define SENSOR_DRIVE_READY 2
#define SENSOR_DRIVE_POWERUP 3
#define SENSOR_DRIVE_ONLINE 4
#define SENSOR_DRIVE_IDLE 5
#define SENSOR_DRIVE_ACTIVE 6
#define SENSOR_DRIVE_REBUILD 7
#define SENSOR_DRIVE_POWERDOWN 8
#define SENSOR_DRIVE_FAIL 9
#define SENSOR_DRIVE_PFAIL 10
The benefit of this is that we could get notification in real time
instead of polling though bioctl.
I want this for mfi(4), for which I have no alternatives to get RAID status
(if a drive fail you don't know, unless you go in front of the box and look
at the LEDs). I will also add support to amr(4) as I have the hardware
for this.
Comments ?
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
--qDbXVdCdHGoSgWSk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="bio.0"
Content-Transfer-Encoding: quoted-printable
BIO(4) NetBSD Kernel Interfaces Manual BIO=
(4)
N=08NA=08AM=08ME=08E
b=08bi=08io=08o -- Block IO ioctl tunnel pseudo-device
S=08SY=08YN=08NO=08OP=08PS=08SI=08IS=08S
p=08ps=08se=08eu=08ud=08do=08o-=08-d=08de=08ev=08vi=08ic=08ce=08e b=08=
bi=08io=08o [_=08c_=08o_=08u_=08n_=08t]
D=08DE=08ES=08SC=08CR=08RI=08IP=08PT=08TI=08IO=08ON=08N
The b=08bi=08io=08o driver provides userland applications ioctl(2) acc=
ess to devices
otherwise not found as _=08/_=08d_=08e_=08v nodes. The _=08/_=08d_=08=
e_=08v_=08/_=08b_=08i_=08o device node operates by
delegating ioctl calls to a requested device driver. Only drivers whi=
ch
have registered with the b=08bi=08io=08o device can be accessed via th=
is interface.
If _=08c_=08o_=08u_=08n_=08t is given in the specification, and is gre=
ater than 0, a maximum
of one b=08bi=08io=08o device is created.
The following device drivers register with b=08bi=08io=08o for volume =
management:
ami(4) American Megatrends Inc. MegaRAID PATA/SATA/SCSI RAID
controller
arc(4) Areca Technology Corporation SATA RAID controller
ciss(4) Compaq Smart ARRAY 5/6 SAS/SATA/SCSI RAID controller
mfi(4) LSI Logic & Dell MegaRAID SAS RAID controller
The following device drivers register with b=08bi=08io=08o to provide =
enclosure man-
agement:
safte(4) SCSI Accessed Fault-Tolerant Enclosure
ses(4) SCSI Enclosure Services
The following ioctl calls apply to the b=08bi=08io=08o device:
BIOCLOCATE Locate a named device and give back a cookie to the
application for subsequent ioctl calls. The cookie =
is
used to tunnel further ioctls to the right device.
BIOCINQ Retrieve number of volumes and physical disks for a
specific device.
BIOCDISK Retrieve detailed information for the specified phys=
i-
cal disk. Information returned can include status,
size, channel, target, lun, vendor name, serial numb=
er
and processor device (ses or safte).
BIOCVOL Retrieve detailed information for the specified volu=
me.
Information returned can include status, size, RAID
level, number of disks, device name association (sd?)
and vendor name.
BIOCALARM Control the alarm beeper on the device. Supported
states are: disable alarm, enable alarm, silence ala=
rm,
status and test alarm.
Note: These options might not be supported on all
hardware.
BIOCBLINK Blink an LED of the specified physical disk. Suppor=
ted
blink states are: blink LED, unblink LED and blink
alarm LED.
Note: This option is only supported if the disk is
governed by ses(4) or safte(4) and the hardware sup-
ports hardware blinking.
BIOCSETSTATE Alter the state of specified physical disk. Support=
ed
states are: create hot-spare, online disk and offline
disk.
F=08FI=08IL=08LE=08ES=08S
/dev/bio ioctl tunnel device
S=08SE=08EE=08E A=08AL=08LS=08SO=08O
ioctl(2), bioctl(8)
H=08HI=08IS=08ST=08TO=08OR=08RY=08Y
The b=08bi=08io=08o driver first appeared in OpenBSD 3.2.
A=08AU=08UT=08TH=08HO=08OR=08RS=08S
The b=08bi=08io=08o driver was written by Niklas Hallqvist <niklas@ope=
nbsd.org>. The
API was written by Marco Peereboom <marco@openbsd.org>.
NetBSD 4.0 June 8, 2002 NetBSD =
4.0
--qDbXVdCdHGoSgWSk
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="bioctl.0"
Content-Transfer-Encoding: quoted-printable
BIOCTL(8) NetBSD System Manager's Manual BIOCTL=
(8)=0A=0AN=08NA=08AM=08ME=08E=0A b=08bi=08io=08oc=08ct=08tl=08l -- RAID=
management interface=0A=0AS=08SY=08YN=08NO=08OP=08PS=08SI=08IS=08S=0A =
b=08bi=08io=08oc=08ct=08tl=08l [-=08-D=08Dh=08hi=08iv=08v] [-=08-a=08a _=08=
a_=08l_=08a_=08r_=08m_=08-_=08f_=08u_=08n_=08c_=08t_=08i_=08o_=08n] [-=08-b=
=08b _=08c_=08h_=08a_=08n_=08n_=08e_=08l_=08:_=08t_=08a_=08r_=08g_=08e_=08t=
_=08[_=08._=08l_=08u_=08n_=08]]=0A [-=08-c=08c _=08r_=08a_=08i_=
=08d_=08l_=08e_=08v_=08e_=08l] [-=08-H=08H _=08c_=08h_=08a_=08n_=08n_=08e_=
=08l_=08:_=08t_=08a_=08r_=08g_=08e_=08t_=08[_=08._=08l_=08u_=08n_=08]]=0A =
[-=08-l=08l _=08s_=08p_=08e_=08c_=08i_=08a_=08l_=08[_=08,_=08s_=
=08p_=08e_=08c_=08i_=08a_=08l_=08[_=08,_=08._=08._=08._=08]_=08]] [-=08-u=
=08u _=08c_=08h_=08a_=08n_=08n_=08e_=08l_=08:_=08t_=08a_=08r_=08g_=08e_=08t=
_=08[_=08._=08l_=08u_=08n_=08]] _=08d_=08e_=08v_=08i_=08c_=08e=0A=0AD=08DE=
=08ES=08SC=08CR=08RI=08IP=08PT=08TI=08IO=08ON=08N=0A RAID device driver=
s which support management functionality can register=0A their services=
with the bio(4) driver. b=08bi=08io=08oc=08ct=08tl=08l then can be used t=
o main-=0A tain RAID volumes.=0A=0A The options are as follows:=0A=
=0A -=08-a=08a _=08a_=08l_=08a_=08r_=08m_=08-_=08f_=08u_=08n_=08c_=08t_=
=08i_=08o_=08n=0A Control the RAID card's alarm functionality, =
if supported.=0A _=08a_=08l_=08a_=08r_=08m_=08-_=08f_=08u_=08n_=
=08c_=08t_=08i_=08o_=08n may be one of:=0A=0A _=08d_=08i_=08s_=
=08a_=08b_=08l_=08e Disable the alarm on the RAID controller.=0A =
_=08e_=08n_=08a_=08b_=08l_=08e Enable the alarm on the RAID controller=
=2E=0A _=08g_=08e_=08t Retrieve the current alarm state (e=
nabled or disabled).=0A _=08s_=08i_=08l_=08e_=08n_=08c_=08e | _=
=08q_=08u_=08i_=08e_=08t=0A Silence the alarm if it is=
currently beeping.=0A=0A The _=08a_=08l_=08a_=08r_=08m_=08-_=
=08f_=08u_=08n_=08c_=08t_=08i_=08o_=08n may be specified as given above, or=
by the=0A first letter only (e.g. -a e).=0A=0A -=08-b=08b =
_=08c_=08h_=08a_=08n_=08n_=08e_=08l_=08:_=08t_=08a_=08r_=08g_=08e_=08t_=08[=
_=08._=08l_=08u_=08n_=08]=0A Instruct the device at _=08c_=08h_=
=08a_=08n_=08n_=08e_=08l_=08:_=08t_=08a_=08r_=08g_=08e_=08t_=08[_=08._=08l_=
=08u_=08n_=08] to start blinking, if=0A there is ses(4) or saft=
e(4) support in the enclosure.=0A=0A -=08-c=08c _=08r_=08a_=08i_=08d_=
=08l_=08e_=08v_=08e_=08l=0A Create a softraid(4) device of leve=
l _=08r_=08a_=08i_=08d_=08l_=08e_=08v_=08e_=08l. The device must=0A =
begin with ``softraid'' followed by a number.=0A=0A -=08-D=08D =
Enable debug output.=0A=0A -=08-H=08H _=08c_=08h_=08a_=08n_=08n_=08e=
_=08l_=08:_=08t_=08a_=08r_=08g_=08e_=08t_=08[_=08._=08l_=08u_=08n_=08]=0A =
If the device at _=08c_=08h_=08a_=08n_=08n_=08e_=08l_=08:_=08t_=
=08a_=08r_=08g_=08e_=08t_=08[_=08._=08l_=08u_=08n_=08] is currently marked=
=0A ``Unused'', promote it to being a ``Hot Spare''.=0A=0A =
-=08-h=08h Where necessary, produce "human-readable" output. Use unit=
suf-=0A fixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte, P=
etabyte,=0A Exabyte in order to reduce the number of digits to =
four or less.=0A=0A -=08-i=08i Enumerate the selected RAID devices=
=2E=0A=0A -=08-l=08l _=08s_=08p_=08e_=08c_=08i_=08a_=08l_=08[_=08,_=08s=
_=08p_=08e_=08c_=08i_=08a_=08l_=08[_=08,_=08._=08._=08._=08]_=08]=0A =
Use _=08s_=08p_=08e_=08c_=08i_=08a_=08l device list to create within =
the softraid(4) frame-=0A work. Requires -=08-c=08c.=0A=0A =
-=08-u=08u _=08c_=08h_=08a_=08n_=08n_=08e_=08l_=08:_=08t_=08a_=08r_=08g_=
=08e_=08t_=08[_=08._=08l_=08u_=08n_=08]=0A Instruct the device =
at _=08c_=08h_=08a_=08n_=08n_=08e_=08l_=08:_=08t_=08a_=08r_=08g_=08e_=08t_=
=08[_=08._=08l_=08u_=08n_=08] to cease blinking, if=0A there is=
ses(4) or safte(4) support in the enclosure.=0A=0A -=08-v=08v Be =
more verbose in output.=0A=0A _=08d_=08e_=08v_=08i_=08c_=08e Select a =
drive by name (e.g. sd0) or a RAID controller by name=0A (e.g. =
ami0). For operations which will be performed against=0A ses(4=
) or safte(4) enclosures, it is also possible to directly=0A sp=
ecify the enclosure name (e.g. safte0).=0A=0AE=08EX=08XA=08AM=08MP=08PL=08L=
E=08ES=08S=0A The following command, executed from the command line, wo=
uld configure=0A the device softraid0 with 4 special devices (/dev/sd2e=
, /dev/sd3e,=0A /dev/sd4e, /dev/sd5e) and a raid level of 1:=0A=0A =
# bioctl -c 1 -l /dev/sd2e,/dev/sd3e,/dev/sd4e,/dev/sd5e softraid0=0A=0A=
S=08SE=08EE=08E A=08AL=08LS=08SO=08O=0A ami(4), arc(4), bio(4), ciss(4)=
, mfi(4), safte(4), scsi(4), ses(4),=0A softraid(4)=0A=0AH=08HI=08IS=08=
ST=08TO=08OR=08RY=08Y=0A The b=08bi=08io=08oc=08ct=08tl=08l command fir=
st appeared in OpenBSD 3.8.=0A=0AA=08AU=08UT=08TH=08HO=08OR=08RS=08S=0A =
The b=08bi=08io=08oc=08ct=08tl=08l interface was written by Marco Peereboo=
m <marco@openbsd.org>.=0A=0ANetBSD 4.0 December 27, 200=
4 NetBSD 4.0=0A
--qDbXVdCdHGoSgWSk--