Skip to content

drm/amdgpu: WAIT_EVENT notifications and lifetime updates

Jesse Zhang amd-gfx 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest11 patches 0 repliesNew

Changes in v2 from the cover letter

=============

- Patch 07: report the faulting address and the fault status in the MEMORY_EXCEPTION record; they were always returned as 0. (Jesse)

- Patch 11: bound the pending records per event type and report a loss per event source (the queue for a queue-scoped event, the DRM file for a device-scoped one) instead of per DRM file, so unconsumed USERQ_EOP records no longer drop the records of other event types. The queues of a DRM file still share the limit of a queue-scoped event type. (Jesse)

- No changes in the other patches.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11drm/amdgpu: Document render-node EVENTFD subscriptionsDocumentation/gpu/amdgpu/eventfd.rst Documentation/gpu/amdgpu/index.rst include/uapi/drm/amdgpu_drm.h+148 -110 replies
2/11drm/amdgpu: Stop queue notifications before event cleanupdrivers/gpu/drm/amd/amdgpu/amdgpu_eventfd.c drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h +1 more+56 -140 replies
3/11drm/amdgpu: Cancel WAIT_EVENT waits when a queue is removeddrivers/gpu/drm/amd/amdgpu/amdgpu_userq.c drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.c+15 -70 replies
4/11drm/amdgpu: Support process-scoped WAIT_EVENT recordsdrivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.c+13 -90 replies
5/11drm/amdgpu: Record GPU_RESET WAIT_EVENT notificationsdrivers/gpu/drm/amd/amdgpu/amdgpu_device.c+9 -50 replies
6/11drm/amdgpu: Signal MEMORY_EXCEPTION EVENTFD notificationsdrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+3 -00 replies
7/11drm/amdgpu: Record MEMORY_EXCEPTION WAIT_EVENT notificationsdrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.c drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.h+52 -40 replies
8/11drm/amdgpu: Clear PASID ownership before event manager teardowndrivers/gpu/drm/amd/amdgpu/amdgpu_ids.c drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c+8 -40 replies
9/11drm/amdgpu: Wake WAIT_EVENT callers on device unplugdrivers/gpu/drm/amd/amdgpu/amdgpu_device.c drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.c +2 more+39 -00 replies
10/11drm/amdgpu: Wait for USERQ destructors on closedrivers/gpu/drm/amd/amdgpu/amdgpu_userq.c drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h+22 -20 replies
11/11drm/amdgpu: Bound WAIT_EVENT records and report event lossdrivers/gpu/drm/amd/amdgpu/amdgpu_userq.h drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.c drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.h +1 more+114 -220 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/11] drm/amdgpu: WAIT_EVENT notifications and lifetime updates

AMDGPU currently provides EVENTFD notifications and WAIT_EVENT metadata retrieval for render-node clients.

Previous work introduced the EVENTFD infrastructure, EVENTFD event producers, and WAIT_EVENT metadata retrieval support.

References
==========

EVENTFD infrastructure:
https://patchwork.freedesktop.org/series/164618/

GPU event producers for EVENTFD notifications:
https://patchwork.freedesktop.org/series/170501/

WAIT_EVENT metadata retrieval and consumption:
https://patchwork.freedesktop.org/series/164813/

Queue-scoped USERQ_EOP and QUEUE_RESET WAIT_EVENT notifications are already integrated into the WAIT_EVENT framework.

This series extends WAIT_EVENT support for additional event types and addresses several lifetime, teardown, and robustness issues discovered during development and testing.

What this series adds
=====================

This series adds:

- Documentation for the EVENTFD and WAIT_EVENT interfaces.
- GPU_RESET WAIT_EVENT notifications.
- MEMORY_EXCEPTION EVENTFD notifications.
- MEMORY_EXCEPTION WAIT_EVENT notifications, with the faulting address and the fault status in the record.
- Support for process-scoped WAIT_EVENT records.

What this series fixes
======================

This series also improves behavior during queue teardown, device unplug, PASID ownership cleanup, and DRM file shutdown.

Specifically it:

- Stops new notifications once queue cleanup begins.
- Cancels WAIT_EVENT waits when a queue is removed.
- Prevents PASID lookups from reaching event managers being destroyed.
- Wakes blocked WAIT_EVENT callers during device unplug.
- Ensures USERQ destructors complete before manager teardown.
- Prevents unbounded WAIT_EVENT record growth and reports event loss. Records are bounded per event type and a loss is reported for the source of the dropped event, so the events of one type which nobody consumes cannot cost a DRM file the events of another type.

