Subject: Stuck in biowait() again....
To: , <port-arm@NetBSD.org>
From: Sean McGranaghan <smm@appcongroup.com>
List: port-arm
Date: 04/14/2004 11:05:55
This is a multi-part message in MIME format.

------=_NextPart_000_0006_01C42210.74F8CCA0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hello all,

I have a strange situation occuring where it looks like biowait() is waiting
for a buffer that never gets loaded via strategy(). I have looked over the
archives and found some similiar situations. I found an old bug reference
#3694/Kern that could explain my situation. What is the status of that bug?

Here is my situation:

I am building a diskless kernel on the evbarm platform. I am trying to debug
a simple polled mode disk driver for a flash device. The driver is basically
functional. The driver is implemented using a worker thread that is woken up
by strategy() when new requests arrive. The worker thread processes all the
requests on the queue, calling biodone() as needed and goes back to sleep.
This appears to be working fine. Basic read/write operations seem to be
working. I can mount a MSDOS filesystem from the device and walk through the
directory tree. I can create and delete files. The problem first appeared
when I starting using "cat" to read files larger than one block (512 bytes).

I can read small files (<512 bytes) perfectly. When trying to read a 513
byte file "cat" gets stuck inside biowait() in tsleep(). I added debugging
to trace the buffer requests through each biowait(), biodone() and
strategy() call. It looks like the buffer that biowait() is waiting for was
never loaded into the cache. Every buffer request I receive via strategy() I
see processed in the worker thread. I can not find a strategy() call for the
buffer that causes the sleep in biowait()!

I must be missing something. This is my first netbsd block driver so maybe I
am filling the buffer requests incorrectly? Are there other response fields
in the buffer struct that I need to set? I set in b_bcount, b_resid, b_error
and b_flags. What exactly are the rules on responding to the buffer
requests? (I based my driver on a combination of the memory (md) and floppy
(fd) drivers.)

Any help is greatly appreciated,

Sean

------=_NextPart_000_0006_01C42210.74F8CCA0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><FONT size=3D2>
<P>Hello all,</P>
<P>I have a strange situation occuring where it looks like biowait() is =
waiting=20
for a buffer that never gets loaded via strategy(). I have looked over =
the=20
archives and found some similiar situations. I found an old bug =
reference=20
#3694/Kern that could explain my situation. What is the status of that =
bug?</P>
<P>Here is my situation:</P>
<P>I am building a diskless kernel on the evbarm platform. I am trying =
to debug=20
a simple polled mode disk driver for a flash device. The driver is =
basically=20
functional. The driver is implemented using a worker thread that is =
woken up by=20
strategy() when new requests arrive. The worker thread processes all the =

requests on the queue, calling biodone() as needed and goes back to =
sleep. This=20
appears to be working fine. Basic read/write operations seem to be =
working. I=20
can mount a MSDOS filesystem from the device and walk through the =
directory=20
tree. I can create and delete files. The problem first appeared when I =
starting=20
using "cat" to read files larger than one block (512 bytes).</P>
<P>I can read small files (&lt;512 bytes) perfectly. When trying to read =
a 513=20
byte file "cat" gets stuck inside biowait() in tsleep(). I added =
debugging to=20
trace the buffer requests through each biowait(), biodone() and =
strategy() call.=20
It looks like the buffer that biowait() is waiting for was never loaded =
into the=20
cache. Every buffer request I receive via strategy() I see processed in =
the=20
worker thread. I can not find a strategy() call for the buffer that =
causes the=20
sleep in biowait()!</P>
<P>I must be missing something. This is my first netbsd block driver so =
maybe I=20
am filling the buffer requests incorrectly? Are there other response =
fields in=20
the buffer struct that I need to set? I set in b_bcount, b_resid, =
b_error and=20
b_flags. What exactly are the rules on responding to the buffer =
requests? (I=20
based my driver on a combination of the memory (md) and floppy (fd)=20
drivers.)</P>
<P>Any help is greatly appreciated,</P>
<P>Sean</P></FONT></FONT></DIV></BODY></HTML>

------=_NextPart_000_0006_01C42210.74F8CCA0--