Most sysfs reads do not require cross-process level mutex, and writes to sysfs
should be protected by the kernel already.
Users can still switch to the old behavior by setting the environment variable AMDSMI_MUTEX_CROSS_PROCESS=1.
[ROCm/amdsmi commit: 8e74024b11]
Change copyrights to MIT and remove date
Signed-off-by: Joe Narlo <Joseph.Narlo@amd.com>
Change-Id: I16f5b412f2b9ddefaaa1771aa714cc18829a1be4
[ROCm/amdsmi commit: 3052ad4220]
In multiple GPUs environment, too many warning messages generated,
and then need to be removed.
Change-Id: I275de2397eb0e6b189e2e17e94335cb1e8f97815
[ROCm/amdsmi commit: 78ee3f5e5a]
The environment variable RSMI_MUTEX_THREAD_ONLY=1 to enable thread only mutex.
The RSMI_INIT_FLAG_THRAD_ONLY_MUTEX can also be pass to rsmi_init()
to enable thread only mutex.
Change-Id: I2d9844039b774e386f03bb9bb130d8c342504ea6
[ROCm/amdsmi commit: dbba33d3f5]
After the dead process is detected, pthread_mutex_consistent() will
be called. After that, the pthread_mutex_unlock() should also be
called to unlock it: "It is the responsibility of the application to
recover the state so it can be reused."
Change-Id: I45d3e2e68c3b06779f3acb1e908dbec0c6a39297
[ROCm/amdsmi commit: 06b9232a56]
To prevent reset the mutex while using it, only reset the mutex
if it cannot acquire it.
Change-Id: I95e0ed1bf543f285ce81b4df9c51e16a88081d38
[ROCm/amdsmi commit: 160c99d12d]
If the code is crashed and the mutex may be in bad status. The user
has to mannually remove it. The fix will remove the shared mutex
if no process is using it.
Change-Id: I18bf562f2e0a7de8b3f0cccf72d60950b0d9bb2d
[ROCm/amdsmi commit: 76b5528feb]
Previously, when a process holding a shared mutex was killed,
the next time an RSMI application was started, it would not be
able to obtain the mutex--the application would have to exit.
This fix uses pthread_mutexattr_setrobust() to detect this
situation and act accordingingly.
Also, add some missing, needed mutexes and move mutexes
closer to where the protect resource is used.
Change-Id: Icfdc3a246f4cfa3fd008e3f13472199abd76fd35
[ROCm/amdsmi commit: f4938b0ac9]