All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu:read VRAMLOST from gim
@ 2017-11-02  7:50 Monk Liu
       [not found] ` <1509609006-19165-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Monk Liu @ 2017-11-02  7:50 UTC (permalink / raw
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Monk Liu

Change-Id: I6a268903465004d6e8f65f135734094772b9f614
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 ++++-----
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c   | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h   | 3 +++
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 068b56a..eccb3fa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2953,11 +2953,10 @@ static int amdgpu_reset_sriov(struct amdgpu_device *adev, uint64_t *reset_flags,
 	amdgpu_virt_release_full_gpu(adev, true);
 
 	if (reset_flags) {
-		/* will get vram_lost from GIM in future, now all
-		 * reset request considered VRAM LOST
-		 */
-		(*reset_flags) |= ~AMDGPU_RESET_INFO_VRAM_LOST;
-		atomic_inc(&adev->vram_lost_counter);
+		if (adev->virt.gim_feature & AMDGIM_FEATURE_GIM_FLR_VRAMLOST) {
+			(*reset_flags) |= AMDGPU_RESET_INFO_VRAM_LOST;
+			atomic_inc(&adev->vram_lost_counter);
+		}
 
 		/* VF FLR or hotlink reset is always full-reset */
 		(*reset_flags) |= AMDGPU_RESET_INFO_FULLRESET;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index f791518..9cd030a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -332,6 +332,7 @@ void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev)
 		pf2vf_ver = adev->virt.fw_reserve.p_pf2vf->version;
 		AMDGPU_FW_VRAM_PF2VF_READ(adev, header.size, &pf2vf_size);
 		AMDGPU_FW_VRAM_PF2VF_READ(adev, checksum, &checksum);
+		AMDGPU_FW_VRAM_PF2VF_READ(adev, feature_flags, &adev->virt.gim_feature);
 
 		/* pf2vf message must be in 4K */
 		if (pf2vf_size > 0 && pf2vf_size < 4096) {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
index e3f78f5..f77d116 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
@@ -81,6 +81,8 @@ enum AMDGIM_FEATURE_FLAG {
 	AMDGIM_FEATURE_ERROR_LOG_COLLECT = 0x1,
 	/* GIM supports feature of loading uCodes */
 	AMDGIM_FEATURE_GIM_LOAD_UCODES   = 0x2,
+	/* VRAM LOST by GIM */
+	AMDGIM_FEATURE_GIM_FLR_VRAMLOST = 0x4,
 };
 
 struct amdgim_pf2vf_info_header {
@@ -246,6 +248,7 @@ struct amdgpu_virt {
 	const struct amdgpu_virt_ops	*ops;
 	struct amdgpu_vf_error_buffer   vf_errors;
 	struct amdgpu_virt_fw_reserve	fw_reserve;
+	uint32_t gim_feature;
 };
 
 #define AMDGPU_CSA_SIZE    (8 * 1024)
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] Revert "drm/amd/scheduler:fix duplicate operation in entity fini"
       [not found] ` <1509609006-19165-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
