Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2654034rdb; Fri, 22 Sep 2023 05:12:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGf81v8rFUYzNP3mFMmPX+XSKLFhg3A4PrKhivINt8h/Epy3GlsV/n3qWh3EfqltHnpoe70 X-Received: by 2002:a05:6a21:7895:b0:123:149b:a34f with SMTP id bf21-20020a056a21789500b00123149ba34fmr8466320pzc.1.1695384773905; Fri, 22 Sep 2023 05:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695384773; cv=none; d=google.com; s=arc-20160816; b=RFeYNtb6XHXvYFbJ3d9pJrNGPdw0qiGlsdyket+lgiXh2eUUeTXGGPiuoob5fgKRKO Ic3++iEpBHTZhjrcrf1rpApg97i/KLx8SF0xKYL/0qTvDuKpNbLLmUT+3nZnEMS0gSD1 J3VoVhdSYq5ntFwNW4KQ1DLRAxQ1biAlcmF0mAS5C+0/YO4+u1+oG9aHtGguTG3ZhzRr gJD0LM1GRL736ox51cqdvO9U6zyJAX3VjLoVlTBsWkkEUWOJuF5yKUOFJG1Nykle88LS 0Iay/EcVejiDzvXicvAwACwtGrH0gx6vQssF3pk9yjr6SYvkJ/unJtRHrMwy536EAnje f35Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=4cbMygGp9uogMxBbKSPpHm/fjDurwwZEgvsXEFU9RNA=; fh=N0RYM3Alz4ogp9681eZ/03ZhimB0dle7gQaqXsIe22g=; b=b9Q2Ncfh2Tinl1PQdt0ZCsYkbpHQfY1wGQUKN+nLgfbEFtdTKQgDhHAS+ceiVsqeQ8 osGTNF/gR3aIkoOIZa0d5zUcMjwx97cIG9o04hX2Kqy2V3teY46AemFQGdv2yA4+Anjx r56l/DKDINbk99xhCr+Ls/tIIltYzUolYndRnp+KqKk5xF6Ik32LTp5BeQu0PfG1LY7W jztqY5uvBoC2khlC6YOGVfuJyp1iOlZQEscmH1+xTYaknsf0ZeNhRh+5O4x//Twogn07 pH4aVMde8XnqPeo4RTcP9iP7J5WoF6neh3uUgH0EDQ2pmUY4GbqHH4QH/qBCBpwoaU/C qYwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sw-optimization.com header.s=dkim11 header.b=wEdMDiiN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sw-optimization.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u8-20020a056a00158800b00690f8ed35dbsi3952817pfk.345.2023.09.22.05.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 05:12:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=fail header.i=@sw-optimization.com header.s=dkim11 header.b=wEdMDiiN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sw-optimization.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E707E8370815; Fri, 22 Sep 2023 00:50:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231789AbjIVHuM (ORCPT + 99 others); Fri, 22 Sep 2023 03:50:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231787AbjIVHuL (ORCPT ); Fri, 22 Sep 2023 03:50:11 -0400 Received: from mx12lb.world4you.com (mx12lb.world4you.com [81.19.149.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAE8F19C; Fri, 22 Sep 2023 00:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sw-optimization.com; s=dkim11; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4cbMygGp9uogMxBbKSPpHm/fjDurwwZEgvsXEFU9RNA=; b=wEdMDiiNDDdZqiLCicthKEUI+0 WTtV7XdnyB2Jq0z1Igwdaa64pw6JbaIoincNcfX4LgexUUoBirew/mSisrzfcX/8DxD7Hq8JBNyfA FWPywOSDVfMVYpBYpZgaWBFtypfTBC/rr961QllnOKIfCF/aq9FkuU04EHpSsj1HgjRU=; Received: from [195.192.57.194] (helo=[192.168.0.20]) by mx12lb.world4you.com with esmtpa (Exim 4.96) (envelope-from ) id 1qjavJ-0001VD-2X; Fri, 22 Sep 2023 09:50:02 +0200 Message-ID: <8d18106d-444e-9346-26cc-3767540df5d8@sw-optimization.com> Date: Fri, 22 Sep 2023 09:49:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH] dmaengine: altera-msgdma: fix descriptors freeing logic To: Olivier Dautricourt Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Vinod Koul , Stefan Roese References: <20230920200636.32870-3-olivierdautricourt@gmail.com> <22402987-305b-024b-044e-53db17037d90@sw-optimization.com> Content-Language: de-DE From: Eric Schwarz In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AV-Do-Run: Yes X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 22 Sep 2023 00:50:09 -0700 (PDT) Hello Olivier, >> Am 20.09.2023 um 21:58 schrieb Olivier Dautricourt: >>> Sparse complains because we first take the lock in msgdma_tasklet -> move >>> locking to msgdma_chan_desc_cleanup. >>> In consequence, move calling of msgdma_chan_desc_cleanup outside of the >>> critical section of function msgdma_tasklet. >>> >>> Use spin_unlock_irqsave/restore instead of just spinlock/unlock to keep >>> state of irqs while executing the callbacks. >> >> What about the locking in the IRQ handler msgdma_irq_handler() itself? - >> Shouldn't spin_unlock_irqsave/restore() be used there as well instead of >> just spinlock/unlock()? > > IMO no: > It is covered by [1]("Locking Between Hard IRQ and Softirqs/Tasklets") > The irq handler cannot be preempted by the tasklet, so the > spin_lock/unlock version is ok. However the tasklet could be interrupted > by the Hard IRQ hence the disabling of irqs with save/restore when > entering critical section. > > It should not be needed to keep interrupts locally disabled while invoking > callbacks, will add this to the commit description. > > [1] https://www.kernel.org/doc/Documentation/kernel-hacking/locking.rst Thanks for the link. I have read differently here [2] w/ special emphasis on "Lesson 3: spinlocks revisited.". [2] https://www.kernel.org/doc/Documentation/locking/spinlocks.txt Cheers Eric