From: "Christian König" <deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
To: Grazvydas Ignotas <notasas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu:guarantee 128dws between vm flush and IB(v3)
Date: Thu, 19 Jan 2017 15:32:26 +0100 [thread overview]
Message-ID: <fd28a4f9-80ce-49d4-d6e7-9765988e0181@vodafone.de> (raw)
In-Reply-To: <CANOLnOOwu2Fd0Svx5tcp7kqb2b28Ar30gTd-FeY4xQwm32J5YQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Am 19.01.2017 um 14:51 schrieb Grazvydas Ignotas:
> On Thu, Jan 19, 2017 at 11:10 AM, Christian König
> <deathsimple@vodafone.de> wrote:
>> Am 18.01.2017 um 12:42 schrieb Monk Liu:
>>> @@ -6743,6 +6741,15 @@ static void gfx_v8_ring_emit_cntxcntl(struct
>>> amdgpu_ring *ring, uint32_t flags)
>>> if (amdgpu_sriov_vf(ring->adev))
>>> gfx_v8_0_ring_emit_de_meta_init(ring,
>>> (flags & AMDGPU_VM_DOMAIN) ? AMDGPU_CSA_VADDR :
>>> ring->adev->virt.csa_vmid0_addr);
>>> +
>>> + /* We need to pad some NOPs before emit_ib to prevent CE run ahead
>>> of
>>> + * vm_flush, which may trigger VM fault. */
>>> + if (ring->wptr > ring->last_vm_flush_pos) /* no wptr wrapping to
>>> RB head */
>>> + amdgpu_ring_insert_nop(ring, 128 - (ring->wptr -
>>> ring->last_vm_flush_pos));
>>
>> This can easily result in a negative number, couldn't it?
>>
>>> + else
>>> + if (ring->ptr_mask + 1 - ring->last_vm_flush_pos +
>>> ring->wptr < 128)
>>> + amdgpu_ring_insert_nop(ring,
>>> + 128 - (ring->ptr_mask + 1 -
>>> ring->last_vm_flush_pos + ring->wptr));
>>
>> I think it would be cleaner if you calculate the number of NOPs needed first
>> for both cases and then check if the number isn't negative for both cases.
> What about this:
> 128 - ((ring->wptr - ring->last_vm_flush_pos) & 127)
That won't handle the case for negative nop count correctly either.
See when we already emitted more than 128 dw we don't want to add some more.
Christian.
>
> Gražvydas
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-01-19 14:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 11:42 [PATCH] drm/amdgpu:guarantee 128dws between vm flush and IB(v3) Monk Liu
[not found] ` <1484739739-30080-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-01-19 9:10 ` Christian König
[not found] ` <7ff8505a-a6c2-8258-5cfa-45a5344ba2df-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-01-19 13:51 ` Grazvydas Ignotas
[not found] ` <CANOLnOOwu2Fd0Svx5tcp7kqb2b28Ar30gTd-FeY4xQwm32J5YQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-19 14:32 ` Christian König [this message]
[not found] ` <fd28a4f9-80ce-49d4-d6e7-9765988e0181-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-01-19 15:16 ` Grazvydas Ignotas
2017-01-19 14:39 ` Liu, Monk
2017-01-19 14:49 ` Liu, Monk
[not found] ` <BY2PR1201MB1110457767084D1B300C67D8847E0-O28G1zQ8oGliQkyLPkmea2rFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-01-20 8:48 ` Christian König
[not found] ` <72ce673f-a232-290d-62c0-082e6ede3bbd-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-01-22 2:47 ` 答复: " Liu, Monk
[not found] ` <BY2PR1201MB11108334E6D9C3AAE1DF30D384730-O28G1zQ8oGliQkyLPkmea2rFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-01-22 3:53 ` Liu, Monk
-- strict thread matches above, loose matches on Subject: below --
2017-01-18 10:33 Monk Liu
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=fd28a4f9-80ce-49d4-d6e7-9765988e0181@vodafone.de \
--to=deathsimple-antagkrnahcb1svskn2v4q@public.gmane.org \
--cc=Monk.Liu-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=notasas-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.