From 85c323c3e89d6e1b624b839c3325ae072952e545 Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Wed, 8 Aug 2018 17:36:01 +0530 Subject: gpu: nvgpu: restrict devfreq during active clk_arb set requests Restrict access to devfreq when there are active set requests in the clk_arbiter. We make the following changes in the patch. 1) Add a global counter in the struct gk20a named clk_arb_global_nr which is used to track the number of active set requests in the system. 2) Anytime a set request is successfully made by the userspace, clk_arb_global_nr is incremented by 1 and during the completion of request(releasing the corresponding file handle), clk_arb_global_nr is decremented by 1. 3) gk20a_scale_target(invoked by devfreq to set the new frequency based on load) atomically checks clk_arb_global_nr. If the value = 0, the code simply continue or else if its > 0, it quits thus making devfreq requests mutually exclusive with the clk_arbiter. Bug 2061372 Change-Id: I5d19de03e45520f4ff8fccb97b1f1589d04c8ab8 Signed-off-by: Debarshi Dutta Reviewed-on: https://git-master.nvidia.com/r/1790002 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/clk_arb.h | 2 ++ drivers/gpu/nvgpu/include/nvgpu/gk20a.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h b/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h index 81b1df1b..a04e3542 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h +++ b/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h @@ -295,6 +295,8 @@ int nvgpu_clk_arb_worker_init(struct gk20a *g); int nvgpu_clk_arb_init_arbiter(struct gk20a *g); +bool nvgpu_clk_arb_has_active_req(struct gk20a *g); + int nvgpu_clk_arb_get_arbiter_clk_range(struct gk20a *g, u32 api_domain, u16 *min_mhz, u16 *max_mhz); diff --git a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h index b8ca5754..5f875707 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h @@ -1596,6 +1596,8 @@ struct gk20a { struct nvgpu_mutex clk_arb_enable_lock; + nvgpu_atomic_t clk_arb_global_nr; + struct gk20a_ce_app ce_app; bool ltc_intr_en_illegal_compstat; -- cgit v1.2.2