Silence Valgrind warnings
Change-Id: I8803f3d310fccd69d0d04b2464b00dccc40270e3
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
[ROCm/ROCR-Runtime commit: 056ddbbc82]
Этот коммит содержится в:
коммит произвёл
Felix Kuehling
родитель
83bbc28ad9
Коммит
84945d39f8
@@ -1094,8 +1094,8 @@ typedef struct _HsaPmcTraceRoot
|
||||
|
||||
typedef struct _HsaGpuTileConfig
|
||||
{
|
||||
const HSAuint32 *TileConfig;
|
||||
const HSAuint32 *MacroTileConfig;
|
||||
HSAuint32 *TileConfig;
|
||||
HSAuint32 *MacroTileConfig;
|
||||
HSAuint32 NumTileConfigs;
|
||||
HSAuint32 NumMacroTileConfigs;
|
||||
|
||||
|
||||
@@ -67,9 +67,8 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtDbgRegister(HSAuint32 NodeId)
|
||||
if (result != HSAKMT_STATUS_SUCCESS)
|
||||
return result;
|
||||
|
||||
struct kfd_ioctl_dbg_register_args args;
|
||||
struct kfd_ioctl_dbg_register_args args = {0};
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
args.gpu_id = gpu_id;
|
||||
|
||||
long err = kmtIoctl(kfd_fd, AMDKFD_IOC_DBG_REGISTER, &args);
|
||||
@@ -96,9 +95,8 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtDbgUnregister(HSAuint32 NodeId)
|
||||
if (result != HSAKMT_STATUS_SUCCESS)
|
||||
return result;
|
||||
|
||||
struct kfd_ioctl_dbg_unregister_args args;
|
||||
struct kfd_ioctl_dbg_unregister_args args = {0};
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
args.gpu_id = gpu_id;
|
||||
long err = kmtIoctl(kfd_fd, AMDKFD_IOC_DBG_UNREGISTER, &args);
|
||||
|
||||
|
||||
@@ -65,9 +65,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtCreateEvent(HsaEventDescriptor *EventDesc,
|
||||
|
||||
memset(e, 0, sizeof(*e));
|
||||
|
||||
struct kfd_ioctl_create_event_args args;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
struct kfd_ioctl_create_event_args args = {0};
|
||||
|
||||
args.event_type = EventDesc->EventType;
|
||||
args.node_id = EventDesc->NodeId;
|
||||
@@ -127,9 +125,8 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtCreateEvent(HsaEventDescriptor *EventDesc,
|
||||
EventDesc->SyncVar.SyncVarSize;
|
||||
|
||||
if (IsSignaled && !IsSystemEventType(e->EventData.EventType)) {
|
||||
struct kfd_ioctl_set_event_args set_args;
|
||||
struct kfd_ioctl_set_event_args set_args = {0};
|
||||
|
||||
memset(&set_args, 0, sizeof(set_args));
|
||||
set_args.event_id = args.event_id;
|
||||
|
||||
kmtIoctl(kfd_fd, AMDKFD_IOC_SET_EVENT, &set_args);
|
||||
@@ -147,9 +144,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtDestroyEvent(HsaEvent *Event)
|
||||
if (!Event)
|
||||
return HSAKMT_STATUS_INVALID_HANDLE;
|
||||
|
||||
struct kfd_ioctl_destroy_event_args args;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
struct kfd_ioctl_destroy_event_args args = {0};
|
||||
|
||||
args.event_id = Event->EventId;
|
||||
|
||||
@@ -173,9 +168,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtSetEvent(HsaEvent *Event)
|
||||
if (IsSystemEventType(Event->EventData.EventType))
|
||||
return HSAKMT_STATUS_ERROR;
|
||||
|
||||
struct kfd_ioctl_set_event_args args;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
struct kfd_ioctl_set_event_args args = {0};
|
||||
|
||||
args.event_id = Event->EventId;
|
||||
|
||||
@@ -198,9 +191,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtResetEvent(HsaEvent *Event)
|
||||
if (IsSystemEventType(Event->EventData.EventType))
|
||||
return HSAKMT_STATUS_ERROR;
|
||||
|
||||
struct kfd_ioctl_reset_event_args args;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
struct kfd_ioctl_reset_event_args args = {0};
|
||||
|
||||
args.event_id = Event->EventId;
|
||||
|
||||
@@ -306,9 +297,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtWaitOnMultipleEvents(HsaEvent *Events[],
|
||||
event_data[i].kfd_event_data_ext = (uint64_t)(uintptr_t)NULL;
|
||||
}
|
||||
|
||||
struct kfd_ioctl_wait_events_args args;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
struct kfd_ioctl_wait_events_args args = {0};
|
||||
|
||||
args.wait_for_all = WaitOnAll;
|
||||
args.timeout = Milliseconds;
|
||||
|
||||
@@ -728,8 +728,8 @@ static vm_object_t *fmm_allocate_memory_object(uint32_t gpu_id, void *mem,
|
||||
uint64_t *mmap_offset,
|
||||
uint32_t flags)
|
||||
{
|
||||
struct kfd_ioctl_alloc_memory_of_gpu_args args;
|
||||
struct kfd_ioctl_free_memory_of_gpu_args free_args;
|
||||
struct kfd_ioctl_alloc_memory_of_gpu_args args = {0};
|
||||
struct kfd_ioctl_free_memory_of_gpu_args free_args = {0};
|
||||
vm_object_t *vm_obj = NULL;
|
||||
|
||||
if (!mem)
|
||||
@@ -891,7 +891,7 @@ static uint32_t fmm_translate_hsa_to_ioc_flags(HsaMemFlags flags)
|
||||
void *fmm_allocate_scratch(uint32_t gpu_id, uint64_t MemorySizeInBytes)
|
||||
{
|
||||
manageable_aperture_t *aperture_phy;
|
||||
struct kfd_ioctl_alloc_memory_of_scratch_args args;
|
||||
struct kfd_ioctl_alloc_memory_of_scratch_args args = {0};
|
||||
int32_t gpu_mem_id;
|
||||
void *mem = NULL;
|
||||
uint64_t aligned_size = ALIGN_UP(MemorySizeInBytes, SCRATCH_ALIGN);
|
||||
@@ -1298,7 +1298,7 @@ void *fmm_allocate_host(uint32_t node_id, uint64_t MemorySizeInBytes,
|
||||
|
||||
static void __fmm_release(void *address, manageable_aperture_t *aperture)
|
||||
{
|
||||
struct kfd_ioctl_free_memory_of_gpu_args args;
|
||||
struct kfd_ioctl_free_memory_of_gpu_args args = {0};
|
||||
vm_object_t *object;
|
||||
|
||||
if (!address)
|
||||
@@ -1394,7 +1394,7 @@ void fmm_release(void *address)
|
||||
static int fmm_set_memory_policy(uint32_t gpu_id, int default_policy, int alt_policy,
|
||||
uintptr_t alt_base, uint64_t alt_size)
|
||||
{
|
||||
struct kfd_ioctl_set_memory_policy_args args;
|
||||
struct kfd_ioctl_set_memory_policy_args args = {0};
|
||||
|
||||
args.gpu_id = gpu_id;
|
||||
args.default_policy = default_policy;
|
||||
@@ -1421,12 +1421,11 @@ static HSAKMT_STATUS get_process_apertures(
|
||||
struct kfd_process_device_apertures *process_apertures,
|
||||
uint32_t *num_of_nodes)
|
||||
{
|
||||
struct kfd_ioctl_get_process_apertures_new_args args_new = {
|
||||
.kfd_process_device_apertures_ptr = (uintptr_t)process_apertures,
|
||||
.num_of_nodes = *num_of_nodes
|
||||
};
|
||||
struct kfd_ioctl_get_process_apertures_new_args args_new = {0};
|
||||
struct kfd_ioctl_get_process_apertures_args args_old;
|
||||
|
||||
args_new.kfd_process_device_apertures_ptr = (uintptr_t)process_apertures;
|
||||
args_new.num_of_nodes = *num_of_nodes;
|
||||
if (!kmtIoctl(kfd_fd, AMDKFD_IOC_GET_PROCESS_APERTURES_NEW,
|
||||
(void *)&args_new)) {
|
||||
*num_of_nodes = args_new.num_of_nodes;
|
||||
@@ -1435,6 +1434,8 @@ static HSAKMT_STATUS get_process_apertures(
|
||||
|
||||
/* New IOCTL failed, try the old one in case we're running on
|
||||
* a really old kernel */
|
||||
memset(&args_old, 0, sizeof(args_old));
|
||||
|
||||
if (kmtIoctl(kfd_fd, AMDKFD_IOC_GET_PROCESS_APERTURES,
|
||||
(void *)&args_old))
|
||||
return HSAKMT_STATUS_ERROR;
|
||||
@@ -1530,7 +1531,7 @@ HSAKMT_STATUS fmm_init_process_apertures(unsigned int NumNodes)
|
||||
* the apertures in kfd_process_device_apertures_ptr
|
||||
*/
|
||||
num_of_nodes = gpu_mem_count;
|
||||
process_apertures = malloc(num_of_nodes * sizeof(struct kfd_process_device_apertures));
|
||||
process_apertures = calloc(num_of_nodes, sizeof(struct kfd_process_device_apertures));
|
||||
if (!process_apertures) {
|
||||
ret = HSAKMT_STATUS_NO_MEMORY;
|
||||
goto sysfs_parse_failed;
|
||||
@@ -1782,7 +1783,7 @@ static int _fmm_map_to_gpu(manageable_aperture_t *aperture,
|
||||
void *address, uint64_t size, vm_object_t *obj,
|
||||
uint32_t *nodes_to_map, uint32_t nodes_array_size)
|
||||
{
|
||||
struct kfd_ioctl_map_memory_to_gpu_args args;
|
||||
struct kfd_ioctl_map_memory_to_gpu_args args = {0};
|
||||
vm_object_t *object;
|
||||
|
||||
if (!obj)
|
||||
@@ -2057,7 +2058,7 @@ static int _fmm_unmap_from_gpu(manageable_aperture_t *aperture, void *address,
|
||||
{
|
||||
vm_object_t *object;
|
||||
int ret = 0;
|
||||
struct kfd_ioctl_unmap_memory_from_gpu_args args;
|
||||
struct kfd_ioctl_unmap_memory_from_gpu_args args = {0};
|
||||
HSAuint32 page_offset = (HSAint64)address & (PAGE_SIZE - 1);
|
||||
|
||||
if (!obj)
|
||||
@@ -2124,7 +2125,7 @@ static int _fmm_unmap_from_gpu_scratch(uint32_t gpu_id,
|
||||
{
|
||||
int32_t gpu_mem_id;
|
||||
vm_object_t *object;
|
||||
struct kfd_ioctl_unmap_memory_from_gpu_args args;
|
||||
struct kfd_ioctl_unmap_memory_from_gpu_args args = {0};
|
||||
|
||||
/* Retrieve gpu_mem id according to gpu_id */
|
||||
gpu_mem_id = gpu_mem_find_by_gpu_id(gpu_id);
|
||||
@@ -2245,7 +2246,7 @@ static bool is_dgpu_mem_init = false;
|
||||
|
||||
static int set_dgpu_aperture(uint32_t gpu_id, uint64_t base, uint64_t limit)
|
||||
{
|
||||
struct kfd_ioctl_set_process_dgpu_aperture_args args;
|
||||
struct kfd_ioctl_set_process_dgpu_aperture_args args = {0};
|
||||
|
||||
args.gpu_id = gpu_id;
|
||||
args.dgpu_base = base;
|
||||
@@ -2578,9 +2579,9 @@ HSAKMT_STATUS fmm_register_graphics_handle(HSAuint64 GraphicsResourceHandle,
|
||||
uint32_t *gpu_id_array,
|
||||
uint32_t gpu_id_array_size)
|
||||
{
|
||||
struct kfd_ioctl_get_dmabuf_info_args infoArgs;
|
||||
struct kfd_ioctl_import_dmabuf_args importArgs;
|
||||
struct kfd_ioctl_free_memory_of_gpu_args freeArgs;
|
||||
struct kfd_ioctl_get_dmabuf_info_args infoArgs = {0};
|
||||
struct kfd_ioctl_import_dmabuf_args importArgs = {0};
|
||||
struct kfd_ioctl_free_memory_of_gpu_args freeArgs = {0};
|
||||
manageable_aperture_t *aperture;
|
||||
vm_object_t *obj;
|
||||
void *metadata;
|
||||
@@ -2684,7 +2685,7 @@ HSAKMT_STATUS fmm_share_memory(void *MemoryAddress,
|
||||
HSAuint32 gpu_id = 0;
|
||||
vm_object_t *obj = NULL;
|
||||
manageable_aperture_t *aperture = NULL;
|
||||
struct kfd_ioctl_ipc_export_handle_args exportArgs;
|
||||
struct kfd_ioctl_ipc_export_handle_args exportArgs = {0};
|
||||
HsaApertureInfo ApeInfo;
|
||||
HsaSharedMemoryStruct *SharedMemoryStruct =
|
||||
to_hsa_shared_memory_struct(SharedMemoryHandle);
|
||||
@@ -2741,8 +2742,8 @@ HSAKMT_STATUS fmm_register_shared_memory(const HsaSharedMemoryHandle *SharedMemo
|
||||
vm_object_t *obj = NULL;
|
||||
void *reservedMem = NULL;
|
||||
manageable_aperture_t *aperture;
|
||||
struct kfd_ioctl_ipc_import_handle_args importArgs;
|
||||
struct kfd_ioctl_free_memory_of_gpu_args freeArgs;
|
||||
struct kfd_ioctl_ipc_import_handle_args importArgs = {0};
|
||||
struct kfd_ioctl_free_memory_of_gpu_args freeArgs = {0};
|
||||
const HsaSharedMemoryStruct *SharedMemoryStruct =
|
||||
to_const_hsa_shared_memory_struct(SharedMemoryHandle);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtSetMemoryPolicy(HSAuint32 Node,
|
||||
void *MemoryAddressAlternate,
|
||||
HSAuint64 MemorySizeInBytes)
|
||||
{
|
||||
struct kfd_ioctl_set_memory_policy_args args;
|
||||
struct kfd_ioctl_set_memory_policy_args args = {0};
|
||||
HSAKMT_STATUS result;
|
||||
uint32_t gpu_id;
|
||||
|
||||
@@ -74,8 +74,6 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtSetMemoryPolicy(HSAuint32 Node,
|
||||
CHECK_PAGE_MULTIPLE(MemoryAddressAlternate);
|
||||
CHECK_PAGE_MULTIPLE(MemorySizeInBytes);
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
|
||||
args.gpu_id = gpu_id;
|
||||
args.default_policy = (DefaultPolicy == HSA_CACHING_CACHED) ?
|
||||
KFD_IOC_CACHE_POLICY_COHERENT :
|
||||
@@ -356,7 +354,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtProcessVMRead(HSAuint32 Pid,
|
||||
HSAuint64 RemoteMemoryArrayCount,
|
||||
HSAuint64 *SizeCopied)
|
||||
{
|
||||
struct kfd_ioctl_cross_memory_copy_args args;
|
||||
struct kfd_ioctl_cross_memory_copy_args args = {0};
|
||||
|
||||
pr_debug("[%s]\n", __func__);
|
||||
|
||||
@@ -391,7 +389,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtProcessVMWrite(HSAuint32 Pid,
|
||||
HSAuint64 RemoteMemoryArrayCount,
|
||||
HSAuint64 *SizeCopied)
|
||||
{
|
||||
struct kfd_ioctl_cross_memory_copy_args args;
|
||||
struct kfd_ioctl_cross_memory_copy_args args = {0};
|
||||
|
||||
pr_debug("[%s]\n", __func__);
|
||||
|
||||
@@ -530,7 +528,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtUnmapGraphicHandle(HSAuint32 NodeId,
|
||||
|
||||
HSAKMT_STATUS HSAKMTAPI hsaKmtGetTileConfig(HSAuint32 NodeId, HsaGpuTileConfig *config)
|
||||
{
|
||||
struct kfd_ioctl_get_tile_config_args args;
|
||||
struct kfd_ioctl_get_tile_config_args args = {0};
|
||||
uint32_t gpu_id;
|
||||
HSAKMT_STATUS result;
|
||||
|
||||
@@ -540,6 +538,12 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtGetTileConfig(HSAuint32 NodeId, HsaGpuTileConfig *
|
||||
if (result != HSAKMT_STATUS_SUCCESS)
|
||||
return result;
|
||||
|
||||
/* Avoid Valgrind warnings about uninitialized data. Valgrind doesn't
|
||||
* know that KFD writes this.
|
||||
*/
|
||||
memset(config->TileConfig, 0, sizeof(*config->TileConfig) * config->NumTileConfigs);
|
||||
memset(config->MacroTileConfig, 0, sizeof(*config->MacroTileConfig) * config->NumMacroTileConfigs);
|
||||
|
||||
args.gpu_id = gpu_id;
|
||||
args.tile_config_ptr = (uint64_t)config->TileConfig;
|
||||
args.macro_tile_config_ptr = (uint64_t)config->MacroTileConfig;
|
||||
|
||||
@@ -528,9 +528,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtCreateQueue(HSAuint32 NodeId,
|
||||
q->cu_mask[i/32] |= (1 << (i % 32));
|
||||
}
|
||||
|
||||
struct kfd_ioctl_create_queue_args args;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
struct kfd_ioctl_create_queue_args args = {0};
|
||||
|
||||
args.gpu_id = gpu_id;
|
||||
|
||||
@@ -618,7 +616,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtUpdateQueue(HSA_QUEUEID QueueId,
|
||||
HSAuint64 QueueSize,
|
||||
HsaEvent *Event)
|
||||
{
|
||||
struct kfd_ioctl_update_queue_args arg;
|
||||
struct kfd_ioctl_update_queue_args arg = {0};
|
||||
struct queue *q = PORT_UINT64_TO_VPTR(QueueId);
|
||||
|
||||
CHECK_KFD_OPEN();
|
||||
@@ -648,13 +646,11 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtDestroyQueue(HSA_QUEUEID QueueId)
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
struct queue *q = PORT_UINT64_TO_VPTR(QueueId);
|
||||
struct kfd_ioctl_destroy_queue_args args;
|
||||
struct kfd_ioctl_destroy_queue_args args = {0};
|
||||
|
||||
if (!q)
|
||||
return HSAKMT_STATUS_INVALID_PARAMETER;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
|
||||
args.queue_id = q->queue_id;
|
||||
|
||||
int err = kmtIoctl(kfd_fd, AMDKFD_IOC_DESTROY_QUEUE, &args);
|
||||
@@ -671,14 +667,13 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtSetQueueCUMask(HSA_QUEUEID QueueId,
|
||||
HSAuint32 *QueueCUMask)
|
||||
{
|
||||
struct queue *q = PORT_UINT64_TO_VPTR(QueueId);
|
||||
struct kfd_ioctl_set_cu_mask_args args;
|
||||
struct kfd_ioctl_set_cu_mask_args args = {0};
|
||||
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
if (CUMaskCount == 0 || !QueueCUMask || ((CUMaskCount % 32) != 0))
|
||||
return HSAKMT_STATUS_INVALID_PARAMETER;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
args.queue_id = q->queue_id;
|
||||
args.num_cu_mask = CUMaskCount;
|
||||
args.cu_mask_ptr = (uintptr_t)QueueCUMask;
|
||||
@@ -702,7 +697,7 @@ hsaKmtGetQueueInfo(
|
||||
)
|
||||
{
|
||||
struct queue *q = PORT_UINT64_TO_VPTR(QueueId);
|
||||
struct kfd_ioctl_get_queue_wave_state_args args;
|
||||
struct kfd_ioctl_get_queue_wave_state_args args = {0};
|
||||
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
@@ -712,7 +707,6 @@ hsaKmtGetQueueInfo(
|
||||
if (q->ctx_save_restore == NULL)
|
||||
return HSAKMT_STATUS_ERROR;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
args.queue_id = q->queue_id;
|
||||
args.ctl_stack_address = (uintptr_t)q->ctx_save_restore;
|
||||
|
||||
@@ -739,7 +733,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtSetTrapHandler(HSAuint32 Node,
|
||||
void *TrapBufferBaseAddress,
|
||||
HSAuint64 TrapBufferSizeInBytes)
|
||||
{
|
||||
struct kfd_ioctl_set_trap_handler_args args;
|
||||
struct kfd_ioctl_set_trap_handler_args args = {0};
|
||||
HSAKMT_STATUS result;
|
||||
uint32_t gpu_id;
|
||||
|
||||
@@ -749,8 +743,6 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtSetTrapHandler(HSAuint32 Node,
|
||||
if (result != HSAKMT_STATUS_SUCCESS)
|
||||
return result;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
|
||||
args.gpu_id = gpu_id;
|
||||
args.tba_addr = (uintptr_t)TrapHandlerBaseAddress;
|
||||
args.tma_addr = (uintptr_t)TrapBufferBaseAddress;
|
||||
|
||||
@@ -31,7 +31,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtGetClockCounters(HSAuint32 NodeId,
|
||||
{
|
||||
HSAKMT_STATUS result;
|
||||
uint32_t gpu_id;
|
||||
struct kfd_ioctl_get_clock_counters_args args;
|
||||
struct kfd_ioctl_get_clock_counters_args args = {0};
|
||||
int err;
|
||||
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
@@ -32,9 +32,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtGetVersion(HsaVersionInfo *VersionInfo)
|
||||
{
|
||||
CHECK_KFD_OPEN();
|
||||
|
||||
struct kfd_ioctl_get_version_args args;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
struct kfd_ioctl_get_version_args args = {0};
|
||||
|
||||
if (kmtIoctl(kfd_fd, AMDKFD_IOC_GET_VERSION, &args) == -1)
|
||||
return HSAKMT_STATUS_ERROR;
|
||||
|
||||
Ссылка в новой задаче
Block a user