Re: [PATCH v2 1/7] i2c: stm32f7: perform most of irq job in threaded handler

From: Andi Shyti
Date: Fri Dec 08 2023 - 15:04:35 EST


Hi Alain,

On Fri, Dec 08, 2023 at 05:47:10PM +0100, Alain Volmat wrote:
> The irq handling is currently split between the irq handler
> and the threaded irq handler. Some of the handling (such as
> dma related stuffs) done within the irq handler might sleep or
> take some time leading to issues if the kernel is built with
> realtime constraints. In order to fix that, perform an overall
> rework to perform most of the job within the threaded handler
> and only keep fifo access in the non threaded handler.
>
> Signed-off-by: Alain Volmat <alain.volmat@xxxxxxxxxxx>

quite a difficult review because this git diff algorithm makes it
difficult to read throuhg.

But it looks like just a copy paste from to
stm32f7_i2c_isr_event() to stm32f7_i2c_isr_event_thread() of the
STM32F7_I2C_ISR_NACKF, STM32F7_I2C_ISR_STOPF, STM32F7_I2C_ISR_TC
and STM32F7_I2C_ISR_TCR.

[...]

> +static irqreturn_t stm32f7_i2c_isr_event_thread(int irq, void *data)
> +{
> + struct stm32f7_i2c_dev *i2c_dev = data;
> + struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg;
> + struct stm32_i2c_dma *dma = i2c_dev->dma;
> + void __iomem *base = i2c_dev->base;
> + u32 status, mask;
> + int ret;
> +
> + if (!i2c_dev->master_mode)
> + return stm32f7_i2c_slave_isr_event(i2c_dev);
> +
> + status = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR);

looks to me like this readl_relaxed is read too many times during
the whole irq handling.

Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxx>

Thanks,
Andi