Skip to contentSkip to conversation

Documentation: vkms: clarify devres managed refernce cleanup

PATCH Applied Brandon Pollack 3 participants 5 messages Apr 25, 2023 – May 8, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation: vkms: clarify devres managed refernce cleanup

added documentation to drm_dev_unregister clarifying that devres managed devices allocated with devm_drm_dev_alloc do not require calls to drm_dev_put.

---

This is my first patch to any tree. I've tried my best to read as many kernel docs etc as possible (wip). This took me a moment to realize so I figured it was as good a candidate as any for a first patch (at the very least to make sure I have the whole patching process figured out). I hope to make more janitorial changes as I continue to learn leading up to the work I hope to do.

We're hoping to add multiple display hotplug output support to VKMS for testing purposes. Some work has been done already, but we'll be taking over moving forward. Our intent is to remain involved and assist in maintaining these changes.

Looking forward to your comments/advice (now and henceforth!)

---
 drivers/gpu/drm/drm_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_drv.c +3 -1
index cee0cc522ed9..12687dd9e1ac 100644
@@ -969,7 +969,9 @@ EXPORT_SYMBOL(drm_dev_register);
  *
  * Unregister the DRM device from the system. This does the reverse of
  * drm_dev_register() but does not deallocate the device. The caller must call
- * drm_dev_put() to drop their final reference.
+ * drm_dev_put() to drop their final reference, unless it is managed with devres
+ * (as devices allocated with devm_drm_dev_alloc() are), in which case there is
+ * already an unwind action registered.
  *
  * A special form of unregistering for hotpluggable devices is drm_dev_unplug(),
  * which can be called while there are still open users of @dev.
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Brandon Pollack

added documentation to drm_dev_unregister clarifying that devres managed devices allocated with devm_drm_dev_alloc do not require calls to drm_dev_put.

---

This is my first patch to any tree. I've tried my best to read as many kernel docs etc as possible (wip). This took me a moment to realize so I figured it was as good a candidate as any for a first patch (at the very least to make sure I have the whole patching process figured out). I hope to make more janitorial changes as I continue to learn leading up to the work I hope to do.

Quoted 6 lines

We're hoping to add multiple display hotplug output support to VKMS for testing purposes. Some work has been done already, but we'll be taking over moving forward. Our intent is to remain involved and assist in maintaining these changes.

Looking forward to your comments/advice (now and henceforth!)

Looking good!

Since you're @chromium.org I'm assuming that one of the cros committers will push this to drm-misc-next. If not please holler. -Daniel

Quoted 22 lines
---
 drivers/gpu/drm/drm_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_drv.c +3 -1
index cee0cc522ed9..12687dd9e1ac 100644
@@ -969,7 +969,9 @@ EXPORT_SYMBOL(drm_dev_register);
  *
  * Unregister the DRM device from the system. This does the reverse of
  * drm_dev_register() but does not deallocate the device. The caller must call
- * drm_dev_put() to drop their final reference.
+ * drm_dev_put() to drop their final reference, unless it is managed with devres
+ * (as devices allocated with devm_drm_dev_alloc() are), in which case there is
+ * already an unwind action registered.
  *
  * A special form of unregistering for hotpluggable devices is drm_dev_unplug(),
  * which can be called while there are still open users of @dev.
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#2 lore raw
Quoted 24 lines · Daniel Vetter
Quoted 15 lines · Brandon Pollack

added documentation to drm_dev_unregister clarifying that devres managed devices allocated with devm_drm_dev_alloc do not require calls to drm_dev_put.

---

This is my first patch to any tree. I've tried my best to read as many kernel docs etc as possible (wip). This took me a moment to realize so I figured it was as good a candidate as any for a first patch (at the very least to make sure I have the whole patching process figured out). I hope to make more janitorial changes as I continue to learn leading up to the work I hope to do.

Quoted 6 lines

We're hoping to add multiple display hotplug output support to VKMS for testing purposes. Some work has been done already, but we'll be taking over moving forward. Our intent is to remain involved and assist in maintaining these changes.

Looking forward to your comments/advice (now and henceforth!)

Quoted 7 lines

Looking good!

Since you're @chromium.org I'm assuming that one of the cros committers will push this to drm-misc-next. If not please holler. -Daniel

I'm actually working in relative isolation on this (I'm located in Tokyo) so please go ahead. I'll get in touch with some of those folks soon :)

Quoted 28 lines
Quoted 21 lines
---
 drivers/gpu/drm/drm_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_drv.c +3 -2
index cee0cc522ed9..12687dd9e1ac 100644
@@ -969,7 +969,9 @@ EXPORT_SYMBOL(drm_dev_register);
  *
  * Unregister the DRM device from the system. This does the reverse of
  * drm_dev_register() but does not deallocate the device. The caller must call
- * drm_dev_put() to drop their final reference.
+ * drm_dev_put() to drop their final reference, unless it is managed with devres
+ * (as devices allocated with devm_drm_dev_alloc() are), in which case there is
+ * already an unwind action registered.
  *
  * A special form of unregistering for hotpluggable devices is drm_dev_unplug(),
  * which can be called while there are still open users of @dev.
