From: Matthew Brost <matthew.brost@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>,
<intel-xe@lists.freedesktop.org>,
Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>,
Tejas Upadhyay <tejas.upadhyay@intel.com>
Subject: Re: [PATCH v2 2/2] drm/xe: Use the filelist from drm for ccs_mode change
Date: Tue, 8 Oct 2024 18:00:25 +0000 [thread overview]
Message-ID: <ZwVzOahncbCljo1f@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <ZwVq0JIEz64OhROM@DUT025-TGLU.fm.intel.com>
On Tue, Oct 08, 2024 at 05:24:32PM +0000, Matthew Brost wrote:
> On Tue, Oct 08, 2024 at 11:55:03AM -0500, Lucas De Marchi wrote:
> > On Tue, Oct 08, 2024 at 03:42:09PM +0000, Matthew Brost wrote:
> > > On Tue, Oct 08, 2024 at 10:20:15AM -0500, Lucas De Marchi wrote:
> > > > On Tue, Oct 08, 2024 at 02:54:19PM +0000, Matthew Brost wrote:
> > > > > On Tue, Oct 08, 2024 at 01:06:28PM +0530, Balasubramani Vivekanandan wrote:
> > > > > > Drop the exclusive client count tracking and use the filelist from the
> > > > > > drm to track the active clients. This also ensures the clients created
> > > > > > internally by the driver won't block changing the ccs mode.
> > > > > >
> > > > > > Fixes: ce8c161cbad4 ("drm/xe: Add ref counting for xe_file")
> > > > >
> > > > > Is this really fixing anything. As far as I can tell nothing upstream
> > > > > opens a file internally (i.e. xe_file_open) is never called directly.
> > > >
> > > > should fix this case:
> > > >
> > > > open()
> > > > close()
> > > > <---- race here
> > > > change_ccs_mode()
> > > >
> > > > because the close is not completely sync - the cleanup where the
> > > > previous number of clients is decremented is executed too late and
> > > > subject to a race fixed here.
> > > >
> > >
> > > Ah, ok. But then IMO just move the clients.count decrement to
> > > xe_file_close. I try to preach solid locking / layering and this seems
> > > to go against this idea.
> >
> > why do you want to track the exact same thing in 2 ways, one in drm and
> > the other in xe? "Are there clients connected?" is something drm_file
> > answer and doesn't need to be duplicated in the individual drivers.
> >
>
> Well layering, making assumptions about the file list means, and not
> randomly deciding what we can and can't do with locks we don't own.
>
I looked at this a bit more, if we want to do it this way then I think
at a minimum we need a drm helper for this.
e.g.,
bool drm_device_user_clients_open(struct drm_device *dev)
{
lockdep_assert(&dev->filelist_mutex);
return !!list_empty(&dev->filelist);
}
Matt
> > At least it's also used for similar reasons in amdgpu and vmwgfx:
> >
> > $ git grep -l -e "->filelist" -- drivers/gpu/drm/
> > drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> > drivers/gpu/drm/drm_client.c
> > drivers/gpu/drm/drm_debugfs.c
> > drivers/gpu/drm/drm_drv.c
> > drivers/gpu/drm/drm_file.c
> > drivers/gpu/drm/vmwgfx/vmwgfx_gem.c
> >
>
> The AMD / VMWGFX usage certainly looks wrong to me. If the file list was
> meant to be traversed by drivers there should be an exported iterator
> IMO.
>
> Matt
>
> >
> > Lucas De Marchi
next prev parent reply other threads:[~2024-10-08 18:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 7:36 [PATCH v2 0/2] compute mode change refactoring Balasubramani Vivekanandan
2024-10-08 7:36 ` [PATCH v2 1/2] drm/xe: Set mask bits for CCS_MODE register Balasubramani Vivekanandan
2024-10-08 14:56 ` Matthew Brost
2024-10-08 16:34 ` Lucas De Marchi
2024-10-31 5:55 ` Lucas De Marchi
2024-10-08 7:36 ` [PATCH v2 2/2] drm/xe: Use the filelist from drm for ccs_mode change Balasubramani Vivekanandan
2024-10-08 14:54 ` Matthew Brost
2024-10-08 15:20 ` Lucas De Marchi
2024-10-08 15:42 ` Matthew Brost
2024-10-08 16:55 ` Lucas De Marchi
2024-10-08 17:24 ` Matthew Brost
2024-10-08 18:00 ` Matthew Brost [this message]
2024-10-10 11:03 ` Vivekanandan, Balasubramani
2024-10-10 16:02 ` Lucas De Marchi
2024-10-12 4:43 ` Matthew Brost
2024-10-12 23:45 ` Lucas De Marchi
2024-11-01 13:11 ` Lucas De Marchi
2024-11-01 14:23 ` Matthew Brost
2024-10-08 8:16 ` ✓ CI.Patch_applied: success for compute mode change refactoring Patchwork
2024-10-08 8:17 ` ✓ CI.checkpatch: " Patchwork
2024-10-08 8:18 ` ✓ CI.KUnit: " Patchwork
2024-10-08 8:29 ` ✓ CI.Build: " Patchwork
2024-10-08 8:32 ` ✓ CI.Hooks: " Patchwork
2024-10-08 8:33 ` ✓ CI.checksparse: " Patchwork
2024-10-08 8:56 ` ✓ CI.BAT: " Patchwork
2024-10-08 12:43 ` ✗ CI.FULL: failure " 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=ZwVzOahncbCljo1f@DUT025-TGLU.fm.intel.com \
--to=matthew.brost@intel.com \
--cc=balasubramani.vivekanandan@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=niranjana.vishwanathapura@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