From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755698AbbCBWDk (ORCPT ); Mon, 2 Mar 2015 17:03:40 -0500 Received: from smtp05.smtpout.orange.fr ([80.12.242.127]:41548 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755459AbbCBWDi (ORCPT ); Mon, 2 Mar 2015 17:03:38 -0500 X-ME-Helo: beldin X-ME-Date: Mon, 02 Mar 2015 23:03:36 +0100 X-ME-IP: 109.214.21.72 From: Robert Jarzmik To: Lars-Peter Clausen Cc: Vinod Koul , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dmaengine: virt-dma: fix completion list manipulation References: <1425331196-7895-1-git-send-email-robert.jarzmik@free.fr> <54F4D631.6020605@metafoo.de> X-URL: http://belgarath.falguerolles.org/ Date: Mon, 02 Mar 2015 23:03:33 +0100 In-Reply-To: <54F4D631.6020605@metafoo.de> (Lars-Peter Clausen's message of "Mon, 02 Mar 2015 22:29:21 +0100") Message-ID: <87fv9n12h6.fsf@free.fr> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Lars-Peter Clausen writes: > On 03/02/2015 10:19 PM, Robert Jarzmik wrote: >> diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h >> index 3772032..2a3da22 100644 >> --- a/drivers/dma/virt-dma.h >> +++ b/drivers/dma/virt-dma.h >> @@ -91,7 +91,7 @@ static inline void vchan_cookie_complete(struct virt_dma_desc *vd) >> dma_cookie_complete(&vd->tx); >> dev_vdbg(vc->chan.device->dev, "txd %p[%x]: marked complete\n", >> vd, cookie); >> - list_add_tail(&vd->node, &vc->desc_completed); >> + list_move_tail(&vd->node, &vc->desc_completed); > > That will break all drivers which handle this currently correctly and remove the > descriptor from any list before calling vchan_cookie_complete. Ah, well well I don't agree. First, let's split the drivers which remove the descriptors and these which don't : These which remove the descriptor: dma-jz4740.c fsl-edma.c These which don't remove the descriptor: amba-pl08x.c edma.c img-mdc-dma.c k3dma.c moxart-dma.c omap-dma.c qcom_bam_dma.c s3c24xx-dma.c sa11x0-dma.c sun6i-dma.c That settles the correctness I think, the correct behavior is to not remove the descriptor and let it be done by vchan_cookie_complete(). Now for the remaining 2 drivers, we'll have : - list_del(&vd->node) => vd becomes a singleton - list_move_tail(&vd->node, &...desc_completed) => list_del(&vd->node) : nothing changes, it's a nop => list_add_tail(&vd->node, &...desc_completed) And the behavior remains correct after the patch, only one "list_del()" is done twice for nothing. Where do you see any breakage ? Cheers. -- Robert