Re: [PATCH] iio: trigger: Don't use RT priority

From: Christian Eggers
Date: Mon Sep 14 2020 - 13:37:49 EST


Hi Jonathan,

On Sunday, 13 September 2020, 11:43:05 CEST, Jonathan Cameron wrote:
> Looks like we can't do this unless we have a precusor patch to export that
> function for module use.

This patch compiles fine on my development kernel (5.4-rt). I guess that it
doesn't link on latest due to https://lwn.net/Articles/818388/

This raises the important question, which priority to use for the iio trigger.
According to the above link, this should better be chosen by user space than
by the kernel. Some systems may require a medium/high priority thread for data
acquisition, on other systems (like mine) this exposed a number of bugs in the
i2c bus driver which blocked the whole system.

Use space can change the priority of the iio trigger thread using the chrt
command. The question is, which priority should be used by default (RT / non
RT). If desired, I'll port the patch to latest.

What happened on my system (only if interested):
A normal priority user space process was using the i2c bus. Due to noise on
the bus and several bugs in the (noise related) error handling in i2c-imx, the
driver code was caught in a busy wait loop with a 500 ms timeout. This was bad
enough but after the iio trigger irq thread with a RT priority equal to
interrupt threads wanted to access the same i2c bus, the prio of the user
space process was boosted and busy waiting was done with IRQ priority. For the
rest of the 500 ms timeout, no further IRQ threads were serviced.

Best regards
Christian