[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200723195634.GA908@ninjato>
Date: Thu, 23 Jul 2020 21:56:34 +0200
From: Wolfram Sang <wsa@...-dreams.de>
To: Douglas Anderson <dianders@...omium.org>
Cc: swboyd@...omium.org, msavaliy@...eaurora.org,
Sai Prakash Ranjan <saiprakash.ranjan@...eaurora.org>,
Akash Asthana <akashast@...eaurora.org>,
Rajendra Nayak <rnayak@...eaurora.org>,
Alok Chauhan <alokc@...eaurora.org>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Girish Mahadevan <girishm@...eaurora.org>,
Karthikeyan Ramasubramanian <kramasub@...eaurora.org>,
Sagar Dharia <sdharia@...eaurora.org>,
linux-arm-msm@...r.kernel.org, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] i2c: i2c-qcom-geni: Fix DMA transfer race
On Wed, Jul 22, 2020 at 03:00:21PM -0700, Douglas Anderson wrote:
> When I have KASAN enabled on my kernel and I start stressing the
> touchscreen my system tends to hang. The touchscreen is one of the
> only things that does a lot of big i2c transfers and ends up hitting
> the DMA paths in the geni i2c driver. It appears that KASAN adds
> enough delay in my system to tickle a race condition in the DMA setup
> code.
>
> When the system hangs, I found that it was running the geni_i2c_irq()
> over and over again. It had these:
>
> m_stat = 0x04000080
> rx_st = 0x30000011
> dm_tx_st = 0x00000000
> dm_rx_st = 0x00000000
> dma = 0x00000001
>
> Notably we're in DMA mode but are getting M_RX_IRQ_EN and
> M_RX_FIFO_WATERMARK_EN over and over again.
>
> Putting some traces in geni_i2c_rx_one_msg() showed that when we
> failed we were getting to the start of geni_i2c_rx_one_msg() but were
> never executing geni_se_rx_dma_prep().
>
> I believe that the problem here is that we are starting the geni
> command before we run geni_se_rx_dma_prep(). If a transfer makes it
> far enough before we do that then we get into the state I have
> observed. Let's change the order, which seems to work fine.
>
> Although problems were seen on the RX path, code inspection suggests
> that the TX should be changed too. Change it as well.
>
> Fixes: 37692de5d523 ("i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller")
> Signed-off-by: Douglas Anderson <dianders@...omium.org>
> Tested-by: Sai Prakash Ranjan <saiprakash.ranjan@...eaurora.org>
> Reviewed-by: Akash Asthana <akashast@...eaurora.org>
Applied to for-current, thanks!
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists