gpu: nvgpu: use nvgpu list for cycle stats snapshot clients

Use nvgpu list APIs instead of linux list APIs
for cycle stats snapshot clients list

Jira NVGPU-13

Change-Id: I124812b70ca8deb26ee1644d4d79cc404fd2aed9
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1454010
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Deepak Nibade
2017-03-31 16:19:41 +05:30
committed by mobile promotions
parent 468d6888fc
commit 42852f182a
2 changed files with 21 additions and 19 deletions

View File

@@ -118,7 +118,7 @@ static int css_gr_create_shared_data(struct gr_gk20a *gr)
if (!data)
return -ENOMEM;
INIT_LIST_HEAD(&data->clients);
nvgpu_init_list_node(&data->clients);
gr->cs_data = data;
return 0;
@@ -243,14 +243,12 @@ static void css_gr_free_shared_data(struct gr_gk20a *gr)
static struct gk20a_cs_snapshot_client*
css_gr_search_client(struct list_head *clients, u32 perfmon)
css_gr_search_client(struct nvgpu_list_node *clients, u32 perfmon)
{
struct list_head *pos;
struct gk20a_cs_snapshot_client *client;
list_for_each(pos, clients) {
struct gk20a_cs_snapshot_client *client =
container_of(pos,
struct gk20a_cs_snapshot_client, list);
nvgpu_list_for_each_entry(client, clients,
gk20a_cs_snapshot_client, list) {
if (CONTAINS_PERFMON(client, perfmon))
return client;
}
@@ -284,7 +282,7 @@ static int css_gr_flush_snapshots(struct channel_gk20a *ch)
if (!css)
return -EINVAL;
if (list_empty(&css->clients))
if (nvgpu_list_empty(&css->clients))
return -EBADF;
/* check data available */
@@ -296,11 +294,8 @@ static int css_gr_flush_snapshots(struct channel_gk20a *ch)
return 0;
if (hw_overflow) {
struct list_head *pos;
list_for_each(pos, &css->clients) {
cur = container_of(pos,
struct gk20a_cs_snapshot_client, list);
nvgpu_list_for_each_entry(cur, &css->clients,
gk20a_cs_snapshot_client, list) {
cur->snapshot->hw_overflow_events_occured++;
}
@@ -445,7 +440,7 @@ static int css_gr_free_client_data(struct gk20a *g,
int ret = 0;
if (client->list.next && client->list.prev)
list_del(&client->list);
nvgpu_list_del(&client->list);
if (client->perfmon_start && client->perfmon_count
&& g->ops.css.release_perfmon_ids) {
@@ -524,7 +519,7 @@ static int css_gr_create_client_data(struct gk20a *g,
}
}
list_add_tail(&cur->list, &data->clients);
nvgpu_list_add_tail(&cur->list, &data->clients);
*client = cur;
return 0;
@@ -590,7 +585,7 @@ failed:
*cs_client = NULL;
}
if (list_empty(&gr->cs_data->clients))
if (nvgpu_list_empty(&gr->cs_data->clients))
css_gr_free_shared_data(gr);
}
nvgpu_mutex_release(&gr->cs_lock);
@@ -620,7 +615,7 @@ int gr_gk20a_css_detach(struct channel_gk20a *ch,
g->ops.css.detach_snapshot(ch, cs_client);
ret = css_gr_free_client_data(g, data, cs_client);
if (list_empty(&data->clients))
if (nvgpu_list_empty(&data->clients))
css_gr_free_shared_data(gr);
} else {
ret = -EBADF;

View File

@@ -88,7 +88,7 @@ struct gk20a_cs_snapshot_fifo_entry {
/* cycle stats snapshot client data (e.g. associated with channel) */
struct gk20a_cs_snapshot_client {
struct list_head list;
struct nvgpu_list_node list;
u32 dmabuf_fd;
struct dma_buf *dma_handler;
struct gk20a_cs_snapshot_fifo *snapshot;
@@ -97,6 +97,13 @@ struct gk20a_cs_snapshot_client {
u32 perfmon_count;
};
static inline struct gk20a_cs_snapshot_client *
gk20a_cs_snapshot_client_from_list(struct nvgpu_list_node *node)
{
return (struct gk20a_cs_snapshot_client *)
((uintptr_t)node - offsetof(struct gk20a_cs_snapshot_client, list));
};
/* should correlate with size of gk20a_cs_snapshot_fifo_entry::perfmon_id */
#define CSS_MAX_PERFMON_IDS 256
@@ -106,7 +113,7 @@ struct gk20a_cs_snapshot_client {
/* cycle stats snapshot control structure for one HW entry and many clients */
struct gk20a_cs_snapshot {
unsigned long perfmon_ids[PM_BITMAP_SIZE];
struct list_head clients;
struct nvgpu_list_node clients;
struct mem_desc hw_memdesc;
/* pointer to allocated cpu_va memory where GPU place data */
struct gk20a_cs_snapshot_fifo_entry *hw_snapshot;