Re: [PATCH] drm/amdgpu: remove variable vm in function amdgpu_ib_schedule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 21.01.25 um 07:50 schrieb Lin.Cao:
use job && job->vm to check ib has vmid and use job && job->vmid to
check if switch buffer should be emitted

Signed-off-by: Lin.Cao <lincao12@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 2ea98ec60220..af908932b8dc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -129,7 +129,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
  	struct amdgpu_ib *ib = &ibs[0];
  	struct dma_fence *tmp = NULL;
  	bool need_ctx_switch;
-	struct amdgpu_vm *vm;
  	uint64_t fence_ctx;
  	uint32_t status = 0, alloc_size;
  	unsigned int fence_flags = 0;
@@ -147,7 +146,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
/* ring tests don't use a job */
  	if (job) {
-		vm = job->vm;
  		fence_ctx = job->base.s_fence ?
  			job->base.s_fence->scheduled.context : 0;
  		shadow_va = job->shadow_va;
@@ -155,7 +153,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
  		gds_va = job->gds_va;
  		init_shadow = job->init_shadow;
  	} else {
-		vm = NULL;
  		fence_ctx = 0;
  		shadow_va = 0;
  		csa_va = 0;
@@ -168,7 +165,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
  		return -EINVAL;
  	}
- if (vm && !job->vmid && !ring->is_mes_queue) {
+	if (job && job->vm && !job->vmid && !ring->is_mes_queue) {

That check here makes no sense any more since the VM is already cleared when that function is called.

Please completely remove this check since it is superfluous in the first place as far as I can see.

Regards,
Christian.

  		dev_err(adev->dev, "VM IB without ID\n");
  		return -EINVAL;
  	}
@@ -297,7 +294,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
  	amdgpu_ring_patch_cond_exec(ring, cond_exec);
ring->current_ctx = fence_ctx;
-	if (job && ring->funcs->emit_switch_buffer)
+	if (job && job->vmid && ring->funcs->emit_switch_buffer)
  		amdgpu_ring_emit_switch_buffer(ring);
if (ring->funcs->emit_wave_limit &&




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux