Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1597740ybh; Thu, 23 Jul 2020 12:59:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKJ25+Csj7tKK3DmkEbfoZMN+5WaszWiM8xhE9vaasiSjfJQUUo2bu6UFQMFLQCgLtkAEr X-Received: by 2002:a05:6402:ca1:: with SMTP id cn1mr5656290edb.223.1595534382439; Thu, 23 Jul 2020 12:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595534382; cv=none; d=google.com; s=arc-20160816; b=bfm3mCid7TL4cAiPD9k+aAAjxWItj8Htgfb7AgUxEJh7lmd05I1iM5GNzCJJAjIALl tf43c7vD2HtYFz0vFXlqjy1cH+lGmVokmXahGU5AvuhlBg6WcPbuSXs+9rA3vcueBkuD Y+bfI0Z6Dfp6hDAfZ23oQqS9l/CqxAQ/jpL/jhjlQuuPNmSvdMvdZvdvpD+ueTw63yU6 UGao9eZx6I5Qhei0u8649ZjKnEktnHKvpmsNn4/N28V4VX+A18QEVzNgqk3h1ZVbbtwC S3fQ0WQ3Xqhgt9jGbEg7XhVlqGne430hFnSa+2ENz4bZwahmfamc0EG228afbs/Xlwn+ tvrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=5PwAw7CfDuXQHqzGsZ8r45St2oemY/uS4zE+BBscXjo=; b=oj+/SVIp/cnMKOssMPdziUOtIGcjA4pSCiCvWT8G2bf1q3l/Exo7kiiz0xm9NzHbB6 ijFj7lLK2V8YwsSINroF7NnsZDc09bb9W1tp/vRMBXATqmLNJRCIOGU3fKw52+OhvjAq dDfav7JZIgRdzJIwk4Fe8azmOpIdR7mjKWClKH4Fa3WolUIUluiE04RTGNGKObryijQV GN53ZOz72ZGFNHPyuYOK9tbHnDut9mNzPfXfJSgQwBUtQSeMtDADrWZJvIKEFLWA/XES zKZY99oNjE1h1Uvfs6OZ/+rS6KIweBOOAud+OO1UvZXoAAvtk4/y43J/rUHIU9zKdhwc 6QOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f21si2999995ejl.329.2020.07.23.12.59.19; Thu, 23 Jul 2020 12:59:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726503AbgGWT4k (ORCPT + 99 others); Thu, 23 Jul 2020 15:56:40 -0400 Received: from sauhun.de ([88.99.104.3]:47484 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbgGWT4k (ORCPT ); Thu, 23 Jul 2020 15:56:40 -0400 Received: from localhost (p5486cde4.dip0.t-ipconnect.de [84.134.205.228]) by pokefinder.org (Postfix) with ESMTPSA id E31D52C0654; Thu, 23 Jul 2020 21:56:37 +0200 (CEST) Date: Thu, 23 Jul 2020 21:56:34 +0200 From: Wolfram Sang To: Douglas Anderson Cc: swboyd@chromium.org, msavaliy@codeaurora.org, Sai Prakash Ranjan , Akash Asthana , Rajendra Nayak , Alok Chauhan , Andy Gross , Bjorn Andersson , Girish Mahadevan , Karthikeyan Ramasubramanian , Sagar Dharia , linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] i2c: i2c-qcom-geni: Fix DMA transfer race Message-ID: <20200723195634.GA908@ninjato> References: <20200722145948.v2.1.I7efdf6efaa6edadbb690196cd4fbe3392a582c89@changeid> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="SUOF0GtieIMvvwua" Content-Disposition: inline In-Reply-To: <20200722145948.v2.1.I7efdf6efaa6edadbb690196cd4fbe3392a582c89@changeid> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --SUOF0GtieIMvvwua Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > When the system hangs, I found that it was running the geni_i2c_irq() > over and over again. It had these: >=20 > m_stat =3D 0x04000080 > rx_st =3D 0x30000011 > dm_tx_st =3D 0x00000000 > dm_rx_st =3D 0x00000000 > dma =3D 0x00000001 >=20 > Notably we're in DMA mode but are getting M_RX_IRQ_EN and > M_RX_FIFO_WATERMARK_EN over and over again. >=20 > 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(). >=20 > 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. >=20 > Although problems were seen on the RX path, code inspection suggests > that the TX should be changed too. Change it as well. >=20 > Fixes: 37692de5d523 ("i2c: i2c-qcom-geni: Add bus driver for the Qualcomm= GENI I2C controller") > Signed-off-by: Douglas Anderson > Tested-by: Sai Prakash Ranjan > Reviewed-by: Akash Asthana Applied to for-current, thanks! --SUOF0GtieIMvvwua Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl8Z624ACgkQFA3kzBSg KbYZog/+MH7CA5qU2jQ/+0weiqVJl7p12RN7zBbUpOE/pKjaRgenj6KQEDkUqwGM Dv7cGBq91V2SYEkhbvWXisWZiqhF66F4tmy8JaTCU+oozVw6suyqosPMjs9g5RFv PLoKK4rgcfLByYbXSXdX0tbPe+e2P69s+fvttOvPQsOCZ8Yq8RAZubN9HiPIHpXP 93tFSF/O0BFb5awmHKgBeFcMhawUhjiUojC/mDhrww3vRXmSMvHtBKiD38HHTut6 0js9RnUFs/GDpdFo2LPl73Wrb8oPopMBYv9dODXLy2aRDzxHXPiEEXCeRv9Ekxr1 2smfexvpPdn6//eNcQXTJc9Dk13xuASWBdb9sS1czNlONSMPqzdhVqW/5km1kzPT NLsYLyiX5IeiWCuyZw4+MtB6iB3bEMMmmbPqYeNwW8S5kIIv3xOagn5/AjzNrH29 c/u+6QBfvahomXLOWq1D9U7KnvRsLLQxmx00K7tmDd6HUCnk9LygqogXESXXxpRs OxNt+b+yJM8hIKtXx2o4fFIst50IuCboZaat3fxl4c9PcSjOR/jzRNSwuVGcf2zB Me8uXilaBUqrbcI1KWVT1CaRihWEDykOdkXCJ24asGEW04HvnYkxEzqRxtMl9iMM cdeJcy+Axgx2kpPWEE3FVFyvRkfjvYSILinMKwiMqHri98IqBHQ= =l0IS -----END PGP SIGNATURE----- --SUOF0GtieIMvvwua--