Mailing List archive

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

[linux-dvb] Re: [PATCH] support for multiple feeds per pid



On Tue, Feb 18, 2003 at 11:46:10PM +0100, Emard wrote:
> > I think you might like to read the following documents:
> > http://kernelnewbies.org/documents/kdoc/kernel-locking/lklockingguide.html
> > http://lwn.net/Articles/21064/
> 
> Right, I gave'em a glance, peeked at some real code in kernel
> and found that:
> 
> tasklet locking is not done as suggested by the doc.
> 
> in sw_demux, locking is based on hardware interrput 
> spin_lock_irq(), instead of tasklet spin_lock_bh().
> 
> Locking on hard irq is not correct, because hard irq doesn't
> access any sw_demux data. data is accessed outside of
> hard irq, later in tasklet.

I think that spin_lock_irq() is "stronger" than spin_lock_bh().
On SMP the critical region will be protected by the spin lock,
on UP you can't get interrupted when irqs are disabled. But
it is of course more efficient to not to lock irqs when not
necessary, that's the whole point of using tasklets.

> I *GUESS/COMMENTS_PLEASE* vpeirq() only reads (doesnt
> write) sw_demux structure, so
> 
> it can call sw_demux_packets_whatever with read-only 
> lock request:
> 
>  read_lock(demux)
> 
> while ioctl, while updating sw_demux should request 
> write-lock with 
> 
>  write_lock_bh(demux)

I haven't had time to look at vpeirq() &c.

Generally, using read locks is an optimization, allowing for multiple
concurrent readers.  If there are no concurrent readers, then the
optimization is useless.

Regards,
Johannes


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



Home | Main Index | Thread Index