From: Daniel Vetter <daniel@ffwll.ch>
To: Egbert Eich <eich@suse.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/4] drm: Add a non-locking version of drm_kms_helper_poll_enable().
Date: Wed, 2 Sep 2015 13:57:26 +0200 [thread overview]
Message-ID: <20150902115726.GA1367@phenom.ffwll.local> (raw)
In-Reply-To: <1441138895-23732-2-git-send-email-eich@suse.de>
On Tue, Sep 01, 2015 at 10:21:32PM +0200, Egbert Eich wrote:
> drm_kms_helper_poll_enable() was converted to lock the mode_config
> mutex in commit 8c4ccc4ab6f64e859d4ff8d7c02c2ed2e956e07f
> ("drm/probe-helper: Grab mode_config.mutex in poll_init/enable").
>
> This disregarded the cases where this function is called from a context
> where this mutex is already locked.
>
> Add a non-locking version as well.
>
> Signed-off-by: Egbert Eich <eich@suse.de>
> ---
> drivers/gpu/drm/drm_probe_helper.c | 19 ++++++++++++++++---
> include/drm/drm_crtc_helper.h | 1 +
> 2 files changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> index d734780..a93ad1b 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -93,8 +93,19 @@ static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector)
> return 1;
> }
>
> +/**
> + * drm_kms_helper_poll_enable_no_lock - re-enable output polling.
> + * @dev: drm_device
> + *
> + * This function re-enables the output polling work without
> + * locking the mode_config mutex.
> + *
> + * This is like drm_kms_helper_poll_enable() however it is to be
> + * called from a context where the mode_config mutex is locked
> + * already.
> + */
> #define DRM_OUTPUT_POLL_PERIOD (10*HZ)
> -static void __drm_kms_helper_poll_enable(struct drm_device *dev)
> +void drm_kms_helper_poll_enable_no_lock(struct drm_device *dev)
Please use _locked to stay consistent with other such functions. With that
address this lgtm.
-Daniel
> {
> bool poll = false;
> struct drm_connector *connector;
> @@ -113,6 +124,8 @@ static void __drm_kms_helper_poll_enable(struct drm_device *dev)
> if (poll)
> schedule_delayed_work(&dev->mode_config.output_poll_work, DRM_OUTPUT_POLL_PERIOD);
> }
> +EXPORT_SYMBOL(drm_kms_helper_poll_enable_no_lock);
> +
>
> static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connector *connector,
> uint32_t maxX, uint32_t maxY, bool merge_type_bits)
> @@ -174,7 +187,7 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect
>
> /* Re-enable polling in case the global poll config changed. */
> if (drm_kms_helper_poll != dev->mode_config.poll_running)
> - __drm_kms_helper_poll_enable(dev);
> + drm_kms_helper_poll_enable_no_lock(dev);
>
> dev->mode_config.poll_running = drm_kms_helper_poll;
>
> @@ -428,7 +441,7 @@ EXPORT_SYMBOL(drm_kms_helper_poll_disable);
> void drm_kms_helper_poll_enable(struct drm_device *dev)
> {
> mutex_lock(&dev->mode_config.mutex);
> - __drm_kms_helper_poll_enable(dev);
> + drm_kms_helper_poll_enable_no_lock(dev);
> mutex_unlock(&dev->mode_config.mutex);
> }
> EXPORT_SYMBOL(drm_kms_helper_poll_enable);
> diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
> index 2a747a9..f96703d 100644
> --- a/include/drm/drm_crtc_helper.h
> +++ b/include/drm/drm_crtc_helper.h
> @@ -240,5 +240,6 @@ extern void drm_kms_helper_hotplug_event(struct drm_device *dev);
>
> extern void drm_kms_helper_poll_disable(struct drm_device *dev);
> extern void drm_kms_helper_poll_enable(struct drm_device *dev);
> +extern void drm_kms_helper_poll_enable_no_lock(struct drm_device *dev);
>
> #endif
> --
> 1.8.4.5
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-09-02 11:57 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-01 20:21 [PATCH 0/4] Fix numerous issues with HPDstorm handling Egbert Eich
2015-09-01 20:21 ` [PATCH 1/4] drm: Add a non-locking version of drm_kms_helper_poll_enable() Egbert Eich
2015-09-01 21:27 ` Lukas Wunner
2015-09-01 22:10 ` Egbert Eich
2015-09-01 22:31 ` Lukas Wunner
2015-09-02 4:57 ` Egbert Eich
2015-09-01 22:50 ` Egbert Eich
2015-09-02 11:57 ` Daniel Vetter [this message]
2015-09-01 20:21 ` [PATCH 2/4] drm/i915: Call " Egbert Eich
2015-09-02 11:58 ` Daniel Vetter
2015-09-23 14:13 ` [PATCH 1/2] drm: Add a non-locking version of drm_kms_helper_poll_enable(), v2 Egbert Eich
2015-09-23 14:13 ` [PATCH 2/2] drm/i915: Call " Egbert Eich
2015-09-23 14:50 ` [PATCH 1/2] drm: Add a " Daniel Vetter
2015-09-24 12:46 ` Jani Nikula
2015-09-25 6:00 ` Egbert Eich
2015-09-25 7:52 ` Jani Nikula
2015-09-29 14:35 ` Jani Nikula
2015-09-30 8:38 ` Jani Nikula
2015-09-01 20:21 ` [PATCH 3/4] drm/i915: Use the correct hpd_status list for non-G4xx/VLV Egbert Eich
2015-09-02 12:00 ` Daniel Vetter
2015-09-02 12:25 ` Imre Deak
2015-09-02 13:42 ` Jani Nikula
2015-09-01 20:21 ` [PATCH 4/4] drm/i915: Avoid race of intel_crt_detect_hotplug() with HPD interrupt Egbert Eich
2015-09-02 12:06 ` Daniel Vetter
2015-09-02 14:19 ` Egbert Eich
2015-09-02 14:32 ` Jani Nikula
2015-09-02 14:58 ` Egbert Eich
2015-09-02 14:46 ` Daniel Vetter
2015-09-02 15:17 ` Egbert Eich
2015-09-23 14:15 ` [PATCH] drm/i915: Avoid race of intel_crt_detect_hotplug() with HPD interrupt, v2 Egbert Eich
2015-09-23 14:57 ` Daniel Vetter
2015-09-23 15:43 ` Egbert Eich
2015-09-25 6:09 ` [PATCH] drm/i915: On reset/suspend disable hpd pins & cancel pending delayed work Egbert Eich
2015-09-25 12:29 ` Ville Syrjälä
2015-09-28 7:36 ` Daniel Vetter
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=20150902115726.GA1367@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=daniel.vetter@ffwll.ch \
--cc=eich@suse.de \
--cc=intel-gfx@lists.freedesktop.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