--
Quoted 2 lines

2.40.0.634.g4ca3ef3211-goog

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

#3 lore raw

Seems it might be best just to have you do this, Daniel. Thanks for the review :)

Quoted 73 lines · Brandon Ross Pollack
Quoted 3 lines · Daniel Vetter
Quoted 1 line · Brandon Pollack

added documentation to drm_dev_unregister clarifying that devres

managed

Quoted 9 lines
Quoted 9 lines

devices allocated with devm_drm_dev_alloc do not require calls to drm_dev_put.

---

This is my first patch to any tree. I've tried my best to read as many kernel docs etc as possible (wip). This took me a moment to realize so

I

Quoted 1 line
Quoted 1 line

figured it was as good a candidate as any for a first patch (at the

very

Quoted 11 lines
Quoted 10 lines

least to make sure I have the whole patching process figured out). I hope to make more janitorial changes as I continue to learn leading up to the work I hope to do.

We're hoping to add multiple display hotplug output support to VKMS for testing purposes. Some work has been done already, but we'll be taking over moving forward. Our intent is to remain involved and assist in maintaining these changes.

Looking forward to your comments/advice (now and henceforth!)

Quoted 7 lines

Looking good!

Since you're @chromium.org I'm assuming that one of the cros committers will push this to drm-misc-next. If not please holler. -Daniel

I'm actually working in relative isolation on this (I'm located in Tokyo) so please go ahead. I'll get in touch with some of those folks soon :)

Quoted 5 lines
Quoted 5 lines
---
 drivers/gpu/drm/drm_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 8 lines

drivers/gpu/drm/drm_drv.c EXPORT_SYMBOL(drm_dev_register); · line 971

Quoted 8 lines
drivers/gpu/drm/drm_drv.c +0 -0
index cee0cc522ed9..12687dd9e1ac 100644
@@ -969,7 +969,9 @@ EXPORT_SYMBOL(drm_dev_register);
  *
  * Unregister the DRM device from the system. This does the reverse of
  * drm_dev_register() but does not deallocate the device. The caller

must call

Quoted 2 lines

drivers/gpu/drm/drm_drv.c EXPORT_SYMBOL(drm_dev_register); · line 972

Quoted 2 lines
drivers/gpu/drm/drm_drv.c +1 -1
- * drm_dev_put() to drop their final reference.
+ * drm_dev_put() to drop their final reference, unless it is managed

with devres

Quoted 1 line

drivers/gpu/drm/drm_drv.c EXPORT_SYMBOL(drm_dev_register); · line 973

Quoted 1 line
drivers/gpu/drm/drm_drv.c +1 -0
+ * (as devices allocated with devm_drm_dev_alloc() are), in which

case there is

Quoted 3 lines

drivers/gpu/drm/drm_drv.c EXPORT_SYMBOL(drm_dev_register);

Quoted 3 lines
drivers/gpu/drm/drm_drv.c +1 -0
+ * already an unwind action registered.
  *
  * A special form of unregistering for hotpluggable devices is

drm_dev_unplug(),

Quoted 9 lines
Quoted 4 lines
drivers/gpu/drm/drm_drv.c +0 -1
  * which can be called while there are still open users of @dev.
--

2.40.0.634.g4ca3ef3211-goog

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Applied
#4 lore raw
In reply to Daniel Vetter
Quoted 21 lines · Daniel Vetter
Quoted 20 lines · Brandon Pollack

added documentation to drm_dev_unregister clarifying that devres managed devices allocated with devm_drm_dev_alloc do not require calls to drm_dev_put.

---

This is my first patch to any tree. I've tried my best to read as many kernel docs etc as possible (wip). This took me a moment to realize so I figured it was as good a candidate as any for a first patch (at the very least to make sure I have the whole patching process figured out). I hope to make more janitorial changes as I continue to learn leading up to the work I hope to do.

We're hoping to add multiple display hotplug output support to VKMS for testing purposes. Some work has been done already, but we'll be taking over moving forward. Our intent is to remain involved and assist in maintaining these changes.

Quoted 8 lines
Quoted 1 line

Looking forward to your comments/advice (now and henceforth!)

Looking good!

Since you're @chromium.org I'm assuming that one of the cros committers will push this to drm-misc-next. If not please holler.

Applied to drm-misc-next, thank you for the review.

Sean

Quoted 29 lines

-Daniel

Quoted 22 lines
---
 drivers/gpu/drm/drm_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_drv.c +3 -1
index cee0cc522ed9..12687dd9e1ac 100644
@@ -969,7 +969,9 @@ EXPORT_SYMBOL(drm_dev_register);
  *
  * Unregister the DRM device from the system. This does the reverse of
  * drm_dev_register() but does not deallocate the device. The caller must call
- * drm_dev_put() to drop their final reference.
+ * drm_dev_put() to drop their final reference, unless it is managed with devres
+ * (as devices allocated with devm_drm_dev_alloc() are), in which case there is
+ * already an unwind action registered.
  *
  * A special form of unregistering for hotpluggable devices is drm_dev_unplug(),
  * which can be called while there are still open users of @dev.
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS