Skip to content

drm_device managed resources

Daniel Vetter dri-devel intel-gfx linux-amlogic linux-arm-kernel linux-mm linux-renesas-soc linux-rockchip virtualization xen-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest52 patches 82 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/52mm/sl[uo]b: export __kmalloc_track(_node)_callermm/slob.c mm/slub.c+4 -02 replies
2/52drm/i915: Don't clear drvdata in ->releasedrivers/gpu/drm/i915/i915_drv.c+0 -30 replies
3/52drm: add managed resources tied to drm_deviceDocumentation/gpu/drm-internals.rst drivers/gpu/drm/Makefile drivers/gpu/drm/drm_drv.c +5 more+239 -218 replies
4/52drm: Set final_kfree in drm_dev_allocdrivers/gpu/drm/drm_drv.c drivers/gpu/drm/xen/xen_drm_front.c+4 -14 replies
5/52drm/mipi_dbi: Use drmm_add_final_kfree in all driversdrivers/gpu/drm/drm_mipi_dbi.c drivers/gpu/drm/tiny/hx8357d.c drivers/gpu/drm/tiny/ili9225.c +5 more+14 -36 replies
6/52drm/udl: Use drmm_add_final_kfreedrivers/gpu/drm/udl/udl_drv.c+2 -10 replies
7/52drm/udl: Use drmm_add_final_kfreedrivers/gpu/drm/udl/udl_drv.c+1 -22 replies
8/52drm/qxl: Use drmm_add_final_kfreedrivers/gpu/drm/qxl/qxl_drv.c drivers/gpu/drm/qxl/qxl_kms.c+2 -20 replies
9/52drm/i915: Use drmm_add_final_kfreedrivers/gpu/drm/i915/i915_drv.c drivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/selftests/mock_gem_device.c+28 -20 replies
10/52drm/cirrus: Use drmm_add_final_kfreedrivers/gpu/drm/cirrus/cirrus.c+7 -71 reply
11/52drm/v3d: Use drmm_add_final_kfreedrivers/gpu/drm/v3d/v3d_drv.c+20 -181 reply
12/52drm/tidss: Use drmm_add_final_kfreedrivers/gpu/drm/tidss/tidss_drv.c+2 -20 replies
13/52drm/mcde: Use drmm_add_final_kfreedrivers/gpu/drm/mcde/mcde_drv.c+2 -11 reply
14/52drm/vgem: Use drmm_add_final_kfreedrivers/gpu/drm/vgem/vgem_drv.c+8 -60 replies
15/52drm/vkms: Use drmm_add_final_kfreedrivers/gpu/drm/vkms/vkms_drv.c+9 -90 replies
16/52drm/repaper: Use drmm_add_final_kfreedrivers/gpu/drm/tiny/repaper.c+2 -31 reply
17/52drm/inigenic: Use drmm_add_final_kfreedrivers/gpu/drm/ingenic/ingenic-drm.c+2 -30 replies
18/52drm/gm12u320: Use drmm_add_final_kfreedrivers/gpu/drm/tiny/gm12u320.c+2 -10 replies
19/52drm/<drivers>: Use drmm_add_final_kfreedrivers/gpu/drm/arm/display/komeda/komeda_kms.c drivers/gpu/drm/armada/armada_drv.c drivers/gpu/drm/vboxvideo/vbox_drv.c+6 -04 replies
20/52drm: Cleanups after drmm_add_final_kfree rolloutdrivers/gpu/drm/drm_drv.c+4 -70 replies
21/52drm: Handle dev->unique with drmm_drivers/gpu/drm/drm_drv.c drivers/gpu/drm/drm_managed.c include/drm/drm_managed.h+19 -32 replies
22/52drm: Use drmm_ for drm_dev_init cleanupdrivers/gpu/drm/drm_drv.c+25 -234 replies
23/52drm: manage drm_minor cleanup with drmm_drivers/gpu/drm/drm_drv.c drivers/gpu/drm/drm_managed.c include/drm/drm_managed.h+59 -472 replies
24/52drm: Manage drm_gem_init with drmm_drivers/gpu/drm/drm_drv.c drivers/gpu/drm/drm_gem.c drivers/gpu/drm/drm_internal.h+11 -194 replies
25/52drm: Manage drm_vblank_cleanup with drmm_drivers/gpu/drm/drm_drv.c drivers/gpu/drm/drm_internal.h drivers/gpu/drm/drm_vblank.c +1 more+28 -210 replies
26/52drm: Garbage collect drm_dev_finidrivers/gpu/drm/cirrus/cirrus.c drivers/gpu/drm/drm_drv.c drivers/gpu/drm/drm_mipi_dbi.c +12 more+2 -500 replies
27/52drm: Manage drm_mode_config_init with drmm_drivers/gpu/drm/drm_drv.c drivers/gpu/drm/drm_mode_config.c include/drm/drm_mode_config.h+17 -186 replies
28/52drm/bochs: Remove leftover drm_atomic_helper_shutdowndrivers/gpu/drm/bochs/bochs_kms.c+0 -11 reply
29/52drm/bochs: Drop explicit drm_mode_config_cleanupdrivers/gpu/drm/bochs/bochs.h drivers/gpu/drm/bochs/bochs_drv.c drivers/gpu/drm/bochs/bochs_kms.c+7 -141 reply
30/52drm/cirrus: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/cirrus/cirrus.c+11 -101 reply
31/52drm/cirrus: Fully embrace devm_drivers/gpu/drm/cirrus/cirrus.c+14 -301 reply
32/52drm/ingenic: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/ingenic/ingenic-drm.c+4 -70 replies
33/52drm/mcde: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/mcde/mcde_drv.c+6 -161 reply
34/52drm/mcde: More devm_drm_dev_initdrivers/gpu/drm/mcde/mcde_drv.c+3 -61 reply
35/52drm/meson: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/meson/meson_drv.c+3 -21 reply
36/52drm/pl111: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/pl111/pl111_drv.c+6 -60 replies
37/52drm/rcar-du: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/rcar-du/rcar_du_drv.c drivers/gpu/drm/rcar-du/rcar_du_kms.c+3 -27 replies
38/52drm/rockchip: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/rockchip/rockchip_drm_drv.c+3 -70 replies
39/52drm/stm: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/stm/drv.c+4 -62 replies
40/52drm/shmob: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/shmobile/shmob_drm_drv.c drivers/gpu/drm/shmobile/shmob_drm_kms.c+5 -31 reply
41/52drm/mtk: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/mediatek/mtk_drm_drv.c+4 -50 replies
42/52drm/tidss: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/tidss/tidss_drv.c drivers/gpu/drm/tidss/tidss_kms.c drivers/gpu/drm/tidss/tidss_kms.h+5 -190 replies
43/52drm/gm12u320: More drmm_drivers/gpu/drm/tiny/gm12u320.c+7 -110 replies
44/52drm/gm12u320: Use devm_drm_dev_initdrivers/gpu/drm/tiny/gm12u320.c+7 -120 replies
45/52drm/gm12u320: Use helpers for shutdown/suspend/resumedrivers/gpu/drm/tiny/gm12u320.c+3 -130 replies
46/52drm/gm12u320: Simplify upload workdrivers/gpu/drm/tiny/gm12u320.c+67 -1030 replies
47/52drm/repaper: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/tiny/repaper.c+0 -81 reply
48/52drm/mipi-dbi: Move drm_mode_config_init into mipi librarydrivers/gpu/drm/drm_mipi_dbi.c drivers/gpu/drm/tiny/hx8357d.c drivers/gpu/drm/tiny/ili9225.c +5 more+4 -141 reply
49/52drm/mipi-dbi: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/drm_mipi_dbi.c drivers/gpu/drm/tiny/hx8357d.c drivers/gpu/drm/tiny/ili9225.c +6 more+0 -241 reply
50/52drm/udl: Drop explicit drm_mode_config_cleanup calldrivers/gpu/drm/udl/udl_drv.c drivers/gpu/drm/udl/udl_drv.h drivers/gpu/drm/udl/udl_modeset.c+6 -170 replies
51/52drm/udl: drop drm_driver.release hookdrivers/gpu/drm/udl/udl_drv.c drivers/gpu/drm/udl/udl_drv.h drivers/gpu/drm/udl/udl_main.c+0 -170 replies
52/52drm: Add docs for managed resourcesDocumentation/gpu/drm-internals.rst drivers/gpu/drm/drm_drv.c drivers/gpu/drm/drm_managed.c +2 more+134 -44 replies

