From: zhoucm1 <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: Alex Xie <AlexBin.Xie-5C7GfCeVMHo@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 1/3] drm/amdgpu: Optimize a function called by every IB sheduling
Date: Wed, 31 May 2017 10:58:08 +0800 [thread overview]
Message-ID: <592E3140.6030602@amd.com> (raw)
In-Reply-To: <1496180868-2617-1-git-send-email-AlexBin.Xie-5C7GfCeVMHo@public.gmane.org>
On 2017年05月31日 05:47, Alex Xie wrote:
> Move several if statements and a loop statment from
> run time to initialization time.
>
> Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
nice, Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 33 ++++++++++++++++++++++++++++++++
> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 6 ++++++
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 28 +--------------------------
> 3 files changed, 40 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index 6a85db0..7d95435 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -153,6 +153,36 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring)
> }
>
> /**
> + * amdgpu_ring_check_compute_vm_bug - check whether this ring has compute vm bug
> + *
> + * @adev: amdgpu_device pointer
> + * @ring: amdgpu_ring structure holding ring information
> + */
> +static void amdgpu_ring_check_compute_vm_bug(struct amdgpu_device *adev,
> + struct amdgpu_ring *ring)
> +{
> + const struct amdgpu_ip_block *ip_block;
> +
> + ring->has_compute_vm_bug = false;
> +
> + if (ring->funcs->type != AMDGPU_RING_TYPE_COMPUTE)
> + /* only compute rings */
> + return;
> +
> + ip_block = amdgpu_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GFX);
> + if (!ip_block)
> + return;
> +
> + /* Compute ring has a VM bug for GFX version < 7.
> + And compute ring has a VM bug for GFX 8 MEC firmware version < 673.*/
> + if (ip_block->version->major <= 7) {
> + ring->has_compute_vm_bug = true;
> + } else if (ip_block->version->major == 8)
> + if (adev->gfx.mec_fw_version < 673)
> + ring->has_compute_vm_bug = true;
> +}
> +
> +/**
> * amdgpu_ring_init - init driver ring struct.
> *
> * @adev: amdgpu_device pointer
> @@ -257,6 +287,9 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
> if (amdgpu_debugfs_ring_init(adev, ring)) {
> DRM_ERROR("Failed to register debugfs file for rings !\n");
> }
> +
> + amdgpu_ring_check_compute_vm_bug(adev, ring);
> +
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> index a9223a8..334307e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> @@ -185,6 +185,7 @@ struct amdgpu_ring {
> u64 cond_exe_gpu_addr;
> volatile u32 *cond_exe_cpu_addr;
> unsigned vm_inv_eng;
> + bool has_compute_vm_bug;
> #if defined(CONFIG_DEBUG_FS)
> struct dentry *ent;
> #endif
> @@ -207,4 +208,9 @@ static inline void amdgpu_ring_clear_ring(struct amdgpu_ring *ring)
>
> }
>
> +static inline bool amdgpu_ring_has_compute_vm_bug(struct amdgpu_ring *ring)
> +{
> + return ring->has_compute_vm_bug;
> +}
> +
> #endif
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index b2384b8..7a323f9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -656,32 +656,6 @@ static int amdgpu_vm_alloc_reserved_vmid(struct amdgpu_device *adev,
> return r;
> }
>
> -static bool amdgpu_vm_ring_has_compute_vm_bug(struct amdgpu_ring *ring)
> -{
> - struct amdgpu_device *adev = ring->adev;
> - const struct amdgpu_ip_block *ip_block;
> -
> - if (ring->funcs->type != AMDGPU_RING_TYPE_COMPUTE)
> - /* only compute rings */
> - return false;
> -
> - ip_block = amdgpu_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GFX);
> - if (!ip_block)
> - return false;
> -
> - if (ip_block->version->major <= 7) {
> - /* gfx7 has no workaround */
> - return true;
> - } else if (ip_block->version->major == 8) {
> - if (adev->gfx.mec_fw_version >= 673)
> - /* gfx8 is fixed in MEC firmware 673 */
> - return false;
> - else
> - return true;
> - }
> - return false;
> -}
> -
> bool amdgpu_vm_need_pipeline_sync(struct amdgpu_ring *ring,
> struct amdgpu_job *job)
> {
> @@ -691,7 +665,7 @@ bool amdgpu_vm_need_pipeline_sync(struct amdgpu_ring *ring,
> struct amdgpu_vm_id *id;
> bool gds_switch_needed;
> bool vm_flush_needed = job->vm_needs_flush ||
> - amdgpu_vm_ring_has_compute_vm_bug(ring);
> + amdgpu_ring_has_compute_vm_bug(ring);
>
> if (job->vm_id == 0)
> return false;
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-05-31 2:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-30 21:47 [PATCH 1/3] drm/amdgpu: Optimize a function called by every IB sheduling Alex Xie
[not found] ` <1496180868-2617-1-git-send-email-AlexBin.Xie-5C7GfCeVMHo@public.gmane.org>
2017-05-30 21:47 ` [PATCH 2/3] drm/amdgpu: Remove two ! operations in an if condition Alex Xie
[not found] ` <1496180868-2617-2-git-send-email-AlexBin.Xie-5C7GfCeVMHo@public.gmane.org>
2017-05-31 2:59 ` zhoucm1
2017-05-31 3:09 ` Michel Dänzer
2017-05-31 6:59 ` Christian König
2017-05-30 21:47 ` [PATCH 3/3] drm/amdgpu: clean up code to make it easier to understand Alex Xie
[not found] ` <1496180868-2617-3-git-send-email-AlexBin.Xie-5C7GfCeVMHo@public.gmane.org>
2017-05-31 3:11 ` zhoucm1
2017-05-31 2:58 ` zhoucm1 [this message]
2017-05-31 6:57 ` [PATCH 1/3] drm/amdgpu: Optimize a function called by every IB sheduling Christian König
[not found] ` <966bbfa3-488d-2a12-7ebd-cf59812928d6-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-31 12:53 ` Xie, AlexBin
[not found] ` <MWHPR1201MB0045FC6C00CA6008273C385BF2F10-3iK1xFAIwjq45V35fqe+hGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-05-31 13:07 ` Christian König
[not found] ` <c856088d-e779-4f5f-6252-d7f547124861-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-31 18:28 ` Xie, AlexBin
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=592E3140.6030602@amd.com \
--to=david1.zhou-5c7gfcevmho@public.gmane.org \
--cc=AlexBin.Xie-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@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