mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
gpu: nvgpu: fix event id polling
In gk20a_event_id_poll(), we always set the mask value and return it. This causes poll() from UMD to be always successful irrespective of event is really generated or not Fix this by adding a flag event_posted for each event Set this flag while posting the event In gk20a_event_id_poll(), set the mask value only if this flag is set. If flag is set, set mask and clear the flag Bug 200089620 Change-Id: If14236547c611fe4bfa1410ff5b69c9fa02d43bb Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1160253 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
committed by
Terje Bergstrom
parent
9b1bb51cf0
commit
2bc8f4e36d
@@ -2519,18 +2519,25 @@ static unsigned int gk20a_event_id_poll(struct file *filep, poll_table *wait)
|
|||||||
if (event_id_data->is_tsg) {
|
if (event_id_data->is_tsg) {
|
||||||
struct tsg_gk20a *tsg = g->fifo.tsg + event_id_data->id;
|
struct tsg_gk20a *tsg = g->fifo.tsg + event_id_data->id;
|
||||||
|
|
||||||
|
if (event_id_data->event_posted) {
|
||||||
gk20a_dbg_info(
|
gk20a_dbg_info(
|
||||||
"found pending event_id=%d on TSG=%d\n",
|
"found pending event_id=%d on TSG=%d\n",
|
||||||
event_id, tsg->tsgid);
|
event_id, tsg->tsgid);
|
||||||
|
mask = (POLLPRI | POLLIN);
|
||||||
|
event_id_data->event_posted = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
struct channel_gk20a *ch = g->fifo.channel
|
struct channel_gk20a *ch = g->fifo.channel
|
||||||
+ event_id_data->id;
|
+ event_id_data->id;
|
||||||
|
|
||||||
|
if (event_id_data->event_posted) {
|
||||||
gk20a_dbg_info(
|
gk20a_dbg_info(
|
||||||
"found pending event_id=%d on chid=%d\n",
|
"found pending event_id=%d on chid=%d\n",
|
||||||
event_id, ch->hw_chid);
|
event_id, ch->hw_chid);
|
||||||
}
|
|
||||||
mask = (POLLPRI | POLLIN);
|
mask = (POLLPRI | POLLIN);
|
||||||
|
event_id_data->event_posted = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mutex_unlock(&event_id_data->lock);
|
mutex_unlock(&event_id_data->lock);
|
||||||
|
|
||||||
@@ -2609,6 +2616,7 @@ void gk20a_channel_event_id_post_event(struct channel_gk20a *ch,
|
|||||||
gk20a_dbg_info(
|
gk20a_dbg_info(
|
||||||
"posting event for event_id=%d on ch=%d\n",
|
"posting event for event_id=%d on ch=%d\n",
|
||||||
event_id, ch->hw_chid);
|
event_id, ch->hw_chid);
|
||||||
|
event_id_data->event_posted = true;
|
||||||
|
|
||||||
wake_up_interruptible_all(&event_id_data->event_id_wq);
|
wake_up_interruptible_all(&event_id_data->event_id_wq);
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ struct gk20a_event_id_data {
|
|||||||
bool is_tsg;
|
bool is_tsg;
|
||||||
u32 event_id;
|
u32 event_id;
|
||||||
|
|
||||||
|
bool event_posted;
|
||||||
|
|
||||||
wait_queue_head_t event_id_wq;
|
wait_queue_head_t event_id_wq;
|
||||||
struct mutex lock;
|
struct mutex lock;
|
||||||
struct list_head event_id_node;
|
struct list_head event_id_node;
|
||||||
|
|||||||
@@ -231,6 +231,7 @@ void gk20a_tsg_event_id_post_event(struct tsg_gk20a *tsg,
|
|||||||
gk20a_dbg_info(
|
gk20a_dbg_info(
|
||||||
"posting event for event_id=%d on tsg=%d\n",
|
"posting event for event_id=%d on tsg=%d\n",
|
||||||
event_id, tsg->tsgid);
|
event_id, tsg->tsgid);
|
||||||
|
event_id_data->event_posted = true;
|
||||||
|
|
||||||
wake_up_interruptible_all(&event_id_data->event_id_wq);
|
wake_up_interruptible_all(&event_id_data->event_id_wq);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user