2023-12-12 23:31:53

by Woody Suwalski

[permalink] [raw]
Subject: [PATCH v2] drm/radeon: Prevent multiple debug error lines on suspend

Fix to avoid multiple debug error lines printed on every suspend by
Radeon driver's debugfs.

radeon_debugfs_init() calls debugfs_create_file() for every ring.

This results in printing multiple error lines to the screen and dmesg
similar to this:

[   92.378726] debugfs: File 'radeon_ring_gfx' in directory
'0000:00:01.0' already present!
[   92.378732] debugfs: File 'radeon_ring_cp1' in directory
'0000:00:01.0' already present!
[   92.378734] debugfs: File 'radeon_ring_cp2' in directory
'0000:00:01.0' already present!
[   92.378737] debugfs: File 'radeon_ring_dma1' in directory
'0000:00:01.0' already present!
[   92.378739] debugfs: File 'radeon_ring_dma2' in directory
'0000:00:01.0' already present!
[   92.380775] debugfs: File 'radeon_ring_uvd' in directory
'0000:00:01.0' already present!
[   92.406620] debugfs: File 'radeon_ring_vce1' in directory
'0000:00:01.0' already present!
[   92.406624] debugfs: File 'radeon_ring_vce2' in directory
'0000:00:01.0' already present!


Patch v1: The fix was to run lookup() for the file before trying to
(re)create that debug file.
Patch v2: Call the radeon_debugfs_init() only once when radeon ring is
initialized (as suggested  by Christian K. - thanks)

Signed-off-by: Woody Suwalski <[email protected]>

diff --git a/drivers/gpu/drm/radeon/radeon_ring.c
b/drivers/gpu/drm/radeon/radeon_ring.c
index e6534fa9f1fb..38048593bb4a 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -413,6 +413,7 @@ int radeon_ring_init(struct radeon_device *rdev,
struct radeon_ring *ring, unsig
             dev_err(rdev->dev, "(%d) ring map failed\n", r);
             return r;
         }
+        radeon_debugfs_ring_init(rdev, ring);
     }
     ring->ptr_mask = (ring->ring_size / 4) - 1;
     ring->ring_free_dw = ring->ring_size / 4;
@@ -421,7 +422,6 @@ int radeon_ring_init(struct radeon_device *rdev,
struct radeon_ring *ring, unsig
         ring->next_rptr_gpu_addr = rdev->wb.gpu_addr + index;
         ring->next_rptr_cpu_addr = &rdev->wb.wb[index/4];
     }
-    radeon_debugfs_ring_init(rdev, ring);
     radeon_ring_lockup_update(rdev, ring);
     return 0;
 }


2023-12-13 06:38:43

by Christian König

[permalink] [raw]
Subject: Re: [PATCH v2] drm/radeon: Prevent multiple debug error lines on suspend

Am 13.12.23 um 00:31 schrieb Woody Suwalski:
> Fix to avoid multiple debug error lines printed on every suspend by
> Radeon driver's debugfs.
>
> radeon_debugfs_init() calls debugfs_create_file() for every ring.
>
> This results in printing multiple error lines to the screen and dmesg
> similar to this:
>
> [   92.378726] debugfs: File 'radeon_ring_gfx' in directory
> '0000:00:01.0' already present!
> [   92.378732] debugfs: File 'radeon_ring_cp1' in directory
> '0000:00:01.0' already present!
> [   92.378734] debugfs: File 'radeon_ring_cp2' in directory
> '0000:00:01.0' already present!
> [   92.378737] debugfs: File 'radeon_ring_dma1' in directory
> '0000:00:01.0' already present!
> [   92.378739] debugfs: File 'radeon_ring_dma2' in directory
> '0000:00:01.0' already present!
> [   92.380775] debugfs: File 'radeon_ring_uvd' in directory
> '0000:00:01.0' already present!
> [   92.406620] debugfs: File 'radeon_ring_vce1' in directory
> '0000:00:01.0' already present!
> [   92.406624] debugfs: File 'radeon_ring_vce2' in directory
> '0000:00:01.0' already present!
>
>
> Patch v1: The fix was to run lookup() for the file before trying to
> (re)create that debug file.
> Patch v2: Call the radeon_debugfs_init() only once when radeon ring is
> initialized (as suggested  by Christian K. - thanks)
>
> Signed-off-by: Woody Suwalski <[email protected]>

Reviewed-by: Christian König <[email protected]>

Thanks for the help,
Christian.

>
> diff --git a/drivers/gpu/drm/radeon/radeon_ring.c
> b/drivers/gpu/drm/radeon/radeon_ring.c
> index e6534fa9f1fb..38048593bb4a 100644
> --- a/drivers/gpu/drm/radeon/radeon_ring.c
> +++ b/drivers/gpu/drm/radeon/radeon_ring.c
> @@ -413,6 +413,7 @@ int radeon_ring_init(struct radeon_device *rdev,
> struct radeon_ring *ring, unsig
>              dev_err(rdev->dev, "(%d) ring map failed\n", r);
>              return r;
>          }
> +        radeon_debugfs_ring_init(rdev, ring);
>      }
>      ring->ptr_mask = (ring->ring_size / 4) - 1;
>      ring->ring_free_dw = ring->ring_size / 4;
> @@ -421,7 +422,6 @@ int radeon_ring_init(struct radeon_device *rdev,
> struct radeon_ring *ring, unsig
>          ring->next_rptr_gpu_addr = rdev->wb.gpu_addr + index;
>          ring->next_rptr_cpu_addr = &rdev->wb.wb[index/4];
>      }
> -    radeon_debugfs_ring_init(rdev, ring);
>      radeon_ring_lockup_update(rdev, ring);
>      return 0;
>  }
>

2023-12-13 18:29:02

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH v2] drm/radeon: Prevent multiple debug error lines on suspend

Applied manually. Please double check how you are sending the
patches. git complained about a malformed patch. I'd suggest using
git-send-email.

Thanks,

Alex

On Wed, Dec 13, 2023 at 1:45 AM Christian König
<[email protected]> wrote:
>
> Am 13.12.23 um 00:31 schrieb Woody Suwalski:
> > Fix to avoid multiple debug error lines printed on every suspend by
> > Radeon driver's debugfs.
> >
> > radeon_debugfs_init() calls debugfs_create_file() for every ring.
> >
> > This results in printing multiple error lines to the screen and dmesg
> > similar to this:
> >
> > [ 92.378726] debugfs: File 'radeon_ring_gfx' in directory
> > '0000:00:01.0' already present!
> > [ 92.378732] debugfs: File 'radeon_ring_cp1' in directory
> > '0000:00:01.0' already present!
> > [ 92.378734] debugfs: File 'radeon_ring_cp2' in directory
> > '0000:00:01.0' already present!
> > [ 92.378737] debugfs: File 'radeon_ring_dma1' in directory
> > '0000:00:01.0' already present!
> > [ 92.378739] debugfs: File 'radeon_ring_dma2' in directory
> > '0000:00:01.0' already present!
> > [ 92.380775] debugfs: File 'radeon_ring_uvd' in directory
> > '0000:00:01.0' already present!
> > [ 92.406620] debugfs: File 'radeon_ring_vce1' in directory
> > '0000:00:01.0' already present!
> > [ 92.406624] debugfs: File 'radeon_ring_vce2' in directory
> > '0000:00:01.0' already present!
> >
> >
> > Patch v1: The fix was to run lookup() for the file before trying to
> > (re)create that debug file.
> > Patch v2: Call the radeon_debugfs_init() only once when radeon ring is
> > initialized (as suggested by Christian K. - thanks)
> >
> > Signed-off-by: Woody Suwalski <[email protected]>
>
> Reviewed-by: Christian König <[email protected]>
>
> Thanks for the help,
> Christian.
>
> >
> > diff --git a/drivers/gpu/drm/radeon/radeon_ring.c
> > b/drivers/gpu/drm/radeon/radeon_ring.c
> > index e6534fa9f1fb..38048593bb4a 100644
> > --- a/drivers/gpu/drm/radeon/radeon_ring.c
> > +++ b/drivers/gpu/drm/radeon/radeon_ring.c
> > @@ -413,6 +413,7 @@ int radeon_ring_init(struct radeon_device *rdev,
> > struct radeon_ring *ring, unsig
> > dev_err(rdev->dev, "(%d) ring map failed\n", r);
> > return r;
> > }
> > + radeon_debugfs_ring_init(rdev, ring);
> > }
> > ring->ptr_mask = (ring->ring_size / 4) - 1;
> > ring->ring_free_dw = ring->ring_size / 4;
> > @@ -421,7 +422,6 @@ int radeon_ring_init(struct radeon_device *rdev,
> > struct radeon_ring *ring, unsig
> > ring->next_rptr_gpu_addr = rdev->wb.gpu_addr + index;
> > ring->next_rptr_cpu_addr = &rdev->wb.wb[index/4];
> > }
> > - radeon_debugfs_ring_init(rdev, ring);
> > radeon_ring_lockup_update(rdev, ring);
> > return 0;
> > }
> >
>