linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Price <steven.price@arm.com>
To: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Gustavo Padovan <gustavo.padovan@collabora.com>,
	Daniel Stone <daniel@fooishbar.org>,
	virtualization@lists.linux-foundation.org,
	Dmitry Osipenko <digetx@gmail.com>,
	David Airlie <airlied@linux.ie>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Gurchetan Singh <gurchetansingh@chromium.org>,
	Chia-I Wu <olvaffe@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Daniel Almeida <daniel.almeida@collabora.com>,
	Gert Wollny <gert.wollny@collabora.com>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Rob Herring <robh@kernel.org>,
	Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Subject: Re: [PATCH v2 8/8] drm/panfrost: Switch to generic memory shrinker
Date: Fri, 18 Mar 2022 14:47:44 +0000	[thread overview]
Message-ID: <049f8b0c-7c3e-8ee1-5ae0-a4348278ee63@arm.com> (raw)
In-Reply-To: <b8d74d79-7d49-658f-5e0b-4a5da4fa2afc@collabora.com>

On 18/03/2022 14:41, Dmitry Osipenko wrote:
> 
> On 3/17/22 02:04, Dmitry Osipenko wrote:
>>
>> On 3/16/22 18:04, Steven Price wrote:
>>> On 14/03/2022 22:42, Dmitry Osipenko wrote:
>>>> Replace Panfrost's memory shrinker with a generic DRM memory shrinker.
>>>>
>>>> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
>>>> ---
>>> I gave this a spin on my Firefly-RK3288 board and everything seems to
>>> work. So feel free to add a:
>>>
>>> Tested-by: Steven Price <steven.price@arm.com>
>>>
>>> As Alyssa has already pointed out you need to remove the
>>> panfrost_gem_shrinker.c file. But otherwise everything looks fine, and
>>> I'm very happy to see the shrinker code gone ;)
>>
>> Awesome, thank you.
> 
> Steven, could you please tell me how exactly you tested the shrinker?
> 
> I realized that today's IGT doesn't have any tests for the Panfrost's
> madvise ioctl.
> 
> You may invoke "echo 2 > /proc/sys/vm/drop_caches" manually in order to
> trigger shrinker while 3d app is running actively (like a game or
> benchmark). Nothing crashing will be a good enough indicator that it
> works okay.
> 
> I may get an RK board next week and then will be able to test it by
> myself, so please don't hurry.

I have to admit it wasn't a very thorough test. I run glmark on the
board with the following hack:

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index b014dadcf51f..194dec00695a 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -279,6 +279,14 @@ static int panfrost_ioctl_submit(struct drm_device *dev, void *data,
        if (ret)
                goto out_cleanup_job;
 
+       {
+       struct shrink_control sc = {
+               .nr_to_scan = 1000
+       };
+       dev->shmem_shrinker->base.scan_objects(&dev->shmem_shrinker->base,
+                       &sc);
+       }
+
        ret = panfrost_job_push(job);
        if (ret)
                goto out_cleanup_job;

That hack was specifically because I had some doubts about the removal
of the 'gpu_usecount' counter and wanted to ensure that purging as the
job is submitted wouldn't cause problems.

The drop_caches file should also work AFAIK.

Steve

  reply	other threads:[~2022-03-18 14:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 22:42 [PATCH v2 0/8] Add memory shrinker to VirtIO-GPU DRM driver Dmitry Osipenko
2022-03-14 22:42 ` [PATCH v2 1/8] drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling Dmitry Osipenko
2022-03-15 13:05   ` Dmitry Osipenko
2022-03-14 22:42 ` [PATCH v2 2/8] drm/virtio: Check whether transferred 2D BO is shmem Dmitry Osipenko
2022-03-14 22:42 ` [PATCH v2 3/8] drm/virtio: Unlock GEM reservations in error code path Dmitry Osipenko
2022-03-14 22:42 ` [PATCH v2 4/8] drm/virtio: Improve DMA API usage for shmem BOs Dmitry Osipenko
2022-03-16 12:41   ` Robin Murphy
2022-03-16 13:52     ` Dmitry Osipenko
2022-03-17  1:09   ` Dmitry Osipenko
2022-03-14 22:42 ` [PATCH v2 5/8] drm/shmem-helper: Correct doc-comment of drm_gem_shmem_get_sg_table() Dmitry Osipenko
2022-03-14 22:42 ` [PATCH v2 6/8] drm/shmem-helper: Add generic memory shrinker Dmitry Osipenko
2022-03-16 15:04   ` Steven Price
2022-03-16 23:03     ` Dmitry Osipenko
2022-03-16 20:00   ` Rob Clark
2022-03-17  0:13     ` Dmitry Osipenko
2022-03-17 16:13       ` Rob Clark
2022-03-17 17:43         ` Dmitry Osipenko
2022-03-17 17:32   ` Daniel Vetter
2022-03-17 17:45     ` Dmitry Osipenko
2022-03-14 22:42 ` [PATCH v2 7/8] drm/virtio: Support memory shrinking Dmitry Osipenko
2022-03-15 12:43   ` Emil Velikov
2022-03-16 14:23     ` Dmitry Osipenko
2022-03-14 22:42 ` [PATCH v2 8/8] drm/panfrost: Switch to generic memory shrinker Dmitry Osipenko
2022-03-14 23:26   ` Alyssa Rosenzweig
2022-03-14 23:32     ` Dmitry Osipenko
2022-03-16 15:04   ` Steven Price
2022-03-16 23:04     ` Dmitry Osipenko
2022-03-18 14:41       ` Dmitry Osipenko
2022-03-18 14:47         ` Steven Price [this message]
2022-03-18 17:09           ` Dmitry Osipenko
2022-03-15 12:47 ` [PATCH v2 0/8] Add memory shrinker to VirtIO-GPU DRM driver Emil Velikov
2022-03-15 13:10   ` Dmitry Osipenko

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=049f8b0c-7c3e-8ee1-5ae0-a4348278ee63@arm.com \
    --to=steven.price@arm.com \
    --cc=airlied@linux.ie \
    --cc=alyssa.rosenzweig@collabora.com \
    --cc=daniel.almeida@collabora.com \
    --cc=daniel@ffwll.ch \
    --cc=daniel@fooishbar.org \
    --cc=digetx@gmail.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gert.wollny@collabora.com \
    --cc=gurchetansingh@chromium.org \
    --cc=gustavo.padovan@collabora.com \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=olvaffe@gmail.com \
    --cc=robh@kernel.org \
    --cc=tomeu.vizoso@collabora.com \
    --cc=tzimmermann@suse.de \
    --cc=virtualization@lists.linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).