From owner-freebsd-drivers@FreeBSD.ORG Fri Oct 28 22:57:16 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C940916A420 for ; Fri, 28 Oct 2005 22:57:16 +0000 (GMT) (envelope-from bharmaji@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.197]) by mx1.FreeBSD.org (Postfix) with ESMTP id D680D43D4C for ; Fri, 28 Oct 2005 22:57:15 +0000 (GMT) (envelope-from bharmaji@gmail.com) Received: by xproxy.gmail.com with SMTP id t14so423897wxc for ; Fri, 28 Oct 2005 15:57:15 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=fSel9wR2bJk/74vgEBtvIU4J5Ed5W9EW1ydlIGod8caIJPF7bVVnU8z4jlfLbx8S9KAcPOt+TBuh9iufMNCRpV1cmStL7nVr9XNc7nIs2yxdsolt3AcirkQ6ksqAluI68OaLgnNuNCyMWC8ReOoLryL0mb8grGWhZNcocE5m9CI= Received: by 10.65.96.7 with SMTP id y7mr468877qbl; Fri, 28 Oct 2005 15:57:15 -0700 (PDT) Received: by 10.65.124.10 with HTTP; Fri, 28 Oct 2005 15:57:15 -0700 (PDT) Message-ID: <67beabb0510281557k5d237a0br9b586bdde35c6971@mail.gmail.com> Date: Fri, 28 Oct 2005 15:57:15 -0700 From: Bharma Ji To: freebsd-drivers@freebsd.org In-Reply-To: <20051017.210955.104032631.imp@bsdimp.com> MIME-Version: 1.0 References: <67beabb0510171825q1e124bf6v2adbe0c9f235a6ae@mail.gmail.com> <20051017.210955.104032631.imp@bsdimp.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: Recommended ways to log driver operations X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Oct 2005 22:57:16 -0000 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 writ= e the messages to the disk while the driver is executing.(seems to much to as= k probably - but someone somewhere would have thought of a way around it) On 10/17/05, M. Warner Losh wrote: > > In message: <67beabb0510171825q1e124bf6v2adbe0c9f235a6ae@mail.gmail.com> > Bharma Ji 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 wil= l > : 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 >