Skip to contentSkip to conversation

drm: Add a gpu page-table walker

PATCH In review Thomas Hellström 6 participants 11 messages Feb 16, 2023 – Feb 27, 2023

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

cover drm: Add a gpu page-table walker

A slightly unusual cover letter for a single patch.

The page table walker is currently used by the xe driver only, but the code is generic so we can be good citizens and add it to drm as a helper, for possible use by other drivers,
If so we can merge the commit when we merge the xe driver.

The question raised here is
*) Should it be a generic drm helper or xe-specific with changed
prefixes?
*) If a drm helper, should we use a config option?

For usage examples, see xe_pt.c
https://gitlab.freedesktop.org/drm/xe/kernel/-/blob/drm-xe-next/drivers/gpu/drm/xe/xe_pt.c

Thanks,
Thomas

Thomas Hellström (1):
drm: Add a gpu page-table walker helper

 drivers/gpu/drm/Makefile      |   1 +
 drivers/gpu/drm/drm_pt_walk.c | 159 +++++++++++++++++++++++++++++++++
 include/drm/drm_pt_walk.h     | 161 ++++++++++++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 drivers/gpu/drm/drm_pt_walk.c
 create mode 100644 include/drm/drm_pt_walk.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 drm: Add a gpu page-table walker helper

Add a gpu page table walker similar in functionality to the cpu page-table walker in mm/pagewalk.c. This is made a drm helper in the hope that it might prove useful to other drivers, but we could of course make it single-driver only and rename the functions initially.

Also if remaining a DRM helper, we should consider making it a helper kernel module of its own.

---
 drivers/gpu/drm/Makefile      |   1 +
 drivers/gpu/drm/drm_pt_walk.c | 159 +++++++++++++++++++++++++++++++++
 include/drm/drm_pt_walk.h     | 161 ++++++++++++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 drivers/gpu/drm/drm_pt_walk.c
 create mode 100644 include/drm/drm_pt_walk.h
drivers/gpu/drm/Makefile +1 -0
index ab4460fcd63f..53aae8a4ae99 100644
@@ -39,6 +39,7 @@ drm-y := \
 	drm_prime.o \
 	drm_print.o \
 	drm_property.o \
+	drm_pt_walk.o \
 	drm_syncobj.o \
 	drm_sysfs.o \
 	drm_trace_points.o \
drivers/gpu/drm/drm_pt_walk.c new file +159 -0

159 lines not on this page · raw message

include/drm/drm_pt_walk.h new file +161 -0

161 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Add a gpu page-table walker

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: drm: Add a gpu page-table walker
URL : https://patchwork.freedesktop.org/series/114109/
State : warning

== Summary ==

Error: dim checkpatch failed
8e7a3eb796b4 drm: Add a gpu page-table walker helper
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:32: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #32:
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 327 lines checked

#3 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm: Add a gpu page-table walker

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: drm: Add a gpu page-table walker
URL : https://patchwork.freedesktop.org/series/114109/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12751 -> Patchwork_114109v1
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_114109v1 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_114109v1, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/index.html

Participating hosts (38 -> 39)
------------------------------

