Commit 29565548 authored by Pierre-Eric Pelloux-Prayer's avatar Pierre-Eric Pelloux-Prayer Committed by Philipp Stanner
Browse files

drm/sched: Store the drm client_id in drm_sched_fence



This will be used in a later commit to trace the drm client_id in
some of the gpu_scheduler trace events.

This requires changing all the users of drm_sched_job_init to
add an extra parameter.

The newly added drm_client_id field in the drm_sched_fence is a bit
of a duplicate of the owner one. One suggestion I received was to
merge those 2 fields - this can't be done right now as amdgpu uses
some special values (AMDGPU_FENCE_OWNER_*) that can't really be
translated into a client id. Christian is working on getting rid of
those; when it's done we should be able to squash owner/drm_client_id
together.

Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: default avatarPhilipp Stanner <phasta@kernel.org>
Link: https://lore.kernel.org/r/20250526125505.2360-3-pierre-eric.pelloux-prayer@amd.com
parent 18c44fb6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -848,7 +848,8 @@ int aie2_cmd_submit(struct amdxdna_hwctx *hwctx, struct amdxdna_sched_job *job,
		goto up_sem;
	}

	ret = drm_sched_job_init(&job->base, &hwctx->priv->entity, 1, hwctx);
	ret = drm_sched_job_init(&job->base, &hwctx->priv->entity, 1, hwctx,
				 hwctx->client->filp->client_id);
	if (ret) {
		XDNA_ERR(xdna, "DRM job init failed, ret %d", ret);
		goto free_chain;
+1 −1
Original line number Diff line number Diff line
@@ -639,7 +639,7 @@ int amdgpu_amdkfd_submit_ib(struct amdgpu_device *adev,
		goto err;
	}

	ret = amdgpu_job_alloc(adev, NULL, NULL, NULL, 1, &job);
	ret = amdgpu_job_alloc(adev, NULL, NULL, NULL, 1, &job, 0);
	if (ret)
		goto err;

+2 −1
Original line number Diff line number Diff line
@@ -293,7 +293,8 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,

	for (i = 0; i < p->gang_size; ++i) {
		ret = amdgpu_job_alloc(p->adev, vm, p->entities[i], vm,
				       num_ibs[i], &p->jobs[i]);
				       num_ibs[i], &p->jobs[i],
				       p->filp->client_id);
		if (ret)
			goto free_all_kdata;
		p->jobs[i]->enforce_isolation = p->adev->enforce_isolation[fpriv->xcp_id];
+5 −3
Original line number Diff line number Diff line
@@ -204,7 +204,8 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)

int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,
		     struct drm_sched_entity *entity, void *owner,
		     unsigned int num_ibs, struct amdgpu_job **job)
		     unsigned int num_ibs, struct amdgpu_job **job,
		     u64 drm_client_id)
{
	if (num_ibs == 0)
		return -EINVAL;
@@ -222,7 +223,8 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,
	if (!entity)
		return 0;

	return drm_sched_job_init(&(*job)->base, entity, 1, owner);
	return drm_sched_job_init(&(*job)->base, entity, 1, owner,
				  drm_client_id);
}

int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev,
@@ -232,7 +234,7 @@ int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev,
{
	int r;

	r = amdgpu_job_alloc(adev, NULL, entity, owner, 1, job);
	r = amdgpu_job_alloc(adev, NULL, entity, owner, 1, job, 0);
	if (r)
		return r;

+2 −1
Original line number Diff line number Diff line
@@ -90,7 +90,8 @@ static inline struct amdgpu_ring *amdgpu_job_ring(struct amdgpu_job *job)

int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,
		     struct drm_sched_entity *entity, void *owner,
		     unsigned int num_ibs, struct amdgpu_job **job);
		     unsigned int num_ibs, struct amdgpu_job **job,
		     u64 drm_client_id);
int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev,
			     struct drm_sched_entity *entity, void *owner,
			     size_t size, enum amdgpu_ib_pool_type pool_type,
Loading