From 2b498cdf8aaa6c628cc1ac8e2b0b3a582c0decb3 Mon Sep 17 00:00:00 2001 From: Sourab Gupta Date: Mon, 30 Apr 2018 15:53:22 +0530 Subject: gpu: nvgpu: remove rcu locks in clk arbiter RCU's are available only in (linux) kernel. Though they are able to achieve lockless access in some specific scenarios, they are heavily dependent on the kernel for their functionality. E.g. synchronize_rcu(), which depends on the kernel in order to delimit read side critical sections. As such it is very difficult to implement constructs analogous to RCUs in userspace code. As a result the code which depends on RCU's for synchronization is not portable between OS'es, especially if one of them is in userspace, viz. QNX. Also, if the code is not in performance critical path, we can do with non-RCU constructs. For clk arbiter code here, RCU's are replaced by the traditional spinlocks, so that the code could be used by QNX down the line. Jira VQRM-3741 Change-Id: I178e5958788c8fd998303a6a94d8f2f328201508 Signed-off-by: Sourab Gupta Reviewed-on: https://git-master.nvidia.com/r/1705535 Reviewed-by: svc-mobile-coverity Reviewed-by: Alex Waterman GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/clk_arb_linux.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/common/linux/clk_arb_linux.h') diff --git a/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h b/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h index b66876da..0942dd86 100644 --- a/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h +++ b/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h @@ -41,11 +41,12 @@ struct nvgpu_clk_arb { struct nvgpu_spinlock sessions_lock; struct nvgpu_spinlock users_lock; + struct nvgpu_spinlock requests_lock; struct nvgpu_mutex pstate_lock; struct list_head users; struct list_head sessions; - struct llist_head requests; + struct list_head requests; struct gk20a *g; int status; @@ -92,7 +93,7 @@ struct nvgpu_clk_dev { struct nvgpu_clk_session *session; union { struct list_head link; - struct llist_node node; + struct list_head node; }; struct nvgpu_cond readout_wq; nvgpu_atomic_t poll_mask; @@ -110,8 +111,9 @@ struct nvgpu_clk_session { struct gk20a *g; struct nvgpu_ref refcount; struct list_head link; - struct llist_head targets; + struct list_head targets; + struct nvgpu_spinlock session_lock; struct nvgpu_clk_arb_target target_pool[2]; struct nvgpu_clk_arb_target *target; }; -- cgit v1.2.2