Additional (2): bat-atsm-1 fi-pnv-d510
Missing (1): fi-snb-2520m

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_114109v1:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@gt_heartbeat:
- fi-kbl-soraka: [PASS][1] -> [DMESG-FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html

#### Warnings ####

* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: [DMESG-FAIL][3] ([i915#1886]) -> [ABORT][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

Known issues
------------

Here are the changes found in Patchwork_114109v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@fbdev@eof:
- bat-atsm-1: NOTRUN -> [SKIP][5] ([i915#2582]) +4 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@gem_mmap@basic:
- bat-atsm-1: NOTRUN -> [SKIP][6] ([i915#4083])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@gem_tiled_fence_blits@basic:
- bat-atsm-1: NOTRUN -> [SKIP][7] ([i915#4077]) +2 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@gem_tiled_pread_basic:
- bat-atsm-1: NOTRUN -> [SKIP][8] ([i915#4079]) +1 similar issue
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@gem_tiled_pread_basic.html

* igt@i915_pm_rps@basic-api:
- bat-atsm-1: NOTRUN -> [SKIP][9] ([i915#6621])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@i915_selftest@live@gt_lrc:
- bat-dg2-11: [PASS][10] -> [INCOMPLETE][11] ([i915#7609] / [i915#7913])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/bat-dg2-11/igt@i915_selftest@live@gt_lrc.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-dg2-11/igt@i915_selftest@live@gt_lrc.html

* igt@i915_selftest@live@gt_pm:
- bat-rpls-2: [PASS][12] -> [DMESG-FAIL][13] ([i915#4258])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/bat-rpls-2/igt@i915_selftest@live@gt_pm.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-rpls-2/igt@i915_selftest@live@gt_pm.html

* igt@i915_selftest@live@hangcheck:
- fi-skl-guc: [PASS][14] -> [DMESG-WARN][15] ([i915#8073])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/fi-skl-guc/igt@i915_selftest@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/fi-skl-guc/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@reset:
- bat-rpls-1: [PASS][16] -> [ABORT][17] ([i915#4983])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/bat-rpls-1/igt@i915_selftest@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-rpls-1/igt@i915_selftest@[email protected]

* igt@i915_suspend@basic-s3-without-i915:
- bat-atsm-1: NOTRUN -> [SKIP][18] ([i915#6645])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@kms_addfb_basic@size-max:
- bat-atsm-1: NOTRUN -> [SKIP][19] ([i915#6077]) +36 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size:
- fi-bsw-n3050: [PASS][20] -> [FAIL][21] ([i915#6298])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12751/fi-bsw-n3050/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/fi-bsw-n3050/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html

* igt@kms_cursor_legacy@basic-flip-after-cursor:
- bat-atsm-1: NOTRUN -> [SKIP][22] ([i915#6078]) +14 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@kms_flip@basic-plain-flip:
- bat-atsm-1: NOTRUN -> [SKIP][23] ([i915#6166]) +3 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@kms_force_connector_basic@prune-stale-modes:
- bat-atsm-1: NOTRUN -> [SKIP][24] ([i915#6093]) +3 similar issues
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@kms_pipe_crc_basic@hang-read-crc:
- bat-atsm-1: NOTRUN -> [SKIP][25] ([i915#1836]) +6 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@kms_pipe_crc_basic@read-crc:
- bat-adlp-9: NOTRUN -> [SKIP][26] ([i915#3546]) +1 similar issue
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-adlp-9/igt@[email protected]

* igt@kms_prop_blob@basic:
- bat-atsm-1: NOTRUN -> [SKIP][27] ([i915#7357])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@kms_psr@primary_page_flip:
- fi-pnv-d510: NOTRUN -> [SKIP][28] ([fdo#109271]) +44 similar issues
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/fi-pnv-d510/igt@kms_psr@primary_page_flip.html

* igt@kms_psr@sprite_plane_onoff:
- bat-atsm-1: NOTRUN -> [SKIP][29] ([i915#1072]) +3 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@kms_psr@sprite_plane_onoff.html

* igt@kms_setmode@basic-clone-single-crtc:
- bat-atsm-1: NOTRUN -> [SKIP][30] ([i915#6094])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@prime_vgem@basic-fence-flip:
- bat-atsm-1: NOTRUN -> [SKIP][31] ([fdo#109295] / [i915#6078])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@prime_vgem@basic-fence-mmap:
- bat-atsm-1: NOTRUN -> [SKIP][32] ([fdo#109295] / [i915#4077]) +1 similar issue
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

* igt@prime_vgem@basic-write:
- bat-atsm-1: NOTRUN -> [SKIP][33] ([fdo#109295]) +3 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/bat-atsm-1/igt@[email protected]

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1836]: https://gitlab.freedesktop.org/drm/intel/issues/1836
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#6077]: https://gitlab.freedesktop.org/drm/intel/issues/6077
[i915#6078]: https://gitlab.freedesktop.org/drm/intel/issues/6078
[i915#6093]: https://gitlab.freedesktop.org/drm/intel/issues/6093
[i915#6094]: https://gitlab.freedesktop.org/drm/intel/issues/6094
[i915#6166]: https://gitlab.freedesktop.org/drm/intel/issues/6166
[i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
[i915#7357]: https://gitlab.freedesktop.org/drm/intel/issues/7357
[i915#7609]: https://gitlab.freedesktop.org/drm/intel/issues/7609
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#8073]: https://gitlab.freedesktop.org/drm/intel/issues/8073

Build changes
-------------

* Linux: CI_DRM_12751 -> Patchwork_114109v1

CI-20190529: 20190529
CI_DRM_12751: b6ba15d59cdc7e7d488646370f9ca6b0a36f9db5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7161: 5574f110ae838031eef6db5236bad02e8c2d2dee @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_114109v1: b6ba15d59cdc7e7d488646370f9ca6b0a36f9db5 @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

55bda49b1ace drm: Add a gpu page-table walker helper

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114109v1/index.html

#4 lore raw
In reply to Thomas Hellström
Quoted 10 lines · Thomas Hellström

A slightly unusual cover letter for a single patch.

The page table walker is currently used by the xe driver only, but the code is generic so we can be good citizens and add it to drm as a helper, for possible use by other drivers,
If so we can merge the commit when we merge the xe driver.

The question raised here is
*) Should it be a generic drm helper or xe-specific with changed
prefixes?

I think if there's some other drivers interested in using this, then this sounds like a good idea. Maybe more useful if it's also integrated into the vm/vma helpers that are being discussed as an optional part?

Maybe some good old sales pitching here to convince people would be good.

Maybe one of the new accel drivers is interested in this too?

Quoted 1 line

*) If a drm helper, should we use a config option?

I am no fan of Kconfig things tbh. Maybe just include it in the vma helpers, or perhaps we want to do a drm-accel-helpers with gem helpers, drm/sched, this one here, vm/vma helpers or whatever they will be and so on? Kinda like we have modeset helpers.

I'd definitely not go for a Kconfig per individual file, that's just excessive.
-Daniel

Quoted 20 lines

For usage examples, see xe_pt.c
https://gitlab.freedesktop.org/drm/xe/kernel/-/blob/drm-xe-next/drivers/gpu/drm/xe/xe_pt.c

Thanks,
Thomas

Thomas Hellström (1):
drm: Add a gpu page-table walker helper

 drivers/gpu/drm/Makefile      |   1 +
 drivers/gpu/drm/drm_pt_walk.c | 159 +++++++++++++++++++++++++++++++++
 include/drm/drm_pt_walk.h     | 161 ++++++++++++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 drivers/gpu/drm/drm_pt_walk.c
 create mode 100644 include/drm/drm_pt_walk.h
Signature · 1 line
2.34.1
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#5 lore raw

Hi, Daniel,

Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Thomas Hellström

A slightly unusual cover letter for a single patch.

The page table walker is currently used by the xe driver only, but the code is generic so we can be good citizens and add it to drm as a helper, for possible use by other drivers,
If so we can merge the commit when we merge the xe driver.

The question raised here is
*) Should it be a generic drm helper or xe-specific with changed
prefixes?

Quoted 7 lines

I think if there's some other drivers interested in using this, then this sounds like a good idea. Maybe more useful if it's also integrated into the vm/vma helpers that are being discussed as an optional part?

Maybe some good old sales pitching here to convince people would be good.

Maybe one of the new accel drivers is interested in this too?

Thanks for your thoughts on this. Yeah, I think it's a bit awkward to push for having code generic when there is only one user, and the prospect of having other drivers rewrite their page-table building code based on this helper in the near future is probably small. Perhaps more of interest to new drivers. I think what will happen otherwise is that during some future cleanup this will be pushed down to xe claiming it's the only user.

I wonder whether it might be an idea to maintain a small document where driver writers can list suggestions for code that could be lifted to core drm and be reused by others. That way both reviewers and writers of other drivers can keep an eye on that document and use it to avoid duplicating code. The procedure would then be to lift it to core drm and fix up prefixes as soon as we have two or more users.

Thoughts?

Thomas

Quoted 30 lines
Quoted 2 lines

*) If a drm helper, should we use a config option?

I am no fan of Kconfig things tbh. Maybe just include it in the vma helpers, or perhaps we want to do a drm-accel-helpers with gem helpers, drm/sched, this one here, vm/vma helpers or whatever they will be and so on? Kinda like we have modeset helpers.

I'd definitely not go for a Kconfig per individual file, that's just excessive.
-Daniel

Quoted 19 lines

For usage examples, see xe_pt.c
https://gitlab.freedesktop.org/drm/xe/kernel/-/blob/drm-xe-next/drivers/gpu/drm/xe/xe_pt.c

Thanks,
Thomas

Thomas Hellström (1):
drm: Add a gpu page-table walker helper

  drivers/gpu/drm/Makefile      |   1 +
  drivers/gpu/drm/drm_pt_walk.c | 159 +++++++++++++++++++++++++++++++++
  include/drm/drm_pt_walk.h     | 161 ++++++++++++++++++++++++++++++++++
  3 files changed, 321 insertions(+)

create mode 100644 drivers/gpu/drm/drm_pt_walk.c create mode 100644 include/drm/drm_pt_walk.h

Signature · 1 line
2.34.1
#6 lore raw
Quoted 31 lines · Thomas Hellström

Hi, Daniel,

Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Thomas Hellström

A slightly unusual cover letter for a single patch.

The page table walker is currently used by the xe driver only, but the code is generic so we can be good citizens and add it to drm as a helper, for possible use by other drivers,
If so we can merge the commit when we merge the xe driver.

The question raised here is
*) Should it be a generic drm helper or xe-specific with changed
prefixes?

Quoted 7 lines

I think if there's some other drivers interested in using this, then this sounds like a good idea. Maybe more useful if it's also integrated into the vm/vma helpers that are being discussed as an optional part?

Maybe some good old sales pitching here to convince people would be good.

Maybe one of the new accel drivers is interested in this too?

Thanks for your thoughts on this. Yeah, I think it's a bit awkward to push for having code generic when there is only one user, and the prospect of having other drivers rewrite their page-table building code based on this helper in the near future is probably small. Perhaps more of interest to new drivers. I think what will happen otherwise is that during some future cleanup this will be pushed down to xe claiming it's the only user.

Quoted 8 lines

I wonder whether it might be an idea to maintain a small document where driver writers can list suggestions for code that could be lifted to core drm and be reused by others. That way both reviewers and writers of other drivers can keep an eye on that document and use it to avoid duplicating code. The procedure would then be to lift it to core drm and fix up prefixes as soon as we have two or more users.

Thoughts?

FWIW, when we originally wrote the GPU scheduler it was part of amdgpu, but we consciously kept any AMD-isms out of it so it could be lifted up to a core component when another user came along. Maybe some comments in the top of those files to that effect to maintain the separation.

Alex

Quoted 34 lines

Thomas

Quoted 30 lines
Quoted 2 lines

*) If a drm helper, should we use a config option?

I am no fan of Kconfig things tbh. Maybe just include it in the vma helpers, or perhaps we want to do a drm-accel-helpers with gem helpers, drm/sched, this one here, vm/vma helpers or whatever they will be and so on? Kinda like we have modeset helpers.

I'd definitely not go for a Kconfig per individual file, that's just excessive.
-Daniel

Quoted 19 lines

For usage examples, see xe_pt.c
https://gitlab.freedesktop.org/drm/xe/kernel/-/blob/drm-xe-next/drivers/gpu/drm/xe/xe_pt.c

Thanks,
Thomas

Thomas Hellström (1):
drm: Add a gpu page-table walker helper

  drivers/gpu/drm/Makefile      |   1 +
  drivers/gpu/drm/drm_pt_walk.c | 159 +++++++++++++++++++++++++++++++++
  include/drm/drm_pt_walk.h     | 161 ++++++++++++++++++++++++++++++++++
  3 files changed, 321 insertions(+)

create mode 100644 drivers/gpu/drm/drm_pt_walk.c create mode 100644 include/drm/drm_pt_walk.h

--
2.34.1

#7 lore raw
Quoted 18 lines · Alex Deucher
Quoted 15 lines · Thomas Hellström

Hi, Daniel,

Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Thomas Hellström

A slightly unusual cover letter for a single patch.

The page table walker is currently used by the xe driver only, but the code is generic so we can be good citizens and add it to drm as a helper, for possible use by other drivers,
If so we can merge the commit when we merge the xe driver.

The question raised here is
*) Should it be a generic drm helper or xe-specific with changed
prefixes?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

I think if there's some other drivers interested in using this, then this sounds like a good idea. Maybe more useful if it's also integrated into the vm/vma helpers that are being discussed as an optional part?

Maybe some good old sales pitching here to convince people would be good.

Maybe one of the new accel drivers is interested in this too?

Hi,
As the habanalabs driver is not really a new driver, I currently don't see the benefit of moving
to this code. Our pgt code is quite mature and was tested extensively in deployment in the
past couple of years.

Nevertheless, I'll try to offer this code for any new/future driver that will want to join accel.

Stanislaw, I'm adding you here in case you missed this. Might be of an interest to you.

Thanks,
Oded

- Oded

Quoted 61 lines
Quoted 9 lines

Thanks for your thoughts on this. Yeah, I think it's a bit awkward to push for having code generic when there is only one user, and the prospect of having other drivers rewrite their page-table building code based on this helper in the near future is probably small. Perhaps more of interest to new drivers. I think what will happen otherwise is that during some future cleanup this will be pushed down to xe claiming it's the only user.

Quoted 8 lines

I wonder whether it might be an idea to maintain a small document where driver writers can list suggestions for code that could be lifted to core drm and be reused by others. That way both reviewers and writers of other drivers can keep an eye on that document and use it to avoid duplicating code. The procedure would then be to lift it to core drm and fix up prefixes as soon as we have two or more users.

Thoughts?

FWIW, when we originally wrote the GPU scheduler it was part of amdgpu, but we consciously kept any AMD-isms out of it so it could be lifted up to a core component when another user came along. Maybe some comments in the top of those files to that effect to maintain the separation.

Alex

Quoted 34 lines

Thomas

Quoted 30 lines
Quoted 2 lines

*) If a drm helper, should we use a config option?

I am no fan of Kconfig things tbh. Maybe just include it in the vma helpers, or perhaps we want to do a drm-accel-helpers with gem helpers, drm/sched, this one here, vm/vma helpers or whatever they will be and so on? Kinda like we have modeset helpers.

I'd definitely not go for a Kconfig per individual file, that's just excessive.
-Daniel

Quoted 19 lines

For usage examples, see xe_pt.c
https://gitlab.freedesktop.org/drm/xe/kernel/-/blob/drm-xe-next/drivers/gpu/drm/xe/xe_pt.c

Thanks,
Thomas

Thomas Hellström (1):
drm: Add a gpu page-table walker helper

  drivers/gpu/drm/Makefile      |   1 +
  drivers/gpu/drm/drm_pt_walk.c | 159 +++++++++++++++++++++++++++++++++
  include/drm/drm_pt_walk.h     | 161 ++++++++++++++++++++++++++++++++++
  3 files changed, 321 insertions(+)

create mode 100644 drivers/gpu/drm/drm_pt_walk.c create mode 100644 include/drm/drm_pt_walk.h

--
2.34.1

#10 lore raw
In reply to Alex Deucher

Hi,

Quoted 38 lines · Alex Deucher
Quoted 36 lines · Thomas Hellström

Hi, Daniel,

Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Thomas Hellström

A slightly unusual cover letter for a single patch.

The page table walker is currently used by the xe driver only, but the code is generic so we can be good citizens and add it to drm as a helper, for possible use by other drivers,
If so we can merge the commit when we merge the xe driver.

The question raised here is
*) Should it be a generic drm helper or xe-specific with changed
prefixes?

Quoted 7 lines

I think if there's some other drivers interested in using this, then this sounds like a good idea. Maybe more useful if it's also integrated into the vm/vma helpers that are being discussed as an optional part?

Maybe some good old sales pitching here to convince people would be good.

Maybe one of the new accel drivers is interested in this too?

Thanks for your thoughts on this. Yeah, I think it's a bit awkward to push for having code generic when there is only one user, and the prospect of having other drivers rewrite their page-table building code based on this helper in the near future is probably small. Perhaps more of interest to new drivers. I think what will happen otherwise is that during some future cleanup this will be pushed down to xe claiming it's the only user.

I wonder whether it might be an idea to maintain a small document where driver writers can list suggestions for code that could be lifted to core drm and be reused by others. That way both reviewers and writers of other drivers can keep an eye on that document and use it to avoid duplicating code. The procedure would then be to lift it to core drm and fix up prefixes as soon as we have two or more users.

Quoted 6 lines
Quoted 1 line

Thoughts?

FWIW, when we originally wrote the GPU scheduler it was part of amdgpu, but we consciously kept any AMD-isms out of it so it could be lifted up to a core component when another user came along. Maybe some comments in the top of those files to that effect to maintain the separation.

Sure. I'll do that. It sounds like we'll keep this in xe for now.

Thanks,

/Thomas

Quoted 35 lines

Alex

Quoted 32 lines

Thomas

Quoted 29 lines
Quoted 1 line

*) If a drm helper, should we use a config option?

I am no fan of Kconfig things tbh. Maybe just include it in the vma helpers, or perhaps we want to do a drm-accel-helpers with gem helpers, drm/sched, this one here, vm/vma helpers or whatever they will be and so on? Kinda like we have modeset helpers.

I'd definitely not go for a Kconfig per individual file, that's just excessive.
-Daniel

Quoted 19 lines

For usage examples, see xe_pt.c
https://gitlab.freedesktop.org/drm/xe/kernel/-/blob/drm-xe-next/drivers/gpu/drm/xe/xe_pt.c

Thanks,
Thomas

Thomas Hellström (1):
drm: Add a gpu page-table walker helper

   drivers/gpu/drm/Makefile      |   1 +
   drivers/gpu/drm/drm_pt_walk.c | 159 +++++++++++++++++++++++++++++++++
   include/drm/drm_pt_walk.h     | 161 ++++++++++++++++++++++++++++++++++
   3 files changed, 321 insertions(+)

create mode 100644 drivers/gpu/drm/drm_pt_walk.c create mode 100644 include/drm/drm_pt_walk.h

--
2.34.1

#8 lore raw
In reply to Oded Gabbay

Hi, Oded.

Quoted 31 lines · Oded Gabbay
Quoted 16 lines · Alex Deucher
Quoted 14 lines · Thomas Hellström

Hi, Daniel,

Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Thomas Hellström

A slightly unusual cover letter for a single patch.

The page table walker is currently used by the xe driver only, but the code is generic so we can be good citizens and add it to drm as a helper, for possible use by other drivers,
If so we can merge the commit when we merge the xe driver.

The question raised here is
*) Should it be a generic drm helper or xe-specific with changed
prefixes?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

I think if there's some other drivers interested in using this, then this sounds like a good idea. Maybe more useful if it's also integrated into the vm/vma helpers that are being discussed as an optional part?

Maybe some good old sales pitching here to convince people would be good.

Maybe one of the new accel drivers is interested in this too?

Hi,
As the habanalabs driver is not really a new driver, I currently don't see the benefit of moving
to this code. Our pgt code is quite mature and was tested extensively in deployment in the
past couple of years.

Quoted 5 lines

Nevertheless, I'll try to offer this code for any new/future driver that will want to join accel.

Stanislaw, I'm adding you here in case you missed this. Might be of an interest to you.

Thanks for taking a look. Yes, as also mentioned to Alex, I think we'll keep this in xe for now.

/Thomas

Quoted 65 lines

Thanks,
Oded

- Oded

Quoted 57 lines
Quoted 8 lines

Thanks for your thoughts on this. Yeah, I think it's a bit awkward to push for having code generic when there is only one user, and the prospect of having other drivers rewrite their page-table building code based on this helper in the near future is probably small. Perhaps more of interest to new drivers. I think what will happen otherwise is that during some future cleanup this will be pushed down to xe claiming it's the only user.

Quoted 8 lines

I wonder whether it might be an idea to maintain a small document where driver writers can list suggestions for code that could be lifted to core drm and be reused by others. That way both reviewers and writers of other drivers can keep an eye on that document and use it to avoid duplicating code. The procedure would then be to lift it to core drm and fix up prefixes as soon as we have two or more users.

Thoughts?

FWIW, when we originally wrote the GPU scheduler it was part of amdgpu, but we consciously kept any AMD-isms out of it so it could be lifted up to a core component when another user came along. Maybe some comments in the top of those files to that effect to maintain the separation.

Alex

Quoted 32 lines

Thomas

Quoted 29 lines
Quoted 1 line

*) If a drm helper, should we use a config option?

I am no fan of Kconfig things tbh. Maybe just include it in the vma helpers, or perhaps we want to do a drm-accel-helpers with gem helpers, drm/sched, this one here, vm/vma helpers or whatever they will be and so on? Kinda like we have modeset helpers.

I'd definitely not go for a Kconfig per individual file, that's just excessive.
-Daniel

Quoted 19 lines

For usage examples, see xe_pt.c
https://gitlab.freedesktop.org/drm/xe/kernel/-/blob/drm-xe-next/drivers/gpu/drm/xe/xe_pt.c

Thanks,
Thomas

Thomas Hellström (1):
drm: Add a gpu page-table walker helper

   drivers/gpu/drm/Makefile      |   1 +
   drivers/gpu/drm/drm_pt_walk.c | 159 +++++++++++++++++++++++++++++++++
   include/drm/drm_pt_walk.h     | 161 ++++++++++++++++++++++++++++++++++
   3 files changed, 321 insertions(+)

create mode 100644 drivers/gpu/drm/drm_pt_walk.c create mode 100644 include/drm/drm_pt_walk.h

--
2.34.1

#9 lore raw
Quoted 39 lines · Thomas Hellström

Hi, Oded.

Quoted 36 lines · Oded Gabbay
Quoted 16 lines · Alex Deucher
Quoted 14 lines · Thomas Hellström

Hi, Daniel,

Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Thomas Hellström

A slightly unusual cover letter for a single patch.

The page table walker is currently used by the xe driver only, but the code is generic so we can be good citizens and add it to drm as a helper, for possible use by other drivers,
If so we can merge the commit when we merge the xe driver.

The question raised here is
*) Should it be a generic drm helper or xe-specific with changed
prefixes?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

I think if there's some other drivers interested in using this, then this sounds like a good idea. Maybe more useful if it's also integrated into the vm/vma helpers that are being discussed as an optional part?

Maybe some good old sales pitching here to convince people would be good.

Maybe one of the new accel drivers is interested in this too?

Hi,
As the habanalabs driver is not really a new driver, I currently don't see the benefit of moving
to this code. Our pgt code is quite mature and was tested extensively in deployment in the
past couple of years.

Nevertheless, I'll try to offer this code for any new/future driver that will want to join accel.

Stanislaw, I'm adding you here in case you missed this. Might be of an interest to you.

Rewrite table walk will not give the ivpu driver much, perhaps one function would be smaller. Nothing that would justify the effort IMO.

Quoted 2 lines

Thanks for taking a look. Yes, as also mentioned to Alex, I think we'll keep this in xe for now.

Sounds good :-)

Regards
Stanislaw