From: Matthew Brost <matthew.brost@intel.com>
To: Matthew Auld <matthew.auld@intel.com>
Cc: Nirmoy Das <nirmoy.das@intel.com>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe: Add warn when level can not be zero.
Date: Tue, 21 May 2024 15:32:34 +0000 [thread overview]
Message-ID: <Zky+kn5n2a1f31pT@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <552219db-7505-4dff-851c-71ed534f884e@intel.com>
On Tue, May 21, 2024 at 03:52:45PM +0100, Matthew Auld wrote:
> On 21/05/2024 15:08, Matthew Brost wrote:
> > On Tue, May 21, 2024 at 12:36:23PM +0200, Nirmoy Das wrote:
> > > At xe_pt_zap_ptes_entry() and xe_pt_stage_unbind_entry, the level cannot
> > > be 0. Therefore, add an independent check for the level. Since the level
> > > cannot be zero at this point, there is no need to check for `is_compact`,
> > > so remove that instead.
> > >
> >
> > This doesn't look right. Both xe_pt_zap_ptes_entry &
> > xe_pt_stage_unbind_entry can be at level 0 is 4K page entries are used,
> > right? CI looks good though so confused by that. I think maybe 2
> > independent VMAs would have to mapped within a 2M range for these paths
> > to decend to level 0. Maybe we don't have tests in place that do this.
>
> Not too sure, but in both cases this is followed by doing a level-1 which is
> then used as the index into some array AFAICT. So if level can indeed by
> zero here then that would be a serious bug. Improving the assert here to
> catch that looked reasonable to me.
>
Ah, yes. The comment below explains this. The this function is called on
the parent while operating on the child. So to write 4k page entries the
level would be 1.
This LGTM.
Matt
> >
> > Regardless please don't merge this until my concerns are addresesed.
> >
> > Matt
> >
> > > Cc: Matthew Auld <matthew.auld@intel.com>
> > > Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
> > > ---
> > > drivers/gpu/drm/xe/xe_pt.c | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
> > > index 11dd0988ffda..cd60c009b679 100644
> > > --- a/drivers/gpu/drm/xe/xe_pt.c
> > > +++ b/drivers/gpu/drm/xe/xe_pt.c
> > > @@ -763,7 +763,7 @@ static int xe_pt_zap_ptes_entry(struct xe_ptw *parent, pgoff_t offset,
> > > pgoff_t end_offset;
> > > XE_WARN_ON(!*child);
> > > - XE_WARN_ON(!level && xe_child->is_compact);
> > > + XE_WARN_ON(!level);
> > > /*
> > > * Note that we're called from an entry callback, and we're dealing
> > > @@ -1445,7 +1445,7 @@ static int xe_pt_stage_unbind_entry(struct xe_ptw *parent, pgoff_t offset,
> > > struct xe_pt *xe_child = container_of(*child, typeof(*xe_child), base);
> > > XE_WARN_ON(!*child);
> > > - XE_WARN_ON(!level && xe_child->is_compact);
> > > + XE_WARN_ON(!level);
> > > xe_pt_check_kill(addr, next, level - 1, xe_child, action, walk);
> > > --
> > > 2.42.0
> > >
next prev parent reply other threads:[~2024-05-21 15:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-21 10:36 [PATCH] drm/xe: Add warn when level can not be zero Nirmoy Das
2024-05-21 10:58 ` Matthew Auld
2024-05-21 12:27 ` ✓ CI.Patch_applied: success for " Patchwork
2024-05-21 12:27 ` ✓ CI.checkpatch: " Patchwork
2024-05-21 12:28 ` ✓ CI.KUnit: " Patchwork
2024-05-21 12:42 ` ✓ CI.Build: " Patchwork
2024-05-21 12:45 ` ✓ CI.Hooks: " Patchwork
2024-05-21 12:48 ` ✓ CI.checksparse: " Patchwork
2024-05-21 13:09 ` ✓ CI.BAT: " Patchwork
2024-05-21 14:08 ` [PATCH] " Matthew Brost
2024-05-21 14:52 ` Matthew Auld
2024-05-21 15:32 ` Matthew Brost [this message]
2024-05-21 20:14 ` Nirmoy Das
2024-05-21 16:08 ` ✗ CI.FULL: failure for " 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=Zky+kn5n2a1f31pT@DUT025-TGLU.fm.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=nirmoy.das@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