Unified Hardware Monitoring Interface for FreeBSD
(Port OpenBSD's sysctl Hardware Sensors Framework)

Constantine A. Murenin

mureninc@gmail.com
cnst+freebsd@bugmail.mojo.ru

2007-04-06

Abstract

Having recently improved OpenBSD's sysctl hw.sensors framework, I propose porting the framework to FreeBSD.

Sensors framework consists of kernel API that is used by drivers to add sensors to sensor devices via sensor_attach(9), and then register sensor devices via sensordev_install(9), so that sensors become available under sysctl(3) tree.

Consequently, sysctl(3) calls can be used to query sensor devices and individual sensors for recent sensor readings. In turn, sysctl(8) presents the information about available sensors to the user in accessible fashion, systat(1) allows for semi-realtime sensor monitoring, whereas sensorsd(8) lets the user set various alarms in case certain sensors go out-of-range. Third party utilities, like ports/sysutils/symon, allow remote monitoring of these hardware sensors.

All-in-all, the framework promotes system availability by detecting hardware problems early on.

Benefits to the FreeBSD community

Deliverables of this project will allow FreeBSD users to access information that is provided by microprocessor system hardware monitors (e.g. system temperature, voltage, fan speed, RAID status) in a systematic way. Utilities provided hereby will facilitate appropriate warnings about possible system failure, as well as they will allow one to monitor status of the system across the network.

The project will very likely enhance system availability for many users, because it will make it easy to detect many possible problems (e.g. broken fans etc).

Deliverables

Project schedule

I can begin immediately after 3rd June 2007.

I first plan to adapt OpenBSD's sensor framework for FreeBSD, which will require some time, because FreeBSD's and OpenBSD's sysctl interfaces differ substantially; for example, OpenBSD doesn't have any equivalences of sysctlnametomib(3) and sysctlbyname(3) calls, whereas FreeBSD does. This step will involve kernel API and sysctl(3) glue code, as well as any necessary sysctl(8) patches for FreeBSD. I have substantially rewritten sensors framework for OpenBSD, so I am very familiar with the code that must be ported from OpenBSD during this step.

The second step will involve porting the most popular hardware monitoring driver — lm(4) — from OpenBSD to FreeBSD. As I have contributed to the lm(4) driver on OpenBSD and extensively studied Winbond datasheets for my Final Year Project at DMU, I am already familiar with much of the code that must be ported during this step.

The third step would be to port other userland utilities that interact with the sensors framework, including sensorsd(8), systat(1) and ports/sysutils/symon. I have contributed to all of these utilities on OpenBSD, including symon, thus I pretty much know the code by heart.

In the fourth step, I will create patches to convert existing hardware monitoring device drivers on FreeBSD (e.g. dev/iicbus/ad7418.c) to utilise the new framework. In parallel, I will port other popular hardware monitoring drivers from OpenBSD, e.g. it(4). Additionally, at the moment OpenBSD's sensors framework is read-only, i.e. it is not possible to interact with the monitoring chips to modify cruising temperature or perform fan-header voltage control right from the operating system. This fourth step will thus include development of the infrastructure and most importantly patches for the then-existing lm(4) and it(4) FreeBSD drivers to allow a generalised interface for fan-controlling to take place.

As time permits, we will see if any other of the 44 OpenBSD drivers that utilise sensors framework can be ported to FreeBSD.

Availability

I plan to be available full-time all summer starting from 3rd June 2007 until mid August 2007.

Bio

I have a Bachelor of Science (Honours) degree from De Montfort University, which I've acquired when I was a participant of East Carolina University sponsored study-abroad exchange programme. During my year-long study at DMU, I've taken the opportunity to do the Final Year Computing Project on Microprocessor System Hardware Monitors and their interfacing with OpenBSD's sysctl mechanism. Many patches from the project are already part of OpenBSD, most notably, the patch that implements the new addressing scheme and converts all 44 drivers from the old to the new API, as well as all userland utilities, including those from the ports tree. In the shop is the patch that allows effective fan controlling to take place.

Prior to my involvement with OpenBSD, I have contributed to mozilla.org back in 2003/2004, and I am officially listed as a Mozilla Contributor in about:credits page of Netscape/Mozilla/Firefox. I am also a member of Mozilla Anglicisation Team, and I have released official 1.6a, 1.6b and 1.6 en-GB language packs on behalf of the team.

I am a FreeBSD user since 2002. During the course of the years, I have deployed FreeBSD for various purposes, including Mozilla development, working on computer science homework, hosting a self-written dynamically-generated web-site at East Carolina University, Independent Study IPv6 networking project at ECU, as well as various other personal and educational uses.

References

Valid XHTML 1.0! Valid CSS!