From: Andi Shyti <andi.shyti@linux.intel.com>
To: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Tvrtko Ursulin <tursulin@ursulin.net>,
Lucas De Marchi <lucas.demarchi@intel.com>,
Chris Wilson <chris.p.wilson@linux.intel.com>
Subject: Re: [PATCH 0/3] drm/i915: Fix harmfull driver register/unregister assymetry
Date: Wed, 12 Feb 2025 16:32:18 +0100 [thread overview]
Message-ID: <Z6y_Ap7eLszsKCtz@ashyti-mobl2.lan> (raw)
In-Reply-To: <13696895.uLZWGnKmhe@jkrzyszt-mobl2.ger.corp.intel.com>
Hi Janusz,
On Tue, Feb 11, 2025 at 01:12:37PM +0100, Janusz Krzysztofik wrote:
> On Monday, 10 February 2025 14:01:19 CET Andi Shyti wrote:
> > On Thu, Feb 06, 2025 at 07:07:38PM +0100, Janusz Krzysztofik wrote:
> > > We return immediately from i915_driver_register() if drm_dev_register()
> > > fails, skipping remaining registration steps. However, the _unregister()
> > > counterpart called at device remove knows nothing about that skip and
> > > executes reverts for all those steps. For that to work correctly, those
> > > revert functions must be resistant to being called even on uninitialized
> > > objects, or we must not skip their initialization.
> > >
> > > Three cases have been identified and fixes proposed. Call traces are
> > > taken from CI results of igt@i915_driver_load@reload-with-fault-injection
> > > execution, reported to several separate Gitlab issues (links provided).
> > >
> > > Immediate return was introduced to i915_driver_register() by commit
> > > ec3e00b4ee27 ("drm/i915: stop registering if drm_dev_register() fails"),
> > > however, quite a few things have changed since then. That's why I haven't
> > > mentioned it in a Fixes: tag to avoid it being picked up by stable, which
> > > I haven't tested.
> >
> > I'm not fully convinced about this series as I think that you are
> > fixing a subset of what needs to be handled properly. What about
> > hwmon? What about gt? what about debugfs?
>
> For all of those, their _unregister() functions seem to be designed to be safe
> to call even if not registered. Like e.g. kfree() -- you can call it safely
> even with NULL argument, you don't need to check for NULL and call it
> conditionally. However, ...
>
> >
> > In my opinion we need to check in _unregister whether the
> > drm_dev_register has succeded
>
> I agree with you that it would be more clear if we skipped not only
> _register() but also _unregister() steps symmetrically, based on result of
> drm_dev_register().
>
> > and one way would be, e.g., to
> > check for the drm minor value, or even set the drm device tu NULL
> > (first things that come to my mind, maybe there are smarter ways
> > of doing it).
>
> As long as drm doesn't provide explicit support for checking if registration
> succeeded other than examining the return value of drm_dev_register(), I would
> rather store that value somewhere in our drm_i915_private structure instead of
> depending on drm internals. What do you think?
yes, I think we could have a local flag.
Andi
> Thanks,
> Janusz
>
>
> > This way we could skip some of the _unregister()
> > steps.
> >
> > Andi
> >
>
>
>
next prev parent reply other threads:[~2025-02-12 15:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 18:07 [PATCH 0/3] drm/i915: Fix harmfull driver register/unregister assymetry Janusz Krzysztofik
2025-02-06 18:07 ` [PATCH 1/3] drm/i915: Fix PM reference not released if device register fails Janusz Krzysztofik
2025-02-06 18:07 ` [PATCH 2/3] drm/i915: Fix GT sysfs unregister tried even if not registered Janusz Krzysztofik
2025-02-06 18:07 ` [PATCH 3/3] drm/i915: Fix device sysfs teardown tried even if not set up Janusz Krzysztofik
2025-02-06 20:11 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix harmfull driver register/unregister assymetry Patchwork
2025-02-06 20:11 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-02-07 14:24 ` ✗ i915.CI.BAT: failure " Patchwork
2025-02-10 13:01 ` [PATCH 0/3] " Andi Shyti
2025-02-11 12:12 ` Janusz Krzysztofik
2025-02-12 15:32 ` Andi Shyti [this message]
2025-02-14 13:12 ` Janusz Krzysztofik
2025-02-12 11:50 ` Krzysztof Niemiec
2025-02-12 15:35 ` Andi Shyti
2025-02-13 14:33 ` Krzysztof Niemiec
2025-02-13 17:15 ` Lucas De Marchi
2025-02-10 14:24 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix harmfull driver register/unregister assymetry (rev2) Patchwork
2025-02-10 14:24 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-02-10 15:56 ` ✓ i915.CI.BAT: success " Patchwork
2025-02-10 20:34 ` ✗ i915.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=Z6y_Ap7eLszsKCtz@ashyti-mobl2.lan \
--to=andi.shyti@linux.intel.com \
--cc=chris.p.wilson@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=janusz.krzysztofik@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=lucas.demarchi@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=tursulin@ursulin.net \
/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.