Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp614601ybh; Tue, 21 Jul 2020 03:49:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnyE589vK0P0sJVae6de75vy0LdpGVKFI55IC8IAL3T+tw+CqWvzSPHGi3gcpiMaCbdyfO X-Received: by 2002:a17:907:4240:: with SMTP id oi24mr24448781ejb.23.1595328598238; Tue, 21 Jul 2020 03:49:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595328598; cv=none; d=google.com; s=arc-20160816; b=m6C4k+BZtmadl51vWe6Ff85mqiEfetbYCuTDqvWmuFpJKNm4G5Acebj/FOALoAdrhS 1+1mvyIjWubv67nKjDyi+PpkTeYmFdNorMoTMbeT3epHDuEDtV8lUZk9z1RcV+4gLxGs IFw1Js2yiTxbAu0vR0yuagnruha+PD8zv9+neD3QuHjRQSyxHHvlxtIBJVJEWM5krhp6 JeKNAfv8VADoswsA5Z/m/j/AL2EfokdQfLTyZUPj3mWeuc0IQoQN5pFGtPkvpEdHs3+R JTQeevIw3wg+KcO9Wtv4yLe1ikAq3w3+6j8w1+VVNN13XejD8I/bM+EyUXje+MIyDbw7 ESNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature; bh=hWSCkjwa6XTH8wbP9rLLbwZRQrSZSARhWd3jpGdV9Qs=; b=IekFskUOAFQXe+A+glmO9STyZ1aw+DUVs0eGkMR+iOad37VDPMx9AMhAaYSFhAcvan H7XR5B8Y34mh6snhmbQ9svm/aIGOz42LE3UFhTm1ISccAyjxQ3tn4jmTPzspIWq1ENla pxU2L2fUZtbRE2nTYjTEM8jeJ9WsW2paCANF9qMxGwEoDXHZYIyMJ4zOrwClDo80yR78 SZYZ6Yja7XjVdgxcfUxlkcZ1BM3Iqk20UxasXBj4905SE6gqHsdarx/VNN5+d3nMTjZj eBfsgHX+lthFwVnTr/OZ0i/C1g3ilPP+ji4Khm5ad/pOobu/+r/BBDIYq8LhqQTz0jSI Ih9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=W6ArY2zY; 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 a8si12594715edr.123.2020.07.21.03.49.35; Tue, 21 Jul 2020 03:49:58 -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; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=W6ArY2zY; 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 S1729357AbgGUKtG (ORCPT + 99 others); Tue, 21 Jul 2020 06:49:06 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:35733 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727043AbgGUKtG (ORCPT ); Tue, 21 Jul 2020 06:49:06 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595328545; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=hWSCkjwa6XTH8wbP9rLLbwZRQrSZSARhWd3jpGdV9Qs=; b=W6ArY2zY9uBILB+tpU3OXMgh4efGvksJKrcU47Dctn9epu3ErP9795X/ETcXTS3FvVTRK0qk kxBnvhJ0/T/3r2zgNHwNBjZtX0gy3dAMm88QvAynAF5nkVa6bIVxSBiHbODFbATWkMA15APl 9CeEY3OpuKdjX549Vfnoat1trmM= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n16.prod.us-east-1.postgun.com with SMTP id 5f16c805427cd557667500df (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 21 Jul 2020 10:48:37 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 42CD6C433A0; Tue, 21 Jul 2020 10:48:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,NICE_REPLY_A, SPF_NONE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.43.98] (unknown [157.48.50.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: akashast) by smtp.codeaurora.org (Postfix) with ESMTPSA id 20993C433CA; Tue, 21 Jul 2020 10:48:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 20993C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=akashast@codeaurora.org Subject: Re: [PATCH] i2c: i2c-qcom-geni: Fix DMA transfer race To: Douglas Anderson , Wolfram Sang Cc: Sai Prakash Ranjan , Rajendra Nayak , swboyd@chromium.org, Alok Chauhan , Andy Gross , Bjorn Andersson , Girish Mahadevan , Karthikeyan Ramasubramanian , Wolfram Sang , linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200720172448.1.I7efdf6efaa6edadbb690196cd4fbe3392a582c89@changeid> From: Akash Asthana Message-ID: Date: Tue, 21 Jul 2020 16:18:23 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200720172448.1.I7efdf6efaa6edadbb690196cd4fbe3392a582c89@changeid> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/21/2020 5:54 AM, 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 writing the transfer > length and setting up 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. > > Fixes: 37692de5d523 ("i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller") > Signed-off-by: Douglas Anderson > --- Reviewed-by: Akash Asthana -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project