From: Thomas Zimmermann <tzimmermann@suse.de>
To: Gerd Hoffmann <kraxel@redhat.com>, dri-devel@lists.freedesktop.org
Cc: Maxime Ripard <maxime.ripard@bootlin.com>,
open list <linux-kernel@vger.kernel.org>,
David Airlie <airlied@linux.ie>, Sean Paul <sean@poorly.run>
Subject: Re: [PATCH 3/5] drm/vram: add vram-mm debugfs file
Date: Mon, 2 Sep 2019 16:34:17 +0200 [thread overview]
Message-ID: <2110d38c-1793-a5c9-921c-94ccfe2205cb@suse.de> (raw)
In-Reply-To: <20190902124126.7700-4-kraxel@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 4347 bytes --]
Hi
Am 02.09.19 um 14:41 schrieb Gerd Hoffmann:
> Wire up drm_mm_print() for vram helpers, using a new
> debugfs file, so one can see how vram is used:
>
> # cat /sys/kernel/debug/dri/0/vram-mm
> 0x0000000000000000-0x0000000000000300: 768: used
> 0x0000000000000300-0x0000000000000600: 768: used
> 0x0000000000000600-0x0000000000000900: 768: used
> 0x0000000000000900-0x0000000000000c00: 768: used
> 0x0000000000000c00-0x0000000000004000: 13312: free
> total: 16384, used 3072 free 13312
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> include/drm/drm_gem_vram_helper.h | 1 +
> include/drm/drm_vram_mm_helper.h | 1 +
> drivers/gpu/drm/drm_vram_mm_helper.c | 33 ++++++++++++++++++++++++++++
> 3 files changed, 35 insertions(+)
>
> diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h
> index 17f160dd6e7d..d48fdf90b254 100644
> --- a/include/drm/drm_gem_vram_helper.h
> +++ b/include/drm/drm_gem_vram_helper.h
> @@ -123,6 +123,7 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file,
> * &struct drm_driver with default functions.
> */
> #define DRM_GEM_VRAM_DRIVER \
> + .debugfs_init = drm_vram_mm_debugfs_init, \
This line seems to be the reason for putting the include statement into
the header in patch [2/5]. I suggest to merge both patches into one.
> .dumb_create = drm_gem_vram_driver_dumb_create, \
> .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset, \
> .gem_prime_mmap = drm_gem_prime_mmap
> diff --git a/include/drm/drm_vram_mm_helper.h b/include/drm/drm_vram_mm_helper.h
> index 2aacfb1ccfae..9e0ac9aaac7d 100644
> --- a/include/drm/drm_vram_mm_helper.h
> +++ b/include/drm/drm_vram_mm_helper.h
> @@ -60,6 +60,7 @@ static inline struct drm_vram_mm *drm_vram_mm_of_bdev(
> return container_of(bdev, struct drm_vram_mm, bdev);
> }
>
> +int drm_vram_mm_debugfs_init(struct drm_minor *minor);
I cannot find a caller of this function. Will this be called form
drm_debugfs_init()?
> int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev,
> uint64_t vram_base, size_t vram_size,
> const struct drm_vram_mm_funcs *funcs);
> diff --git a/drivers/gpu/drm/drm_vram_mm_helper.c b/drivers/gpu/drm/drm_vram_mm_helper.c
> index c911781d6728..486061b83a73 100644
> --- a/drivers/gpu/drm/drm_vram_mm_helper.c
> +++ b/drivers/gpu/drm/drm_vram_mm_helper.c
> @@ -1,7 +1,9 @@
> // SPDX-License-Identifier: GPL-2.0-or-later
>
> +#include <drm/drm_debugfs.h>
> #include <drm/drm_device.h>
> #include <drm/drm_file.h>
> +#include <drm/drm_gem_ttm_helper.h>
> #include <drm/drm_vram_mm_helper.h>
>
> #include <drm/ttm/ttm_page_alloc.h>
> @@ -148,6 +150,37 @@ static struct ttm_bo_driver bo_driver = {
> * struct drm_vram_mm
> */
>
> +#if defined(CONFIG_DEBUG_FS)
> +static int drm_vram_mm_debugfs(struct seq_file *m, void *data)
> +{
> + struct drm_info_node *node = (struct drm_info_node *) m->private;
> + struct drm_vram_mm *vmm = node->minor->dev->vram_mm;
> + struct drm_mm *mm = vmm->bdev.man[TTM_PL_VRAM].priv;
> + struct ttm_bo_global *glob = vmm->bdev.glob;
> + struct drm_printer p = drm_seq_file_printer(m);
> +
> + spin_lock(&glob->lru_lock);
> + drm_mm_print(mm, &p);
> + spin_unlock(&glob->lru_lock);
> + return 0;
> +}
> +
> +static struct drm_info_list drm_vram_mm_debugfs_list[] = {
Can this be made 'static const'?
> + { "vram-mm", drm_vram_mm_debugfs, 0, NULL },
> +};
> +#endif
> +
> +int drm_vram_mm_debugfs_init(struct drm_minor *minor)
Documentation is missing.
With these points addressed
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Best regards
Thomas
> +{
> +#if defined(CONFIG_DEBUG_FS)
> + drm_debugfs_create_files(drm_vram_mm_debugfs_list,
> + ARRAY_SIZE(drm_vram_mm_debugfs_list),
> + minor->debugfs_root, minor);
> +#endif
> + return 0;
> +}
> +EXPORT_SYMBOL(drm_vram_mm_debugfs_init);
> +
> /**
> * drm_vram_mm_init() - Initialize an instance of VRAM MM.
> * @vmm: the VRAM MM instance to initialize
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-09-02 14:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190902124126.7700-1-kraxel@redhat.com>
2019-09-02 12:41 ` [PATCH 1/5] drm/ttm: add drm_gem_ttm_print_info() Gerd Hoffmann
2019-09-02 14:19 ` Thomas Zimmermann
2019-09-03 6:15 ` Gerd Hoffmann
2019-09-02 12:41 ` [PATCH 2/5] drm/vram: use drm_gem_ttm_print_info Gerd Hoffmann
2019-09-02 14:24 ` Thomas Zimmermann
2019-09-03 6:17 ` Gerd Hoffmann
2019-09-02 12:41 ` [PATCH 3/5] drm/vram: add vram-mm debugfs file Gerd Hoffmann
2019-09-02 14:34 ` Thomas Zimmermann [this message]
2019-09-03 6:20 ` Gerd Hoffmann
2019-09-02 12:41 ` [PATCH 4/5] drm/qxl: use drm_gem_object_funcs callbacks Gerd Hoffmann
2019-09-02 14:34 ` Thomas Zimmermann
2019-09-03 6:24 ` Gerd Hoffmann
2019-09-03 6:52 ` Thomas Zimmermann
2019-09-02 12:41 ` [PATCH 5/5] drm/qxl: use drm_gem_ttm_print_info Gerd Hoffmann
2019-09-02 14:42 ` Thomas Zimmermann
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=2110d38c-1793-a5c9-921c-94ccfe2205cb@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.ripard@bootlin.com \
--cc=sean@poorly.run \
/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
all inboxes | Powered by JetHome®