drm/amdgpu: partial revert VRAM lost handling v2
Subsystems (2)
PATCH 1/4 drm/amdgpu: partial revert VRAM lost handling v2
From: Christian König <[email protected]>
Keep blocking the CS, but revert everything else. Mapping BOs and info IOCTL are harmless and can still happen even when VRAM content ist lost.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 11 ----------- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 5 ----- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 14 ++++++++++---- 3 files changed, 10 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -11
@@ -1257,16 +1257,12 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, {union drm_amdgpu_wait_cs *wait = data;struct amdgpu_device *adev = dev->dev_private; -struct amdgpu_fpriv *fpriv = filp->driver_priv;unsigned long timeout =amdgpu_gem_timeout (wait->in.timeout);struct amdgpu_ring *ring =NULL ;struct amdgpu_ctx *ctx;struct dma_fence *fence;long r; -if (amdgpu_kms_vram_lost (adev, fpriv)) -return -ENODEV ; - ctx =amdgpu_ctx_get (filp->driver_priv, wait->in.ctx_id);if (ctx ==NULL )return -EINVAL ;
@@ -1335,16 +1331,12 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) {struct amdgpu_device *adev = dev->dev_private; -struct amdgpu_fpriv *fpriv = filp->driver_priv;union drm_amdgpu_fence_to_handle *info = data;struct dma_fence *fence;struct drm_syncobj *syncobj;struct sync_file *sync_file;int fd, r; -if (amdgpu_kms_vram_lost (adev, fpriv)) -return -ENODEV ; - fence =amdgpu_cs_get_fence (adev, filp, &info->in.fence);if (IS_ERR (fence))return PTR_ERR (fence);
@@ -1506,15 +1498,12 @@ int amdgpu_cs_wait_fences_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) {struct amdgpu_device *adev = dev->dev_private; -struct amdgpu_fpriv *fpriv = filp->driver_priv;union drm_amdgpu_wait_fences *wait = data;uint32_t fence_count = wait->in.fence_count;struct drm_amdgpu_fence *fences_user;struct drm_amdgpu_fence *fences;int r; -if (amdgpu_kms_vram_lost (adev, fpriv)) -return -ENODEV ;/* Get the fences from userspace */ fences =kmalloc_array (fence_count,sizeof (struct drm_amdgpu_fence ),GFP_KERNEL );
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -5
@@ -577,11 +577,6 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, args->operation);return -EINVAL ; } -if ((args->operation ==AMDGPU_VA_OP_MAP ) || - (args->operation ==AMDGPU_VA_OP_REPLACE )) { -if (amdgpu_kms_vram_lost (adev, fpriv)) -return -ENODEV ; - }INIT_LIST_HEAD (&list);INIT_LIST_HEAD (&duplicates);
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +10 -4
@@ -269,7 +269,6 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,static int amdgpu_info_ioctl (struct drm_device *dev,void *data,struct drm_file *filp) {struct amdgpu_device *adev = dev->dev_private; -struct amdgpu_fpriv *fpriv = filp->driver_priv;struct drm_amdgpu_info *info = data;struct amdgpu_mode_info *minfo = &adev->mode_info;void __user *out = (void __user *)(uintptr_t )info->return_pointer;
@@ -282,8 +281,6 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_fileif (!info->return_size || !info->return_pointer)return -EINVAL ; -if (amdgpu_kms_vram_lost (adev, fpriv)) -return -ENODEV ;switch (info->query) {case AMDGPU_INFO_ACCEL_WORKING :
@@ -791,10 +788,19 @@ void amdgpu_driver_lastclose_kms(struct drm_device *dev)vga_switcheroo_process_delayed_switch (); } +/** +* amdgpu_kms_vram_lost - check if VRAM was lost for this client +* +* @adev: amdgpu device +* @fpriv: client private +* +* Check if all CS is blocked for the client because of lost VRAM +*/ bool amdgpu_kms_vram_lost (struct amdgpu_device *adev,struct amdgpu_fpriv *fpriv) { -return fpriv->vram_lost_counter !=atomic_read (&adev->vram_lost_counter); +return fpriv->vram_lost_counter != +atomic_read (&adev->vram_lost_counter); }/**
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1507563272-7868-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
PATCH 2/4 drm/amdgpu: keep copy of VRAM lost counter in job
From: Christian König <[email protected]>
Instead of reading the current counter from fpriv.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 13 +++++++------ 3 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1116,6 +1116,7 @@ struct amdgpu_job {uint32_t gds_base, gds_size;uint32_t gws_base, gws_size;uint32_t oa_base, oa_size; +uint32_t vram_lost_counter;/* user fence handling */ uint64_t uf_addr;
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -0
@@ -170,6 +170,8 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)if (ret) goto free_all_kdata; + p->job->vram_lost_counter = fpriv->vram_lost_counter; +if (p->uf_entry.robj) p->job->uf_addr = uf_offset;kfree (chunk_array);
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +7 -6
@@ -61,6 +61,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, (*job)->vm = vm; (*job)->ibs = (void *)&(*job)[1 ]; (*job)->num_ibs = num_ibs; + (*job)->vram_lost_counter =atomic_read (&adev->vram_lost_counter);amdgpu_sync_create (&(*job)->sync);amdgpu_sync_create (&(*job)->dep_sync);
@@ -177,8 +178,8 @@ static struct dma_fence *amdgpu_job_dependency(struct amd_sched_job *sched_job)static struct dma_fence *amdgpu_job_run (struct amd_sched_job *sched_job) {struct dma_fence *fence =NULL ; +struct amdgpu_device *adev;struct amdgpu_job *job; -struct amdgpu_fpriv *fpriv =NULL ;int r;if (!sched_job) {
@@ -186,17 +187,17 @@ static struct dma_fence *amdgpu_job_run(struct amd_sched_job *sched_job)return NULL ; } job =to_amdgpu_job (sched_job); + adev = job->adev;BUG_ON (amdgpu_sync_peek_fence (&job->sync,NULL ));trace_amdgpu_sched_run_job (job); -if (job->vm) - fpriv = container_of(job->vm, struct amdgpu_fpriv, vm);/* skip ib schedule when vram is lost */ -if (fpriv &&amdgpu_kms_vram_lost (job->adev, fpriv)) +if (job->vram_lost_counter !=atomic_read (&adev->vram_lost_counter)) {DRM_ERROR ("Skip scheduling IBs!\n" ); -else { - r =amdgpu_ib_schedule (job->ring, job->num_ibs, job->ibs, job, &fence); + }else { + r =amdgpu_ib_schedule (job->ring, job->num_ibs, job->ibs, job, + &fence);if (r)DRM_ERROR ("Error scheduling IBs (%d)\n" , r); }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1507563272-7868-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
RE: [PATCH 2/4] drm/amdgpu: keep copy of VRAM lost counter in job
Christian,
Can you elaborate what benefit it brings that keep a counter copy in JOB ?
Because you know when vram lost happens, the thing real matter is : if the BO in BO_LIST of this job modified/created before this vram lost, Not that if the job creating timestamp ...
Since kernel side now doesn't implement a way to compare counter per BO (which is too low efficient considering OCL app that have 5000+ BO in BO_LIST),
if we always consider BO is created/modified since this job's context created (you know many job can refer to one specific BO like texture, which is long time ago modified before JOB creation), than we just need to compare the counter in ctx,
BR Monk
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Monday, October 9, 2017 11:35 PM
To: [email protected]
Subject: [PATCH 2/4] drm/amdgpu: keep copy of VRAM lost counter in job
From: Christian König <[email protected]>
Instead of reading the current counter from fpriv.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 13 +++++++------ 3 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1116,6 +1116,7 @@ struct amdgpu_job {uint32_t gds_base, gds_size;uint32_t gws_base, gws_size;uint32_t oa_base, oa_size; +uint32_t vram_lost_counter;/* user fence handling */ uint64_t uf_addr;
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -0
@@ -170,6 +170,8 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)if (ret) goto free_all_kdata; + p->job->vram_lost_counter = fpriv->vram_lost_counter; +if (p->uf_entry.robj) p->job->uf_addr = uf_offset;kfree (chunk_array);
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +7 -6
@@ -61,6 +61,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, (*job)->vm = vm; (*job)->ibs = (void *)&(*job)[1 ]; (*job)->num_ibs = num_ibs; + (*job)->vram_lost_counter =atomic_read (&adev->vram_lost_counter);amdgpu_sync_create (&(*job)->sync);amdgpu_sync_create (&(*job)->dep_sync);
@@ -177,8 +178,8 @@ static struct dma_fence *amdgpu_job_dependency(struct amd_sched_job *sched_job) static struct dma_fence *amdgpu_job_run(struct amd_sched_job *sched_job) {struct dma_fence *fence =NULL ; +struct amdgpu_device *adev;struct amdgpu_job *job; -struct amdgpu_fpriv *fpriv =NULL ;int r;if (!sched_job) {
@@ -186,17 +187,17 @@ static struct dma_fence *amdgpu_job_run(struct amd_sched_job *sched_job)return NULL ; } job =to_amdgpu_job (sched_job); + adev = job->adev;BUG_ON (amdgpu_sync_peek_fence (&job->sync,NULL ));trace_amdgpu_sched_run_job (job); -if (job->vm) - fpriv = container_of(job->vm, struct amdgpu_fpriv, vm);/* skip ib schedule when vram is lost */ -if (fpriv &&amdgpu_kms_vram_lost (job->adev, fpriv)) +if (job->vram_lost_counter !=atomic_read (&adev->vram_lost_counter)) {DRM_ERROR ("Skip scheduling IBs!\n" ); -else { - r =amdgpu_ib_schedule (job->ring, job->num_ibs, job->ibs, job, &fence); + }else { + r =amdgpu_ib_schedule (job->ring, job->num_ibs, job->ibs, job, + &fence);if (r)DRM_ERROR ("Error scheduling IBs (%d)\n" , r); }
--
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amdgpu: move the VRAM lost counter per context
In reply to a message not in the archiveFrom: Christian König <[email protected]>
Instead of per device track the VRAM lost per context and return ECANCELED instead of ENODEV.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 ++---- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 16 ---------------- 4 files changed, 8 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -4
@@ -735,10 +735,11 @@ struct amdgpu_ctx {struct amdgpu_device *adev;struct amdgpu_queue_mgr queue_mgr;unsigned reset_counter; +uint32_t vram_lost_counter;spinlock_t ring_lock;struct dma_fence **fences;struct amdgpu_ctx_ring rings[AMDGPU_MAX_RINGS ]; -bool preamble_presented; +bool preamble_presented; };struct amdgpu_ctx_mgr {
@@ -773,7 +774,6 @@ struct amdgpu_fpriv {struct mutex bo_list_lock;struct idr bo_list_handles;struct amdgpu_ctx_mgr ctx_mgr; -u32 vram_lost_counter; };/*
@@ -1868,8 +1868,6 @@ static inline bool amdgpu_has_atpx(void) { return false; }extern const struct drm_ioctl_desc amdgpu_ioctls_kms[];extern const int amdgpu_max_kms_ioctl; -bool amdgpu_kms_vram_lost (struct amdgpu_device *adev, -struct amdgpu_fpriv *fpriv);int amdgpu_driver_load_kms (struct drm_device *dev,unsigned long flags);void amdgpu_driver_unload_kms (struct drm_device *dev);void amdgpu_driver_lastclose_kms (struct drm_device *dev);
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +5 -4
@@ -170,7 +170,11 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)if (ret) goto free_all_kdata; - p->job->vram_lost_counter = fpriv->vram_lost_counter; + p->job->vram_lost_counter =atomic_read (&p->adev->vram_lost_counter); +if (p->ctx->vram_lost_counter != p->job->vram_lost_counter) { + ret = -ECANCELED ; + goto free_all_kdata; + }if (p->uf_entry.robj) p->job->uf_addr = uf_offset;
@@ -1191,7 +1195,6 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,int amdgpu_cs_ioctl (struct drm_device *dev,void *data,struct drm_file *filp) {struct amdgpu_device *adev = dev->dev_private; -struct amdgpu_fpriv *fpriv = filp->driver_priv;union drm_amdgpu_cs *cs = data;struct amdgpu_cs_parser parser = {};bool reserved_buffers = false;
@@ -1199,8 +1202,6 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)if (!adev->accel_working)return -EBUSY ; -if (amdgpu_kms_vram_lost (adev, fpriv)) -return -ENODEV ; parser.adev = adev; parser.filp = filp;
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +1 -0
@@ -45,6 +45,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx) } ctx->reset_counter =atomic_read (&adev->gpu_reset_counter); + ctx->vram_lost_counter =atomic_read (&adev->vram_lost_counter);/* create context entity for each ring */ for (i =0 ; i < adev->num_rings; i++) {
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -16
@@ -789,21 +789,6 @@ void amdgpu_driver_lastclose_kms(struct drm_device *dev) }/** -* amdgpu_kms_vram_lost - check if VRAM was lost for this client -* -* @adev: amdgpu device -* @fpriv: client private -* -* Check if all CS is blocked for the client because of lost VRAM -*/ -bool amdgpu_kms_vram_lost (struct amdgpu_device *adev, -struct amdgpu_fpriv *fpriv) -{ -return fpriv->vram_lost_counter != -atomic_read (&adev->vram_lost_counter); -} - -/** * amdgpu_driver_open_kms - drm callback for open * * @dev: drm dev pointer
@@ -859,7 +844,6 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)amdgpu_ctx_mgr_init (&fpriv->ctx_mgr); - fpriv->vram_lost_counter =atomic_read (&adev->vram_lost_counter); file_priv->driver_priv = fpriv; out_suspend:
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/amdgpu: set -ECANCELED when dropping jobs
In reply to a message not in the archiveFrom: Christian König <[email protected]>
And return from the wait functions the fence error code.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 ++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +6 -1
@@ -1283,6 +1283,8 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, r =PTR_ERR (fence); else if (fence) { r =dma_fence_wait_timeout (fence, true, timeout); +if (r >0 && fence->error) + r = fence->error;dma_fence_put (fence); } else r =1 ;
@@ -1420,6 +1422,9 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,if (r ==0 )break ; + +if (fence->error) +return fence->error; }memset (wait,0 ,sizeof (*wait));
@@ -1480,7 +1485,7 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev, wait->out.status = (r >0 ); wait->out.first_signaled = first;/* set return value 0 to indicate success */ - r =0 ; + r = array[first]->error; err_free_fence_array:for (i =0 ; i < fence_count; i++)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -0
@@ -194,6 +194,7 @@ static struct dma_fence *amdgpu_job_run(struct amd_sched_job *sched_job)trace_amdgpu_sched_run_job (job);/* skip ib schedule when vram is lost */ if (job->vram_lost_counter !=atomic_read (&adev->vram_lost_counter)) { +dma_fence_set_error (&job->base.s_fence->finished, -ECANCELED );DRM_ERROR ("Skip scheduling IBs!\n" ); }else { r = amdgpu_ib_schedule(job->ring, job->num_ibs, job->ibs, job,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1507563272-7868-4-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Nicolai Hähnle
Reviewed-byRe: [PATCH 4/4] drm/amdgpu: set -ECANCELED when dropping jobs
Quoted 5 lines · Christian König
From: Christian König <[email protected]>
And return from the wait functions the fence error code.
Signed-off-by Christian König <[email protected]>
For the series:
Quoted 50 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 ++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +6
-1@@ -1283,6 +1283,8 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, r =PTR_ERR (fence); else if (fence) { r =dma_fence_wait_timeout (fence, true, timeout); +if (r >0 && fence->error) + r = fence->error;dma_fence_put (fence); } else r =1 ;@@ -1420,6 +1422,9 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,if (r ==0 )break ; + +if (fence->error) +return fence->error; }memset (wait,0 ,sizeof (*wait));@@ -1480,7 +1485,7 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev, wait->out.status = (r >0 ); wait->out.first_signaled = first;/* set return value 0 to indicate success */ - r =0 ; + r = array[first]->error; err_free_fence_array:for (i =0 ; i < fence_count; i++)drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1
-0@@ -194,6 +194,7 @@ static struct dma_fence *amdgpu_job_run(struct amd_sched_job *sched_job)trace_amdgpu_sched_run_job (job);/* skip ib schedule when vram is lost */ if (job->vram_lost_counter !=atomic_read (&adev->vram_lost_counter)) { +dma_fence_set_error (&job->base.s_fence->finished, -ECANCELED );DRM_ERROR ("Skip scheduling IBs!\n" ); }else { r = amdgpu_ib_schedule(job->ring, job->num_ibs, job->ibs, job,
Signature · 6 lines
Lerne, wie die Welt wirklich ist, Aber vergiss niemals, wie sie sein sollte. _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 4/4] drm/amdgpu: set -ECANCELED when dropping jobs
In reply to a message not in the archiveYou should use "dma_fence_wait_timeout()" instead of fence->error, that's more make sense
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: 2017年10月9日 23:35
To: [email protected]
Subject: [PATCH 4/4] drm/amdgpu: set -ECANCELED when dropping jobs
From: Christian König <[email protected]>
And return from the wait functions the fence error code.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 ++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +6 -1
@@ -1283,6 +1283,8 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, r =PTR_ERR (fence); else if (fence) { r =dma_fence_wait_timeout (fence, true, timeout); +if (r >0 && fence->error) + r = fence->error;dma_fence_put (fence); } else r =1 ;
@@ -1420,6 +1422,9 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,if (r ==0 )break ; + +if (fence->error) +return fence->error; }memset (wait,0 ,sizeof (*wait));
@@ -1480,7 +1485,7 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev, wait->out.status = (r >0 ); wait->out.first_signaled = first;/* set return value 0 to indicate success */ - r =0 ; + r = array[first]->error; err_free_fence_array:for (i =0 ; i < fence_count; i++)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -0
@@ -194,6 +194,7 @@ static struct dma_fence *amdgpu_job_run(struct amd_sched_job *sched_job)trace_amdgpu_sched_run_job (job);/* skip ib schedule when vram is lost */ if (job->vram_lost_counter !=atomic_read (&adev->vram_lost_counter)) { +dma_fence_set_error (&job->base.s_fence->finished, -ECANCELED );DRM_ERROR ("Skip scheduling IBs!\n" ); }else { r = amdgpu_ib_schedule(job->ring, job->num_ibs, job->ibs, job,
--
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): BLUPR12MB04495B50D53D96F73DF1312384750-7LeqcoF/[email protected]
RE: [PATCH 4/4] drm/amdgpu: set -ECANCELED when dropping jobs
Sorry, should be "dma_fence_get_error"
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Liu, Monk
Sent: 2017年10月10日 12:37
To: Christian König <[email protected]>; [email protected]
Subject: RE: [PATCH 4/4] drm/amdgpu: set -ECANCELED when dropping jobs
You should use "dma_fence_wait_timeout()" instead of fence->error, that's more make sense
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: 2017年10月9日 23:35
To: [email protected]
Subject: [PATCH 4/4] drm/amdgpu: set -ECANCELED when dropping jobs
From: Christian König <[email protected]>
And return from the wait functions the fence error code.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 ++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +6 -1
@@ -1283,6 +1283,8 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, r =PTR_ERR (fence); else if (fence) { r =dma_fence_wait_timeout (fence, true, timeout); +if (r >0 && fence->error) + r = fence->error;dma_fence_put (fence); } else r =1 ;
@@ -1420,6 +1422,9 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,if (r ==0 )break ; + +if (fence->error) +return fence->error; }memset (wait,0 ,sizeof (*wait));
@@ -1480,7 +1485,7 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev, wait->out.status = (r >0 ); wait->out.first_signaled = first;/* set return value 0 to indicate success */ - r =0 ; + r = array[first]->error; err_free_fence_array:for (i =0 ; i < fence_count; i++)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -0
@@ -194,6 +194,7 @@ static struct dma_fence *amdgpu_job_run(struct amd_sched_job *sched_job)trace_amdgpu_sched_run_job (job);/* skip ib schedule when vram is lost */ if (job->vram_lost_counter !=atomic_read (&adev->vram_lost_counter)) { +dma_fence_set_error (&job->base.s_fence->finished, -ECANCELED );DRM_ERROR ("Skip scheduling IBs!\n" ); }else { r = amdgpu_ib_schedule(job->ring, job->num_ibs, job->ibs, job,
--
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 4/4] drm/amdgpu: set -ECANCELED when dropping jobs
In reply to a message not in the archiveShould be "dma_fence_get_status()"
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Liu, Monk
Sent: 2017年10月10日 12:37
To: Christian König <[email protected]>; [email protected]
Subject: RE: [PATCH 4/4] drm/amdgpu: set -ECANCELED when dropping jobs
You should use "dma_fence_wait_timeout()" instead of fence->error, that's more make sense
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: 2017年10月9日 23:35
To: [email protected]
Subject: [PATCH 4/4] drm/amdgpu: set -ECANCELED when dropping jobs
From: Christian König <[email protected]>
And return from the wait functions the fence error code.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 ++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +6 -1
@@ -1283,6 +1283,8 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, r =PTR_ERR (fence); else if (fence) { r =dma_fence_wait_timeout (fence, true, timeout); +if (r >0 && fence->error) + r = fence->error;dma_fence_put (fence); } else r =1 ;
@@ -1420,6 +1422,9 @@ static int amdgpu_cs_wait_all_fences(struct amdgpu_device *adev,if (r ==0 )break ; + +if (fence->error) +return fence->error; }memset (wait,0 ,sizeof (*wait));
@@ -1480,7 +1485,7 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev, wait->out.status = (r >0 ); wait->out.first_signaled = first;/* set return value 0 to indicate success */ - r =0 ; + r = array[first]->error; err_free_fence_array:for (i =0 ; i < fence_count; i++)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -0
@@ -194,6 +194,7 @@ static struct dma_fence *amdgpu_job_run(struct amd_sched_job *sched_job)trace_amdgpu_sched_run_job (job);/* skip ib schedule when vram is lost */ if (job->vram_lost_counter !=atomic_read (&adev->vram_lost_counter)) { +dma_fence_set_error (&job->base.s_fence->finished, -ECANCELED );DRM_ERROR ("Skip scheduling IBs!\n" ); }else { r = amdgpu_ib_schedule(job->ring, job->num_ibs, job->ibs, job,
--
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx