libhsakmt: add event age tracking

Keeping last signaled event age to avoid race conditions
for HSA_EVENTTYPE_SIGNAL when event age init value is non-zero.

Change-Id: Ifb9a11a6868e5762a9f92f579e45a0a2c8fa1017
Signed-off-by: James Zhu <James.Zhu@amd.com>
이 커밋은 다음에 포함됨:
James Zhu
2023-05-17 16:30:30 -04:00
부모 4675492852
커밋 a0cbf90b90
3개의 변경된 파일과 78개의 추가작업 그리고 3개의 파일을 삭제
+43
파일 보기
@@ -243,6 +243,25 @@ hsaKmtWaitOnEvent(
HSAuint32 Milliseconds //IN
);
/**
Checks the current state of the event object. If the object's state is
nonsignaled, the calling thread enters the wait state. event_age can
help avoiding race conditions.
The function returns when one of the following occurs:
- The specified event object is in the signaled state.
- The time-out interval elapses.
- Tracking event age
*/
HSAKMT_STATUS
HSAKMTAPI
hsaKmtWaitOnEvent_Ext(
HsaEvent* Event, //IN
HSAuint32 Milliseconds, //IN
uint64_t *event_age //IN/OUT
);
/**
Checks the current state of multiple event objects.
@@ -264,6 +283,30 @@ hsaKmtWaitOnMultipleEvents(
HSAuint32 Milliseconds //IN
);
/**
Checks the current state of multiple event objects.
event_age can help avoiding race conditions.
The function returns when one of the following occurs:
- Either any one or all of the specified objects are in the signaled state
- if "WaitOnAll" is "true" the function returns when the state of all
objects in array is signaled
- if "WaitOnAll" is "false" the function returns when the state of any
one of the objects is set to signaled
- The time-out interval elapses.
- Tracking event age
*/
HSAKMT_STATUS
HSAKMTAPI
hsaKmtWaitOnMultipleEvents_Ext(
HsaEvent* Events[], //IN
HSAuint32 NumEvents, //IN
bool WaitOnAll, //IN
HSAuint32 Milliseconds, //IN
uint64_t *event_age //IN/OUT
);
/**
new TEMPORARY function definition - to be used only on "Triniti + Southern Islands" platform
If used on other platforms the function will return HSAKMT_STATUS_ERROR
+11 -2
파일 보기
@@ -39,9 +39,10 @@
* - 1.11 - Add unified memory for ctx save/restore area
* - 1.12 - Add DMA buf export ioctl
* - 1.13 - Add debugger API
* - 1.14 - Update kfd_event_data
*/
#define KFD_IOCTL_MAJOR_VERSION 1
#define KFD_IOCTL_MINOR_VERSION 13
#define KFD_IOCTL_MINOR_VERSION 14
/*
* Debug revision change log
@@ -979,12 +980,20 @@ struct kfd_hsa_hw_exception_data {
__u32 gpu_id;
};
/* hsa signal event data */
struct kfd_hsa_signal_event_data {
__u64 last_event_age; /* to and from KFD */
};
/* Event data */
struct kfd_event_data {
union {
/* From KFD */
struct kfd_hsa_memory_exception_data memory_exception_data;
struct kfd_hsa_hw_exception_data hw_exception_data;
}; /* From KFD */
/* To and From KFD */
struct kfd_hsa_signal_event_data signal_event_data;
};
__u64 kfd_event_data_ext; /* pointer to an extension structure
for future exception types */
__u32 event_id; /* to KFD */