gpu: nvgpu: Add exit condition in clk_arb wq.

Currently clk_arb wq waits only for tasks.
Sometimes this doesnt invoke wq when thread_stop is called.
Add a check for thread_stop when waiting in wq.
Remove atomic_inc when no job is submitted.
Use current_time_ns() instead of ptimer to get time.

Bug 200488054

Change-Id: I770d566dd29371bd189d30dd5e60a6b23a9c98ff
Signed-off-by: Abdul Salam <absalam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2012244
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Abdul Salam
2019-02-05 19:23:19 +05:30
committed by mobile promotions
parent 800d96865d
commit 59b93d1572
2 changed files with 7 additions and 7 deletions

View File

@@ -473,7 +473,8 @@ static int nvgpu_clk_arb_poll_worker(void *arg)
ret = NVGPU_COND_WAIT_INTERRUPTIBLE(
&worker->wq,
nvgpu_clk_arb_worker_pending(g, get), 0);
nvgpu_clk_arb_worker_pending(g, get) ||
nvgpu_thread_should_stop(&worker->poll_task), 0);
if (nvgpu_thread_should_stop(&worker->poll_task)) {
break;
@@ -617,8 +618,6 @@ void nvgpu_clk_arb_schedule_alarm(struct gk20a *g, u32 alarm)
static void nvgpu_clk_arb_worker_deinit(struct gk20a *g)
{
nvgpu_atomic_inc(&g->clk_arb_worker.put);
nvgpu_mutex_acquire(&g->clk_arb_worker.start_lock);
nvgpu_thread_stop(&g->clk_arb_worker.poll_task);
nvgpu_mutex_release(&g->clk_arb_worker.start_lock);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2016-2019, 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"),
@@ -23,6 +23,7 @@
#include <nvgpu/gk20a.h>
#include <nvgpu/clk_arb.h>
#include <nvgpu/pmu/clk.h>
#include <nvgpu/timers.h>
#include "clk_arb_gv100.h"
#include "common/pmu/clk/clk.h"
@@ -478,7 +479,7 @@ void gv100_clk_arb_run_arbiter_cb(struct nvgpu_clk_arb *arb)
struct nvgpu_clk_slave_freq vf_point;
#ifdef CONFIG_DEBUG_FS
u64 t0, t1;
s64 t0, t1;
struct nvgpu_clk_arb_debug *debug;
#endif
@@ -491,7 +492,7 @@ void gv100_clk_arb_run_arbiter_cb(struct nvgpu_clk_arb *arb)
}
#ifdef CONFIG_DEBUG_FS
g->ops.ptimer.read_ptimer(g, &t0);
t0 = nvgpu_current_time_ns();
#endif
/* Only one arbiter should be running */
@@ -653,7 +654,7 @@ void gv100_clk_arb_run_arbiter_cb(struct nvgpu_clk_arb *arb)
nvgpu_cond_signal_interruptible(&arb->request_wq);
#ifdef CONFIG_DEBUG_FS
g->ops.ptimer.read_ptimer(g, &t1);
t1 = nvgpu_current_time_ns();
debug = arb->debug == &arb->debug_pool[0] ?
&arb->debug_pool[1] : &arb->debug_pool[0];