From: Daniel Vetter <daniel@ffwll.ch>
To: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
DRI Development <dri-devel@lists.freedesktop.org>,
Daniel Vetter <daniel.vetter@intel.com>,
Emil Velikov <emil.velikov@collabora.com>
Subject: Re: [PATCH] drm/crc-debugfs: User irqsafe spinlock in drm_crtc_add_crc_entry
Date: Thu, 6 Jun 2019 11:35:05 +0200 [thread overview]
Message-ID: <20190606093505.GZ21222@phenom.ffwll.local> (raw)
In-Reply-To: <CA+M3ks41OnehTCHxz2TwJ3DA1ODNLNFhPsFs-k0bLX6Brye6sw@mail.gmail.com>
On Thu, Jun 06, 2019 at 10:27:23AM +0200, Benjamin Gaignard wrote:
> Le jeu. 6 juin 2019 à 10:12, Ville Syrjälä
> <ville.syrjala@linux.intel.com> a écrit :
> >
> > On Wed, Jun 05, 2019 at 09:45:56PM +0200, Daniel Vetter wrote:
> > > We can be called from any context, we need to be prepared.
> > >
> > > Noticed this while hacking on vkms, which calls this function from a
> > > normal worker. Which really upsets lockdep.
> > >
> > > Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > > Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> > > Cc: Emil Velikov <emil.velikov@collabora.com>
> > > Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> > > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> >
> > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Thanks for taking a look, patch pushed to drm-misc-next.
-Daniel
>
> >
> > > ---
> > > drivers/gpu/drm/drm_debugfs_crc.c | 5 +++--
> > > 1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
> > > index 585169f0dcc5..7f35b5ba1924 100644
> > > --- a/drivers/gpu/drm/drm_debugfs_crc.c
> > > +++ b/drivers/gpu/drm/drm_debugfs_crc.c
> > > @@ -396,8 +396,9 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame,
> > > struct drm_crtc_crc *crc = &crtc->crc;
> > > struct drm_crtc_crc_entry *entry;
> > > int head, tail;
> > > + unsigned long flags;
> > >
> > > - spin_lock(&crc->lock);
> > > + spin_lock_irqsave(&crc->lock, flags);
> > >
> > > /* Caller may not have noticed yet that userspace has stopped reading */
> > > if (!crc->entries) {
> > > @@ -428,7 +429,7 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame,
> > > head = (head + 1) & (DRM_CRC_ENTRIES_NR - 1);
> > > crc->head = head;
> > >
> > > - spin_unlock(&crc->lock);
> > > + spin_unlock_irqrestore(&crc->lock, flags);
> > >
> > > wake_up_interruptible(&crc->wq);
> > >
> > > --
> > > 2.20.1
> > >
> > > _______________________________________________
> > > dri-devel mailing list
> > > dri-devel@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >
> > --
> > Ville Syrjälä
> > Intel
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-06-06 9:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-05 19:45 [PATCH] drm/crc-debugfs: User irqsafe spinlock in drm_crtc_add_crc_entry Daniel Vetter
2019-06-05 20:02 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2019-06-05 20:24 ` ✓ Fi.CI.BAT: success " Patchwork
2019-06-06 8:12 ` [PATCH] " Ville Syrjälä
2019-06-06 8:27 ` Benjamin Gaignard
2019-06-06 9:35 ` Daniel Vetter [this message]
2019-06-07 16:24 ` ✓ Fi.CI.IGT: success for " Patchwork
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=20190606093505.GZ21222@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=benjamin.gaignard@linaro.org \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.velikov@collabora.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=rodrigosiqueiramelo@gmail.com \
--cc=tomeu.vizoso@collabora.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