mbox series

[0/3] i2c: i2c-qcom-geni: More properly fix the DMA race

Message ID 20201008225235.2035820-1-dianders@chromium.org
Headers show
Series i2c: i2c-qcom-geni: More properly fix the DMA race | expand

Message

Doug Anderson Oct. 8, 2020, 10:52 p.m. UTC
Previously I landed commit 02b9aec59243 ("i2c: i2c-qcom-geni: Fix DMA
transfer race") to fix a race we were seeing.  While that most
definitely fixed the race we were seeing, it looks like it causes
problems in the TX path, which we didn't stress test until we started
trying to update firmware on devices.

Let's revert that patch and try another way: fix the original problem
by disabling the interrupts that aren't relevant to DMA transfers.
Now we can stress both TX and RX cases and see no problems.  I also
can't find any place to put an msleep() that causes problems anymore.

Since this problem only affects i2c, I'm hoping for an Ack from Bjorn
and then all these patches can go through the i2c tree.  However, if
maintainers want to work a different way out to land that's OK too.

NOTE: the 3rd patch in the series could certianly be squashed with
patch #1 or I could re-order / rejigger.  To me it seemed like a good
idea to first fix the probelm (and make the two functions as much of
an inverse as possible) and later try to clean things up.  Yell if you
want something different.


Douglas Anderson (3):
  soc: qcom: geni: More properly switch to DMA mode
  Revert "i2c: i2c-qcom-geni: Fix DMA transfer race"
  soc: qcom: geni: Optimize select fifo/dma mode

 drivers/i2c/busses/i2c-qcom-geni.c |  6 ++--
 drivers/soc/qcom/qcom-geni-se.c    | 47 ++++++++++++++++++++----------
 2 files changed, 34 insertions(+), 19 deletions(-)

Comments

Stephen Boyd Oct. 10, 2020, 12:26 a.m. UTC | #1
+Roja

Quoting Douglas Anderson (2020-10-08 15:52:32)
> Previously I landed commit 02b9aec59243 ("i2c: i2c-qcom-geni: Fix DMA
> transfer race") to fix a race we were seeing.  While that most
> definitely fixed the race we were seeing, it looks like it causes
> problems in the TX path, which we didn't stress test until we started
> trying to update firmware on devices.
> 
> Let's revert that patch and try another way: fix the original problem
> by disabling the interrupts that aren't relevant to DMA transfers.
> Now we can stress both TX and RX cases and see no problems.  I also
> can't find any place to put an msleep() that causes problems anymore.
> 
> Since this problem only affects i2c, I'm hoping for an Ack from Bjorn
> and then all these patches can go through the i2c tree.  However, if
> maintainers want to work a different way out to land that's OK too.
> 
> NOTE: the 3rd patch in the series could certianly be squashed with
> patch #1 or I could re-order / rejigger.  To me it seemed like a good
> idea to first fix the probelm (and make the two functions as much of
> an inverse as possible) and later try to clean things up.  Yell if you
> want something different.
> 
> 
> Douglas Anderson (3):
>   soc: qcom: geni: More properly switch to DMA mode
>   Revert "i2c: i2c-qcom-geni: Fix DMA transfer race"
>   soc: qcom: geni: Optimize select fifo/dma mode
> 
>  drivers/i2c/busses/i2c-qcom-geni.c |  6 ++--
>  drivers/soc/qcom/qcom-geni-se.c    | 47 ++++++++++++++++++++----------
>  2 files changed, 34 insertions(+), 19 deletions(-)
> 
> -- 
> 2.28.0.1011.ga647a8990f-goog
>
Dmitry Baryshkov Oct. 10, 2020, 1:16 p.m. UTC | #2
On 09/10/2020 01:52, Douglas Anderson wrote:
> Previously I landed commit 02b9aec59243 ("i2c: i2c-qcom-geni: Fix DMA
> transfer race") to fix a race we were seeing.  While that most
> definitely fixed the race we were seeing, it looks like it causes
> problems in the TX path, which we didn't stress test until we started
> trying to update firmware on devices.
> 
> Let's revert that patch and try another way: fix the original problem
> by disabling the interrupts that aren't relevant to DMA transfers.
> Now we can stress both TX and RX cases and see no problems.  I also
> can't find any place to put an msleep() that causes problems anymore.
> 
> Since this problem only affects i2c, I'm hoping for an Ack from Bjorn
> and then all these patches can go through the i2c tree.  However, if
> maintainers want to work a different way out to land that's OK too.

These patches fix I2C DMA issues on SM8250 we were observing
Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>