From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12CB0C43603 for ; Wed, 4 Dec 2019 08:46:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6481206DF for ; Wed, 4 Dec 2019 08:46:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725830AbfLDIqF (ORCPT ); Wed, 4 Dec 2019 03:46:05 -0500 Received: from smtp04.smtpout.orange.fr ([80.12.242.126]:23584 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725840AbfLDIqF (ORCPT ); Wed, 4 Dec 2019 03:46:05 -0500 Received: from belgarion ([86.201.44.80]) by mwinf5d08 with ME id Zklx2100E1jnNL603km3FG; Wed, 04 Dec 2019 09:46:04 +0100 X-ME-Helo: belgarion X-ME-Auth: amFyem1pay5yb2JlcnRAb3JhbmdlLmZy X-ME-Date: Wed, 04 Dec 2019 09:46:04 +0100 X-ME-IP: 86.201.44.80 From: Robert Jarzmik To: Sascha Hauer Cc: dmaengine@vger.kernel.org, Peter Ujfalusi , Vinod Koul , kernel@pengutronix.de Subject: Re: vchan helper broken wrt locking References: <20191203115050.yvpaehsrck6zydmk@pengutronix.de> X-URL: http://belgarath.falguerolles.org/ Date: Wed, 04 Dec 2019 09:45:57 +0100 In-Reply-To: <20191203115050.yvpaehsrck6zydmk@pengutronix.de> (Sascha Hauer's message of "Tue, 3 Dec 2019 12:50:50 +0100") Message-ID: <87wobcxyuy.fsf@belgarion.home> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/26 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Sascha Hauer writes: > Hi All, Hi Sascha, The short story : from my understanding, vc->desc_free() shouldn't be called with vd->lock held. The locking of callbacks called by virt-dma shouldn't be handled by virt-dma, but be a part of the dma driver's architecture rather than forced by virt-dma. The long story : This is what I remember and my understanding for the virt-dma : - virt_dma_chan->lock protects only : - all lists within virt_dma_chan - virt_dma_desc->node, which is on one of the above lists As a consequence of this statement, this lock shouldn't be held for other parts of the code, and therefore not while calling vc->desc_free(). I base the above statement on my "former" understanding, and that is a code I dealt with years ago, so I might be a little rusty here and there. The original code Russell wrote states in virt-dma.h : - in structure "struct_dma_desc" The "protected by vc.lock" is just for the "node" field - in structure "struct virt_dma_chan" The "protected by vc.lock" is just above the 4 lists (originally 3, and the I added one more) Now Peter might have more insight, as he has modified the code more recently that I did. Cheers. -- Robert PS: And yes, there are occurrences of list manipulations in virt-dma that should be protected by vc.lock as you pointed out.