STREAMS queue returned to stream head during service routine execution

STREAMS queue returned to stream head during service routine execution

Post by Jim Robins » Thu, 06 Apr 1995 04:00:00

We are seeing something rather strange when running our STREAMS multiplexor
drivers on a Solaris 2.3 dual CPU SPARC 20. What is happening is that
occasionally, I believe after an I_UNLINK, the queue associated w/ a
running lower write service routine will revert back to the stream head
part way thru execution of the service routine.  Needless to say this has
devastating consequences.  What seems to be happening is that there is a
lack of synchronization wrt the running of the lower service routines and
the return of a "borrowed" queue pair. We have never seen this occur on
single CPU SPARC 10s or on a dual CPU SPARC 20 w/ one CPU disabled.

We do not use perimeters (should we?), but instead do mutex locking on a
driver basis. I.e., each driver has a single mutex which is acquired first
thing in each put and service routine. The mutex is released prior to
putnext() and family, and qreply(), and it is reacquired afterwards if
necessary. Just prior to return from the service or put routine, the mutex
is released. You can't get much coarser granularity than that.

Is this a Solaris bug? If so, is there a work-around? If not, what are we
doing incorrectly? Is there a lock of some sort that we should grab prior
to performing processing in the service routine?

Any help gratefully accepted.

Jim Robinson



1. URGENT STREAMS pseudodevice/kernel stream head question

Dear STREAMS and kernel experts,

        I got a problem with a simple pseudodevice driver programmed by me.
        Long time, anything works fine but then suddenly a deadlock occures.
        This thing is very strang because of the following:
        - the program reading the pseudo device is in a _read and blocked
        - the streams head shows mit flags $3E or 076, which tells me:
          (QWANTR) someone up (_read) needs data (indeed)
          (QWANTW) someone from below has data (indeed)
          (QFULL) block by flow control (got 6k, flow allows 5k)
          (QREADR,QUSE) ok, the normal way
        and nothing happens. So how can QWANTR and QFULL set at one time,
        i.e. how can a _read block with 6k bytes of data waiting on the
        queue? I put all the data with 'putnext' to the queue, using a
        service procedure, 'canput' and whatever UNIX likes. What can be

        We are running DG/UX 4.31 on a Data General AViiON 300.

Thank you in advance

                        Jochen Manns
                        Physikalisches Institut der Universitaet Bonn
                        Nussallee 12
                        5300 Bonn 1

2. Programmer's InfoPage news

3. STREAMS driver per-adaptor read service routine

4. hdd compatibility?

5. How do I set a streams queue (pipe queue) size?

6. Looking for good fortran compiler for linux

7. WANTED Streams Performance Study SVR3/SVR4 to non Streams comm SW

8. Won't Boot

9. copy/divide (video)stream into two streams

10. iosched: effect of streaming read on streaming write

11. how do i divide/copy one stream into two streams through a named pipe???

12. Streaming Windows Media Audio IN -> Streaming MP3 Out?

13. Need source for SVR3 Streams -> SVR4 Streams changes