From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 1/3] drm/i915/uncore: split unclaimed_reg_debug() to header and footer
Date: Thu, 6 Jul 2023 11:50:24 +0100 [thread overview]
Message-ID: <3b5ee224-272c-0eeb-7d6f-f5da9cc2b3f0@linux.intel.com> (raw)
In-Reply-To: <2abb4ff40e939d2a8e2bf0f2837fc6769614e50b.1688463863.git.jani.nikula@intel.com>
On 04/07/2023 10:48, Jani Nikula wrote:
> Make it easier to have different logic for the two for follow-up.
>
> Cc: Lee Shawn C <shawn.c.lee@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/intel_uncore.c | 37 +++++++++++++++++------------
> 1 file changed, 22 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index 796ebfe6c550..a88aa342b623 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -1926,10 +1926,8 @@ __unclaimed_previous_reg_debug(struct intel_uncore *uncore,
> }
>
> static inline void
> -unclaimed_reg_debug(struct intel_uncore *uncore,
> - const i915_reg_t reg,
> - const bool read,
> - const bool before)
> +unclaimed_reg_debug_header(struct intel_uncore *uncore,
> + const i915_reg_t reg, const bool read)
> {
> if (likely(!uncore->i915->params.mmio_debug) || !uncore->debug)
> return;
> @@ -1937,13 +1935,22 @@ unclaimed_reg_debug(struct intel_uncore *uncore,
> /* interrupts are disabled and re-enabled around uncore->lock usage */
> lockdep_assert_held(&uncore->lock);
>
> - if (before) {
> - spin_lock(&uncore->debug->lock);
> - __unclaimed_previous_reg_debug(uncore, reg, read);
> - } else {
> - __unclaimed_reg_debug(uncore, reg, read);
> - spin_unlock(&uncore->debug->lock);
> - }
> + spin_lock(&uncore->debug->lock);
> + __unclaimed_previous_reg_debug(uncore, reg, read);
> +}
> +
> +static inline void
> +unclaimed_reg_debug_footer(struct intel_uncore *uncore,
> + const i915_reg_t reg, const bool read)
> +{
> + if (likely(!uncore->i915->params.mmio_debug) || !uncore->debug)
> + return;
> +
> + /* interrupts are disabled and re-enabled around uncore->lock usage */
> + lockdep_assert_held(&uncore->lock);
> +
> + __unclaimed_reg_debug(uncore, reg, read);
> + spin_unlock(&uncore->debug->lock);
> }
>
> #define __vgpu_read(x) \
> @@ -2004,10 +2011,10 @@ __gen2_read(64)
> u##x val = 0; \
> assert_rpm_wakelock_held(uncore->rpm); \
> spin_lock_irqsave(&uncore->lock, irqflags); \
> - unclaimed_reg_debug(uncore, reg, true, true)
> + unclaimed_reg_debug_header(uncore, reg, true)
>
> #define GEN6_READ_FOOTER \
> - unclaimed_reg_debug(uncore, reg, true, false); \
> + unclaimed_reg_debug_footer(uncore, reg, true); \
> spin_unlock_irqrestore(&uncore->lock, irqflags); \
> trace_i915_reg_rw(false, reg, val, sizeof(val), trace); \
> return val
> @@ -2108,10 +2115,10 @@ __gen2_write(32)
> trace_i915_reg_rw(true, reg, val, sizeof(val), trace); \
> assert_rpm_wakelock_held(uncore->rpm); \
> spin_lock_irqsave(&uncore->lock, irqflags); \
> - unclaimed_reg_debug(uncore, reg, false, true)
> + unclaimed_reg_debug_header(uncore, reg, false)
>
> #define GEN6_WRITE_FOOTER \
> - unclaimed_reg_debug(uncore, reg, false, false); \
> + unclaimed_reg_debug_footer(uncore, reg, false); \
> spin_unlock_irqrestore(&uncore->lock, irqflags)
>
> #define __gen6_write(x) \
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
next prev parent reply other threads:[~2023-07-06 10:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-04 9:48 [Intel-gfx] [PATCH 0/3] drm/i915/uncore: unclaimed reg debug race fix and optimization Jani Nikula
2023-07-04 9:48 ` [Intel-gfx] [PATCH 1/3] drm/i915/uncore: split unclaimed_reg_debug() to header and footer Jani Nikula
2023-07-06 10:50 ` Tvrtko Ursulin [this message]
2023-07-04 9:48 ` [Intel-gfx] [PATCH 2/3] drm/i915/uncore: fix race around i915->params.mmio_debug Jani Nikula
2023-07-06 10:51 ` Tvrtko Ursulin
2023-07-04 9:48 ` [Intel-gfx] [PATCH 3/3] drm/i915/uncore: optimize CONFIG_DRM_I915_DEBUG_MMIO=n more Jani Nikula
2023-07-06 10:56 ` Tvrtko Ursulin
2023-07-06 12:06 ` Jani Nikula
2023-07-06 13:48 ` Tvrtko Ursulin
2023-07-25 3:01 ` Lee, Shawn C
2023-07-04 10:02 ` [Intel-gfx] [PATCH 0/3] drm/i915/uncore: unclaimed reg debug race fix and optimization Jani Nikula
2023-07-04 11:26 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork
2023-07-04 11:36 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-07-04 15:23 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=3b5ee224-272c-0eeb-7d6f-f5da9cc2b3f0@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@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