Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2020726imu; Sat, 8 Dec 2018 12:30:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/XWeHq7rq8DgigfJmv8v4m++ADXvlj0cw+GKZXwwLf4zTB/PRUD1LhagK2y2DNTFgF3EWUS X-Received: by 2002:a17:902:f24:: with SMTP id 33mr6856986ply.65.1544301000228; Sat, 08 Dec 2018 12:30:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544301000; cv=none; d=google.com; s=arc-20160816; b=07ub3FT7Ls62Py/fmwlHZsxn4bX5EfsJDEu/uLRf4sdZUFRHCTrsuj6WMyzMSTXhLN 8Dzq9x1u+keQTMl3RuA6WLghxHU7wz4BtKko63o6NF66EW54gnCD6UlodqHCF57HsQ6w iBFaw1W9ib3t8jVuougH2fvxxkWOJcIbKfvqTB2luFjwWen8ZGsQIzvLj7LuGVRUW0mW WYLqto/SkBjyXFvi8Dx4eogksHwKX5cAaUwbvwpvP2OMNEV88MFPGt/uRRcF+rgMJm4j CfPsQWu8fV8pdD88pU+M3BXI6FP+Vrg3pF2aSvzb2gSi08dks+36ZMXxXoqZEFOiz7Cj JM+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=5d30IjZqCxXCvaccwVP55AkuGBR3IcmUKVAJ0sA7oUU=; b=IM3we5lBPMmvyXbw3ya85K1D4TGREmujpFipOG6eev9cPnq5lQ7Dg6o9+UP5modRJM +YagyVYTF/uwj8orJQLAv7TLzGzJxEzKcMrJfjuS3eJ5hlryeVYsjJ+eci42hkonF0Wb zDfHDBjc1DIRU0YO8NaVXLXDfV029of9JJwUWVsBPpa5dIiBBs/nKWbewdNldHtrX0Mw mB7ABlp86U2JrxoIOXkji2jIgZEdmO8WB6d0Hq9E9cDG8UjH63/GtEt+4f1eEB+WbacV +wBdDwncSgbDAunmVbsMRochaA4YVsvxFs19XFihn2FWcpxACTdg9LzJZDYJPnJhp4MF lrZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xVVjqbw9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si3792216pll.384.2018.12.08.12.29.44; Sat, 08 Dec 2018 12:30:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xVVjqbw9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726225AbeLHU3D (ORCPT + 99 others); Sat, 8 Dec 2018 15:29:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:34360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbeLHU3C (ORCPT ); Sat, 8 Dec 2018 15:29:02 -0500 Received: from [192.168.0.109] (cpe-174-109-247-98.nc.res.rr.com [174.109.247.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B2692081F; Sat, 8 Dec 2018 20:29:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544300942; bh=63XzysPyjU/fSz1E4sS6O8QzyYl9dn9rMAsO5kg6ufE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=xVVjqbw9pMydZ/QrQxI2PAJqMcTuqkIfVcZKhsv6e0Jg0ZCFHazujVPxeNNNgBW8P eoz3vK11qFlAnO7B6+FE/MoHcFQSZWHe6OMvHY/3hh0uhrs+j/SUnHHd3AcbU103JX z68nX156rTGYMiu46hww20V9Gx+IRJEKje9h6LBA= Subject: Re: [PATCH 2/2] dmaengine: qcom_hidma: assign channel cookie correctly To: Shunyong Yang Cc: andy.gross@linaro.org, david.brown@linaro.org, vkoul@kernel.org, dan.j.williams@intel.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Joey Zheng References: <81c9fe2de4b5dac1d5b974f5305e35bf1cf5d127.1544156508.git.shunyong.yang@hxt-semitech.com> From: Sinan Kaya Message-ID: <88ef21bd-4e4f-8cce-39b3-53da45740f0f@kernel.org> Date: Sat, 8 Dec 2018 15:28:59 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/6/2018 11:29 PM, Shunyong Yang wrote: > When dma_cookie_complete() is called in hidma_process_completed(), > dma_cookie_status() will return DMA_COMPLETE in hidma_tx_status(). Then, > hidma_txn_is_success() will be called to use channel cookie > mchan->last_success to do additional DMA status check. Current code > assigns mchan->last_success after dma_cookie_complete(). This causes > a race condition of dma_cookie_status() returns DMA_COMPLETE before > mchan->last_success is assigned correctly. The race will cause > hidma_tx_status() return DMA_ERROR but the transaction is actually a > success. Moreover, in async_tx case, it will cause a timeout panic > in async_tx_quiesce(). > > Kernel panic - not syncing: async_tx_quiesce: DMA error waiting for > transaction > ... > Call trace: > [] dump_backtrace+0x0/0x1f4 > [] show_stack+0x24/0x2c > [] dump_stack+0x84/0xa8 > [] panic+0x12c/0x29c > [] async_tx_quiesce+0xa4/0xc8 [async_tx] > [] async_trigger_callback+0x70/0x1c0 [async_tx] > [] raid_run_ops+0x86c/0x1540 [raid456] > [] handle_stripe+0x5e8/0x1c7c [raid456] > [] handle_active_stripes.isra.45+0x2d4/0x550 [raid456] > [] raid5d+0x38c/0x5d0 [raid456] > [] md_thread+0x108/0x168 > [] kthread+0x10c/0x138 > [] ret_from_fork+0x10/0x18 > > Cc: Joey Zheng > Signed-off-by: Shunyong Yang Acked-by: Sinan Kaya to both patches 1/2 and 2/2.