Re: [PATCH v2 2/8] drm/amdkfd: Add KFD SMI event IDs and triggers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Am 2022-01-20 um 18:13 schrieb Philip Yang:
Define new system management interface event IDs, migration triggers and
user queue eviction triggers, those will be implemented in the following
patches.

Signed-off-by: Philip Yang <Philip.Yang@xxxxxxx>
---
  include/uapi/linux/kfd_ioctl.h | 27 +++++++++++++++++++++++++++
  1 file changed, 27 insertions(+)

diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
index af96af174dc4..de0b5bb95db3 100644
--- a/include/uapi/linux/kfd_ioctl.h
+++ b/include/uapi/linux/kfd_ioctl.h
@@ -459,10 +459,37 @@ enum kfd_smi_event {
	KFD_SMI_EVENT_THERMAL_THROTTLE = 2,
  	KFD_SMI_EVENT_GPU_PRE_RESET = 3,
  	KFD_SMI_EVENT_GPU_POST_RESET = 4,
+	KFD_SMI_EVENT_MIGRATION = 5,
+	KFD_SMI_EVENT_PAGE_FAULT_START = 6,
+	KFD_SMI_EVENT_PAGE_FAULT_END = 7,
+	KFD_SMI_EVENT_QUEUE_EVICTION = 8,
+	KFD_SMI_EVENT_QUEUE_EVICTION_RESTORE = 9,
+	KFD_SMI_EVENT_UNMAP_FROM_GPU = 10,
+
+	/*
+	 * max event number, as a flag bit to get events from all processes,
+	 * this requires super user permission, otherwise will not be able to
+	 * receive event from any process. Without this flag to receive events
+	 * from same process.
+	 */
+	KFD_SMI_EVENT_ALL_PROCESS = 64
  };
#define KFD_SMI_EVENT_MASK_FROM_INDEX(i) (1ULL << ((i) - 1)) +enum KFD_MIGRATION_QUEUE_EVICTION_UNMAP_EVENT_TRIGGER {
+	MIGRATION_TRIGGER_PREFETCH = 1,
+	MIGRATION_TRIGGER_PAGEFAULT,

Call this KFD_MIGRATION_TRIGGER_PAGEFAULT_GPU for consistency. Add the KFD_ prefix to all the migration triggers.


+	MIGRATION_TRIGGER_PAGEFAULT_CPU,
+	MIGRATION_TRIGGER_TTM_EVICTION,
+	SVM_RANGE_EVICTION,
+	SVM_RANGE_MIGRATION,
+	USERPTR_EVICTION,
+	TTM_EVICTION,
+	UNMAP_FROM_CPU,
+	SUSPEND_EVICTION
Migration triggers and queue eviction triggers should be separate enums. The eviction triggers should have a consistent prefix: KFD_QUEUE_EVICTION_TRIGGER...

I'm not sure the distinction between SVM_RANGE_MIGRATION and SVM_RANGE_EVICTION is useful. It should be clear from the context, since migrations log their own events. If anything, the term SVM_RANGE_EVICTION is misleading. It's really any MMU notifier that's not MMU_NOTIFY_MIGRATE or MMU_NOTIFY_UNMAP.

I'd suggest the following names:

KFD_QUEUE_EVICTION_TRIGGER_SVM
KFD_QUEUE_EVICTION_TRIGGER_USERPTR
KFD_QUEUE_EVICTION_TRIGGER_TTM
KFD_QUEUE_EVICTION_TRIGGER_SUSPEND

Then there are triggers for unmapping from GPU, which seems to have some overlap with queue eviction in svm_range_evict. But that becomes a bit easier if you remove the distinction between SVM_RANGE_MIGRATION and SVM_RANGE_EVICTION. Then you are left with these two unmap triggers:

KFD_SVM_UNMAP_TRIGGER_MMU_NOTIFIER
KFD_SVM_UNMAP_TRIGGER_UNMAP_FROM_CPU

Regards,
  Felix


+};
+
  struct kfd_ioctl_smi_events_args {
  	__u32 gpuid;	/* to KFD */
  	__u32 anon_fd;	/* from KFD */



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux