From 79077811f5fa6cbf055aa9b9aae5121eabc7bb94 Mon Sep 17 00:00:00 2001 From: shaoyunl Date: Wed, 9 Mar 2016 14:30:12 -0500 Subject: [PATCH] Add Imprecise flag for memory access fault KFD may not be able to provide the precise VM fault address and status. This flag will indicate whether the event data has the fault details Change-Id: I15ffd5c25f555003c6450cc0700efb769418f76b --- include/hsakmttypes.h | 3 ++- include/linux/kfd_ioctl.h | 2 +- src/events.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/hsakmttypes.h b/include/hsakmttypes.h index 02d8319c6a..d091c833f0 100644 --- a/include/hsakmttypes.h +++ b/include/hsakmttypes.h @@ -781,7 +781,8 @@ typedef struct _HsaAccessAttributeFailure unsigned int NoExecute : 1; // Execute access to a page marked NX unsigned int GpuAccess : 1; // Host access only unsigned int ECC : 1; // ECC failure (if supported by HW) - unsigned int Reserved : 27; // must be 0 + unsigned int Imprecise : 1; // Can't determine the exact fault address + unsigned int Reserved : 26; // must be 0 } HsaAccessAttributeFailure; // data associated with HSA_EVENTID_MEMORY diff --git a/include/linux/kfd_ioctl.h b/include/linux/kfd_ioctl.h index ffa68a3555..b0d13cc3b7 100644 --- a/include/linux/kfd_ioctl.h +++ b/include/linux/kfd_ioctl.h @@ -222,7 +222,7 @@ struct kfd_memory_exception_failure { bool NotPresent; /* Page not present or supervisor privilege */ bool ReadOnly; /* Write access to a read-only page */ bool NoExecute; /* Execute access to a page marked NX */ - bool pad; + bool imprecise; /* Can't determine the exact fault address */ }; /* memory exception data*/ diff --git a/src/events.c b/src/events.c index b31353f49c..a45716ad4a 100644 --- a/src/events.c +++ b/src/events.c @@ -278,6 +278,7 @@ hsaKmtWaitOnMultipleEvents( Events[i]->EventData.EventData.MemoryAccessFault.Failure.NotPresent = event_data[i].memory_exception_data.failure.NotPresent; Events[i]->EventData.EventData.MemoryAccessFault.Failure.ReadOnly = event_data[i].memory_exception_data.failure.ReadOnly; Events[i]->EventData.EventData.MemoryAccessFault.Failure.NoExecute = event_data[i].memory_exception_data.failure.NoExecute; + Events[i]->EventData.EventData.MemoryAccessFault.Failure.Imprecise = event_data[i].memory_exception_data.failure.imprecise; Events[i]->EventData.EventData.MemoryAccessFault.Flags = HSA_EVENTID_MEMORY_FATAL_PROCESS; } }