diff options
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c index 7509acd7..e8da54fb 100644 --- a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c | |||
@@ -504,12 +504,17 @@ static u32 css_gr_allocate_perfmon_ids(struct gk20a_cs_snapshot *data, | |||
504 | if (!count || count > CSS_MAX_PERFMON_IDS - CSS_FIRST_PERFMON_ID) | 504 | if (!count || count > CSS_MAX_PERFMON_IDS - CSS_FIRST_PERFMON_ID) |
505 | return 0; | 505 | return 0; |
506 | 506 | ||
507 | for (f = CSS_FIRST_PERFMON_ID; f < e; f++) { | 507 | for (f = CSS_FIRST_PERFMON_ID; f <= e; f++) { |
508 | u32 slots = 0; | 508 | u32 slots; |
509 | u32 cur; | 509 | u32 cur; |
510 | u32 end = f + count; | 510 | u32 end; |
511 | |||
512 | if (CSS_PERFMON_GET(pids, f)) | ||
513 | continue; | ||
511 | 514 | ||
512 | /* lookup for continuous hole [f, f+count) of unused bits */ | 515 | /* lookup for continuous hole [f, f+count) of unused bits */ |
516 | slots = 0; | ||
517 | end = f + count; | ||
513 | for (cur = f; cur < end; cur++) { | 518 | for (cur = f; cur < end; cur++) { |
514 | if (CSS_PERFMON_GET(pids, cur)) | 519 | if (CSS_PERFMON_GET(pids, cur)) |
515 | break; | 520 | break; |
@@ -556,7 +561,9 @@ static int css_gr_free_client_data(struct gk20a_cs_snapshot *data, | |||
556 | { | 561 | { |
557 | int ret = 0; | 562 | int ret = 0; |
558 | 563 | ||
559 | list_del(&client->list); | 564 | if (client->list.next && client->list.prev) |
565 | list_del(&client->list); | ||
566 | |||
560 | if (client->perfmon_start && client->perfmon_count) { | 567 | if (client->perfmon_start && client->perfmon_count) { |
561 | if (client->perfmon_count != css_gr_release_perfmon_ids(data, | 568 | if (client->perfmon_count != css_gr_release_perfmon_ids(data, |
562 | client->perfmon_start, client->perfmon_count)) | 569 | client->perfmon_start, client->perfmon_count)) |