Recommended ways to log driver operations

Bharma Ji bharmaji at gmail.com
Fri Oct 28 15:57:16 PDT 2005


Resurrecting a recent thread...
Thanks for your resposne. ktr and alq are unfortunately not availabe on the
freebsd version that I am using.
I have reduced my requirements for the logging facility. Now all I require
is that the log be persistent. The problem that I face is that in the event
of a kernel panic - the driver messages are all lost.Is there a way to write
the messages to the disk while the driver is executing.(seems to much to ask
probably - but someone somewhere would have thought of a way around it)


On 10/17/05, M. Warner Losh <imp at bsdimp.com> wrote:
>
> In message: <67beabb0510171825q1e124bf6v2adbe0c9f235a6ae at mail.gmail.com>
> Bharma Ji <bharmaji at gmail.com> writes:
> : I recently wrote a driver for a chip. I am wondering if there are any
> : standard recommended ways of logging the driver operations. I have used
> : printf in the driver and I look at it using dmesg so far. Am wondering
> if it
> : is possible to create a driver specific log file so that it is easy to
> : debug. Also, if the driver emits copious output then the log buffer will
> : overflow and some messages may be truncated. Writing to a specific log
> file
> : may help in that case. However, I have no idea if this is worth
> : investigating. Any suggestions appreciated
>
> printf(9) doesn't give you much of a chance to segregate the logs. You
> can also use log(9), but that just adds the ability to give a priority
> to the log message, which can help.
>
> If you want to debug the driver to find out what's going on at a high
> rate, you might want to look at ktr(9) and alq(9). These facilities
> are more for debugging and performance tuning, rather than day to day
> operations. In general, FreeBSD drivers follow the unix tradition of
> only complaining when there are problems.
>
> Warner
>


More information about the freebsd-drivers mailing list