Reviews trailers per patch

20 of 52 patches have a Reviewed-by or Acked-by.

PatchNeil ArmstrongOleksandr AndrushchenkoLaurent PinchartLinus WalleijEric AnholtAndrew MortonPhilippe CornuNoralf TrønnesChristoph LameterGerd Hoffmann
1/52A-b A-b
2/52
3/52
4/52R-b
5/52R-b T-b
6/52
7/52
8/52
9/52
10/52A-b
11/52A-b
12/52
13/52R-b
14/52
15/52
16/52R-b
17/52
18/52
19/52
20/52
21/52
22/52
23/52
24/52
25/52
26/52
27/52
28/52A-b
29/52A-b
30/52A-b
31/52A-b
32/52
33/52R-b
34/52R-b
35/52R-b
36/52
37/52R-b
38/52
39/52A-b
40/52R-b
41/52
42/52
43/52
44/52
45/52
46/52
47/52R-b
48/52R-b
49/52R-b
50/52
51/52
52/52

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 10 reviewers.

Read the v1 thread

Cover letter [PATCH 00/52] drm_device managed resources

Hi all,

So I finally bit the bullet and started a little framework for managed resources tied to the drm_device lifetime, instead of the lifetime of the underlying physical device. Because I've seen one patch too many that just totally got this wrong.

