gpu: nvgpu: Create unique share id

This is fixing a race in address space identifier
creation by making atomic variable increment.

Bug 3684734

Change-Id: I864e8f61257569e35f926822c2a5260532d41360
Signed-off-by: Dinesh T <dt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2742206
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Richard Zhao <rizhao@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Dinesh T
2022-07-08 20:28:27 +00:00
committed by mobile promotions
parent eae4593343
commit b1d7c77d8e
8 changed files with 33 additions and 117 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -119,7 +119,7 @@ int test_init_mm(struct unit_module *m, struct gk20a *g, void *args);
* Test Type: Feature
*
* Targets: gk20a_as_alloc_share, gk20a_as_release_share,
* gk20a_vm_release_share, gk20a_from_as
* gk20a_vm_release_share
*
* Input:
* - The test_init_mm must have been executed
@@ -153,24 +153,4 @@ int test_init_mm(struct unit_module *m, struct gk20a *g, void *args);
*/
int test_as_alloc_share(struct unit_module *m, struct gk20a *g, void *args);
/**
* Test specification for: test_gk20a_from_as
*
* Description: Simple test to check gk20a_from_as.
*
* Test Type: Feature
*
* Targets: gk20a_from_as
*
* Input: None
*
* Steps:
* - Call gk20a_from_as with an 'as' pointer and ensure it returns a
* pointer on g.
*
* Output: Returns PASS if the steps above were executed successfully. FAIL
* otherwise.
*/
int test_gk20a_from_as(struct unit_module *m, struct gk20a *g, void *args);
#endif /* UNIT_MM_AS_H */