Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp323756ybg; Sun, 26 Jul 2020 05:48:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCPGQXH7i3ssmJLfXIMurdigmp6cq1GzObNmJNNw3wsByKS2ssd2kCZ+K1lBxduxi1Hx/a X-Received: by 2002:a05:6402:b26:: with SMTP id bo6mr12032513edb.104.1595767708178; Sun, 26 Jul 2020 05:48:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595767708; cv=none; d=google.com; s=arc-20160816; b=JsD3hMMuCOUb+y/vx4+Ahf4m2cLRSWKRPV6NerQ5GORnVAmJkxNmyK+b4MN/Y9ACow AYfDK45jC24JjH3D0VtzL3KmN8FTkLwJprXsB/FKe0N0H5rzQGXfHfOqZL5uPI7r/mn/ ssRsannjboWDYFDGzNRAOhS8FHEr2AcacyoUmvEF0XjJMljf5Dyh9mwqQnqxB7dZYhhG cwYR31kmvNjZXjdpOwCQ9fBx6LiuAjAaWRQCPeVNXHGPuvCKcLbdpd08Q15CnIMUpRaU xCkdEsOlqInPpQqYqFWhs8jHDk7nzara3TUBhD4G1mFTTSZqLYLlsmFQRNlyxDJ5SCZE Tm4A== 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=sySulG+RoVS2AoIXIgrTU9eWzhhljQrTNCQ8eLvgWsM=; b=LfM8+PInBc98jJlrZcd9UHuwBn9llOba7sk1OImLb503TgMbXcdhzM/5nSLdiZ1UdX 3eO3GfvB9rwBb0/aDui4dqcEkFVG702IAAjosiVsxGbh67T0ci9k3yyZQkQlQVCZsCfY duBMeEEx8QVN57gzu8wTQh+P6SMiifKylGrSw+Ytsn2kOvdrmrUWkDGmZaA2xvkunKLf CbAd06pGrg6zfro2r9KJ9jEJ7y5EkNPdjE8cKqY5LbTsITb0N5wuL9ECwfATZCI9Yyfk W2btc3VCrYMF+yL5VeKGmVrezGz3XWUokgAHSN6aAJI1faZunXqs/R+l6xgf5x5i7mmg lA/g== 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 k6si1203235edl.280.2020.07.26.05.48.05; Sun, 26 Jul 2020 05:48:28 -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 S1727768AbgGZMrx (ORCPT + 99 others); Sun, 26 Jul 2020 08:47:53 -0400 Received: from sauhun.de ([88.99.104.3]:53314 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726042AbgGZMrw (ORCPT ); Sun, 26 Jul 2020 08:47:52 -0400 Received: from localhost (p5486c93f.dip0.t-ipconnect.de [84.134.201.63]) by pokefinder.org (Postfix) with ESMTPSA id 417252C0610; Sun, 26 Jul 2020 14:47:49 +0200 (CEST) Date: Sun, 26 Jul 2020 14:47:48 +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: <20200726124747.GA16169@ninjato> References: <20200722145948.v2.1.I7efdf6efaa6edadbb690196cd4fbe3392a582c89@changeid> <20200723195634.GA908@ninjato> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline In-Reply-To: <20200723195634.GA908@ninjato> 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 --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 23, 2020 at 09:56:34PM +0200, Wolfram Sang wrote: > 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 Qualco= mm GENI I2C controller") > > Signed-off-by: Douglas Anderson > > Tested-by: Sai Prakash Ranjan > > Reviewed-by: Akash Asthana >=20 > Applied to for-current, thanks! Glad we got this sorted. I just wondered that Alok wasn't part of the discussion. Is he still interested in maintaining the driver? Also because there is an unprocessed patch left for this driver: http://patchwork.ozlabs.org/project/linux-i2c/patch/20191103212204.13606-1-= colin.king@canonical.com/ --1yeeQ81UyVL57Vl7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl8de3MACgkQFA3kzBSg KbZfFQ/+IQE8vj6FVFw8UOFQ8gO4XGR5oyKcFYaqngN7SVrbpklAsniO6NCvVdLA /BrWDRdvmfsUvQdA1BdnVzpG9T6N5hf5K41ijoHhZU9u8QKwtlTJ4iJVQ7LceArW a/iYn1zdN2B3fkfKyUqJIPgS2qdgTcwupi5prnuYYMD0wXwldb56QGzAkfERk14S 2PNwaSTAJS5OmVzDU4e+4p56V+BG8d4UAz9kI+zGSs9lJ9GggtxN6I8hYJ4/pxv6 scPz8czhh2gcn94tMxumGlLVZqURrAa8RUgKnPCZgD0xiDxZfkRFJpgtQRUmw7My cHsAts7z/ihNiosL41tNkyP9iCbkKUswRexi96+IjchHX/g/bdkccg37ZweXTSyH PgRk5Oqc9uD6P471xzLSEowI11kGPhlu06u52kvg77UIGMU8vL0b8NWe2SVaKSPg L3WvdgVBNWvCQ5kxjc3w0rva0V73427seGAmQSzIFrYH2IOEj5hD36tEQ6beDGJ3 q8g3H8saNMec8oVeHmzMZNsokuVbWhX0fGKkdx8d54d/Z9Q7WFQgD7TbeTaatVgp XXvUToWCD9XwX7mBYLYoblscVtF8sMExUbO3Y0Jo+hc5tRGw19Jjycwh8zZNID2C 4RwagbzeBFpiP8lQSoVOC+HQAWWwWdFdlaW8eJg2U+Vw1Y6Gv44= =pw9M -----END PGP SIGNATURE----- --1yeeQ81UyVL57Vl7--