History

drm/xe/uapi: Introduce a flag to disallow vm overcommit in fault mode

Some compute applications may try to allocate device memory to probe how much device memory is actually available, assuming that the application will be the only one running on the particular GPU. That strategy fails in fault mode since it allows VM overcommit. While this could be resolved in user-space it's further complicated by cgroups potentially restricting the amount of memory available to the application. Introduce a vm create flag, DRM_XE_VM_CREATE_NO_VM_OVERCOMMIT, that allows fault mode to mimic the behaviour of !fault mode WRT this. It blocks evicting same vm bos during VM_BIND processing. However, it does *not* block evicting same-vm bos during pagefault processing, preferring eviction rather than VM banning in OOM situations.

Thomas Hellström committed 9 months ago

Commit 369cc881 parent 1aafc0a4 files · +23 −2Browse files

Showing the changes to include/uapi (1 of 4 files). Show all

Unified · Split

include/uapi/drm/xe_drm.h+6−0
@@ -969,6 +969,11 @@ struct drm_xe_gem_mmap_offset { · 968 unmodified lines
969 * demand when accessed, and also allows per-VM overcommit of memory.969 * demand when accessed, and also allows per-VM overcommit of memory.
970 * The xe driver internally uses recoverable pagefaults to implement970 * The xe driver internally uses recoverable pagefaults to implement
971 * this.971 * this.
972 * - %DRM_XE_VM_CREATE_FLAG_NO_VM_OVERCOMMIT - Requires also
973 * DRM_XE_VM_CREATE_FLAG_FAULT_MODE. This disallows per-VM overcommit
974 * but only during a &DRM_IOCTL_XE_VM_BIND operation with the
975 * %DRM_XE_VM_BIND_FLAG_IMMEDIATE flag set. This may be useful for
976 * user-space naively probing the amount of available memory.
972 */977 */
973struct drm_xe_vm_create {978struct drm_xe_vm_create {
974 /** @extensions: Pointer to the first extension struct, if any */979 /** @extensions: Pointer to the first extension struct, if any */
@@ -977,6 +982,7 @@ struct drm_xe_vm_create { · 2 unmodified lines
977#define DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE (1 << 0)982#define DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE (1 << 0)
978#define DRM_XE_VM_CREATE_FLAG_LR_MODE (1 << 1)983#define DRM_XE_VM_CREATE_FLAG_LR_MODE (1 << 1)
979#define DRM_XE_VM_CREATE_FLAG_FAULT_MODE (1 << 2)984#define DRM_XE_VM_CREATE_FLAG_FAULT_MODE (1 << 2)
985#define DRM_XE_VM_CREATE_FLAG_NO_VM_OVERCOMMIT (1 << 3)
980 /** @flags: Flags */986 /** @flags: Flags */
981 __u32 flags;987 __u32 flags;
982 988