Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: problems with dmxSctFilterParams and NEWSTRUCT



Hi,

Jeremy Hall wrote:
> Hello,
> 
> Under what circumstances should wake_up(&dmxdev->buffer.queue) be
> called? What exactly does it do?

it wakes up all processes waiting on the event queue 
"dmxdev->buffer.queue". In our case it notifies waiting/reading 
processes of a changed buffer state, the waiting process can try to read 
again from this buffer.



> Note that "what exactly does it do" is looking for a human-understandable
> answer, perhaps a better question would be
> 
> what is its purpose? what happens if it is not called? What assumptions
> might  be made when it is called? What is the difference in wake_up and
> wake_up_interruptable?

when it won't get called the waiting process will never be notified that 
there are new bytes in the buffer and it will never be woken up.

wake_up_interuptible() will only wake up processes that are sleeping in 
XXX_interruptible() calls. wake_up() will wake up all processes.

In usual drivers you should use the XXX_interruptible() versions 
everywhere, because only they make it possible to send signals to 
sleeping processes. Problems like "I can't unload the driver because I 
killed my program/my app segfaulted/died/whatever" are usually related 
to uninterruptible sleeps or incorrect module use counting.

I know there are still many places in the DVB driver, especially in the 
software demuxer where these sleeps are not handled perfectly correct, I 
started to clean this up but there is still a lot to do. If anybody of 
you has some time to review this code, please do so and send me patches.



> If you feel like shooting me now, please point me to docs before doing
> so. :-)

These issues are pretty good explained in Alessandro Rubini's and 
Jonathan Corbet's "Linux Device Drivers" book. There are also PDF 
version available on the net, the paper version costs about 40USD.


> oh and is it legal to test dmxdev->buffer.error without first obtainng the
> spinlock?

you can access atomic variables (all variables that fit into a register) 
without obtaining a spinlock, it's state will always be consistent.

Holger




-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index