All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Steven Price <steven.price@arm.com>
Cc: "Liviu Dudau" <liviu.dudau@arm.com>,
	"Adrián Larumbe" <adrian.larumbe@collabora.com>,
	dri-devel@lists.freedesktop.org,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Akash Goel" <akash.goel@arm.com>,
	"Rob Clark" <robin.clark@oss.qualcomm.com>,
	"Sean Paul" <sean@poorly.run>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Akhil P Oommen" <akhilpo@oss.qualcomm.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Dmitry Osipenko" <dmitry.osipenko@collabora.com>,
	"Chris Diamand" <chris.diamand@arm.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	kernel@collabora.com
Subject: Re: [PATCH v1 9/9] drm/panthor: Add a GEM shrinker
Date: Thu, 15 Jan 2026 13:01:19 +0100	[thread overview]
Message-ID: <20260115130119.1be81c75@fedora> (raw)
In-Reply-To: <fe39739e-25fc-429d-ab4d-37c4fc387be4@arm.com>

On Thu, 15 Jan 2026 11:24:49 +0000
Steven Price <steven.price@arm.com> wrote:

> On 15/01/2026 10:50, Boris Brezillon wrote:
> > Hi Steve,
> > 
> > On Wed, 14 Jan 2026 15:05:36 +0000
> > Steven Price <steven.price@arm.com> wrote:
> >   
> >> On 09/01/2026 13:08, Boris Brezillon wrote:  
> [...]
> >>> @@ -1250,10 +1637,42 @@ static struct drm_info_list panthor_gem_debugfs_list[] = {
> >>>  	{ "gems", panthor_gem_show_bos, 0, NULL },
> >>>  };
> >>>  
> >>> +static int shrink_get(void *data, u64 *val)
> >>> +{
> >>> +	struct panthor_device *ptdev =
> >>> +		container_of(data, struct panthor_device, base);
> >>> +
> >>> +	*val = ptdev->reclaim.nr_pages_reclaimed_on_last_scan;
> >>> +	return 0;
> >>> +}
> >>> +
> >>> +static int shrink_set(void *data, u64 val)
> >>> +{
> >>> +	struct panthor_device *ptdev =
> >>> +		container_of(data, struct panthor_device, base);
> >>> +	struct shrink_control sc = {
> >>> +		.gfp_mask = GFP_KERNEL,
> >>> +		.nr_to_scan = val,
> >>> +	};
> >>> +
> >>> +	fs_reclaim_acquire(GFP_KERNEL);
> >>> +	if (ptdev->reclaim.shrinker)
> >>> +		panthor_gem_shrinker_scan(ptdev->reclaim.shrinker, &sc);
> >>> +	fs_reclaim_release(GFP_KERNEL);
> >>> +
> >>> +	return 0;
> >>> +}    
> >>
> >> Do you have some test to drive this?  
> > 
> > Yes, I do [1].
> >   
> >> My immediate thought was that it
> >> would be nice (for manual testing at least) to printk the return value
> >> from panthor_gem_shrinker_scan(). But we probably wouldn't actually need
> >> nr_pages_reclaimed_on_last_scan if you could just read that from dmesg.
> >> But I can see integrating that into a test might not be ideal.  
> > 
> > I basically based the interface on the existing MSM one. Might not be
> > the best, but it was good enough for this initial testing.  
> 
> Ah well if we're matching MSM then that's probably a good justification.
> It just seemed a little odd throwing away the return value and then
> having to have a separate mechanism to get the number of pages reclaimed
> out. And given I'd just spotted a bug in the return value I thought I'd
> ask ;).

For that particular thing, I diverged from what MSM was doing, because
in some cases, SHRINK_STOP is returned even though pages were
reclaimed. I need to double-check the ->scan() semantics, I got that
wrong a few times already, and paged out everything about these tricky
corner cases already.

> >> I have to admit to being very unsure about all of this - I even resorted
> >> to asking AI, which I think has made me more confused ;)  
> > 
> > I think you're right that we shouldn't complain+fail if pin_count > 0
> > in the de-eviction path. As I said above, de-eviction for the CPU is not
> > the same as de-eviction for the GPU, so pages being present and pinned
> > doesn't mean we have nothing to do for the GPU mapping to be restored.
> > Maybe we should come with a better name for this function.  
> 
> Yes the AI was insisting that the problem was the GPU submission would
> fail. Sadly it was incredibly bad at actually explaining the issue.
> 
> So I agree it looks like it would be safe to remove the WARN_ON and keep
> going in the case of pin_count > 0. The (also confusingly named)
> "vm_bo_validate" will be called because the evicted flag is set which
> will get the BO mapped on the GPU again.
> 
> I'm all for better names, but I'm afraid I don't have any suggestions.

Alright, I'll stick to gem_swapin() then.

  reply	other threads:[~2026-01-15 12:01 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09 13:07 [PATCH v1 0/9] drm/panthor: Add a GEM shrinker Boris Brezillon
2026-01-09 13:07 ` [PATCH v1 1/9] drm/gem: Consider GEM object reclaimable if shrinking fails Boris Brezillon
2026-01-12  9:25   ` Alice Ryhl
2026-01-12 10:02     ` Boris Brezillon
2026-01-15 13:28   ` Liviu Dudau
2026-01-09 13:07 ` [PATCH v1 2/9] drm/gpuvm: Validate BOs in the extobj list when VM is resv protected Boris Brezillon
2026-01-09 19:38   ` Danilo Krummrich
2026-01-12  7:30     ` Boris Brezillon
2026-01-09 13:07 ` [PATCH v1 3/9] drm/panthor: Move panthor_gems_debugfs_init() to panthor_gem.c Boris Brezillon
2026-01-12 11:27   ` Steven Price
2026-01-15 13:39   ` Liviu Dudau
2026-01-09 13:07 ` [PATCH v1 4/9] drm/panthor: Group panthor_kernel_bo_xxx() helpers Boris Brezillon
2026-01-12 11:29   ` Steven Price
2026-01-15 13:41   ` Liviu Dudau
2026-01-09 13:07 ` [PATCH v1 5/9] drm/panthor: Part ways with drm_gem_shmem_object Boris Brezillon
2026-01-12 12:06   ` Steven Price
2026-01-12 14:17     ` Boris Brezillon
2026-01-12 16:03       ` Steven Price
2026-01-12 16:45         ` Boris Brezillon
2026-01-21 11:11       ` Akash Goel
2026-01-21 15:17         ` Boris Brezillon
2026-01-15 16:51   ` Liviu Dudau
2026-01-15 17:27     ` Boris Brezillon
2026-01-15 17:45       ` Liviu Dudau
2026-01-16 12:09         ` Steven Price
2026-01-09 13:07 ` [PATCH v1 6/9] drm/panthor: Lazily allocate pages on mmap() Boris Brezillon
2026-01-12 12:15   ` Steven Price
2026-01-12 14:32     ` Boris Brezillon
2026-01-12 16:41       ` Steven Price
2026-01-12 16:50         ` Boris Brezillon
2026-01-15 17:34   ` Liviu Dudau
2026-01-15 19:27     ` Boris Brezillon
2026-01-16  8:19   ` kernel test robot
2026-01-09 13:07 ` [PATCH v1 7/9] drm/panthor: Split panthor_vm_prepare_map_op_ctx() to prepare for reclaim Boris Brezillon
2026-01-12 12:21   ` Steven Price
2026-01-15 17:40   ` Liviu Dudau
2026-01-09 13:08 ` [PATCH v1 8/9] drm/panthor: Track the number of mmap on a BO Boris Brezillon
2026-01-12 12:33   ` Steven Price
2026-01-12 14:39     ` Boris Brezillon
2026-01-12 15:19       ` Alice Ryhl
2026-01-12 15:49         ` Boris Brezillon
2026-01-12 15:51           ` Alice Ryhl
2026-01-12 16:06             ` Boris Brezillon
2026-01-12 16:49       ` Steven Price
2026-01-12 16:59         ` Boris Brezillon
2026-01-12 17:10           ` Steven Price
2026-01-12 17:18             ` Boris Brezillon
2026-01-13 12:26             ` Boris Brezillon
2026-01-09 13:08 ` [PATCH v1 9/9] drm/panthor: Add a GEM shrinker Boris Brezillon
2026-01-14 15:05   ` Steven Price
2026-01-15 10:50     ` Boris Brezillon
2026-01-15 11:24       ` Steven Price
2026-01-15 12:01         ` Boris Brezillon [this message]
2026-01-15 13:56   ` Akash Goel
2026-01-15 14:36     ` Boris Brezillon
2026-01-15 14:37     ` Boris Brezillon
2026-01-21 11:49   ` Akash Goel
2026-01-21 14:52     ` Boris Brezillon
2026-01-28 11:21       ` Akash Goel
2026-01-28 15:52         ` Boris Brezillon
2026-01-28 16:26           ` Akash Goel
2026-01-12  8:37 ` [PATCH v1 0/9] " Boris Brezillon

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=20260115130119.1be81c75@fedora \
    --to=boris.brezillon@collabora.com \
    --cc=adrian.larumbe@collabora.com \
    --cc=airlied@gmail.com \
    --cc=akash.goel@arm.com \
    --cc=akhilpo@oss.qualcomm.com \
    --cc=aliceryhl@google.com \
    --cc=chris.diamand@arm.com \
    --cc=dakr@kernel.org \
    --cc=dmitry.osipenko@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=konradybcio@kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=robin.clark@oss.qualcomm.com \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tzimmermann@suse.de \
    /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 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.