From patchwork Wed Dec 15 11:01:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 12696255 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8EDFBC433EF for ; Wed, 15 Dec 2021 11:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GuSulUvWGj3VJe0PA/hcvGvfHjk0O6Gg1KrXDuJ/aww=; b=Do8FzUxWJE46Jv kQi78PC0gV/kz1X4eyqThepVCFF/NQvZj4HBw6ahzJkgtqhwOCq64cMF/6dnILqswWXLRoVNBcUtE +AeWblFy7O/UCqjgnaZLOUlBMXhQ936wjaveA8SQ4T0ZVnpfBR/0eCnHzMLvQwQ3RybyHzAo4NcDL CgdsWiDh/uA1ghPp93a2Lvy7PlXiYpGvL+ypSNro6IcfsfkVDsuAVxvlknKZMqVAEJXwXsCgs1/0T EfWSocKcDxkOMjhwgUOErA23twEk5vJ6o6UDbbvTimVY9d6+gaQDzx1y5NLERLqZA71fygM3qSQub Vzr+rDBZb5tV5w8V72Mg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxS8z-000PjZ-Sq; Wed, 15 Dec 2021 11:08:22 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxS2R-000MDb-1X for linux-arm-kernel@lists.infradead.org; Wed, 15 Dec 2021 11:01:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1639566095; x=1671102095; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Gg1aOoAbFdXCK2iIdjdkeyi1r5cweAwvByOXGAnrlsg=; b=2qtef4uvWYCjJEXbK/I3Me9ezAGurzRiwP70hq29tNfqCFU9McpHRsyZ 2gFTIKRxnnVR9O0VGVqZfv2NDaO+sa7s1ZLBce09+jHaABhe+/M4EpEt+ AMbLZjgKwV7gWZkIzvZYYns78Cqo6/qvDIqRMN/nfFCB22hIBis6oa3l0 RTR+iezZCiMrN2quXrhfDRSmx4doBK2TyA1QX9TxNofhRneraZdSg/XC9 7MMbWFc97o+DCIEHEmQpVyjRtjO7La3D8qqWgxXNUDwevIEs+E2CP2pJu 2MMYrm+2exiBf/E3NkZErO1Igm116cOCCUuJrUQnsZmLAtpLOauYUI83H A==; IronPort-SDR: 8U7SQuFLe/DgjTBD8N8bpNi/8HrOYuJlk2UrEq+CgbILcNxq6FpAx5R0OtA1EXv0QFok3r7+Yr ouGkW7B76ONMlDwh3zbCaBXHudGRjKetG424hiW6VzGQk38xGtjPqN/5CATRRmkSh5ayqGfF67 cmJyMl1Nmve6dcN/Y/5Nfl4/KphiQL/t3ZCp4vkvbaxV1166mymniSN9EmWcqxf2HTqCOYepvo L1Y7S5jvUWNv2BLMSAUtj9NwimlEX9SzVF1f0T9gfTjBRMN+kPMcDXQjZNEIG3KScIV7htDK/S 5MIvlG/ewl3mtZzOn5ch8jfy X-IronPort-AV: E=Sophos;i="5.88,207,1635231600"; d="scan'208";a="142483369" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 Dec 2021 04:01:33 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Wed, 15 Dec 2021 04:01:30 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Wed, 15 Dec 2021 04:01:28 -0700 From: Tudor Ambarus To: Subject: [PATCH v3 04/12] dmaengine: at_xdmac: Fix concurrency over chan's completed_cookie Date: Wed, 15 Dec 2021 13:01:07 +0200 Message-ID: <20211215110115.191749-5-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215110115.191749-1-tudor.ambarus@microchip.com> References: <20211215110115.191749-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211215_030135_223360_5FD661B3 X-CRM114-Status: UNSURE ( 8.43 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tudor Ambarus , mripard@kernel.org, linux-kernel@vger.kernel.org, ludovic.desroches@microchip.com, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Caller of dma_cookie_complete is expected to hold a lock to prevent concurrency over the channel's completed cookie marker. Call dma_cookie_complete() with the lock held. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver") Signed-off-by: Tudor Ambarus --- drivers/dma/at_xdmac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index 7d3560acedbb..83c031207530 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1703,11 +1703,10 @@ static void at_xdmac_tasklet(struct tasklet_struct *t) } txd = &desc->tx_dma_desc; - + dma_cookie_complete(txd); at_xdmac_remove_xfer(atchan, desc); spin_unlock_irq(&atchan->lock); - dma_cookie_complete(txd); if (txd->flags & DMA_PREP_INTERRUPT) dmaengine_desc_get_callback_invoke(txd, NULL);