Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Sousa <gustavo.sousa@intel.com>
To: Maarten Lankhorst <dev@lankhorst.se>, <intel-xe@lists.freedesktop.org>
Cc: Jani Nikula <jani.nikula@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [FOR CI 8/8] drm/i915/display: Use intel_de_write_fw in intel_pipe_fastset
Date: Thu, 30 Oct 2025 17:25:36 -0300	[thread overview]
Message-ID: <176185593644.3303.41997236546217622@intel.com> (raw)
In-Reply-To: <411769c1-d90c-418b-bd3d-30ed434d6285@lankhorst.se>

Quoting Maarten Lankhorst (2025-10-30 17:00:29-03:00)
>Hey,
>
>Den 2025-10-30 kl. 19:54, skrev Gustavo Sousa:
>> Quoting Maarten Lankhorst (2025-10-30 15:47:10-03:00)
>>> intel_set_pipe_src_size(), hsw_set_linetime_wm(),
>>> intel_cpu_transcoder_set_m1_n1() and intel_set_transcoder_timings_lrr()
>>> are called from an atomic context on PREEMPT_RT, and should be using the
>>> _fw functions.
>>>
>>> Again noticed when trying to disable preemption in vblank evasion:
>>> <3> BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
>>> <3> in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1505, name: kms_cursor_lega
>>> <3> preempt_count: 1, expected: 0
>>> <3> RCU nest depth: 0, expected: 0
>>> <4> 4 locks held by kms_cursor_lega/1505:
>>> <4>  #0: ffffc90003c6f988 (crtc_ww_class_acquire){+.+.}-{0:0}, at: drm_mode_atomic_ioctl+0x13b/0xe90
>>> <4>  #1: ffffc90003c6f9b0 (crtc_ww_class_mutex){+.+.}-{3:3}, at: drm_mode_atomic_ioctl+0x13b/0xe90
>>> <4>  #2: ffff888135b838b8 (&intel_dp->psr.lock){+.+.}-{3:3}, at: intel_psr_lock+0xc5/0xf0 [xe]
>>> <4>  #3: ffff88812607bbc0 (&wl->lock){+.+.}-{2:2}, at: intel_dmc_wl_get+0x3c/0x140 [xe]
>>> <4> CPU: 6 UID: 0 PID: 1505 Comm: kms_cursor_lega Tainted: G     U              6.18.0-rc3-lgci-xe-xe-pw-156729v1+ #1 PREEMPT_{RT,(lazy)}
>>> <4> Tainted: [U]=USER
>>> <4> Hardware name: Intel Corporation Panther Lake Client Platform/PTL-UH LP5 T3 RVP1, BIOS PTLPFWI1.R00.3383.D02.2509240621 09/24/2025
>>> <4> Call Trace:
>>> <4>  <TASK>
>>> <4>  dump_stack_lvl+0xc1/0xf0
>>> <4>  dump_stack+0x10/0x20
>>> <4>  __might_resched+0x174/0x260
>>> <4>  rt_spin_lock+0x63/0x200
>>> <4>  ? intel_dmc_wl_get+0x3c/0x140 [xe]
>>> <4>  intel_dmc_wl_get+0x3c/0x140 [xe]
>> 
>> Isn't the real problem reported here that we are using a regular
>> spinlock for DMC wakelock instead of a raw spinlock?
>
>Regardless whether it is, we should be using the _fw variant here.
>The idea of the pipe_start/end() sections are that all relevant locks are taken,
>and then complete as deterministically as possible. That's a lot easier when all
>locks are taken in advance. If the wakelock was needed, it needed to be taken
>before entering the critical section between pipe_start/pipe_end
>
>You're pointing out the related problem that the DMC wakelock implementation is
>incorrect right now.
>
>I believe that too, but we should aim for a better solution. The DMC wakelock
>implementation should not hide the fact it exists, instead it should be
>acquired explicitly like the xe_force_wake_get/put() implementation.
>
>This may be a bit of work, but it will be more deterministic than the implicit
>api used in i915.
>
>For correctness we could validate and print a debug error if the DMC wakelock
>was not taken.
>
>intel_de_read() can still optionally validate that the DMC wakelock was taken for
>ranges that need it if debuggig is enabled, but we should aim to remove the
>current spinlock/refcount implementation.

That's an interesting view.

Adding display maintainers to the discussion here. Jani, Rodrigo, how to
you see DMC wakelock being changed in the way proposed by Maarten?

--
Gustavo Sousa

>
>Kind regards,
>~Maarten Lankhorst

  reply	other threads:[~2025-10-30 20:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30 18:47 [FOR CI 0/8] Testing PREEMPT_RT with disabling irqs in the most critical section Maarten Lankhorst
2025-10-30 18:47 ` [FOR CI 1/8] drm/xe: Bump xe_device_l2_flush even higher Maarten Lankhorst
2025-10-30 18:47 ` [FOR CI 2/8] drm/i915/display: Make get_vblank_counter use intel_de_read_fw() Maarten Lankhorst
2025-10-30 18:47 ` [FOR CI 3/8] drm/i915: Use preempt_disable/enable_rt() where recommended Maarten Lankhorst
2025-10-30 18:47 ` [FOR CI 4/8] drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates Maarten Lankhorst
2025-10-30 18:47 ` [FOR CI 5/8] drm/xe/display: Disable preemption in the most critical section Maarten Lankhorst
2025-10-30 18:47 ` [FOR CI 6/8] PREEMPT_RT injection Maarten Lankhorst
2025-10-30 18:47 ` [FOR CI 7/8] With disabled irqs instead Maarten Lankhorst
2025-10-31  8:40   ` [FOR CI FIXED] " Maarten Lankhorst
2025-10-30 18:47 ` [FOR CI 8/8] drm/i915/display: Use intel_de_write_fw in intel_pipe_fastset Maarten Lankhorst
2025-10-30 18:54   ` Gustavo Sousa
2025-10-30 20:00     ` Maarten Lankhorst
2025-10-30 20:25       ` Gustavo Sousa [this message]
2025-10-31 12:49         ` Rodrigo Vivi
2025-10-31 15:43           ` Jani Nikula
2025-10-31 16:46             ` Maarten Lankhorst
2025-10-30 19:14 ` ✗ CI.checkpatch: warning for Testing PREEMPT_RT with disabling irqs in the most critical section Patchwork
2025-10-30 19:15 ` ✓ CI.KUnit: success " Patchwork
2025-10-30 19:29 ` ✗ CI.checksparse: warning " Patchwork
2025-10-30 20:18 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-10-31  1:59 ` ✗ Xe.CI.Full: " Patchwork
2025-10-31  9:35 ` ✗ CI.checkpatch: warning for Testing PREEMPT_RT with disabling irqs in the most critical section. (rev2) Patchwork
2025-10-31  9:36 ` ✓ CI.KUnit: success " Patchwork
2025-10-31  9:51 ` ✗ CI.checksparse: warning " Patchwork
2025-10-31 11:09 ` ✓ Xe.CI.BAT: success " Patchwork
2025-10-31 22:04 ` ✗ Xe.CI.Full: failure " 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=176185593644.3303.41997236546217622@intel.com \
    --to=gustavo.sousa@intel.com \
    --cc=dev@lankhorst.se \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox