From: Matthew Brost <matthew.brost@intel.com>
To: "Nguyen, Brian3" <brian3.nguyen@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
"Upadhyay, Tejas" <tejas.upadhyay@intel.com>,
"Lin, Shuicheng" <shuicheng.lin@intel.com>,
"Summers, Stuart" <stuart.summers@intel.com>,
"Wajdeczko, Michal" <Michal.Wajdeczko@intel.com>
Subject: Re: [PATCH v2 11/11] drm/xe: Add debugfs support for page reclamation
Date: Tue, 2 Dec 2025 14:59:17 -0800 [thread overview]
Message-ID: <aS9vRTsPCfjoIyYo@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <SA1PR11MB88390FA6405D467DFEF90266AAD8A@SA1PR11MB8839.namprd11.prod.outlook.com>
On Tue, Dec 02, 2025 at 03:51:53PM -0700, Nguyen, Brian3 wrote:
> On Tuesday, December 2, 2025 2:29 PM, Matthew Brost wrote:
> > On Thu, Nov 27, 2025 at 07:02:12AM +0800, Brian Nguyen wrote:
> > > Allow for runtime modification to page reclamation feature through
> > > debugfs configuration. This parameter will only take effect if the
> > > platform supports the page reclamation feature by default.
> > >
> > > v2:
> > > - Minor comment tweaks. (Shuicheng)
> > > - Convert to kstrtobool_from_user. (Michal)
> > > - Only expose page reclaim file if page reclaim flag
> > > initially supported and with that, remove
> > > xe_match_desc usage. (Michal)
> > >
> > > Signed-off-by: Brian Nguyen <brian3.nguyen@intel.com>
> > > Cc: Shuicheng Lin <shuicheng.lin@intel.com>
> > > Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> > > ---
> > > drivers/gpu/drm/xe/xe_debugfs.c | 41
> > > +++++++++++++++++++++++++++++++++
> > > 1 file changed, 41 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/xe/xe_debugfs.c
> > > b/drivers/gpu/drm/xe/xe_debugfs.c index 1d5a2a43a9d7..296b8136511b
> > > 100644
> > > --- a/drivers/gpu/drm/xe/xe_debugfs.c
> > > +++ b/drivers/gpu/drm/xe/xe_debugfs.c
> > > @@ -291,6 +291,39 @@ static const struct file_operations wedged_mode_fops = {
> > > .write = wedged_mode_set,
> > > };
> > >
> > > +static ssize_t page_reclaim_hw_assist_show(struct file *f, char __user *ubuf,
> > > + size_t size, loff_t *pos)
> > > +{
> > > + struct xe_device *xe = file_inode(f)->i_private;
> > > + char buf[8];
> > > + int len;
> > > +
> > > + len = scnprintf(buf, sizeof(buf), "%d\n", xe->info.has_page_reclaim_hw_assist);
> > > + return simple_read_from_buffer(ubuf, size, pos, buf, len); }
> > > +
> > > +static ssize_t page_reclaim_hw_assist_set(struct file *f, const char __user *ubuf,
> > > + size_t size, loff_t *pos)
> > > +{
> > > + struct xe_device *xe = file_inode(f)->i_private;
> > > + bool val;
> > > + ssize_t ret;
> > > +
> > > + ret = kstrtobool_from_user(ubuf, size, &val);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + xe->info.has_page_reclaim_hw_assist = val;
> >
> > This does seem a little dangerous as someone could set this on unsupported platform or GuC firmware. Should we maybe store
> > page_reclaim_hw_assist_supported + page_reclaim_hw_assist_enabled in the Xe device and only let page_reclaim_hw_assist_enabled
> > move to 1 if page_reclaim_hw_assist_supported is set?
> >
> > Matt
> >
>
> I had a similar check in my first patch, but I believe this is prevented now by not exposing the file on initial xe_debugfs_register.
> This should handle both the unsupported platform who is always false and GuC FW version check, which is done currently at
> xe_guc_init, earlier in initialization than xe_debugfs_register. Is there a missing edge case here?
>
Ah, yes. I missed the file only gets exposed if
has_page_reclaim_hw_assist is set during the late part of the driver
load. My mistake this patch if fine then.
Sorry for the noise:
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> Brian
>
> > > +
> > > + return size;
> > > +}
> > > +
> > > +static const struct file_operations page_reclaim_hw_assist_fops = {
> > > + .owner = THIS_MODULE,
> > > + .read = page_reclaim_hw_assist_show,
> > > + .write = page_reclaim_hw_assist_set, };
> > > +
> > > static ssize_t atomic_svm_timeslice_ms_show(struct file *f, char __user *ubuf,
> > > size_t size, loff_t *pos)
> > > {
> > > @@ -397,6 +430,14 @@ void xe_debugfs_register(struct xe_device *xe)
> > > debugfs_create_file("disable_late_binding", 0600, root, xe,
> > > &disable_late_binding_fops);
> > >
> > > + /*
> > > + * Don't expose page reclaim configuration file if not supported by the
> > > + * hardware initially.
> > > + */
> > > + if (xe->info.has_page_reclaim_hw_assist)
> > > + debugfs_create_file("page_reclaim_hw_assist", 0600, root, xe,
> > > + &page_reclaim_hw_assist_fops);
> > > +
> > > for (mem_type = XE_PL_VRAM0; mem_type <= XE_PL_VRAM1; ++mem_type) {
> > > man = ttm_manager_type(bdev, mem_type);
> > >
> > > --
> > > 2.52.0
> > >
next prev parent reply other threads:[~2025-12-02 22:59 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 23:02 [PATCH v2 00/11] Page Reclamation Support for Xe3p Platforms Brian Nguyen
2025-11-26 23:02 ` [PATCH v2 01/11] [DO, NOT, REVIEW] drm/xe: Do not forward invalid TLB invalidation seqnos to upper layers Brian Nguyen
2025-11-26 23:02 ` [PATCH v2 02/11] drm/xe: Reset tlb fence timeout on invalid seqno received Brian Nguyen
2025-12-02 22:24 ` Matthew Brost
2025-11-26 23:02 ` [PATCH v2 03/11] drm/xe/xe_tlb_inval: Modify fence interface to support PPC flush Brian Nguyen
2025-12-02 22:18 ` Matthew Brost
2025-11-26 23:02 ` [PATCH v2 04/11] drm/xe: Add page reclamation info to device info Brian Nguyen
2025-11-26 23:02 ` [PATCH v2 05/11] drm/xe/guc: Add page reclamation interface to GuC Brian Nguyen
2025-12-02 22:21 ` Matthew Brost
2025-12-03 0:17 ` Lin, Shuicheng
2025-11-26 23:02 ` [PATCH v2 06/11] drm/xe: Create page reclaim list on unbind Brian Nguyen
2025-12-01 21:45 ` Nguyen, Brian3
2025-12-03 22:56 ` Matthew Brost
2025-12-04 0:19 ` Nguyen, Brian3
2025-11-26 23:02 ` [PATCH v2 07/11] drm/xe: Suballocate BO for page reclaim Brian Nguyen
2025-12-03 23:06 ` Matthew Brost
2025-11-26 23:02 ` [PATCH v2 08/11] drm/xe: Prep page reclaim in tlb inval job Brian Nguyen
2025-12-03 23:13 ` Matthew Brost
2025-12-04 0:22 ` Nguyen, Brian3
2025-12-04 1:20 ` Matthew Brost
2025-12-04 5:42 ` Nguyen, Brian3
2025-12-04 18:05 ` Matthew Brost
2025-12-04 20:02 ` Nguyen, Brian3
2025-12-09 5:57 ` Upadhyay, Tejas
2025-12-09 6:14 ` Nguyen, Brian3
2025-11-26 23:02 ` [PATCH v2 09/11] drm/xe: Append page reclamation action to tlb inval Brian Nguyen
2025-12-03 23:15 ` Matthew Brost
2025-11-26 23:02 ` [PATCH v2 10/11] drm/xe: Optimize flushing of L2$ by skipping unnecessary page reclaim Brian Nguyen
2025-12-09 14:23 ` Upadhyay, Tejas
2025-11-26 23:02 ` [PATCH v2 11/11] drm/xe: Add debugfs support for page reclamation Brian Nguyen
2025-12-02 22:28 ` Matthew Brost
2025-12-02 22:51 ` Nguyen, Brian3
2025-12-02 22:59 ` Matthew Brost [this message]
2025-12-05 18:02 ` Lin, Shuicheng
2025-11-26 23:52 ` ✗ CI.checkpatch: warning for Page Reclamation Support for Xe3p Platforms (rev2) Patchwork
2025-11-26 23:54 ` ✓ CI.KUnit: success " Patchwork
2025-11-27 0:54 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-11-27 1:42 ` ✗ Xe.CI.Full: " Patchwork
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=aS9vRTsPCfjoIyYo@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=Michal.Wajdeczko@intel.com \
--cc=brian3.nguyen@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=shuicheng.lin@intel.com \
--cc=stuart.summers@intel.com \
--cc=tejas.upadhyay@intel.com \
/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