From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 6 02:25:53 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0361A16A421 for ; Wed, 6 Jun 2007 02:25:53 +0000 (UTC) (envelope-from lstewart@room52.net) Received: from swin.edu.au (gpo4.cc.swin.edu.au [136.186.1.224]) by mx1.freebsd.org (Postfix) with ESMTP id 936DA13C468 for ; Wed, 6 Jun 2007 02:25:52 +0000 (UTC) (envelope-from lstewart@room52.net) Received: from [136.186.229.95] (lstewart.caia.swin.edu.au [136.186.229.95]) by swin.edu.au (8.13.6.20060614/8.13.1) with ESMTP id l562Pjrr026565; Wed, 6 Jun 2007 12:25:46 +1000 Message-ID: <46661B30.10404@room52.net> Date: Wed, 06 Jun 2007 12:25:52 +1000 From: Lawrence Stewart User-Agent: Thunderbird 1.5.0.9 (X11/20070123) MIME-Version: 1.0 To: John Baldwin References: <4649349D.4060101@room52.net> <86odkcugev.fsf@dwp.des.no> <46565781.2030407@room52.net> <200706051539.22662.jhb@freebsd.org> In-Reply-To: <200706051539.22662.jhb@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=disabled version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on gpo4.cc.swin.edu.au Cc: freebsd-hackers@freebsd.org, =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= Subject: Re: Writing a plain text file to disk from kernel space X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2007 02:25:53 -0000 Hi John, Thanks for the reply and additional information on locks. The solution I've just completed working on is designed exactly as you describe. We're about to begin testing and evaluating the module, and we'll be releasing the code and 2 technical reports related to it within the coming weeks with any luck. The first report describes the module and its performance characteristics... only interesting to people doing TCP related research with FreeBSD. The other report is a sort of "intro to FreeBSD kernel hacking" paper, which is a brain dump of all the useful lessons we've learnt throughout the process. This report is mostly for our benefit so we remember the lessons we learnt for next time, but we're hoping it will also be something useful for the community to point noob kernel hackers at for some introductory information. I'll be posting to this list as soon as the code and reports are available, as it has been indicated by people following this thread that having some sort of tutorial/reference information would be useful. Cheers, Lawrence John Baldwin wrote: > Use a task to defer the kio_write() to a taskqueue. You have to malloc state > (using M_NOWAIT, which can fail) to do this properly. If you are doing this > for every packet, you are probably better off using malloc() to throw items > into a queue and having a global task that drains the queue on each execution > doing kio_write()'s for each object. > > Regarding sleepable vs. non-sleepable locks. Getting preempted by an > interrupt is not considered "sleeping". Sleeping means voluntarily yielding > the CPU to wait for an event such as via msleep() or a condition variable. > Note that interrupt handlers can acquire non-sleepable locks. If you sleep > while holding a non-sleepable lock, you may have an interrupt handler that > can't run while it waits for some async event (like disk I/O) to complete. > >