AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
	<ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/7] drm/amdgpu: use scheduler load balancing for SDMA CS
Date: Thu, 2 Aug 2018 13:50:33 +0800	[thread overview]
Message-ID: <5B629BA9.60407@amd.com> (raw)
In-Reply-To: <20180801113116.1994-2-christian.koenig-5C7GfCeVMHo@public.gmane.org>

On 08/01/2018 07:31 PM, Christian König wrote:
> Start to use the scheduler load balancing for userspace SDMA
> command submissions.
>

In this case, each SDMA could load all SDMA(instances) rqs, and UMD will not specify a ring id.
If so, we may abstract a set of rings for each type of IP, associated with such kind of IP instances' rq.
Accordingly libdrm needs to update as well, but it may be more user-friendly, regardless of ring id when submits command.

And will it interfere ctx->ring's settings, like sequence?
e.g. submit a command to SDMA0, but SDMA0 is busy and SDMA1 is idle,
So the command will be pushed to SDMA1 rq, but update sequence for ctx->ring[SDMA0] actually.


Regards,
Jerry

> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 25 +++++++++++++++++++++----
>   1 file changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index df6965761046..59046f68975a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -48,7 +48,8 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev,
>   			   struct drm_file *filp,
>   			   struct amdgpu_ctx *ctx)
>   {
> -	unsigned i, j;
> +	struct drm_sched_rq *sdma_rqs[AMDGPU_MAX_RINGS];
> +	unsigned i, j, num_sdma_rqs;
>   	int r;
>
>   	if (priority < 0 || priority >= DRM_SCHED_PRIORITY_MAX)
> @@ -80,18 +81,34 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev,
>   	ctx->init_priority = priority;
>   	ctx->override_priority = DRM_SCHED_PRIORITY_UNSET;
>
> -	/* create context entity for each ring */
> +	num_sdma_rqs = 0;
>   	for (i = 0; i < adev->num_rings; i++) {
>   		struct amdgpu_ring *ring = adev->rings[i];
>   		struct drm_sched_rq *rq;
>
>   		rq = &ring->sched.sched_rq[priority];
> +		if (ring->funcs->type == AMDGPU_RING_TYPE_SDMA)
> +			sdma_rqs[num_sdma_rqs++] = rq;
> +	}
> +
> +	/* create context entity for each ring */
> +	for (i = 0; i < adev->num_rings; i++) {
> +		struct amdgpu_ring *ring = adev->rings[i];
>
>   		if (ring == &adev->gfx.kiq.ring)
>   			continue;
>
> -		r = drm_sched_entity_init(&ctx->rings[i].entity,
> -					  &rq, 1, &ctx->guilty);
> +		if (ring->funcs->type == AMDGPU_RING_TYPE_SDMA) {
> +			r = drm_sched_entity_init(&ctx->rings[i].entity,
> +						  sdma_rqs, num_sdma_rqs,
> +						  &ctx->guilty);
> +		} else {
> +			struct drm_sched_rq *rq;
> +
> +			rq = &ring->sched.sched_rq[priority];
> +			r = drm_sched_entity_init(&ctx->rings[i].entity,
> +						  &rq, 1, &ctx->guilty);
> +		}
>   		if (r)
>   			goto failed;
>   	}
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-08-02  5:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-01 11:31 [PATCH 1/7] drm/amdgpu: use new scheduler load balancing for VMs Christian König
     [not found] ` <20180801113116.1994-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-01 11:31   ` [PATCH 2/7] drm/amdgpu: use scheduler load balancing for SDMA CS Christian König
     [not found]     ` <20180801113116.1994-2-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-02  5:50       ` Zhang, Jerry (Junwei) [this message]
     [not found]         ` <5B629BA9.60407-5C7GfCeVMHo@public.gmane.org>
2018-08-02 10:09           ` Christian König
     [not found]             ` <a7d63f7f-a110-5897-2726-c59c425e42a1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-03  4:53               ` Zhang, Jerry (Junwei)
2018-08-01 11:31   ` [PATCH 3/7] drm/amdgpu: use scheduler load balancing for compute CS Christian König
2018-08-01 11:31   ` [PATCH 4/7] drm/amdgpu: remove the queue manager Christian König
2018-08-01 11:31   ` [PATCH 5/7] drm/amdgpu: remove ring lru handling Christian König
2018-08-01 11:31   ` [PATCH 6/7] drm/amdgpu: move context related stuff to amdgpu_ctx.h Christian König
     [not found]     ` <20180801113116.1994-6-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-02  2:58       ` Huang Rui
2018-08-01 11:31   ` [PATCH 7/7] drm/amdgpu: use entity instead of ring for CS Christian König
2018-08-02  6:40   ` [PATCH 1/7] drm/amdgpu: use new scheduler load balancing for VMs zhoucm1

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5B629BA9.60407@amd.com \
    --to=jerry.zhang-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox