public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Zahari Doychev <zax@zaxnet.org>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Kamil Debski <kamil@wypas.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Zahari Doychev <zahari.doychev@linux.com>,
	linux-media@vger.kernel.org,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Subject: Re: [PATCH 2/2] [media] m2m: fix bad unlock balance
Date: Mon, 17 Aug 2015 09:37:24 +0200	[thread overview]
Message-ID: <20150817073723.GB22469@mail> (raw)
In-Reply-To: <55CDD7BF.8070105@xs4all.nl>

On Fri, Aug 14, 2015 at 01:57:51PM +0200, Hans Verkuil wrote:
> On 08/12/2015 05:50 PM, Kamil Debski wrote:
> > Hi,
> > 
> > On 12 August 2015 at 13:42, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
> >> Hello Hans,
> >>
> >> I'm sorry for a delay. Once again I've been busy with some other internal
> >> stuff.
> >>
> >> On 2015-07-28 11:02, Hans Verkuil wrote:
> >>>
> >>> Kamil, Marek,
> >>>
> >>> Why does v4l2_m2m_poll unlock and lock in that function?
> >>
> >>
> >> I've checked the code and indeed the poll_wait() function doesn't do
> >> anything that
> >> should not be done with queue mutex being taken. I don't remember if it was
> >> always
> >> like that. You are right that the unlock&lock code should be removed.
> >>
> >>> Zahari is right that the locking is unbalanced, but I don't see the reason
> >>> for the unlock/lock sequence in the first place. I'm wondering if that
> >>> shouldn't just be removed.
> >>>
> >>> Am I missing something?
> >>>
> >>> Instead, I would expect to see a spin_lock_irqsave(&src/dst_q->done_lock,
> >>> flags)
> >>> around the list_empty(&src/dst_q->done_list) calls.
> >>
> >>
> >> Indeed, that's another thing that should be fixed in this function. I looks
> >> that
> >> commit c16218402a000bb25c1277c43ae98c11bcb59bd1 ("[media] videobuf2: return
> >> -EPIPE
> >> from DQBUF after the last buffer") is the root cause of both issues
> >> (unballanced
> >> locking and lack of spinlock protection), while the unnecessary queue
> >> unlock/lock
> >> sequence was there from the beginning.
> >>
> > 
> > I am all with Marek on this. Unlock/lock was there from the beginning,
> > it is not necessary. I agree also that spin_lock/unlock should be
> > added for the list_empty call.
> 
> Zahari, will you make a new version of this patch with the suggested changes?

yes I will do it.

Regards

Zahari

> 
> Regards,
> 
> 	Hans
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-08-17  7:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-08 13:37 [PATCH 0/2] RFC: m2m device fixes Zahari Doychev
2015-07-08 13:37 ` [PATCH 1/2] [media] coda: fix sequence counter increment Zahari Doychev
2015-07-08 15:49   ` Philipp Zabel
2015-07-28  8:54     ` Hans Verkuil
2015-07-28 10:25       ` Philipp Zabel
2015-08-03  6:24         ` Zahari Doychev
2015-07-08 13:37 ` [PATCH 2/2] [media] m2m: fix bad unlock balance Zahari Doychev
2015-07-28  9:02   ` Hans Verkuil
2015-08-12 11:42     ` Marek Szyprowski
2015-08-12 15:50       ` Kamil Debski
2015-08-14 11:57         ` Hans Verkuil
2015-08-17  7:37           ` Zahari Doychev [this message]
2015-07-28  9:03   ` Hans Verkuil

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=20150817073723.GB22469@mail \
    --to=zax@zaxnet.org \
    --cc=hverkuil@xs4all.nl \
    --cc=kamil@wypas.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@osg.samsung.com \
    --cc=p.zabel@pengutronix.de \
    --cc=zahari.doychev@linux.com \
    /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