core: change some internals for triggers
This is the first step of a series of changes aimed at a cleaner and more flexible management of triggers, as well as a really transparent "user" trigger. This commit does the following: - zio_fire_trigger renamed to zio_arm_trigger: the trigger is actually armed by software, and then it fires by hardware. This distinction is especially important for the transparent trigger: when devices have internal timing, the software trigger must arm it immediately (as opposed to the dumb devices, where the software trigger really causes I/O to happen). - ZIO_TI_BUSY renamed to ZIO_TI_ARMED. Also, ZIO_TI_COMPLETING is removed. The new, simplified policy is like this: the trigger is armed by software (the trigger module), but completion is driven by hardware (the device module). There is no need for a COMPLETING flag, because the ARMED flag is only cleared after data_done is over for all channels in the cset. - the cset spinlock is used to protect all changes of the ti flags. - change_current_trigger completely revised and fixed to match new conventions. - trigger->abort now takes "ti" instead of "cset" as argument; it is more natural do do so, and no current trigger implements abort so no harm is done. - the trigger->abort and trigger->change_status methods are now always called while holding the cset spinlock. ZIO core calls abort when changing the current trigger type, to ensure no pending blocks are there. - zio_trigger_abort is renamed to zio_trigger_abort_disable, with an additional argument to state whether the trigger must be atomically disabled after the abort is over. This avoids a race condition on trigger removal. It returns the previous "disabled" bit, to be used when changing a buffer type while preserving trigger status. - minor unrelated improvements in error management in objects.c. - documentation update to match the new locking, and a few typos fixed. Signed-off-by:Alessandro Rubini <rubini@gnudd.com> Acked-by:
Federico Vaga <federico.vaga@gmail.com>
Showing
- doc/zio-manual.in 43 additions, 21 deletionsdoc/zio-manual.in
- helpers.c 37 additions, 30 deletionshelpers.c
- include/linux/zio-trigger.h 5 additions, 5 deletionsinclude/linux/zio-trigger.h
- include/linux/zio.h 0 additions, 3 deletionsinclude/linux/zio.h
- objects.c 32 additions, 34 deletionsobjects.c
- sysfs.c 3 additions, 1 deletionsysfs.c
- triggers/zio-trig-hrt.c 1 addition, 1 deletiontriggers/zio-trig-hrt.c
- triggers/zio-trig-irq.c 1 addition, 1 deletiontriggers/zio-trig-irq.c
- triggers/zio-trig-timer.c 3 additions, 3 deletionstriggers/zio-trig-timer.c
- triggers/zio-trig-user.c 2 additions, 2 deletionstriggers/zio-trig-user.c
Please register or sign in to comment