Yes it's huge, but I think this is what we minimally need to show an actual improvement, and at least a glimpse of the road ahead.

For reading the patch series I think it'd be best to start at the very end, which contains the documentation for the entire thing. I've assembled that at the end since a few of the intermediate states are a bit gross, but necessary to get there with full bisectability.

Once you know where things will go, start at the front (the two very first patches are just trivial prep that got in the way).

There's three major phases:

- Handling the final kfree of the structure containing the drm_device

- Converting drm_dev_fini to the managed resource framework

- Converting drm_mode_config_cleanup to the managed resource framework.

The last patch's commit message also contains a bit a todo about what next possible steps could be.

Review (primarily on the big picture at least at first) but also testing for all the drivers I'm touching very much appreciated.

Cheers, Daniel

Daniel Vetter (52):
mm/sl[uo]b: export __kmalloc_track(_node)_caller drm/i915: Don't clear drvdata in ->release
drm: add managed resources tied to drm_device
drm: Set final_kfree in drm_dev_alloc drm/mipi_dbi: Use drmm_add_final_kfree in all drivers drm/udl: Use drmm_add_final_kfree
drm/udl: Use drmm_add_final_kfree
drm/qxl: Use drmm_add_final_kfree
drm/i915: Use drmm_add_final_kfree
drm/cirrus: Use drmm_add_final_kfree
drm/v3d: Use drmm_add_final_kfree
drm/tidss: Use drmm_add_final_kfree
drm/mcde: Use drmm_add_final_kfree
drm/vgem: Use drmm_add_final_kfree
drm/vkms: Use drmm_add_final_kfree
drm/repaper: Use drmm_add_final_kfree drm/inigenic: Use drmm_add_final_kfree drm/gm12u320: Use drmm_add_final_kfree drm/<drivers>: Use drmm_add_final_kfree
drm: Cleanups after drmm_add_final_kfree rollout
drm: Handle dev->unique with drmm_
drm: Use drmm_ for drm_dev_init cleanup
drm: manage drm_minor cleanup with drmm_
drm: Manage drm_gem_init with drmm_
drm: Manage drm_vblank_cleanup with drmm_
drm: Garbage collect drm_dev_fini
drm: Manage drm_mode_config_init with drmm_ drm/bochs: Remove leftover drm_atomic_helper_shutdown drm/bochs: Drop explicit drm_mode_config_cleanup drm/cirrus: Drop explicit drm_mode_config_cleanup call drm/cirrus: Fully embrace devm_
drm/ingenic: Drop explicit drm_mode_config_cleanup call drm/mcde: Drop explicit drm_mode_config_cleanup call drm/mcde: More devm_drm_dev_init
drm/meson: Drop explicit drm_mode_config_cleanup call drm/pl111: Drop explicit drm_mode_config_cleanup call drm/rcar-du: Drop explicit drm_mode_config_cleanup call drm/rockchip: Drop explicit drm_mode_config_cleanup call drm/stm: Drop explicit drm_mode_config_cleanup call drm/shmob: Drop explicit drm_mode_config_cleanup call drm/mtk: Drop explicit drm_mode_config_cleanup call drm/tidss: Drop explicit drm_mode_config_cleanup call drm/gm12u320: More drmm_
drm/gm12u320: Use devm_drm_dev_init drm/gm12u320: Use helpers for shutdown/suspend/resume drm/gm12u320: Simplify upload work
drm/repaper: Drop explicit drm_mode_config_cleanup call drm/mipi-dbi: Move drm_mode_config_init into mipi library drm/mipi-dbi: Drop explicit drm_mode_config_cleanup call drm/udl: Drop explicit drm_mode_config_cleanup call drm/udl: drop drm_driver.release hook
drm: Add docs for managed resources

 Documentation/gpu/drm-internals.rst           |  12 +
 drivers/gpu/drm/Makefile                      |   3 +-
 .../gpu/drm/arm/display/komeda/komeda_kms.c   |   2 +
 drivers/gpu/drm/armada/armada_drv.c           |   2 +
 drivers/gpu/drm/bochs/bochs.h                 |   1 -
 drivers/gpu/drm/bochs/bochs_drv.c             |   6 +-
 drivers/gpu/drm/bochs/bochs_kms.c             |  15 +-
 drivers/gpu/drm/cirrus/cirrus.c               |  74 ++---
 drivers/gpu/drm/drm_drv.c                     | 217 ++++++--------
 drivers/gpu/drm/drm_gem.c                     |  21 +-
 drivers/gpu/drm/drm_internal.h                |   5 +-
 drivers/gpu/drm/drm_managed.c                 | 278 ++++++++++++++++++
 drivers/gpu/drm/drm_mipi_dbi.c                |  24 +-
 drivers/gpu/drm/drm_mode_config.c             |  12 +-
 drivers/gpu/drm/drm_vblank.c                  |  31 +-
 drivers/gpu/drm/i915/i915_drv.c               |  21 +-
 drivers/gpu/drm/i915/i915_drv.h               |   3 +
 .../gpu/drm/i915/selftests/mock_gem_device.c  |  20 +-
 drivers/gpu/drm/ingenic/ingenic-drm.c         |  17 +-
 drivers/gpu/drm/mcde/mcde_drv.c               |  35 +--
 drivers/gpu/drm/mediatek/mtk_drm_drv.c        |   9 +-
 drivers/gpu/drm/meson/meson_drv.c             |   5 +-
 drivers/gpu/drm/pl111/pl111_drv.c             |  12 +-
 drivers/gpu/drm/qxl/qxl_drv.c                 |   2 -
 drivers/gpu/drm/qxl/qxl_kms.c                 |   2 +
 drivers/gpu/drm/rcar-du/rcar_du_drv.c         |   1 -
 drivers/gpu/drm/rcar-du/rcar_du_kms.c         |   4 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |  10 +-
 drivers/gpu/drm/shmobile/shmob_drm_drv.c      |   2 -
 drivers/gpu/drm/shmobile/shmob_drm_kms.c      |   6 +-
 drivers/gpu/drm/stm/drv.c                     |  10 +-
 drivers/gpu/drm/tidss/tidss_drv.c             |  10 +-
 drivers/gpu/drm/tidss/tidss_kms.c             |  19 +-
 drivers/gpu/drm/tidss/tidss_kms.h             |   1 -
 drivers/gpu/drm/tiny/gm12u320.c               | 225 ++++++--------
 drivers/gpu/drm/tiny/hx8357d.c                |   5 +-
 drivers/gpu/drm/tiny/ili9225.c                |   5 +-
 drivers/gpu/drm/tiny/ili9341.c                |   5 +-
 drivers/gpu/drm/tiny/ili9486.c                |   5 +-
 drivers/gpu/drm/tiny/mi0283qt.c               |   5 +-
 drivers/gpu/drm/tiny/repaper.c                |  14 +-
 drivers/gpu/drm/tiny/st7586.c                 |   5 +-
 drivers/gpu/drm/tiny/st7735r.c                |   5 +-
 drivers/gpu/drm/udl/udl_drv.c                 |  14 +-
 drivers/gpu/drm/udl/udl_drv.h                 |   2 -
 drivers/gpu/drm/udl/udl_main.c                |  10 -
 drivers/gpu/drm/udl/udl_modeset.c             |  21 +-
 drivers/gpu/drm/v3d/v3d_drv.c                 |  38 +--
 drivers/gpu/drm/vboxvideo/vbox_drv.c          |   2 +
 drivers/gpu/drm/vgem/vgem_drv.c               |  15 +-
 drivers/gpu/drm/vkms/vkms_drv.c               |  19 +-
 drivers/gpu/drm/xen/xen_drm_front.c           |   4 +-
 include/drm/drm_device.h                      |  12 +
 include/drm/drm_drv.h                         |   9 +-
 include/drm/drm_managed.h                     |  93 ++++++
 include/drm/drm_mipi_dbi.h                    |   1 -
 include/drm/drm_mode_config.h                 |   2 +-
 include/drm/drm_print.h                       |   6 +
 mm/slob.c                                     |   2 +
 mm/slub.c                                     |   2 +
 60 files changed, 816 insertions(+), 602 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_managed.c
 create mode 100644 include/drm/drm_managed.h
Signature · 6 lines
2.24.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx