All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Handle fault with same timestamp
@ 2021-12-08 20:16 Philip Yang
  2021-12-08 20:21 ` Felix Kuehling
  2021-12-08 20:25 ` Alex Deucher
  0 siblings, 2 replies; 5+ messages in thread
From: Philip Yang @ 2021-12-08 20:16 UTC (permalink / raw)
  To: amd-gfx; +Cc: Philip Yang, Felix.Kuehling

Remove not unique timestamp WARNING as same timestamp interrupt happens
on some chips,

Drain fault need to wait for the processed_timestamp to be truly greater
than the checkpoint or the ring to be empty to be sure no stale faults
are handled.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c  | 4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
index 8050f7ba93ad..3df146579ad9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
@@ -188,8 +188,8 @@ int amdgpu_ih_wait_on_checkpoint_process_ts(struct amdgpu_device *adev,
 	checkpoint_ts = amdgpu_ih_decode_iv_ts(adev, ih, checkpoint_wptr, -1);
 
 	return wait_event_interruptible_timeout(ih->wait_process,
-		    !amdgpu_ih_ts_after(ih->processed_timestamp, checkpoint_ts),
-		    timeout);
+		    amdgpu_ih_ts_after(checkpoint_ts, ih->processed_timestamp) ||
+		    ih->rptr == amdgpu_ih_get_wptr(adev, ih), timeout);
 }
 
 /**
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index e031f0cf93a2..571b11117992 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -522,9 +522,6 @@ void amdgpu_irq_dispatch(struct amdgpu_device *adev,
 	if (!handled)
 		amdgpu_amdkfd_interrupt(adev, entry.iv_entry);
 
-	dev_WARN_ONCE(adev->dev, ih->processed_timestamp == entry.timestamp,
-		      "IH timestamps are not unique");
-
 	if (amdgpu_ih_ts_after(ih->processed_timestamp, entry.timestamp))
 		ih->processed_timestamp = entry.timestamp;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: Handle fault with same timestamp
  2021-12-08 20:16 [PATCH] drm/amdgpu: Handle fault with same timestamp Philip Yang
@ 2021-12-08 20:21 ` Felix Kuehling
  2021-12-08 20:25 ` Alex Deucher
  1 sibling, 0 replies; 5+ messages in thread
From: Felix Kuehling @ 2021-12-08 20:21 UTC (permalink / raw)
  To: Philip Yang, amd-gfx


Am 2021-12-08 um 3:16 p.m. schrieb Philip Yang:
> Remove not unique timestamp WARNING as same timestamp interrupt happens
> on some chips,
>
> Drain fault need to wait for the processed_timestamp to be truly greater
> than the checkpoint or the ring to be empty to be sure no stale faults
> are handled.
>
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>


> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c  | 4 ++--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 3 ---
>  2 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
> index 8050f7ba93ad..3df146579ad9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
> @@ -188,8 +188,8 @@ int amdgpu_ih_wait_on_checkpoint_process_ts(struct amdgpu_device *adev,
>  	checkpoint_ts = amdgpu_ih_decode_iv_ts(adev, ih, checkpoint_wptr, -1);
>  
>  	return wait_event_interruptible_timeout(ih->wait_process,
> -		    !amdgpu_ih_ts_after(ih->processed_timestamp, checkpoint_ts),
> -		    timeout);
> +		    amdgpu_ih_ts_after(checkpoint_ts, ih->processed_timestamp) ||
> +		    ih->rptr == amdgpu_ih_get_wptr(adev, ih), timeout);
>  }
>  
>  /**
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> index e031f0cf93a2..571b11117992 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> @@ -522,9 +522,6 @@ void amdgpu_irq_dispatch(struct amdgpu_device *adev,
>  	if (!handled)
>  		amdgpu_amdkfd_interrupt(adev, entry.iv_entry);
>  
> -	dev_WARN_ONCE(adev->dev, ih->processed_timestamp == entry.timestamp,
> -		      "IH timestamps are not unique");
> -
>  	if (amdgpu_ih_ts_after(ih->processed_timestamp, entry.timestamp))
>  		ih->processed_timestamp = entry.timestamp;
>  }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: Handle fault with same timestamp
  2021-12-08 20:16 [PATCH] drm/amdgpu: Handle fault with same timestamp Philip Yang
  2021-12-08 20:21 ` Felix Kuehling
@ 2021-12-08 20:25 ` Alex Deucher
  2021-12-08 20:27   ` Alex Deucher
  1 sibling, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2021-12-08 20:25 UTC (permalink / raw)
  To: Philip Yang; +Cc: Kuehling, Felix, amd-gfx list

On Wed, Dec 8, 2021 at 3:17 PM Philip Yang <Philip.Yang@amd.com> wrote:
>
> Remove not unique timestamp WARNING as same timestamp interrupt happens
> on some chips,
>
> Drain fault need to wait for the processed_timestamp to be truly greater
> than the checkpoint or the ring to be empty to be sure no stale faults
> are handled.
>
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>

Maybe add the link to the bug when you push this?

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c  | 4 ++--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 3 ---
>  2 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
> index 8050f7ba93ad..3df146579ad9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
> @@ -188,8 +188,8 @@ int amdgpu_ih_wait_on_checkpoint_process_ts(struct amdgpu_device *adev,
>         checkpoint_ts = amdgpu_ih_decode_iv_ts(adev, ih, checkpoint_wptr, -1);
>
>         return wait_event_interruptible_timeout(ih->wait_process,
> -                   !amdgpu_ih_ts_after(ih->processed_timestamp, checkpoint_ts),
> -                   timeout);
> +                   amdgpu_ih_ts_after(checkpoint_ts, ih->processed_timestamp) ||
> +                   ih->rptr == amdgpu_ih_get_wptr(adev, ih), timeout);
>  }
>
>  /**
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> index e031f0cf93a2..571b11117992 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> @@ -522,9 +522,6 @@ void amdgpu_irq_dispatch(struct amdgpu_device *adev,
>         if (!handled)
>                 amdgpu_amdkfd_interrupt(adev, entry.iv_entry);
>
> -       dev_WARN_ONCE(adev->dev, ih->processed_timestamp == entry.timestamp,
> -                     "IH timestamps are not unique");
> -
>         if (amdgpu_ih_ts_after(ih->processed_timestamp, entry.timestamp))
>                 ih->processed_timestamp = entry.timestamp;
>  }
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: Handle fault with same timestamp
  2021-12-08 20:25 ` Alex Deucher
@ 2021-12-08 20:27   ` Alex Deucher
  2021-12-09  8:30     ` Christian König
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2021-12-08 20:27 UTC (permalink / raw)
  To: Philip Yang; +Cc: Kuehling, Felix, amd-gfx list

On Wed, Dec 8, 2021 at 3:25 PM Alex Deucher <alexdeucher@gmail.com> wrote:
>
> On Wed, Dec 8, 2021 at 3:17 PM Philip Yang <Philip.Yang@amd.com> wrote:
> >
> > Remove not unique timestamp WARNING as same timestamp interrupt happens
> > on some chips,
> >
> > Drain fault need to wait for the processed_timestamp to be truly greater
> > than the checkpoint or the ring to be empty to be sure no stale faults
> > are handled.
> >
> > Signed-off-by: Philip Yang <Philip.Yang@amd.com>
>
> Maybe add the link to the bug when you push this?

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1818

Alex

>
> Alex
>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c  | 4 ++--
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 3 ---
> >  2 files changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
> > index 8050f7ba93ad..3df146579ad9 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
> > @@ -188,8 +188,8 @@ int amdgpu_ih_wait_on_checkpoint_process_ts(struct amdgpu_device *adev,
> >         checkpoint_ts = amdgpu_ih_decode_iv_ts(adev, ih, checkpoint_wptr, -1);
> >
> >         return wait_event_interruptible_timeout(ih->wait_process,
> > -                   !amdgpu_ih_ts_after(ih->processed_timestamp, checkpoint_ts),
> > -                   timeout);
> > +                   amdgpu_ih_ts_after(checkpoint_ts, ih->processed_timestamp) ||
> > +                   ih->rptr == amdgpu_ih_get_wptr(adev, ih), timeout);
> >  }
> >
> >  /**
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > index e031f0cf93a2..571b11117992 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > @@ -522,9 +522,6 @@ void amdgpu_irq_dispatch(struct amdgpu_device *adev,
> >         if (!handled)
> >                 amdgpu_amdkfd_interrupt(adev, entry.iv_entry);
> >
> > -       dev_WARN_ONCE(adev->dev, ih->processed_timestamp == entry.timestamp,
> > -                     "IH timestamps are not unique");
> > -
> >         if (amdgpu_ih_ts_after(ih->processed_timestamp, entry.timestamp))
> >                 ih->processed_timestamp = entry.timestamp;
> >  }
> > --
> > 2.17.1
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: Handle fault with same timestamp
  2021-12-08 20:27   ` Alex Deucher
@ 2021-12-09  8:30     ` Christian König
  0 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2021-12-09  8:30 UTC (permalink / raw)
  To: Alex Deucher, Philip Yang; +Cc: Kuehling, Felix, amd-gfx list

Am 08.12.21 um 21:27 schrieb Alex Deucher:
> On Wed, Dec 8, 2021 at 3:25 PM Alex Deucher <alexdeucher@gmail.com> wrote:
>> On Wed, Dec 8, 2021 at 3:17 PM Philip Yang <Philip.Yang@amd.com> wrote:
>>> Remove not unique timestamp WARNING as same timestamp interrupt happens
>>> on some chips,
>>>
>>> Drain fault need to wait for the processed_timestamp to be truly greater
>>> than the checkpoint or the ring to be empty to be sure no stale faults
>>> are handled.
>>>
>>> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
>> Maybe add the link to the bug when you push this?
> Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1818

With that done Reviewed-by: Christian König <christian.koenig@amd.com>

>
> Alex
>
>> Alex
>>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c  | 4 ++--
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 3 ---
>>>   2 files changed, 2 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
>>> index 8050f7ba93ad..3df146579ad9 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
>>> @@ -188,8 +188,8 @@ int amdgpu_ih_wait_on_checkpoint_process_ts(struct amdgpu_device *adev,
>>>          checkpoint_ts = amdgpu_ih_decode_iv_ts(adev, ih, checkpoint_wptr, -1);
>>>
>>>          return wait_event_interruptible_timeout(ih->wait_process,
>>> -                   !amdgpu_ih_ts_after(ih->processed_timestamp, checkpoint_ts),
>>> -                   timeout);
>>> +                   amdgpu_ih_ts_after(checkpoint_ts, ih->processed_timestamp) ||
>>> +                   ih->rptr == amdgpu_ih_get_wptr(adev, ih), timeout);
>>>   }
>>>
>>>   /**
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>>> index e031f0cf93a2..571b11117992 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>>> @@ -522,9 +522,6 @@ void amdgpu_irq_dispatch(struct amdgpu_device *adev,
>>>          if (!handled)
>>>                  amdgpu_amdkfd_interrupt(adev, entry.iv_entry);
>>>
>>> -       dev_WARN_ONCE(adev->dev, ih->processed_timestamp == entry.timestamp,
>>> -                     "IH timestamps are not unique");
>>> -
>>>          if (amdgpu_ih_ts_after(ih->processed_timestamp, entry.timestamp))
>>>                  ih->processed_timestamp = entry.timestamp;
>>>   }
>>> --
>>> 2.17.1
>>>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-09 16:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 20:16 [PATCH] drm/amdgpu: Handle fault with same timestamp Philip Yang
2021-12-08 20:21 ` Felix Kuehling
2021-12-08 20:25 ` Alex Deucher
2021-12-08 20:27   ` Alex Deucher
2021-12-09  8:30     ` Christian König

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.