Bert Miemietz wrote:
>> I suspect a bug in your code. Are you holding the
>> ptr->mutex when doing 
>> the cv_signal?
>>     
>
> Yes, I do. 
>   
>> What is the value of tmo?
>>     
>
> I guess it isn't the reason either. Typical values are from 250000 to 5000000 
> (0,25 to 5 s).
>
>   
>> Also, be aware that mutex deadlocks may occur --
>> cv_timedwait() drops, 
>> and reacquires the lock.  If it can't reacquire the
>> lock, then badness 
>> will ensue, and it may appear hung when it is merely
>> blocked.
>>     
>
> This is true. But why does it work correctly with a previous call 
> "(void) ddi_get_lbolt();"?
> The trouble with the mutexes would be the same then.
>
> Couldn't it be that there is a strange thing with ddi_get_lbolt() when
> called for the first time (even though it sounds unbelieveable to me) ?
>   

Its extraordinarily unlikely that your driver code is the firs to call 
ddi_get_lbolt()!

My gut reaction in situations like this is that there is a timing bug.  
It could (as indicated) be a deadlock due to mutexes.  You should 
carefully analyze and make sure that you're not holding the mutex 
anywhere else.

You might also make sure that you're not seeing some form of bizarre 
heap or stack corruption.   Try running with set kmem_flags = 0x1f in 
your /etc/system file.  It will hurt performance, but it might uncover 
heap problems.

The only other thing I can suggest is looking at the system with kmdb, 
and seeing what threads are doing what.  You might see that the cv_wait 
thread is blocked waiting for a lock or somesuch instead of waiting on 
the signal.

    -- Garrett

> Of course the proof would be hard to do - a complete driver just to test
> this. That's why I thought perhaps a question could be permitted... 
>
>   
>>     -- Garrett
>>     
>>>  
>>> This message posted from opensolaris.org
>>> _______________________________________________
>>> opensolaris-code mailing list
>>> opensolaris-code@opensolaris.org
>>>
>>>       
>> http://mail.opensolaris.org/mailman/listinfo/opensolar
>> is-code
>>     
>>>   
>>>       
>> _______________________________________________
>> opensolaris-code mailing list
>> opensolaris-code@opensolaris.org
>> http://mail.opensolaris.org/mailman/listinfo/opensolar
>> is-code
>>     
>  
>  
> This message posted from opensolaris.org
> _______________________________________________
> opensolaris-code mailing list
> opensolaris-code@opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
>   

_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to