From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Tvrtko Ursulin <tursulin@ursulin.net>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v2 3/8] drm/i915: Don't check for atomic context on PREEMPT_RT
Date: Mon, 17 Jun 2024 12:07:52 +0200 [thread overview]
Message-ID: <20240617100752.9XDTS0R5@linutronix.de> (raw)
In-Reply-To: <fa38f377-a00a-4e0c-b416-54a1c3f15d4d@ursulin.net>
On 2024-06-14 13:19:25 [+0100], Tvrtko Ursulin wrote:
> > So the question is why do you need to know if the context is atomic?
> > The only impact is avoiding disabling preemption. Is it that important
> > to avoid it?
> > If so would cant_migrate() work? It requires CONFIG_DEBUG_ATOMIC_SLEEP=y
> > to do the trick.
>
> ... catching misuse of atomic wait helpers step 2 - are you calling it from
> a non-atomic context without the real need. So should use the non-atomic
> helper instead.
>
> When i915 development was very active and with a lot of contributors it was
> beneficial to catch these things which code review would easily miss.
>
> Now that the pace is much, much slower, it is probably not very important.
> So this patch is acceptable for what I am concerned and:
>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
>
> Actually please also add the PREEMPT_RT angle to the comment above
> _WAIT_FOR_ATOMIC_CHECK. Sometimes lines change and git blame makes it hard
> to find the commit text.
Do you want me the repost the series? Are the bots happy enough?
I have the following as far this patch:
------->8--------------
The !in_atomic() check in _wait_for_atomic() triggers on PREEMPT_RT
because the uncore::lock is a spinlock_t and does not disable
preemption or interrupts.
Changing the uncore:lock to a raw_spinlock_t doubles the worst case
latency on an otherwise idle testbox during testing.
Ignore _WAIT_FOR_ATOMIC_CHECK() on PREEMPT_RT.
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Link: https://lore.kernel.org/all/20211006164628.s2mtsdd2jdbfyf7g@linutronix.de/
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/gpu/drm/i915/i915_utils.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 06ec6ceb61d57..f0d3c5cdc1b1b 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -273,8 +273,13 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
(Wmax))
#define wait_for(COND, MS) _wait_for((COND), (MS) * 1000, 10, 1000)
-/* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. */
-#if defined(CONFIG_DRM_I915_DEBUG) && defined(CONFIG_PREEMPT_COUNT)
+/*
+ * If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false.
+ * On PREEMPT_RT the context isn't becoming atomic because it is used in an
+ * interrupt handler or because a spinlock_t is acquired. This leads warnings
+ * which don't occur otherwise and is therefore disabled.
+ */
+#if defined(CONFIG_DRM_I915_DEBUG) && defined(CONFIG_PREEMPT_COUNT) && !defined(CONFIG_PREEMPT_RT)
# define _WAIT_FOR_ATOMIC_CHECK(ATOMIC) WARN_ON_ONCE((ATOMIC) && !in_atomic())
#else
# define _WAIT_FOR_ATOMIC_CHECK(ATOMIC) do { } while (0)
> Regards,
>
> Tvrtko
Sebastian
next prev parent reply other threads:[~2024-06-17 10:07 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-13 10:20 [PATCH v2 0/8] drm/i915: PREEMPT_RT related fixups Sebastian Andrzej Siewior
2024-06-13 10:20 ` [PATCH v2 1/8] drm/i915: Use preempt_disable/enable_rt() where recommended Sebastian Andrzej Siewior
2024-06-13 10:20 ` [PATCH v2 2/8] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates Sebastian Andrzej Siewior
2024-06-13 10:20 ` [PATCH v2 3/8] drm/i915: Don't check for atomic context on PREEMPT_RT Sebastian Andrzej Siewior
2024-06-14 8:32 ` Tvrtko Ursulin
2024-06-14 11:05 ` Sebastian Andrzej Siewior
2024-06-14 12:19 ` Tvrtko Ursulin
2024-06-17 10:07 ` Sebastian Andrzej Siewior [this message]
2024-06-18 9:00 ` Tvrtko Ursulin
2024-06-18 12:54 ` Sebastian Andrzej Siewior
2024-06-19 10:26 ` Tvrtko Ursulin
2024-06-13 10:20 ` [PATCH v2 4/8] drm/i915: Disable tracing points " Sebastian Andrzej Siewior
2024-06-19 10:27 ` Tvrtko Ursulin
2024-06-13 10:20 ` [PATCH v2 5/8] drm/i915/gt: Use spin_lock_irq() instead of local_irq_disable() + spin_lock() Sebastian Andrzej Siewior
2024-06-13 10:20 ` [PATCH v2 6/8] drm/i915: Drop the irqs_disabled() check Sebastian Andrzej Siewior
2024-06-19 10:28 ` Tvrtko Ursulin
2024-06-13 10:20 ` [PATCH v2 7/8] drm/i915/guc: Consider also RCU depth in busy loop Sebastian Andrzej Siewior
2024-06-13 10:20 ` [PATCH v2 8/8] Revert "drm/i915: Depend on !PREEMPT_RT." Sebastian Andrzej Siewior
2024-06-19 10:29 ` Tvrtko Ursulin
2024-06-13 11:52 ` ✓ CI.Patch_applied: success for drm/i915: PREEMPT_RT related fixups. (rev3) Patchwork
2024-06-13 11:52 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-13 11:53 ` ✓ CI.KUnit: success " Patchwork
2024-06-13 12:05 ` ✓ CI.Build: " Patchwork
2024-06-13 12:07 ` ✗ CI.Hooks: failure " Patchwork
2024-06-13 12:09 ` ✗ CI.checksparse: warning " Patchwork
2024-06-13 12:31 ` ✓ CI.BAT: success " Patchwork
2024-06-13 14:34 ` ✓ CI.FULL: " Patchwork
2024-06-17 10:12 ` ✓ CI.Patch_applied: success for drm/i915: PREEMPT_RT related fixups. (rev4) Patchwork
2024-06-17 10:12 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-17 10:13 ` ✓ CI.KUnit: success " Patchwork
2024-06-17 10:26 ` ✓ CI.Build: " Patchwork
2024-06-17 10:30 ` ✗ CI.Hooks: failure " Patchwork
2024-06-17 10:32 ` ✗ CI.checksparse: warning " Patchwork
2024-06-17 10:54 ` ✓ CI.BAT: success " Patchwork
2024-06-17 16:35 ` ✓ CI.FULL: " 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=20240617100752.9XDTS0R5@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=tglx@linutronix.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox