[LinuxPPS] safe pps_register_source()

Fabio Checconi fchecconi at gmail.com
Thu Aug 9 16:54:22 CEST 2007


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 :(

bye



More information about the LinuxPPS mailing list