All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	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>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	Scott Oehrlein <scott.oehrlein@intel.com>,
	Ben Hutchings <ben@decadent.org.uk>,
	Tvrtko Ursulin <tvrtko.ursulin@igalia.com>,
	Luca Abeni <lucabe72@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH v4 4/9] drm/i915: Disable tracing points on PREEMPT_RT
Date: Tue, 15 Jul 2025 20:54:54 +0300	[thread overview]
Message-ID: <aHaV7vtp2Y1RbIAt@intel.com> (raw)
In-Reply-To: <272f743e-15f7-4dc0-a6c0-08cd60ca6cc2@linux.intel.com>

On Tue, Jul 15, 2025 at 10:01:45AM +0200, Maarten Lankhorst wrote:
> Hey,
> 
> I believe the platforms that require spinlocks for reading registers all predate Xe,
> so it should be possible to enable tracepoints on Xe.
> 
> I do see there is still a path there that takes locks, through intel_crtc_get_vblank_counter -> drm_crtc_accurate_vblank_count().
> 
> I would recommend changing intel_crtc_get_vblank_counter to use drm_vblank_count(),
> which doesn't take locks.
> 
> This reduces vblank accuracy slightly on old platforms and gen11+ DSI, but I would say for most usecases it has the same accuracy,

The non-accurate version is completely useless here. So NAK.

