I have a kernel module that provides data to a userland process through read(). That process blocks on read until data becomes available. I achieve this through a wait_event_interruptible() in the read method.
Data comes from an interrupt handler, which sucks it into memory, then schedules a tasklet to process it. The original code schedules the tasklet, then calls wake_up_interruptible() to re-activate the blocked read. However, this causes a race condition as the tasklet may not be done processing the data before read tries to give it to the user process.
So the question is, is it safe to move my call to wake_up_interruptible() to the end of the tasklet?