dmaengine Archive on lore.kernel.org
 help / color / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: dmaengine@vger.kernel.org, Peter Ujfalusi <peter.ujfalusi@ti.com>,
	Vinod Koul <vkoul@kernel.org>,
	kernel@pengutronix.de
Subject: Re: vchan helper broken wrt locking
Date: Wed, 04 Dec 2019 09:45:57 +0100
Message-ID: <87wobcxyuy.fsf@belgarion.home> (raw)
In-Reply-To: <20191203115050.yvpaehsrck6zydmk@pengutronix.de> (Sascha Hauer's message of "Tue, 3 Dec 2019 12:50:50 +0100")

Sascha Hauer <s.hauer@pengutronix.de> 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.

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 11:50 Sascha Hauer
2019-12-04  8:45 ` Robert Jarzmik [this message]
2019-12-04 11:47 ` Peter Ujfalusi
2019-12-04 14:01   ` Vinod Koul
2019-12-04 15:51   ` Sascha Hauer

Reply instructions:

You may reply publically 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=87wobcxyuy.fsf@belgarion.home \
    --to=robert.jarzmik@free.fr \
    --cc=dmaengine@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=peter.ujfalusi@ti.com \
    --cc=s.hauer@pengutronix.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

dmaengine Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dmaengine/0 dmaengine/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dmaengine dmaengine/ https://lore.kernel.org/dmaengine \
		dmaengine@vger.kernel.org
	public-inbox-index dmaengine

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.dmaengine


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git