diff mbox series

drm/v3d: Show the memory-management stats on debugfs

Message ID 20240105145851.193492-1-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series drm/v3d: Show the memory-management stats on debugfs | expand

Commit Message

Maíra Canal Jan. 5, 2024, 2:57 p.m. UTC
Dump the contents of the DRM MM allocator of the V3D driver. This will
help us to debug the VA ranges allocated.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 drivers/gpu/drm/v3d/v3d_debugfs.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

--
2.43.0

Comments

Melissa Wen Jan. 5, 2024, 3:32 p.m. UTC | #1
On 01/05, Maíra Canal wrote:
> Dump the contents of the DRM MM allocator of the V3D driver. This will
> help us to debug the VA ranges allocated.
> 
> Signed-off-by: Maíra Canal <mcanal@igalia.com>
> ---
>  drivers/gpu/drm/v3d/v3d_debugfs.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c b/drivers/gpu/drm/v3d/v3d_debugfs.c
> index f843a50d5dce..cdfe1d3bf5ee 100644
> --- a/drivers/gpu/drm/v3d/v3d_debugfs.c
> +++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
> @@ -260,11 +260,26 @@ static int v3d_measure_clock(struct seq_file *m, void *unused)
>  	return 0;
>  }
> 
> +static int v3d_debugfs_mm(struct seq_file *m, void *unused)
> +{
> +	struct drm_printer p = drm_seq_file_printer(m);
> +	struct drm_debugfs_entry *entry = m->private;
> +	struct drm_device *dev = entry->dev;
> +	struct v3d_dev *v3d = to_v3d_dev(dev);
> +
> +	spin_lock(&v3d->mm_lock);
> +	drm_mm_print(&v3d->mm, &p);
> +	spin_unlock(&v3d->mm_lock);
> +
> +	return 0;
> +}

LGTM.

Reviewed-by: Melissa Wen <mwen@igalia.com>

> +
>  static const struct drm_debugfs_info v3d_debugfs_list[] = {
>  	{"v3d_ident", v3d_v3d_debugfs_ident, 0},
>  	{"v3d_regs", v3d_v3d_debugfs_regs, 0},
>  	{"measure_clock", v3d_measure_clock, 0},
>  	{"bo_stats", v3d_debugfs_bo_stats, 0},
> +	{"v3d_mm", v3d_debugfs_mm, 0},
>  };
> 
>  void
> --
> 2.43.0
>
Maíra Canal Jan. 11, 2024, 2:59 p.m. UTC | #2
On 1/5/24 12:32, Melissa Wen wrote:
> On 01/05, Maíra Canal wrote:
>> Dump the contents of the DRM MM allocator of the V3D driver. This will
>> help us to debug the VA ranges allocated.
>>
>> Signed-off-by: Maíra Canal <mcanal@igalia.com>
>> ---
>>   drivers/gpu/drm/v3d/v3d_debugfs.c | 15 +++++++++++++++
>>   1 file changed, 15 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c b/drivers/gpu/drm/v3d/v3d_debugfs.c
>> index f843a50d5dce..cdfe1d3bf5ee 100644
>> --- a/drivers/gpu/drm/v3d/v3d_debugfs.c
>> +++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
>> @@ -260,11 +260,26 @@ static int v3d_measure_clock(struct seq_file *m, void *unused)
>>   	return 0;
>>   }
>>
>> +static int v3d_debugfs_mm(struct seq_file *m, void *unused)
>> +{
>> +	struct drm_printer p = drm_seq_file_printer(m);
>> +	struct drm_debugfs_entry *entry = m->private;
>> +	struct drm_device *dev = entry->dev;
>> +	struct v3d_dev *v3d = to_v3d_dev(dev);
>> +
>> +	spin_lock(&v3d->mm_lock);
>> +	drm_mm_print(&v3d->mm, &p);
>> +	spin_unlock(&v3d->mm_lock);
>> +
>> +	return 0;
>> +}
> 
> LGTM.
> 
> Reviewed-by: Melissa Wen <mwen@igalia.com>

Pushed to drm-misc/drm-misc-next!

Best Regards,
- Maíra

> 
>> +
>>   static const struct drm_debugfs_info v3d_debugfs_list[] = {
>>   	{"v3d_ident", v3d_v3d_debugfs_ident, 0},
>>   	{"v3d_regs", v3d_v3d_debugfs_regs, 0},
>>   	{"measure_clock", v3d_measure_clock, 0},
>>   	{"bo_stats", v3d_debugfs_bo_stats, 0},
>> +	{"v3d_mm", v3d_debugfs_mm, 0},
>>   };
>>
>>   void
>> --
>> 2.43.0
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c b/drivers/gpu/drm/v3d/v3d_debugfs.c
index f843a50d5dce..cdfe1d3bf5ee 100644
--- a/drivers/gpu/drm/v3d/v3d_debugfs.c
+++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
@@ -260,11 +260,26 @@  static int v3d_measure_clock(struct seq_file *m, void *unused)
 	return 0;
 }

+static int v3d_debugfs_mm(struct seq_file *m, void *unused)
+{
+	struct drm_printer p = drm_seq_file_printer(m);
+	struct drm_debugfs_entry *entry = m->private;
+	struct drm_device *dev = entry->dev;
+	struct v3d_dev *v3d = to_v3d_dev(dev);
+
+	spin_lock(&v3d->mm_lock);
+	drm_mm_print(&v3d->mm, &p);
+	spin_unlock(&v3d->mm_lock);
+
+	return 0;
+}
+
 static const struct drm_debugfs_info v3d_debugfs_list[] = {
 	{"v3d_ident", v3d_v3d_debugfs_ident, 0},
 	{"v3d_regs", v3d_v3d_debugfs_regs, 0},
 	{"measure_clock", v3d_measure_clock, 0},
 	{"bo_stats", v3d_debugfs_bo_stats, 0},
+	{"v3d_mm", v3d_debugfs_mm, 0},
 };

 void