Patch overview
==============

01. drm/amdgpu: Document render-node EVENTFD subscriptions

Document EVENTFD subscriptions, event types, usage model, lifetime handling, and userspace examples.

02. drm/amdgpu: Stop queue notifications before event cleanup

Prevent producers from creating new notifications after queue cleanup begins.

03. drm/amdgpu: Cancel WAIT_EVENT waits when a queue is removed

Wake queue waiters and return -ENOENT when the target queue disappears.

04. drm/amdgpu: Support process-scoped WAIT_EVENT records

Allow WAIT_EVENT records that are not associated with a USERQ.

05. drm/amdgpu: Record GPU_RESET WAIT_EVENT notifications

Add WAIT_EVENT metadata delivery for GPU reset events.

06. drm/amdgpu: Signal MEMORY_EXCEPTION EVENTFD notifications

Add EVENTFD notification delivery for memory exception events.

07. drm/amdgpu: Record MEMORY_EXCEPTION WAIT_EVENT notifications

Add WAIT_EVENT metadata delivery for memory exception events, including the faulting address and the fault status.

08. drm/amdgpu: Clear PASID ownership before event manager teardown

Prevent new PASID-based event lookups from reaching a closing file.

09. drm/amdgpu: Wake WAIT_EVENT callers on device unplug

Wake blocked waiters and return -ENODEV after unplug.

10. drm/amdgpu: Wait for USERQ destructors on close

Ensure queue destruction completes before manager teardown.

11. drm/amdgpu: Bound WAIT_EVENT records and report event loss

Bound pending records per event type and report metadata loss per event source when records cannot be stored.

Changes in v2
=============

- Patch 07: report the faulting address and the fault status in the MEMORY_EXCEPTION record; they were always returned as 0. (Jesse)

- Patch 11: bound the pending records per event type and report a loss per event source (the queue for a queue-scoped event, the DRM file for a device-scoped one) instead of per DRM file, so unconsumed USERQ_EOP records no longer drop the records of other event types. The queues of a DRM file still share the limit of a queue-scoped event type. (Jesse)

- No changes in the other patches.

Testing
=======

IGT amd_eventfd_wait_event on Navi48 (GFX 12.0) with compute, GFX and SDMA user queues: event producers (USERQ_EOP, QUEUE_RESET, GPU_RESET, MEMORY_EXCEPTION), sequence numbers, record limit and loss reporting, queue and DRM file teardown with subscriptions, pending records and blocked waiters, and stress runs up to 100000 events.

Base
====

This series is based on:

amd-unified-interface

Thanks,

Srinivasan Shanmugam (11):
drm/amdgpu: Document render-node EVENTFD subscriptions drm/amdgpu: Stop queue notifications before event cleanup drm/amdgpu: Cancel WAIT_EVENT waits when a queue is removed drm/amdgpu: Support process-scoped WAIT_EVENT records drm/amdgpu: Record GPU_RESET WAIT_EVENT notifications drm/amdgpu: Signal MEMORY_EXCEPTION EVENTFD notifications drm/amdgpu: Record MEMORY_EXCEPTION WAIT_EVENT notifications drm/amdgpu: Clear PASID ownership before event manager teardown drm/amdgpu: Wake WAIT_EVENT callers on device unplug drm/amdgpu: Wait for USERQ destructors on close drm/amdgpu: Bound WAIT_EVENT records and report event loss

 Documentation/gpu/amdgpu/eventfd.rst          | 134 ++++++++++++
 Documentation/gpu/amdgpu/index.rst            |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  15 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |   2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_eventfd.c   |  12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c       |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h       |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       |   3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c     |  67 +++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h     |  21 +-
 .../drm/amd/amdgpu/amdgpu_userq_internal.h    |   2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c        |   6 +
 .../gpu/drm/amd/amdgpu/amdgpu_wait_event.c    | 207 +++++++++++++++---
 .../gpu/drm/amd/amdgpu/amdgpu_wait_event.h    |  20 +-
 include/uapi/drm/amdgpu_drm.h                 |  48 +++-
 15 files changed, 474 insertions(+), 73 deletions(-)
 create mode 100644 Documentation/gpu/amdgpu/eventfd.rst
Signature · 1 line
2.50.1