On 2020-08-13 09:53:57 [+0200], Lars-Peter Clausen wrote: > On PREEMPT_RT enabled kernels unmarked hrtimers are moved into soft > interrupt expiry mode by default. > > The IIO hrtimer-trigger needs to run in hard interrupt context since it > will end up calling generic_handle_irq() which has the requirement to run > in hard interrupt context. > > Explicitly specify that the timer needs to run in hard interrupt context by > using the HRTIMER_MODE_REL_HARD flag. No, I don't think that this is good. It basically renders threaded-irqs in context of IIO useless. This also requires that the IRQ-handler in question runs with IRQs disabled / uses raw_spinlock_t which is in not good idea either. Has this change (including the second patch in thread) been tested on RT in terms of locking and latency? > Fixes: f5c2f0215e36 ("hrtimer: Move unmarked hrtimers to soft interrupt expiry on RT") > Reported-by: Christian Eggers <ceggers@xxxxxxx> > Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx> > --- > drivers/iio/trigger/iio-trig-hrtimer.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/trigger/iio-trig-hrtimer.c b/drivers/iio/trigger/iio-trig-hrtimer.c > index f59bf8d58586..b11ca915fcb2 100644 > --- a/drivers/iio/trigger/iio-trig-hrtimer.c > +++ b/drivers/iio/trigger/iio-trig-hrtimer.c > @@ -132,7 +132,7 @@ static struct iio_sw_trigger *iio_trig_hrtimer_probe(const char *name) > trig_info->swt.trigger->ops = &iio_hrtimer_trigger_ops; > trig_info->swt.trigger->dev.groups = iio_hrtimer_attr_groups; > > - hrtimer_init(&trig_info->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); > + hrtimer_init(&trig_info->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); > trig_info->timer.function = iio_hrtimer_trig_handler; > > trig_info->sampling_frequency = HRTIMER_DEFAULT_SAMPLING_FREQUENCY; Sebastian