From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
To: Sean Anderson <sean.anderson@linux.dev>
Cc: Michal Simek <michal.simek@amd.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
dmaengine@vger.kernel.org, Vinod Koul <vkoul@kernel.org>
Subject: Re: [PATCH 3/3] dma: Add lockdep asserts to virt-dma
Date: Wed, 27 Mar 2024 14:29:02 +0200 [thread overview]
Message-ID: <a4053c39-3781-4fc4-9c5e-45f32b5525ed@ideasonboard.com> (raw)
In-Reply-To: <20240308210034.3634938-4-sean.anderson@linux.dev>
On 08/03/2024 23:00, Sean Anderson wrote:
> Add lockdep asserts to all functions with "vc.lock must be held by
> caller" in their documentation. This will help catch cases where these
> assumptions do not hold.
>
> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> ---
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Tomi
> drivers/dma/virt-dma.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h
> index e9f5250fbe4d..59d9eabc8b67 100644
> --- a/drivers/dma/virt-dma.h
> +++ b/drivers/dma/virt-dma.h
> @@ -81,6 +81,8 @@ static inline struct dma_async_tx_descriptor *vchan_tx_prep(struct virt_dma_chan
> */
> static inline bool vchan_issue_pending(struct virt_dma_chan *vc)
> {
> + lockdep_assert_held(&vc->lock);
> +
> list_splice_tail_init(&vc->desc_submitted, &vc->desc_issued);
> return !list_empty(&vc->desc_issued);
> }
> @@ -96,6 +98,8 @@ static inline void vchan_cookie_complete(struct virt_dma_desc *vd)
> struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan);
> dma_cookie_t cookie;
>
> + lockdep_assert_held(&vc->lock);
> +
> cookie = vd->tx.cookie;
> dma_cookie_complete(&vd->tx);
> dev_vdbg(vc->chan.device->dev, "txd %p[%x]: marked complete\n",
> @@ -146,6 +150,8 @@ static inline void vchan_terminate_vdesc(struct virt_dma_desc *vd)
> {
> struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan);
>
> + lockdep_assert_held(&vc->lock);
> +
> list_add_tail(&vd->node, &vc->desc_terminated);
>
> if (vc->cyclic == vd)
> @@ -160,6 +166,8 @@ static inline void vchan_terminate_vdesc(struct virt_dma_desc *vd)
> */
> static inline struct virt_dma_desc *vchan_next_desc(struct virt_dma_chan *vc)
> {
> + lockdep_assert_held(&vc->lock);
> +
> return list_first_entry_or_null(&vc->desc_issued,
> struct virt_dma_desc, node);
> }
> @@ -177,6 +185,8 @@ static inline struct virt_dma_desc *vchan_next_desc(struct virt_dma_chan *vc)
> static inline void vchan_get_all_descriptors(struct virt_dma_chan *vc,
> struct list_head *head)
> {
> + lockdep_assert_held(&vc->lock);
> +
> list_splice_tail_init(&vc->desc_allocated, head);
> list_splice_tail_init(&vc->desc_submitted, head);
> list_splice_tail_init(&vc->desc_issued, head);
next prev parent reply other threads:[~2024-03-27 12:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 21:00 [PATCH 0/3] dma: xilinx_dpdma: Fix locking Sean Anderson
2024-03-08 21:00 ` [PATCH 1/3] " Sean Anderson
2024-03-27 11:57 ` Tomi Valkeinen
2024-03-08 21:00 ` [PATCH 2/3] dma: xilinx_dpdma: Remove unnecessary use of irqsave/restore Sean Anderson
2024-03-27 12:27 ` Tomi Valkeinen
2024-03-28 15:00 ` Sean Anderson
2024-03-28 16:37 ` Tomi Valkeinen
2024-03-08 21:00 ` [PATCH 3/3] dma: Add lockdep asserts to virt-dma Sean Anderson
2024-03-27 12:29 ` Tomi Valkeinen [this message]
2024-04-07 16:38 ` [PATCH 0/3] dma: xilinx_dpdma: Fix locking Vinod Koul
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=a4053c39-3781-4fc4-9c5e-45f32b5525ed@ideasonboard.com \
--to=tomi.valkeinen@ideasonboard.com \
--cc=dmaengine@vger.kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=sean.anderson@linux.dev \
--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®