Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1086736ybh; Wed, 22 Jul 2020 23:19:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyughqaWgJmWYD11ta4KwBT+WR9atWOxAnfQV/wJVZuT/TBF7kzLGwu6Yd6Sdv234k7zkYJ X-Received: by 2002:a05:6402:1d0a:: with SMTP id dg10mr2643853edb.110.1595485152895; Wed, 22 Jul 2020 23:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595485152; cv=none; d=google.com; s=arc-20160816; b=I718ojHNW9vXvV91IZLQQ40F4SdaZP6gRhj908M5jU2nlnhQrmNo82D48u0QYO8T6c YpyCa815JyN5RRT3bqBlziso/P+p3JUHVXXOpVntRr4f4HU5N0YMVYbh7PQ6kH5gcWaH bCe/96gDgOv02wL8U+7mHF21bNgj6s6Dyet0+A2MqzoNFW6y5O1brV+vJqZ7tBppUmly ceCFqJKCjiDm1XCJ4h6/AzZvBZzwaHVQPqTd1l6yY+yqEUKCWpby2/FY1iPTBp9X711M xxCJ4vNvjGUTIZwaSu/VUzwOm4TNd61OpHBWJSnNh5BV5NLfQPSF0ywp2nyg5eCTVvJn kh3w== 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=JrFqQO/lYLd8xdNMkJQFUXBvOd4aBT1l1GY4iTKRlJ4=; b=eJU+tEnnj4cirL16ywMaBaO/HBfF9BOAAbu5+wPz47QgI1dEs4M95Fgc1wZRCZ0Etz IfZawYZdD2IAJlo30pcblW2JyWA1aassUgPH68eRO/VBbO/w8v0Et1pd1nsieQ1M6mUr KvdFMDHCfHhRGeAzrtLnI4dFWc0lelZTIQ6w2S52zg5v0z5OzO7Ky6ixc+LXx4nk+SqY 74OLbFpIgldvvEKaaE+aYrYgy3GtXO1MOg9PuZjViCPzXepBADVhG65Y1vAB+4WlrodV frT2z1DdnlL0bnHON4aadJEFblBJ2ZO/ddCJdPzeSe4A5oSOPePHp7lr/iTO8iwZiPUg cmYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="djD4Pd/X"; 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 cy13si1358477edb.388.2020.07.22.23.18.49; Wed, 22 Jul 2020 23:19:12 -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="djD4Pd/X"; 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 S1726781AbgGWGQk (ORCPT + 99 others); Thu, 23 Jul 2020 02:16:40 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:12412 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726643AbgGWGQk (ORCPT ); Thu, 23 Jul 2020 02:16:40 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595485000; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=JrFqQO/lYLd8xdNMkJQFUXBvOd4aBT1l1GY4iTKRlJ4=; b=djD4Pd/Xj6Aqy0NrrFjlJDeyNPo40TryQWbNdunbnbjDfC5wSv8m84gBfIg8YbdBjMIdM7Dr piZn6+lq1iqNmh1hl17Dlkr6bzoELp85wP6Z+xYpBat13M7Dn8+s1axx87UPd23WAG1d4xm8 16pB5z122hVBdWQaLxrEdM89OQc= X-Mailgun-Sending-Ip: 104.130.122.29 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-n15.prod.us-east-1.postgun.com with SMTP id 5f192b4603c8596cdb8e55a0 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 23 Jul 2020 06:16:38 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 0B763C433C6; Thu, 23 Jul 2020 06:16:38 +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=-2.7 required=2.0 tests=ALL_TRUSTED,NICE_REPLY_A, SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.0.104] (unknown [123.201.159.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: msavaliy) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1716EC433C9; Thu, 23 Jul 2020 06:16:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1716EC433C9 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=msavaliy@codeaurora.org Subject: Re: [PATCH v2] i2c: i2c-qcom-geni: Fix DMA transfer race To: Stephen Boyd , Douglas Anderson , Wolfram Sang Cc: 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 References: <20200722145948.v2.1.I7efdf6efaa6edadbb690196cd4fbe3392a582c89@changeid> <159546541191.3847286.3212989047313785097@swboyd.mtv.corp.google.com> From: "Mukesh, Savaliya" Message-ID: Date: Thu, 23 Jul 2020 11:46:28 +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: <159546541191.3847286.3212989047313785097@swboyd.mtv.corp.google.com> 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/23/2020 6:20 AM, Stephen Boyd wrote: > Quoting Douglas Anderson (2020-07-22 15:00:21) >> 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 >> Tested-by: Sai Prakash Ranjan >> Reviewed-by: Akash Asthana Reviewed-by: Mukesh Kumar Savaliya >> --- > Reviewed-by: Stephen Boyd