All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Matthew Brost" <matthew.brost@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>,
	<intel-xe@lists.freedesktop.org>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: Re: [RFC 0/3] FW guard class
Date: Mon, 17 Jun 2024 14:00:55 -0400	[thread overview]
Message-ID: <ZnB51-d3XtwUfPfT@intel.com> (raw)
In-Reply-To: <ZnBxSFpuGjc9c9KJ@DUT025-TGLU.fm.intel.com>

On Mon, Jun 17, 2024 at 05:24:24PM +0000, Matthew Brost wrote:
> On Mon, Jun 17, 2024 at 04:34:27PM +0200, Michal Wajdeczko wrote:
> > There is support for 'classes' with constructor and destructor
> > semantics that can be used for any scope-based resource management,
> > like device force-wake management.
> > 
> > Add necessary definitions explicitly, since existing macros from
> > linux/cleanup.h can't deal with our specific requirements yet.
> > 
> > This should allow us to use:
> > 
> > 	scoped_guard(xe_fw, fw, XE_FW_GT)
> > 		foo();
> > or
> > 	CLASS(xe_fw, var)(fw, XE_FW_GT);
> > 
> > without any concern of leaking the force-wake references.
> > 
> > Note: this is preliminary code as right now it's unclear how to
> > correctly handle errors from the force-wake functions.
> > 
> 
> I'm personally don't like this at all. IMO it obfuscate the code with
> little real benefit. This is just an opinion though, others opinions may
> differ from mine.

Well, on the positive side, it is not adding a driver only thing like
i915's with_runtime_pm() macro.

But I'm also not sure if I like the overall idea anyway:

- I don't like adding C++isms in a pure C code. Specially something not
so standard and common that will decrease the ramp-up time for newcomers.
- It looks like and extra overhead on the object creation destruction.
- It looks not flexible for handling different cases... like forcewake for
instance where we might want to ignore the ack timeout in some cases.

> 
> Matt
> 
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> > 
> > Michal Wajdeczko (3):
> >   drm/xe: Introduce force-wake guard class
> >   drm/xe: Use new FW guard in xe_mocs.c
> >   drm/xe: Use new FW guard in xe_pat.c
> > 
> >  drivers/gpu/drm/xe/xe_force_wake.h       | 48 +++++++++++++++++++
> >  drivers/gpu/drm/xe/xe_force_wake_types.h | 12 +++++
> >  drivers/gpu/drm/xe/xe_mocs.c             | 12 +----
> >  drivers/gpu/drm/xe/xe_pat.c              | 60 ++++++++----------------
> >  4 files changed, 82 insertions(+), 50 deletions(-)
> > 
> > -- 
> > 2.43.0
> > 

  reply	other threads:[~2024-06-17 18:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-17 14:34 [RFC 0/3] FW guard class Michal Wajdeczko
2024-06-17 14:34 ` [RFC 1/3] drm/xe: Introduce force-wake " Michal Wajdeczko
2024-06-17 14:34 ` [RFC 2/3] drm/xe: Use new FW guard in xe_mocs.c Michal Wajdeczko
2024-06-17 14:34 ` [RFC 3/3] drm/xe: Use new FW guard in xe_pat.c Michal Wajdeczko
2024-06-17 14:59 ` ✓ CI.Patch_applied: success for FW guard class Patchwork
2024-06-17 15:00 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-17 15:01 ` ✓ CI.KUnit: success " Patchwork
2024-06-17 15:13 ` ✓ CI.Build: " Patchwork
2024-06-17 15:15 ` ✗ CI.Hooks: failure " Patchwork
2024-06-17 15:16 ` ✓ CI.checksparse: success " Patchwork
2024-06-17 15:38 ` ✓ CI.BAT: " Patchwork
2024-06-17 17:24 ` [RFC 0/3] " Matthew Brost
2024-06-17 18:00   ` Rodrigo Vivi [this message]
2024-06-17 18:06     ` Matthew Brost
2024-06-17 19:24     ` Michal Wajdeczko
2024-06-17 23:30       ` Matthew Brost
2024-06-18  0:54         ` Lucas De Marchi
2024-06-18  1:16           ` Matthew Brost
2024-06-18 18:08             ` Michal Wajdeczko
2024-06-18 18:44               ` Matthew Brost
2024-06-18 20:26           ` Rodrigo Vivi
2024-06-19  6:40             ` Thomas Hellström
2024-06-19 18:46               ` Rodrigo Vivi
2024-06-24 16:32             ` Nirmoy Das
2024-06-18  6:39 ` ✗ 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=ZnB51-d3XtwUfPfT@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=thomas.hellstrom@linux.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 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.