Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jul 2007 07:37:33 +0200
From:      Alexander Leidinger <Alexander@Leidinger.net>
To:        John Baldwin <jhb@freebsd.org>
Cc:        Rui Paulo <rpaulo@fnop.net>, Shteryana, Poul-Henning Kamp <phk@phk.freebsd.dk>, "Constantine A. Murenin" <cnst@freebsd.org>, Shopova <syrinx@freebsd.org>, Robert Watson <rwatson@freebsd.org>, freebsd-arch@freebsd.org
Subject:   Re: Porting OpenBSD's sysctl hw.sensors framework to FreeBSD
Message-ID:  <20070713073733.3yk6m2vec0cs88sw@webmail.leidinger.net>
In-Reply-To: <200707121404.34168.jhb@freebsd.org>
References:  <55754.1184143579@critter.freebsd.dk> <200707111145.27741.jhb@freebsd.org> <20070712090008.yc6d6zptwkow04oc@webmail.leidinger.net> <200707121404.34168.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Quoting John Baldwin <jhb@freebsd.org> (from Thu, 12 Jul 2007 14:04:33 -0400=
):

> On Thursday 12 July 2007 03:00:08 am Alexander Leidinger wrote:
>> Quoting John Baldwin <jhb@freebsd.org> (from Wed, 11 Jul 2007
> 11:45:26 -0400):
>>
>> > On Wednesday 11 July 2007 07:49:59 am Alexander Leidinger wrote:
>>
>> >> On the other hand you don't want to allow an userland tool to directly
>> >> mess around with the registers on your RAID or NIC to get some status.=
..
>> >
>> > Err, that's how all the RAID utilities I've used work.  They send firmw=
are
>> > commands from userland and parse the replies in userland.  One exceptio=
n
> I've
>>
>> That's sad... they should provide this functionality in the driver
>> instead, it would allow to use access restrictions for some parts.
>
> Not really, it avoids having to duplicate a lot of work in drivers  =20
> that can be
> written once in a cross-platform userland utility.  Drivers aren't really =
the

If the sensor querying is already cross-platform, it can also be used =20
in the kernel. You have the driver just call the cross-platform =20
function to get back a firmware command it then can send to the =20
hardware.

> place to be monitoring raid status sending pages, e-mails, etc.  It's best=
 to
> let userland invoke sendmail, not the kernel. :)

I fully agree, but nobody wants to send mails from the kernel. We just =20
want to get the sensor data out of the kernel without the possibility =20
to fuck up the device from userland. You don't have a userland tool =20
for each NIC (which you need if you go the cross-platform-tool way), =20
we have a well defined interface there which allows to get back some =20
sensor data (wire speed, MAC address, IP address(es), ...) already and =20
we display it in ifconfig. There's one tool to query it (ifconfig), =20
and nobody complains about it being hard to do it in the driver =20
instead of in a cross-platform userland tool (and Sam enhanced =20
ifconfig to be able to get rid of the special tools for each WLAN NIC, =20
and everybody was happy about this). The sensors framework tries to =20
accomplish the same for sensor data. A driver (or something else in =20
the kernel) registers himself with the sensor framework, and then you =20
can use a generic tool to query all sensor data. No need to reinvent =20
the wheel (how to export, how to name, what unit to use), and a good =20
consistency (e.g. units used).

>> > seen so far is that for software RAID the firmware you are talking to i=
s
> the
>> > driver, not firmware on the card, so you use ioctls directly rather tha=
n
> an
>> > ioctl that sends a command to the firmware on the card.
>>
>> But you have to run this tool as root, don't you? You don't want to
>> let a user run such a tool (and nowadays even desktops start to have
>> RAID, so whoever sits at the machine may be interested to see some
>> status on his desktop).
>
> Whatever talks directly to the driver needs to run as root, yes, but =20
>  you could
> always write a proxy app that receives requests from utilities running as
> non-root and does its own access restrictions.

That's a lot of infrastructure you want to create for such a simple =20
task as displaying "resyncing 50% done" or "0 hotspares" or similar...

Bye,
Alexander.

--=20
In Christianity, a man may have only one wife.
This is called Monotony.

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID =3D B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID =3D 72077137



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070713073733.3yk6m2vec0cs88sw>