From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Coelho, Luciano" <luciano.coelho@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
"Vivi, Rodrigo" <rodrigo.vivi@intel.com>
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915: handle uncore spinlock when not available
Date: Mon, 23 Oct 2023 13:21:45 +0300 [thread overview]
Message-ID: <874jihd4g6.fsf@intel.com> (raw)
In-Reply-To: <9749798a6af666cc070598169ecf9d0770842c93.camel@intel.com>
On Mon, 23 Oct 2023, "Coelho, Luciano" <luciano.coelho@intel.com> wrote:
> On Mon, 2023-10-23 at 12:11 +0300, Jani Nikula wrote:
>> On Mon, 23 Oct 2023, Luca Coelho <luciano.coelho@intel.com> wrote:
>> > The uncore code may not always be available (e.g. when we build the
>> > display code with Xe), so we can't always rely on having the uncore's
>> > spinlock.
>> >
>> > To handle this, split the spin_lock/unlock_irqsave/restore() into
>> > spin_lock/unlock() followed by a call to local_irq_save/restore() and
>> > create wrapper functions for locking and unlocking the uncore's
>> > spinlock. In these functions, we have a condition check and only
>> > actually try to lock/unlock the spinlock when I915 is defined, and
>> > thus uncore is available.
>> >
>> > This keeps the ifdefs contained in these new functions and all such
>> > logic inside the display code.
>> >
>> > Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
>> > ---
>> >
>> > Note: this patch was accidentally sent only to intel-xe[1], but should
>> > have been sent to intel-gfx. Thus, this is v2.
>> >
>> > In v2:
>> >
>> > * Renamed uncore_spin_*() to intel_spin_*()
>> > * Corrected the order: save, lock, unlock, restore
>> >
>> > [1] https://patchwork.freedesktop.org/patch/563288/
>> >
>> >
>> > drivers/gpu/drm/i915/display/intel_display.h | 22 +++++++++++++++++++-
>> > drivers/gpu/drm/i915/display/intel_vblank.c | 19 ++++++++++-------
>> > 2 files changed, 33 insertions(+), 8 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
>> > index 0e5dffe8f018..099476906f4c 100644
>> > --- a/drivers/gpu/drm/i915/display/intel_display.h
>> > +++ b/drivers/gpu/drm/i915/display/intel_display.h
>> > @@ -29,6 +29,7 @@
>> >
>> > #include "i915_reg_defs.h"
>> > #include "intel_display_limits.h"
>> > +#include "i915_drv.h"
>>
>> In general, please avoid including headers from headers. In particular,
>> please don't include i915_drv.h from headers. The header
>> interdependencies are pretty bad already, and we need to clean it up.
>
> Right, I thought twice about this, but this seems far from clean, as
> you say, so I thought it would be fine.
Adding that single include bumps the total recursive includes of this
file from 2 to 97... i915_drv.h is pretty bad.
BR,
Jani.
>
> There's not much point, though, since we have a declaration for
> drm_i915_private in this file anyway, so the dependency is still
> there...
>
> In any case, I'll unspin this change and go back to passing the actual
> lock instead of passing drm_i915_private.
>
> --
> Cheers,
> Luca.
--
Jani Nikula, Intel
WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Coelho, Luciano" <luciano.coelho@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
"Vivi, Rodrigo" <rodrigo.vivi@intel.com>
Subject: Re: [Intel-xe] [Intel-gfx] [PATCH v2] drm/i915: handle uncore spinlock when not available
Date: Mon, 23 Oct 2023 13:21:45 +0300 [thread overview]
Message-ID: <874jihd4g6.fsf@intel.com> (raw)
In-Reply-To: <9749798a6af666cc070598169ecf9d0770842c93.camel@intel.com>
On Mon, 23 Oct 2023, "Coelho, Luciano" <luciano.coelho@intel.com> wrote:
> On Mon, 2023-10-23 at 12:11 +0300, Jani Nikula wrote:
>> On Mon, 23 Oct 2023, Luca Coelho <luciano.coelho@intel.com> wrote:
>> > The uncore code may not always be available (e.g. when we build the
>> > display code with Xe), so we can't always rely on having the uncore's
>> > spinlock.
>> >
>> > To handle this, split the spin_lock/unlock_irqsave/restore() into
>> > spin_lock/unlock() followed by a call to local_irq_save/restore() and
>> > create wrapper functions for locking and unlocking the uncore's
>> > spinlock. In these functions, we have a condition check and only
>> > actually try to lock/unlock the spinlock when I915 is defined, and
>> > thus uncore is available.
>> >
>> > This keeps the ifdefs contained in these new functions and all such
>> > logic inside the display code.
>> >
>> > Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
>> > ---
>> >
>> > Note: this patch was accidentally sent only to intel-xe[1], but should
>> > have been sent to intel-gfx. Thus, this is v2.
>> >
>> > In v2:
>> >
>> > * Renamed uncore_spin_*() to intel_spin_*()
>> > * Corrected the order: save, lock, unlock, restore
>> >
>> > [1] https://patchwork.freedesktop.org/patch/563288/
>> >
>> >
>> > drivers/gpu/drm/i915/display/intel_display.h | 22 +++++++++++++++++++-
>> > drivers/gpu/drm/i915/display/intel_vblank.c | 19 ++++++++++-------
>> > 2 files changed, 33 insertions(+), 8 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
>> > index 0e5dffe8f018..099476906f4c 100644
>> > --- a/drivers/gpu/drm/i915/display/intel_display.h
>> > +++ b/drivers/gpu/drm/i915/display/intel_display.h
>> > @@ -29,6 +29,7 @@
>> >
>> > #include "i915_reg_defs.h"
>> > #include "intel_display_limits.h"
>> > +#include "i915_drv.h"
>>
>> In general, please avoid including headers from headers. In particular,
>> please don't include i915_drv.h from headers. The header
>> interdependencies are pretty bad already, and we need to clean it up.
>
> Right, I thought twice about this, but this seems far from clean, as
> you say, so I thought it would be fine.
Adding that single include bumps the total recursive includes of this
file from 2 to 97... i915_drv.h is pretty bad.
BR,
Jani.
>
> There's not much point, though, since we have a declaration for
> drm_i915_private in this file anyway, so the dependency is still
> there...
>
> In any case, I'll unspin this change and go back to passing the actual
> lock instead of passing drm_i915_private.
>
> --
> Cheers,
> Luca.
--
Jani Nikula, Intel
next prev parent reply other threads:[~2023-10-23 10:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 8:43 [Intel-gfx] [PATCH v2] drm/i915: handle uncore spinlock when not available Luca Coelho
2023-10-23 8:43 ` [Intel-xe] " Luca Coelho
2023-10-23 9:11 ` [Intel-gfx] " Jani Nikula
2023-10-23 9:11 ` [Intel-xe] " Jani Nikula
2023-10-23 10:16 ` [Intel-gfx] " Coelho, Luciano
2023-10-23 10:16 ` [Intel-xe] " Coelho, Luciano
2023-10-23 10:21 ` Jani Nikula [this message]
2023-10-23 10:21 ` Jani Nikula
2023-10-23 10:23 ` [Intel-gfx] [Intel-xe] " Coelho, Luciano
2023-10-23 10:23 ` [Intel-xe] [Intel-gfx] " Coelho, Luciano
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=874jihd4g6.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=luciano.coelho@intel.com \
--cc=rodrigo.vivi@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.