From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751915AbcBKJqm (ORCPT ); Thu, 11 Feb 2016 04:46:42 -0500 Received: from mx-36.synserver.de ([212.40.180.141]:50746 "EHLO smtp-out-022.synserver.de" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751776AbcBKJqi (ORCPT ); Thu, 11 Feb 2016 04:46:38 -0500 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 22385 Subject: Re: [PATCH v2] dmaengine: edma: Implement device_synchronize callback To: Peter Ujfalusi , vinod.koul@intel.com References: <1455181722-32099-1-git-send-email-peter.ujfalusi@ti.com> Cc: linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, nsekhar@ti.com, linux-omap@vger.kernel.org From: Lars-Peter Clausen X-Enigmail-Draft-Status: N1110 Message-ID: <56BC5759.80000@metafoo.de> Date: Thu, 11 Feb 2016 10:41:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 MIME-Version: 1.0 In-Reply-To: <1455181722-32099-1-git-send-email-peter.ujfalusi@ti.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/11/2016 10:08 AM, Peter Ujfalusi wrote: > We need the callback to support the dmaengine_terminate_sync(). > > Signed-off-by: Peter Ujfalusi Looks good, but I noticed a slight race condition in edma_completion_handler(). You need to fetch echan->desc while holding the vchan.lock. Otherwise this can race against terminate_all() and the callback might get scheduled even though terminate_all() completed and then there is a race where the synchronize() operation could be called before the callback gets scheduled, which means it doesn't do its intended job. Highly unlikely to happen, but theoretically possible.