> with the benefit of keeping tracepoints enabled. The only users for intel_crtc_get_vblank_counter() are debug functions.
> 
> With that change, something like: 
> "#if defined(CONFIG_PREEMPT_RT) && defined(I915) && !defined(NOTRACE)"
> 
> would disable tracepoints only on i915.
> 
> Kind regards,
> ~Maarten
> 
> Den 2025-07-14 kl. 17:39, skrev Sebastian Andrzej Siewior:
> > Luca Abeni reported this:
> > | BUG: scheduling while atomic: kworker/u8:2/15203/0x00000003
> > | CPU: 1 PID: 15203 Comm: kworker/u8:2 Not tainted 4.19.1-rt3 #10
> > | Call Trace:
> > |  rt_spin_lock+0x3f/0x50
> > |  gen6_read32+0x45/0x1d0 [i915]
> > |  g4x_get_vblank_counter+0x36/0x40 [i915]
> > |  trace_event_raw_event_i915_pipe_update_start+0x7d/0xf0 [i915]
> > 
> > The tracing events use trace_intel_pipe_update_start() among other events
> > use functions acquire spinlock_t locks which are transformed into
> > sleeping locks on PREEMPT_RT. A few trace points use
> > intel_get_crtc_scanline(), others use ->get_vblank_counter() wich also
> > might acquire a sleeping locks on PREEMPT_RT.
> > At the time the arguments are evaluated within trace point, preemption
> > is disabled and so the locks must not be acquired on PREEMPT_RT.
> > 
> > Based on this I don't see any other way than disable trace points on
> > PREMPT_RT.
> > 
> > Acked-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> > Reported-by: Luca Abeni <lucabe72@gmail.com>
> > Cc: Steven Rostedt <rostedt@goodmis.org>
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display_trace.h | 4 ++++
> >  drivers/gpu/drm/i915/i915_trace.h                  | 4 ++++
> >  drivers/gpu/drm/i915/intel_uncore_trace.h          | 4 ++++
> >  3 files changed, 12 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_trace.h b/drivers/gpu/drm/i915/display/intel_display_trace.h
> > index 27ebc32cb61a5..a519d94700c36 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_trace.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display_trace.h
> > @@ -13,6 +13,10 @@
> >  #if !defined(__INTEL_DISPLAY_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ)
> >  #define __INTEL_DISPLAY_TRACE_H__
> >  
> > +#if defined(CONFIG_PREEMPT_RT) && !defined(NOTRACE)
> > +#define NOTRACE
> > +#endif
> > +
> >  #include <linux/string.h>
> >  #include <linux/string_helpers.h>
> >  #include <linux/types.h>
> > diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
> > index 7ed41ce9b7085..6b87ef6005c69 100644
> > --- a/drivers/gpu/drm/i915/i915_trace.h
> > +++ b/drivers/gpu/drm/i915/i915_trace.h
> > @@ -6,6 +6,10 @@
> >  #if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
> >  #define _I915_TRACE_H_
> >  
> > +#if defined(CONFIG_PREEMPT_RT) && !defined(NOTRACE)
> > +#define NOTRACE
> > +#endif
> > +
> >  #include <linux/stringify.h>
> >  #include <linux/types.h>
> >  #include <linux/tracepoint.h>
> > diff --git a/drivers/gpu/drm/i915/intel_uncore_trace.h b/drivers/gpu/drm/i915/intel_uncore_trace.h
> > index f13ff71edf2db..3c67e267fb602 100644
> > --- a/drivers/gpu/drm/i915/intel_uncore_trace.h
> > +++ b/drivers/gpu/drm/i915/intel_uncore_trace.h
> > @@ -7,6 +7,10 @@
> >  #if !defined(__INTEL_UNCORE_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ)
> >  #define __INTEL_UNCORE_TRACE_H__
> >  
> > +#if defined(CONFIG_PREEMPT_RT) && !defined(NOTRACE)
> > +#define NOTRACE
> > +#endif
> > +
> >  #include "i915_reg_defs.h"
> >  
> >  #include <linux/types.h>

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2025-07-15 17:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-14 15:39 [PATCH v4 0/9] drm/i915: PREEMPT_RT related fixups Sebastian Andrzej Siewior
2025-07-14 15:39 ` [PATCH v4 1/9] drm/i915: Use preempt_disable/enable_rt() where recommended Sebastian Andrzej Siewior
2025-07-14 15:39 ` [PATCH v4 2/9] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates Sebastian Andrzej Siewior
2025-07-14 15:39 ` [PATCH v4 3/9] drm/i915: Don't check for atomic context on PREEMPT_RT Sebastian Andrzej Siewior
2025-07-14 15:39 ` [PATCH v4 4/9] drm/i915: Disable tracing points " Sebastian Andrzej Siewior
2025-07-15  8:01   ` Maarten Lankhorst
2025-07-15 17:54     ` Ville Syrjälä [this message]
2025-07-14 15:39 ` [PATCH v4 5/9] drm/i915/gt: Use spin_lock_irq() instead of local_irq_disable() + spin_lock() Sebastian Andrzej Siewior
2025-07-14 15:39 ` [PATCH v4 6/9] drm/i915: Drop the irqs_disabled() check Sebastian Andrzej Siewior
2025-07-14 15:39 ` [PATCH v4 7/9] drm/i915/guc: Consider also RCU depth in busy loop Sebastian Andrzej Siewior
2025-07-14 15:39 ` [PATCH v4 8/9] drm/i915: Consider RCU read section as atomic Sebastian Andrzej Siewior
2025-07-14 15:39 ` [PATCH v4 9/9] Revert "drm/i915: Depend on !PREEMPT_RT." Sebastian Andrzej Siewior
2025-07-14 15:47 ` ✗ CI.checkpatch: warning for drm/i915: PREEMPT_RT related fixups. (rev6) Patchwork
2025-07-14 15:48 ` ✓ CI.KUnit: success " Patchwork
2025-07-14 16:03 ` ✗ CI.checksparse: warning " Patchwork
2025-07-14 16:35 ` ✓ Xe.CI.BAT: success " Patchwork
2025-07-14 18:08 ` ✓ i915.CI.BAT: success for drm/i915: PREEMPT_RT related fixups. (rev13) Patchwork
2025-07-14 18:11 ` ✗ Xe.CI.Full: failure for drm/i915: PREEMPT_RT related fixups. (rev6) Patchwork
2025-07-14 21:16 ` ✗ i915.CI.Full: failure for drm/i915: PREEMPT_RT related fixups. (rev13) Patchwork
2025-07-21  5:06 ` [PATCH v4 0/9] drm/i915: PREEMPT_RT related fixups Romain Guyard
2025-08-21 11:13   ` Sebastian Andrzej Siewior
2025-08-21 11:17 ` Sebastian Andrzej Siewior

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=aHaV7vtp2Y1RbIAt@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=ben@decadent.org.uk \
    --cc=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=lucabe72@gmail.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=scott.oehrlein@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tursulin@ursulin.net \
    --cc=tvrtko.ursulin@igalia.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.