mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liviu Dudau <Liviu.Dudau@arm.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Russell King - ARM Linux <linux@armlinux.org.uk>,
	David Airlie <airlied@linux.ie>,
	DRI devel <dri-devel@lists.freedesktop.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/i2c: tda998x: Fix lockdep warning about possible circular dependency
Date: Thu, 20 Jul 2017 16:06:28 +0100	[thread overview]
Message-ID: <20170720150628.GE3532@e110455-lin.cambridge.arm.com> (raw)
In-Reply-To: <CAKMK7uEcTGnRFjzGG78QcdRE36yiys0F0CYCkgyqtDfyV6S53Q@mail.gmail.com>

On Thu, Jul 20, 2017 at 04:57:12PM +0200, Daniel Vetter wrote:
> On Thu, Jul 20, 2017 at 4:40 PM, Liviu Dudau <Liviu.Dudau@arm.com> wrote:
> > On Thu, Jul 20, 2017 at 03:24:13PM +0100, Russell King - ARM Linux wrote:
> >> On Thu, Jul 20, 2017 at 03:19:10PM +0100, Liviu Dudau wrote:
> >> > On Thu, Jul 20, 2017 at 02:08:29PM +0100, Russell King - ARM Linux wrote:
> >> > > On Thu, Jul 20, 2017 at 01:54:04PM +0100, Liviu Dudau wrote:
> >> > > > On Thu, Jul 20, 2017 at 12:44:49PM +0100, Russell King - ARM Linux wrote:
> >> > > > > Actually, scrub that idea - drm_helper_probe_single_connector_modes()
> >> > > > > calls drm_edid_to_eld() for these cases anyway, so we must call
> >> > > > > drm_helper_probe_single_connector_modes() with the audio_mutex held.
> >> > > >
> >> > > > OK, so the lockdep warning is spurious?
> >> > >
> >> > > I don't think so.  I think there's two ways to solve this:
> >> > >
> >> > > 1. replace the audio_mutex in tda998x_audio_get_eld() and
> >> > >    tda998x_connector_fill_modes() with a new mutex (eld_mutex) to
> >> > >    protect just the ELD.
> >> > >
> >> > > 2. remove the mutex from these two functions, and take the connection_mutex
> >> > >    modeset lock in tda998x_audio_get_eld().
> >> > >
> >> > > However, I don't have a view on which would be best.
> >> >
> >> > If you don't mind, I took the liberty of picking option 2, just because
> >> > I don't like adding new locks when existing ones might do the job.
> >>
> >> I don't mind - but one question for the DRM people in connection with
> >> your patch is whether we need the acquire context for this relatively
> >> simple lock/copy/unlock sequence.  This path for getting the ELD
> >> shouldn't be holding any other DRM locks.
> >
> > Cc-ing Daniel Vetter in hope of clarifications / nod of approval.
> > However, I can only see my emails in the online dri-devel archive, not
> > yours, so I can't point him to the whole discussion.
> >
> > danvet: a while ago while I was debugging the delayed fb setup I found
> > a lockdep warning with the tda998x driver. Now I've had some more time
> > to investigate so I have created a patch trying to fix the issue, which
> > was on v1 just a re-ordering of places where tda998x's audio_mutex lock
> > was taken. Russell suggested a different approach, which I have
> > implemented in [1], but we wonder if we really have to go through the
> > whole dance.
> 
> If all you do is take only one ww mutex (wrapped up in
> drm_modeset_lock for kms) then you can pass a NULL acquire context.
> The context is only needed when you want to take multiple locks at the
> same time (to be able to resolve deadlocks). Taking a single lock
> within the modeset lock class can't deadlock.

Hi Daniel,

Thanks for clarification. I'll post a v3 with a NULL acquire context.

Best regards,
Liviu

> 
> Reading the kerneldoc that's not explained at all :-( Can you pls type
> a patch to improve the docs for drm_modeset_lock?
> 
> Thanks, Daniel
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

      reply	other threads:[~2017-07-20 15:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20 11:04 Liviu Dudau
2017-07-20 11:38 ` Russell King - ARM Linux
2017-07-20 11:44   ` Russell King - ARM Linux
2017-07-20 12:54     ` Liviu Dudau
2017-07-20 13:08       ` Russell King - ARM Linux
2017-07-20 14:19         ` Liviu Dudau
2017-07-20 14:24           ` Russell King - ARM Linux
2017-07-20 14:40             ` Liviu Dudau
2017-07-20 14:57               ` Daniel Vetter
2017-07-20 15:06                 ` Liviu Dudau [this message]

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=20170720150628.GE3532@e110455-lin.cambridge.arm.com \
    --to=liviu.dudau@arm.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    /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®