From: Sean Paul <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
To: "Noralf Trønnes" <noralf-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
Cc: David1.Zhou-5C7GfCeVMHo@public.gmane.org,
oleksandr_andrushchenko-uRwfk40T5oI@public.gmane.org,
intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
alexander.deucher-5C7GfCeVMHo@public.gmane.org,
airlied-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org,
christian.koenig-5C7GfCeVMHo@public.gmane.org
Subject: Re: [PATCH 2/6] drm/drv: Prepare to remove drm_dev_unplug()
Date: Thu, 7 Feb 2019 16:07:33 -0500 [thread overview]
Message-ID: <20190207210733.GE114153@art_vandelay> (raw)
In-Reply-To: <20190203154200.61479-3-noralf-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
On Sun, Feb 03, 2019 at 04:41:56PM +0100, Noralf Trønnes wrote:
> The only thing now that makes drm_dev_unplug() special is that it sets
> drm_device->unplugged. Move this code to drm_dev_unregister() so that we
> can remove drm_dev_unplug().
>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> ---
>
> Maybe s/unplugged/unregistered/ ?
>
> I looked at drm_device->registered, but using that would mean that
> drm_dev_is_unplugged() would return before drm_device is registered.
> And given that its current purpose is to prevent race against connector
> registration, I stayed away from it.
Makes sense. I think having unregistered along with registered might cause some
confusion unless it's really clearly documented. Perhaps
s/unplugged/unregistered/ and s/registered/initialized/ but init has its own
meaning...
I'd hate to hold up the patchset over naming bikeshed, so maybe this would be
better off as a follow-on series where everyone can pile on opinions. So,
Reviewed-by: Sean Paul <sean@poorly.run>
>
> Noralf.
>
>
> drivers/gpu/drm/drm_drv.c | 27 +++++++++++++++------------
> include/drm/drm_drv.h | 10 ++++------
> 2 files changed, 19 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 05bbc2b622fc..e0941200edc6 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -366,15 +366,6 @@ EXPORT_SYMBOL(drm_dev_exit);
> */
> void drm_dev_unplug(struct drm_device *dev)
> {
> - /*
> - * After synchronizing any critical read section is guaranteed to see
> - * the new value of ->unplugged, and any critical section which might
> - * still have seen the old value of ->unplugged is guaranteed to have
> - * finished.
> - */
> - dev->unplugged = true;
> - synchronize_srcu(&drm_unplug_srcu);
> -
> drm_dev_unregister(dev);
> drm_dev_put(dev);
> }
> @@ -832,11 +823,14 @@ EXPORT_SYMBOL(drm_dev_register);
> * drm_dev_register() but does not deallocate the device. The caller must call
> * drm_dev_put() to drop their final reference.
> *
> - * A special form of unregistering for hotpluggable devices is drm_dev_unplug(),
> - * which can be called while there are still open users of @dev.
> + * This function can be called while there are still open users of @dev as long
> + * as the driver protects its device resources using drm_dev_enter() and
> + * drm_dev_exit().
> *
> * This should be called first in the device teardown code to make sure
> - * userspace can't access the device instance any more.
> + * userspace can't access the device instance any more. Drivers that support
> + * device unplug will probably want to call drm_atomic_helper_shutdown() first
> + * in order to disable the hardware on regular driver module unload.
> */
> void drm_dev_unregister(struct drm_device *dev)
> {
> @@ -845,6 +839,15 @@ void drm_dev_unregister(struct drm_device *dev)
> if (drm_core_check_feature(dev, DRIVER_LEGACY))
> drm_lastclose(dev);
>
> + /*
> + * After synchronizing any critical read section is guaranteed to see
> + * the new value of ->unplugged, and any critical section which might
> + * still have seen the old value of ->unplugged is guaranteed to have
> + * finished.
> + */
> + dev->unplugged = true;
> + synchronize_srcu(&drm_unplug_srcu);
> +
> dev->registered = false;
>
> drm_client_dev_unregister(dev);
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index ca46a45a9cce..c50696c82a42 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -736,13 +736,11 @@ void drm_dev_unplug(struct drm_device *dev);
> * drm_dev_is_unplugged - is a DRM device unplugged
> * @dev: DRM device
> *
> - * This function can be called to check whether a hotpluggable is unplugged.
> - * Unplugging itself is singalled through drm_dev_unplug(). If a device is
> - * unplugged, these two functions guarantee that any store before calling
> - * drm_dev_unplug() is visible to callers of this function after it completes
> + * This function can be called to check whether @dev is unregistered. This can
> + * be used to detect that the underlying parent device is gone.
> *
> - * WARNING: This function fundamentally races against drm_dev_unplug(). It is
> - * recommended that drivers instead use the underlying drm_dev_enter() and
> + * WARNING: This function fundamentally races against drm_dev_unregister(). It
> + * is recommended that drivers instead use the underlying drm_dev_enter() and
> * drm_dev_exit() function pairs.
> */
> static inline bool drm_dev_is_unplugged(struct drm_device *dev)
> --
> 2.20.1
>
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2019-02-07 21:07 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-03 15:41 [PATCH 0/6] drm/drv: Remove drm_dev_unplug() Noralf Trønnes
2019-02-03 15:41 ` [PATCH 1/6] drm: Fix drm_release() and device unplug Noralf Trønnes
[not found] ` <20190203154200.61479-2-noralf-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
2019-02-04 10:17 ` Oleksandr Andrushchenko
2019-02-07 21:00 ` Sean Paul
2019-02-03 15:41 ` [PATCH 2/6] drm/drv: Prepare to remove drm_dev_unplug() Noralf Trønnes
[not found] ` <20190203154200.61479-3-noralf-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
2019-02-04 10:19 ` Oleksandr Andrushchenko
2019-02-04 15:41 ` [Intel-gfx] " Daniel Vetter
[not found] ` <20190204154153.GT3271-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-02-04 17:35 ` Noralf Trønnes
[not found] ` <fd6ab7d7-2f50-14bb-07f4-b25c9fe0892e-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
2019-02-05 9:11 ` Daniel Vetter
[not found] ` <20190205091118.GC3271-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-02-05 10:20 ` Noralf Trønnes
2019-02-05 16:31 ` Daniel Vetter
[not found] ` <20190205163144.GF3271-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-02-05 17:57 ` Noralf Trønnes
2019-02-06 15:26 ` Daniel Vetter
[not found] ` <20190206152626.GI3271-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-02-06 16:46 ` [Intel-gfx] " Noralf Trønnes
2019-02-06 20:36 ` Daniel Vetter
2019-02-06 18:10 ` [Intel-gfx] " Eric Anholt
2019-02-07 21:07 ` Sean Paul [this message]
2019-02-07 21:52 ` Sean Paul
2019-02-03 15:41 ` [PATCH 3/6] drm/amd: Use drm_dev_unregister() Noralf Trønnes
2019-02-03 15:41 ` [PATCH 4/6] drm/udl: " Noralf Trønnes
2019-02-07 21:07 ` Sean Paul
2019-02-03 15:41 ` [PATCH 5/6] drm/xen: " Noralf Trønnes
[not found] ` <20190203154200.61479-6-noralf-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
2019-02-04 10:42 ` Oleksandr Andrushchenko
2019-02-04 13:13 ` Noralf Trønnes
2019-02-03 15:42 ` [PATCH 6/6] drm/drv: Remove drm_dev_unplug() Noralf Trønnes
[not found] ` <20190203154200.61479-7-noralf-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
2019-02-04 10:44 ` Oleksandr Andrushchenko
2019-02-07 21:08 ` Sean Paul
2019-02-03 16:12 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-02-03 17:59 ` ✓ Fi.CI.IGT: " Patchwork
2019-02-04 10:05 ` [PATCH 0/6] " Daniel Vetter
2019-02-04 12:45 ` Koenig, Christian
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=20190207210733.GE114153@art_vandelay \
--to=sean-p7ytbzm4h96eqtr555yldq@public.gmane.org \
--cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
--cc=airlied-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=noralf-L59+Z2yzLopAfugRpC6u6w@public.gmane.org \
--cc=oleksandr_andrushchenko-uRwfk40T5oI@public.gmane.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