Debarshi Dutta
667867a199
gpu: nvgpu: Resolve failed cond init.
...
Following changes are added to fix the issue.
1) Threads having higher priority e.g. RT may preempt
threads with sched-normal priority. As a consequence, higher priority
threads might not still see initialization of data in another thread
resulting in failures such as accessing a condition value before initialization.
Any initialization in the parent thread must be accompanied by a barrier
to make it visible in other thread. Added appropriate barriers to prevent
reordering of the initialization in the thread construction path.
2) There is a race condition between nvgpu_cond_signal() and
nvgpu_cond_destroy() in the asynchronous submit code and corresponding
worker thread's process_item callback for NVS. This may lead to
data corruption and resulting in the above errors as well. Fixed
that by adding a refcount based mechanism for ownership sharing
of the struct nvgpu_nvs_worker_item between the two threads.
Bug 3778235
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com >
Change-Id: Ie9b9ba57bc1dcbb8780801be79863adc39690f72
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2771535
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com >
Reviewed-by: Prateek Sethi <prsethi@nvidia.com >
Reviewed-by: Ketan Patil <ketanp@nvidia.com >
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com >
2022-09-27 23:25:55 -07:00
ajesh
3c519157f5
gpu: nvgpu: fix CERTC violations in Posix unit
...
Fix violations of CERT POS54-C in Posix unit. Check the return
status from the function pthread_cond_broadcast.
JIRA NVGPU-6535
Change-Id: I8b7cc04534c856d609b14aef80e87fe1e0884a8e
Signed-off-by: ajesh <akv@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2495485
(cherry picked from commit 778e71defa2c1860f8560e2661a055207486f3c0)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2497641
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com >
Reviewed-by: Alex Waterman <alexw@nvidia.com >
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2021-03-17 18:23:36 -07:00
ajesh
ce4e7a6859
gpu: nvgpu: remove redundant error prints
...
Remove OS API return error prints from posix files as the BUG
function prints the function and line number which causes the
error.
Jira NVGPU-4987
Change-Id: Ie6d6f781241ac5e837f2732fbb1cc1ddc4d971d4
Signed-off-by: ajesh <akv@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2337390
Reviewed-by: automaticguardword <automaticguardword@nvidia.com >
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com >
Reviewed-by: Shashank Singh <shashsingh@nvidia.com >
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2020-12-15 14:13:28 -06:00
ajesh
1500ce829a
gpu: nvgpu: assert for OS API errors in non fusa
...
Handle the OS API errors with assert in non FUSA builds also.
Jira NVGPU-4987
Change-Id: I90428e845ae9f934b0d4bce08ab93f13f3fde2f8
Signed-off-by: ajesh <akv@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2332544
Reviewed-by: automaticguardword <automaticguardword@nvidia.com >
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com >
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com >
Reviewed-by: Alex Waterman <alexw@nvidia.com >
Reviewed-by: Shashank Singh <shashsingh@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2020-12-15 14:13:28 -06:00
ajesh
b6c7b9976e
Revert "gpu: nvgpu: modify the prints for return values"
...
This reverts commit 48946d43fd9b6028900b594d329cd7f51f196ba4.
Jira NVGPU-4987
Change-Id: I2fbaa3ff0b5eec7fbf051353a6bd80576e818f2e
Signed-off-by: ajesh <akv@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2329597
Reviewed-by: automaticguardword <automaticguardword@nvidia.com >
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com >
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com >
Reviewed-by: Shashank Singh <shashsingh@nvidia.com >
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2020-12-15 14:13:28 -06:00
ajesh
e4285740a4
gpu: nvgpu: modify the prints for return values
...
Modify the prints for certain OS API return values for non safe build.
Jira NVGPU-4987
Change-Id: I7c3eba58b5c685fbf654b7093e4d2180e02c49a6
Signed-off-by: ajesh <akv@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2324992
Reviewed-by: automaticguardword <automaticguardword@nvidia.com >
Reviewed-by: Shashank Singh <shashsingh@nvidia.com >
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com >
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com >
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2020-12-15 14:13:28 -06:00
ajesh
9846573d64
gpu: nvgpu: handle the return values from OS APIs
...
Handle the return values from standard OS library calls.
Jira NVGPU-4987
Change-Id: I41bf0113097d6bfa344ed58f68448abc9cc7f367
Signed-off-by: ajesh <akv@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2299985
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
2020-12-15 14:13:28 -06:00
ajesh
1c1dca5d6f
gpu: nvgpu: avoid hard coded constants
...
Replace the hard coded numeric constants in posix unit.
Jira NVGPU-4954
Change-Id: I9f57e2d60b44c942924c47a7e38c237c732b13b0
Signed-off-by: ajesh <akv@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2289633
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com >
Reviewed-by: Sagar Kamble <skamble@nvidia.com >
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2020-12-15 14:13:28 -06:00
Rajesh Devaraj
e3bbc86805
gpu: nvgpu: add error injection support
...
This patch adds error injection support for nvgpu_cond_broadcast().
JIRA NVGPU-2694
Change-Id: I2dc9c902b29db094d42bd16cd149e6a6eb5fbae9
Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2278408
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com >
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com >
Reviewed-by: Ajesh K V <akv@nvidia.com >
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
GVS: Gerrit_Virtual_Submit
2020-12-15 14:10:29 -06:00
Philip Elcan
b5617a61d9
gpu: nvgpu: posix: cond: add fault injection to timeout
...
Add fault injection to the function nvgpu_cond_timedwait(). This allows
unit tests to test the timeout case when testing code that uses
NVGPU_COND_WAIT().
JIRA NVGPU-2224
Change-Id: I90656f29146f90afc08c6d5e0500e68f01a92043
Signed-off-by: Philip Elcan <pelcan@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/2258705
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2020-12-15 14:10:29 -06:00
Philip Elcan
95c3e56961
gpu: nvgpu: unit: propagate fault injection to threads
...
Change approach to how the fault injection state is stored to facilitate
propagating fault injection state to child-threads. Rather than each
unit maintaining a thread-local object, there is a thread-local
container stored in the posix-fault-injection itself. This container is
initialized for each test module so that is independent of other other
test modules (for parallel test module execution). When child threads
are created with nvgpu_create_thread(), the fault injection container is
configured for the child.
JIRA NVGPU-3981
Change-Id: I9b580dc7f1621a7770eef8eba796f3918f2738bf
Signed-off-by: Philip Elcan <pelcan@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/2238474
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2020-12-15 14:10:29 -06:00
Petlozu Pravareshwar
1e7c3cb038
gpu: nvgpu: add fault injection for posix routines
...
This adds the ability to enable fault injection for some of the
POSIX implementation of the nvgpu condition and thread routines.
JIRA NVGPU-2679
Change-Id: I6abb9d5ba3fbe8921e48a135e440c179702dcf6b
Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/2174647
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com >
Reviewed-by: Alex Waterman <alexw@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2020-12-15 14:05:52 -06:00
Adeel Raza
252ddc4f05
gpu: nvgpu: add coverity whitelisting support
...
Add macros for whitelisting coverity violations. These macros use pragma
directives. The pragma directives and whitelisting macros are only
enabled when a coverity scan is being run.
The whitelisting macros have been added to a new header called
static_analysis.h. The contents of safe_ops.h (CERT C safe ops) have
been moved into static_analysis.h because this will be the new header
for static analysis related macros/defines/etc.
JIRA NVGPU-3820
Change-Id: I9c63f20f670880b420415535738034619314b7c3
Signed-off-by: Adeel Raza <araza@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/2180600
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2020-12-15 14:05:52 -06:00
Philip Elcan
acc65f6e84
gpu: nvgpu: bug: move nvgpu_do_assert_print() into assert.c
...
There was a header file circular dependency that was preventing
including some files. For example, for utils.h to include safe_ops.h
would include bug.h which included log.h which included bitops.h which
included utils.h. To break this loop, the macro nvgpu_do_assert_print()
into a function in a new file assert.c. With this change, log.h is no
longer required in bug.h.
This change also required adding a few includes in C files that were
picking up definitions through the chain above.
JIRA NVGPU-3868
Change-Id: Icf95677bb36e4aa034cba25594cf71f2d028c289
Signed-off-by: Philip Elcan <pelcan@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/2168528
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2019-08-06 13:36:30 -07:00
ajesh
a1bbbd4cad
gpu: nvgpu: fix CERT C violations in cond unit
...
INT31-C requires that integer conversions do not result in lost or
misinterpreted data.
INT32-C requires that operations on signed integers do not result in
overflow.
Fix the above CERT C violations in cond unit.
Jira NVGPU-3607
Change-Id: I31da5b214ee3c39799066a785b0c19f45e48c3cd
Signed-off-by: ajesh <akv@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/2139212
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com >
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com >
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2019-06-25 05:46:35 -07:00
Thomas Fleury
97762279b7
gpu: nvgpu: make nvgpu_init_mutex return void
...
Make the nvgpu_init_mutex function return void.
In linux case, this doesn't affect anything since mutex_init
returns void.
For posix, we assert() and die if pthread_mutex_init fails.
This alleviates the need to error inject for _every_
nvgpu_mutex_init function in the driver.
Jira NVGPU-3476
Change-Id: Ibc801116dc82cdfcedcba2c352785f2640b7d54f
Signed-off-by: Thomas Fleury <tfleury@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/2130538
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2019-06-05 10:25:52 -07:00
Vinod G
7b0620501e
gpu: nvgpu: Fix CERT INT31-C error on common.gr
...
cert_violation: Casting "-1" from "int" to "unsigned int" without checking
its value may result in lost or misinterpreted data.
Error: CERT INT31-C:
Change "(unsigned int)-1" to "~0U" in posix code.
Jira NVGPU-3411
Change-Id: I3f1fed7d0788f9ee5c4f2b3c297d7311a0bf2419
Signed-off-by: Vinod G <vinodg@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/2119008
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com >
Reviewed-by: Alex Waterman <alexw@nvidia.com >
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2019-05-15 16:48:02 -07:00
Shashank Singh
939e85d35f
gpu: nvgpu: add locked cond APIs for posix
...
locked cond APIs are better suited when we have to check/set multiple
conditions before doing wait/signal. This should be preferred for qnx as
we can avoid unnecessary atomics.
NVGPU-1818
Change-Id: Ieec692bfbadf477e11321a3ed485d0315507ee8c
Signed-off-by: Shashank Singh <shashsingh@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/2075306
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com >
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com >
Reviewed-by: Konsta Holtta <kholtta@nvidia.com >
GVS: Gerrit_Virtual_Submit
Reviewed-by: Lakshmanan M <lm@nvidia.com >
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2019-04-01 01:35:44 -07:00
ajesh
6be73f561a
gpu: nvgpu: use posix cond implementation for qnx
...
Unify posix cond unit with qnx.
Jira NVGPU-2151
Change-Id: I769f646751299154d7d753228777266e3098c8d3
Signed-off-by: ajesh <akv@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/2033596
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2019-03-17 23:47:06 -07:00
Nicolas Benech
9467646a87
gpu: nvgpu: nvgpu_cond_signal to return void
...
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch changes nvgpu_cond_signal and nvgpu_cond_signal_interruptible
to return void since no callers were using the return value.
JIRA NVGPU-677
Change-Id: I406309bde247e7ca656c91be1ea5ab742b0a045a
Signed-off-by: Nicolas Benech <nbenech@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/2007563
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com >
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com >
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2019-01-31 12:04:10 -08:00
Shashank Singh
1c4ca22e62
gpu: nvgpu: posix: implement posix cond APIs
...
- Implement posix cond APIs as it is required
when adding cond API calls in mc.c, it will
be anyway useful in future as well for unit
tests requiring posix cond APIs.
Jira NVGPU-1396
Change-Id: I71dd63b58507d099ac535a946f8c7f14c739aaa0
Signed-off-by: Shashank Singh <shashsingh@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/1982652
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com >
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com >
Reviewed-by: Alex Waterman <alexw@nvidia.com >
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com >
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2019-01-10 22:54:49 -08:00
Alex Waterman
b15624b39b
gpu: nvgpu: posix: move the posix dir to os
...
Since the posix code is supporting a particular OS this code
should belong under os/ not common/.
Change-Id: Idf5f75b8ab9d614c9dd43ea23dab8df3c346c0ef
Signed-off-by: Alex Waterman <alexw@nvidia.com >
Reviewed-on: https://git-master.nvidia.com/r/1800658
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com >
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com >
2018-08-17 13:54:25 -07:00