diff options
author | Debarshi Dutta <ddutta@nvidia.com> | 2018-08-08 08:06:01 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-20 13:50:25 -0400 |
commit | 85c323c3e89d6e1b624b839c3325ae072952e545 (patch) | |
tree | 0822589079047c74fb278f512a51f80baff07b85 /drivers/gpu/nvgpu/clk | |
parent | 519948a9c664020fd0b37118749faad2dfd73d97 (diff) |
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 <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1790002
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/clk')
-rw-r--r-- | drivers/gpu/nvgpu/clk/clk_arb.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_arb.c b/drivers/gpu/nvgpu/clk/clk_arb.c index 452d9de3..3d97535d 100644 --- a/drivers/gpu/nvgpu/clk/clk_arb.c +++ b/drivers/gpu/nvgpu/clk/clk_arb.c | |||
@@ -772,6 +772,11 @@ int nvgpu_clk_arb_init_arbiter(struct gk20a *g) | |||
772 | return err; | 772 | return err; |
773 | } | 773 | } |
774 | 774 | ||
775 | bool nvgpu_clk_arb_has_active_req(struct gk20a *g) | ||
776 | { | ||
777 | return (nvgpu_atomic_read(&g->clk_arb_global_nr) > 0); | ||
778 | } | ||
779 | |||
775 | void nvgpu_clk_arb_send_thermal_alarm(struct gk20a *g) | 780 | void nvgpu_clk_arb_send_thermal_alarm(struct gk20a *g) |
776 | { | 781 | { |
777 | nvgpu_clk_arb_schedule_alarm(g, | 782 | nvgpu_clk_arb_schedule_alarm(g, |
@@ -854,10 +859,12 @@ void nvgpu_clk_arb_free_fd(struct nvgpu_ref *refcount) | |||
854 | struct nvgpu_clk_dev *dev = container_of(refcount, | 859 | struct nvgpu_clk_dev *dev = container_of(refcount, |
855 | struct nvgpu_clk_dev, refcount); | 860 | struct nvgpu_clk_dev, refcount); |
856 | struct nvgpu_clk_session *session = dev->session; | 861 | struct nvgpu_clk_session *session = dev->session; |
862 | struct gk20a *g = session->g; | ||
857 | 863 | ||
858 | nvgpu_clk_notification_queue_free(session->g, &dev->queue); | 864 | nvgpu_clk_notification_queue_free(g, &dev->queue); |
859 | 865 | ||
860 | nvgpu_kfree(session->g, dev); | 866 | nvgpu_atomic_dec(&g->clk_arb_global_nr); |
867 | nvgpu_kfree(g, dev); | ||
861 | } | 868 | } |
862 | 869 | ||
863 | void nvgpu_clk_arb_free_session(struct nvgpu_ref *refcount) | 870 | void nvgpu_clk_arb_free_session(struct nvgpu_ref *refcount) |