From: Peter Zijlstra <peterz@infradead.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: 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>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [Intel-gfx] [PATCH 8/8] drm/i915: Don't disable interrupts and pretend a lock as been acquired in __timeline_mark_lock().
Date: Tue, 5 Oct 2021 21:16:17 +0200 [thread overview]
Message-ID: <20211005191617.GA174703@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20211005150046.1000285-9-bigeasy@linutronix.de>
On Tue, Oct 05, 2021 at 05:00:46PM +0200, Sebastian Andrzej Siewior wrote:
> This is a revert of commits
> d67739268cf0e ("drm/i915/gt: Mark up the nested engine-pm timeline lock as irqsafe")
> 6c69a45445af9 ("drm/i915/gt: Mark context->active_count as protected by timeline->mutex")
>
> The existing code leads to a different behaviour depending on wheather
> lockdep is enabled or not. Any following lock that is acquired without
> disabling interrupts (but needs to) will not be noticed by lockdep.
>
> This it not just a lockdep annotation but is used but an actual mutex_t
> that is properly used as a lock but in case of __timeline_mark_lock()
> lockdep is only told that it is acquired but no lock has been acquired.
>
> It appears that its purporse is just satisfy the lockdep_assert_held()
> check in intel_context_mark_active(). The other problem with disabling
> interrupts is that on PREEMPT_RT interrupts are also disabled which
> leads to problems for instance later during memory allocation.
>
> Add an argument to intel_context_mark_active() which is true if the lock
> must have been acquired, false if other magic is involved and the lock
> is not needed. Use the `false' argument only from within
> switch_to_kernel_context() and remove __timeline_mark_lock().
>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Eeew, nice find.
> -static inline void intel_context_mark_active(struct intel_context *ce)
> +static inline void intel_context_mark_active(struct intel_context *ce,
> + bool timeline_mutex_needed)
> {
> - lockdep_assert_held(&ce->timeline->mutex);
> + if (timeline_mutex_needed)
> + lockdep_assert_held(&ce->timeline->mutex);
> ++ce->active_count;
> }
Chris, might it be possible to write that something like:
lockdep_assert(lockdep_is_held(&ce->timeline->mutex) ||
engine_is_parked(ce));
instead?
Otherwise,
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: 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>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 8/8] drm/i915: Don't disable interrupts and pretend a lock as been acquired in __timeline_mark_lock().
Date: Tue, 5 Oct 2021 21:16:17 +0200 [thread overview]
Message-ID: <20211005191617.GA174703@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20211005150046.1000285-9-bigeasy@linutronix.de>
On Tue, Oct 05, 2021 at 05:00:46PM +0200, Sebastian Andrzej Siewior wrote:
> This is a revert of commits
> d67739268cf0e ("drm/i915/gt: Mark up the nested engine-pm timeline lock as irqsafe")
> 6c69a45445af9 ("drm/i915/gt: Mark context->active_count as protected by timeline->mutex")
>
> The existing code leads to a different behaviour depending on wheather
> lockdep is enabled or not. Any following lock that is acquired without
> disabling interrupts (but needs to) will not be noticed by lockdep.
>
> This it not just a lockdep annotation but is used but an actual mutex_t
> that is properly used as a lock but in case of __timeline_mark_lock()
> lockdep is only told that it is acquired but no lock has been acquired.
>
> It appears that its purporse is just satisfy the lockdep_assert_held()
> check in intel_context_mark_active(). The other problem with disabling
> interrupts is that on PREEMPT_RT interrupts are also disabled which
> leads to problems for instance later during memory allocation.
>
> Add an argument to intel_context_mark_active() which is true if the lock
> must have been acquired, false if other magic is involved and the lock
> is not needed. Use the `false' argument only from within
> switch_to_kernel_context() and remove __timeline_mark_lock().
>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Eeew, nice find.
> -static inline void intel_context_mark_active(struct intel_context *ce)
> +static inline void intel_context_mark_active(struct intel_context *ce,
> + bool timeline_mutex_needed)
> {
> - lockdep_assert_held(&ce->timeline->mutex);
> + if (timeline_mutex_needed)
> + lockdep_assert_held(&ce->timeline->mutex);
> ++ce->active_count;
> }
Chris, might it be possible to write that something like:
lockdep_assert(lockdep_is_held(&ce->timeline->mutex) ||
engine_is_parked(ce));
instead?
Otherwise,
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
next prev parent reply other threads:[~2021-10-05 19:18 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-05 15:00 [Intel-gfx] [PATCH 0/8] drm/i915: PREEMPT_RT related fixups Sebastian Andrzej Siewior
2021-10-05 15:00 ` Sebastian Andrzej Siewior
2021-10-05 15:00 ` [Intel-gfx] [PATCH 1/8] drm/i915: Use preempt_disable/enable_rt() where recommended Sebastian Andrzej Siewior
2021-10-05 15:00 ` Sebastian Andrzej Siewior
2021-10-05 15:00 ` [Intel-gfx] [PATCH 2/8] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates Sebastian Andrzej Siewior
2021-10-05 15:00 ` Sebastian Andrzej Siewior
2021-10-06 9:16 ` [Intel-gfx] " Ville Syrjälä
2021-10-05 15:00 ` [Intel-gfx] [PATCH 3/8] drm/i915: Disable tracing points on PREEMPT_RT Sebastian Andrzej Siewior
2021-10-05 15:00 ` Sebastian Andrzej Siewior
2021-10-06 9:34 ` [Intel-gfx] " Ville Syrjälä
2021-10-06 9:34 ` Ville Syrjälä
2021-10-06 10:15 ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-06 10:15 ` Sebastian Andrzej Siewior
2021-10-06 16:46 ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-06 16:46 ` Sebastian Andrzej Siewior
2021-10-05 15:00 ` [Intel-gfx] [PATCH 4/8] drm/i915: skip DRM_I915_LOW_LEVEL_TRACEPOINTS with NOTRACE Sebastian Andrzej Siewior
2021-10-05 15:00 ` Sebastian Andrzej Siewior
2021-10-05 15:00 ` [Intel-gfx] [PATCH 5/8] drm/i915/gt: Queue and wait for the irq_work item Sebastian Andrzej Siewior
2021-10-05 15:00 ` Sebastian Andrzej Siewior
2021-10-05 15:00 ` [Intel-gfx] [PATCH 6/8] drm/i915/gt: Use spin_lock_irq() instead of local_irq_disable() + spin_lock() Sebastian Andrzej Siewior
2021-10-05 15:00 ` Sebastian Andrzej Siewior
2021-10-05 15:00 ` [Intel-gfx] [PATCH 7/8] drm/i915: Drop the irqs_disabled() check Sebastian Andrzej Siewior
2021-10-05 15:00 ` Sebastian Andrzej Siewior
2021-10-05 15:00 ` [Intel-gfx] [PATCH 8/8] drm/i915: Don't disable interrupts and pretend a lock as been acquired in __timeline_mark_lock() Sebastian Andrzej Siewior
2021-10-05 15:00 ` Sebastian Andrzej Siewior
2021-10-05 19:16 ` Peter Zijlstra [this message]
2021-10-05 19:16 ` Peter Zijlstra
2021-10-06 6:58 ` [Intel-gfx] " Sebastian Andrzej Siewior
2021-10-06 6:58 ` Sebastian Andrzej Siewior
2021-10-08 6:21 ` [Intel-gfx] [drm/i915] 511e5fb0c3: WARNING:suspicious_RCU_usage kernel test robot
2021-10-08 6:21 ` kernel test robot
2021-10-08 6:21 ` kernel test robot
2021-10-05 16:12 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: PREEMPT_RT related fixups Patchwork
2021-10-05 16:48 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-10-06 17:41 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: PREEMPT_RT related fixups. (rev2) 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=20211005191617.GA174703@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=airlied@linux.ie \
--cc=bigeasy@linutronix.de \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=tglx@linutronix.de \
/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.