[LinuxPPS] safe pps_register_source()
Rodolfo Giometti
giometti at enneenne.com
Thu Aug 9 16:59:10 CEST 2007
On Thu, Aug 09, 2007 at 10:54:22AM -0400, Fabio Checconi wrote:
> On Thu, Aug 09, 2007 at 04:46:23PM +0200, Rodolfo Giometti wrote:
> > On Thu, Aug 09, 2007 at 10:34:47AM -0400, Fabio Checconi wrote:
> >
> [...]
> > > but a concurrent kfree(pps) on a different processor could be a problem,
> > > I have to think more about that...
> >
> > Mmm... Maybe we can use the "idr_lock" since "kfree(pps)" is only
> > called inside a pps_unregister_source()...
> >
> > Here my suggestion:
> >
> > + /* Now we can release the PPS source for (possible) deregistration */
> > + spin_lock_irqsave(&idr_lock, flags);
> > + atomic_dec(&pps->usage);
> > + wake_up_all(&pps->usage_queue);
> > + spin_unlock_irqrestore(&idr_lock, flags);
>
> the idea should be to use a statically allocated spinlock, so this
> should be the way to go. as I said before I need a little bit more
> time to think about it :(
Ok, no problem! I'm not in an hurry. The important thing is that I'm
going in the right direction! :)
I'll wait for your confirm before committing the code.
Thanks a lot,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti at enneenne.com
Linux Device Driver giometti at gnudd.com
Embedded Systems giometti at linux.it
UNIX programming phone: +39 349 2432127
More information about the LinuxPPS
mailing list