[LinuxPPS] safe pps_register_source()

Rodolfo Giometti giometti at enneenne.com
Thu Aug 9 15:51:08 CEST 2007


On Thu, Aug 09, 2007 at 09:40:41AM -0400, Fabio Checconi wrote:
> 
> I think we need something to prevent the deregistration of the
> source while someone is waiting on it; wrt this patch I think that
> pps_event() is not the best place to signal that the source is no
> more used, since after pps_event() ends, in interrupt context, the
> unregistering task will free the chardev, while the task resuming
> from fetch will try to access the (already freed) source for its
> data.  Also using only the completion structure without an associated
> completion condition (i.e., the number of blocked tasks) I think
> can be racy.

Mmm... I see... so your suggestion is to use an "usage" count and
deregistering the source only when it reachs zero?

> I think we need to leave to the task(s) doing fetch to wake up
> anyone waiting to do source deregistration.

And about the pps_event()? Don't you think that also this function
should be considered?

Ciao,

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