From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1426967AbcBSIPZ (ORCPT ); Fri, 19 Feb 2016 03:15:25 -0500 Received: from smtp-out-208.synserver.de ([212.40.185.208]:1421 "EHLO smtp-out-033.synserver.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1425589AbcBSIPW (ORCPT ); Fri, 19 Feb 2016 03:15:22 -0500 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 4360 Subject: Re: [PATCH] dmaengine: pl330: initialize tasklet after spin_unlock_irqrestore To: Anand Moon , Krzysztof Kozlowski References: <1455816110-2799-1-git-send-email-linux.amoon@gmail.com> <56C6C239.3080000@samsung.com> Cc: Vinod Koul , Dan Williams , dmaengine@vger.kernel.org, Linux Kernel From: Lars-Peter Clausen Message-ID: <56C6CF16.9000908@metafoo.de> Date: Fri, 19 Feb 2016 09:15:18 +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: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/19/2016 09:10 AM, Anand Moon wrote: > Hi Krzysztof, > > On 19 February 2016 at 12:50, Krzysztof Kozlowski > wrote: >> On 19.02.2016 15:39, Anand Moon wrote: >>> Hi Krzysztof, >>> >>> On 19 February 2016 at 11:36, Krzysztof Kozlowski >>> wrote: >>>> 2016-02-19 2:21 GMT+09:00 Anand Moon : >>>>> From: Anand Moon >>>>> >>>>> pl330_tasklet tasklet uses the same spinlock pch->lock for safe IRQ locking. >>>>> It's safe to initialize pl330_tasklet tasklet after release of the locking. >>>> >>>> This is tasklet init, not tasklet execution (which you are referring >>>> to in first sentence). I don't get how usage of spinlock during >>>> execution guarantees the safeness during init... Please describe why >>>> this is safe. >>>> >>>> Best regards, >>>> Krzysztof >>>> >>> >>> http://lxr.free-electrons.com/source/drivers/dma/pl330.c#L1972 >>> >>> pl330_tasklet function which is initiated by tasklet_init is trying to lock >>> using same spin_unlock_irqsave/restore pch->lock. >> >> tasklet_init does not call pl330_tasklet (if this is what you mean by >> "initiated"). What is the correlation? Why are you referring to the >> locks in pl330_tasklet? >> >>> So better release the pch->lock and then initialize the tasklet_init. >> >> Why "better"? >> >> Best regards, >> Krzysztof >> > > On SMP arch, tasklet_init could spawn the pl330_tasklet routine, > it could be any CPU which could take up this task. > So just for good timing of Initialization of the pl330_tasklet after > spin_unlock_irqrestore. > That is what I can figure out. Hi, tasklet_init() does not spwan the tasklet function, tasklet_schedule() does that. But there is still room for optimization here. If you want to move the tasklet_init() call please move it into pl330_probe() next to where the channel is allocated. There is no need to re-initialize the tasklet each time the channel is requested. - Lars