mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Schwarz <eas@sw-optimization.com>
To: Olivier Dautricourt <olivierdautricourt@gmail.com>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vinod Koul <vkoul@kernel.org>, Stefan Roese <sr@denx.de>
Subject: Re: [PATCH] dmaengine: altera-msgdma: fix descriptors freeing logic
Date: Fri, 22 Sep 2023 09:49:59 +0200	[thread overview]
Message-ID: <8d18106d-444e-9346-26cc-3767540df5d8@sw-optimization.com> (raw)
In-Reply-To: <ZQyWsvcQCJgmG5aO@freebase>

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

  reply	other threads:[~2023-09-22  7:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20 19:58 Olivier Dautricourt
2023-09-21 13:07 ` Eric Schwarz
2023-09-21 19:17   ` Olivier Dautricourt
2023-09-22  7:49     ` Eric Schwarz [this message]
2023-09-22 16:33       ` Olivier Dautricourt
2023-09-28  7:57         ` Eric Schwarz
2024-02-25 20:05           ` Eric Schwarz
2024-04-09  3:09             ` Olivier Dautricourt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d18106d-444e-9346-26cc-3767540df5d8@sw-optimization.com \
    --to=eas@sw-optimization.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olivierdautricourt@gmail.com \
    --cc=sr@denx.de \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®