summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2016-12-08 06:02:16 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2016-12-20 18:15:51 -0500
commit339a67b2e84cea20a59334b0640b9ab7e0d75ca9 (patch)
treefdefebf92b85a7b7b1ccea562f6b000fecf056a4 /drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
parent75e52218cec5ccfbb8ec61cb8ba5e41f5e5ec7e5 (diff)
gpu: nvgpu: replace tsg list mutex with rwsem
Lock only for modifications to the tsg channel list, and allow multiple concurrent readers. Bug 1848834 Bug 1814773 Change-Id: Ie3938d4239cfe36a14211f4649ce72b7fc3e2fa4 Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/1269579 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/tsg_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
index 0541f430..8e6f763a 100644
--- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
@@ -43,11 +43,11 @@ int gk20a_enable_tsg(struct tsg_gk20a *tsg)
43 struct gk20a *g = tsg->g; 43 struct gk20a *g = tsg->g;
44 struct channel_gk20a *ch; 44 struct channel_gk20a *ch;
45 45
46 mutex_lock(&tsg->ch_list_lock); 46 down_read(&tsg->ch_list_lock);
47 list_for_each_entry(ch, &tsg->ch_list, ch_entry) { 47 list_for_each_entry(ch, &tsg->ch_list, ch_entry) {
48 g->ops.fifo.enable_channel(ch); 48 g->ops.fifo.enable_channel(ch);
49 } 49 }
50 mutex_unlock(&tsg->ch_list_lock); 50 up_read(&tsg->ch_list_lock);
51 51
52 return 0; 52 return 0;
53} 53}
@@ -57,11 +57,11 @@ int gk20a_disable_tsg(struct tsg_gk20a *tsg)
57 struct gk20a *g = tsg->g; 57 struct gk20a *g = tsg->g;
58 struct channel_gk20a *ch; 58 struct channel_gk20a *ch;
59 59
60 mutex_lock(&tsg->ch_list_lock); 60 down_read(&tsg->ch_list_lock);
61 list_for_each_entry(ch, &tsg->ch_list, ch_entry) { 61 list_for_each_entry(ch, &tsg->ch_list, ch_entry) {
62 g->ops.fifo.disable_channel(ch); 62 g->ops.fifo.disable_channel(ch);
63 } 63 }
64 mutex_unlock(&tsg->ch_list_lock); 64 up_read(&tsg->ch_list_lock);
65 65
66 return 0; 66 return 0;
67} 67}
@@ -126,9 +126,9 @@ int gk20a_tsg_bind_channel(struct tsg_gk20a *tsg,
126 return -EINVAL; 126 return -EINVAL;
127 } 127 }
128 128
129 mutex_lock(&tsg->ch_list_lock); 129 down_write(&tsg->ch_list_lock);
130 list_add_tail(&ch->ch_entry, &tsg->ch_list); 130 list_add_tail(&ch->ch_entry, &tsg->ch_list);
131 mutex_unlock(&tsg->ch_list_lock); 131 up_write(&tsg->ch_list_lock);
132 132
133 kref_get(&tsg->refcount); 133 kref_get(&tsg->refcount);
134 134
@@ -144,9 +144,9 @@ int gk20a_tsg_unbind_channel(struct channel_gk20a *ch)
144 struct fifo_gk20a *f = &ch->g->fifo; 144 struct fifo_gk20a *f = &ch->g->fifo;
145 struct tsg_gk20a *tsg = &f->tsg[ch->tsgid]; 145 struct tsg_gk20a *tsg = &f->tsg[ch->tsgid];
146 146
147 mutex_lock(&tsg->ch_list_lock); 147 down_write(&tsg->ch_list_lock);
148 list_del_init(&ch->ch_entry); 148 list_del_init(&ch->ch_entry);
149 mutex_unlock(&tsg->ch_list_lock); 149 up_write(&tsg->ch_list_lock);
150 150
151 kref_put(&tsg->refcount, gk20a_tsg_release); 151 kref_put(&tsg->refcount, gk20a_tsg_release);
152 152
@@ -168,7 +168,7 @@ int gk20a_init_tsg_support(struct gk20a *g, u32 tsgid)
168 tsg->tsgid = tsgid; 168 tsg->tsgid = tsgid;
169 169
170 INIT_LIST_HEAD(&tsg->ch_list); 170 INIT_LIST_HEAD(&tsg->ch_list);
171 mutex_init(&tsg->ch_list_lock); 171 init_rwsem(&tsg->ch_list_lock);
172 172
173 INIT_LIST_HEAD(&tsg->event_id_list); 173 INIT_LIST_HEAD(&tsg->event_id_list);
174 mutex_init(&tsg->event_id_list_lock); 174 mutex_init(&tsg->event_id_list_lock);