@ 2017-11-02  7:50   ` Monk Liu
       [not found]     ` <1509609006-19165-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Monk Liu @ 2017-11-02  7:50 UTC (permalink / raw
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Monk Liu

fix memory leak.
This reverts commit d6951b49faa8447a6a77cdb1ef3346b1a1786d31.
because when entity_fini is interrupted the jobs in queue still
not processed with job_begin, so the finish_cb is not hooked
on sched fence, we still need manually do cleanups.

Change-Id: I6e17bfeeac85062bc52f1d51b9697852b084845c
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
index 6f041e8..7aa6455 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -231,10 +231,11 @@ void amd_sched_entity_fini(struct amd_gpu_scheduler *sched,
 		kthread_unpark(sched->thread);
 		while ((job = to_amd_sched_job(spsc_queue_pop(&entity->job_queue)))) {
 			struct amd_sched_fence *s_fence = job->s_fence;
-
 			amd_sched_fence_scheduled(s_fence);
 			dma_fence_set_error(&s_fence->finished, -ESRCH);
 			amd_sched_fence_finished(s_fence);
+			dma_fence_put(&s_fence->finished);
+			sched->ops->free_job(job);
 		}
 	}
 }
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] Revert "drm/amd/scheduler:fix duplicate operation in entity fini"
       [not found]     ` <1509609006-19165-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
@ 2017-11-02  9:00       ` Chunming Zhou
       [not found]         ` <286ce63e-595b-b053-b996-33d5d4f671a0-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Chunming Zhou @ 2017-11-02  9:00 UTC (permalink / raw
  To: Monk Liu, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW



On 2017年11月02日 15:50, Monk Liu wrote:
> fix memory leak.
> This reverts commit d6951b49faa8447a6a77cdb1ef3346b1a1786d31.
> because when entity_fini is interrupted the jobs in queue still
> not processed with job_begin, so the finish_cb is not hooked
> on sched fence, we still need manually do cleanups.
>
> Change-Id: I6e17bfeeac85062bc52f1d51b9697852b084845c
> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
> ---
>   drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
> index 6f041e8..7aa6455 100644
> --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
> +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
> @@ -231,10 +231,11 @@ void amd_sched_entity_fini(struct amd_gpu_scheduler *sched,
>   		kthread_unpark(sched->thread);
>   		while ((job = to_amd_sched_job(spsc_queue_pop(&entity->job_queue)))) {
>   			struct amd_sched_fence *s_fence = job->s_fence;
> -
>   			amd_sched_fence_scheduled(s_fence);
>   			dma_fence_set_error(&s_fence->finished, -ESRCH);
>   			amd_sched_fence_finished(s_fence);
> +			dma_fence_put(&s_fence->finished);
> +			sched->ops->free_job(job);
>   		}
>   	}
>   }

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] Revert "drm/amd/scheduler:fix duplicate operation in entity fini"
       [not found]         ` <286ce63e-595b-b053-b996-33d5d4f671a0-5C7GfCeVMHo@public.gmane.org>
@ 2017-11-02  9:50           ` Christian König
  0 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2017-11-02  9:50 UTC (permalink / raw
  To: Chunming Zhou, Monk Liu, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 02.11.2017 um 10:00 schrieb Chunming Zhou:
>
>
> On 2017年11月02日 15:50, Monk Liu wrote:
>> fix memory leak.
>> This reverts commit d6951b49faa8447a6a77cdb1ef3346b1a1786d31.
>> because when entity_fini is interrupted the jobs in queue still
>> not processed with job_begin, so the finish_cb is not hooked
>> on sched fence, we still need manually do cleanups.
>>
>> Change-Id: I6e17bfeeac85062bc52f1d51b9697852b084845c
>> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
> Reviewed-by: Chunming Zhou <david1.zhou@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

>> ---
>>   drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c 
>> b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
>> index 6f041e8..7aa6455 100644
>> --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
>> +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
>> @@ -231,10 +231,11 @@ void amd_sched_entity_fini(struct 
>> amd_gpu_scheduler *sched,
>>           kthread_unpark(sched->thread);
>>           while ((job = 
>> to_amd_sched_job(spsc_queue_pop(&entity->job_queue)))) {
>>               struct amd_sched_fence *s_fence = job->s_fence;
>> -
>>               amd_sched_fence_scheduled(s_fence);
>>               dma_fence_set_error(&s_fence->finished, -ESRCH);
>>               amd_sched_fence_finished(s_fence);
>> +            dma_fence_put(&s_fence->finished);
>> +            sched->ops->free_job(job);
>>           }
>>       }
>>   }
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-02  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-02  7:50 [PATCH 1/2] drm/amdgpu:read VRAMLOST from gim Monk Liu
     [not found] ` <1509609006-19165-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-02  7:50   ` [PATCH 2/2] Revert "drm/amd/scheduler:fix duplicate operation in entity fini" Monk Liu
     [not found]     ` <1509609006-19165-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-11-02  9:00       ` Chunming Zhou
     [not found]         ` <286ce63e-595b-b053-b996-33d5d4f671a0-5C7GfCeVMHo@public.gmane.org>
2017-11-02  9:50           ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.