gpu: nvgpu: fix power races in gsp test

The GSP stress test debug node only checks for gpu poweron and continues
to trigger the stress test if power is on. This results in a small
window where the GPU might get railgated, so call gk20a_busy() to hold a
power ref while loading or starting the stress test (which touches HW).

Change-Id: I2ced45472cd0602da36f1801e56b486097ece83d
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2635604
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Dinesh T <dt@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>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Konsta Hölttä
2021-12-02 11:36:44 +02:00
committed by mobile promotions
parent 9e3566a35b
commit ffb7e1f5ec

View File

@@ -199,11 +199,16 @@ static ssize_t gsp_start_test_write(struct file *file,
if (strtobool(buf, &bv) == 0) {
if (nvgpu_is_powered_on(g) && nvgpu_gsp_get_stress_test_load(g)) {
err = gk20a_busy(g);
if (err)
return err;
err = nvgpu_gsp_set_stress_test_start(g, bv);
if (err != 0) {
nvgpu_err(g, "failed to start GSP stress test");
gk20a_idle(g);
return -EFAULT;
}
gk20a_idle(g);
} else {
nvgpu_err(g,
"Unable to start GSP stress test, check GPU state");
@@ -255,11 +260,16 @@ static ssize_t gsp_load_test_write(struct file *file,
if (strtobool(buf, &bv) == 0) {
if (nvgpu_is_powered_on(g)) {
err = gk20a_busy(g);
if (err)
return err;
err = nvgpu_gsp_set_stress_test_load(g, bv);
if (err != 0) {
nvgpu_err(g, "failed to load GSP stress test");
gk20a_idle(g);
return -EFAULT;
}
gk20a_idle(g);
} else {
nvgpu_err(g,
"Unable to load GSP stress test, check GPU state");