linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: Juri Lelli <juri.lelli@redhat.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-rt-users <linux-rt-users@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RT] i915 sleeping function from atomic in gen6_reset_engines()
Date: Mon, 10 Jul 2023 12:09:48 +0200	[thread overview]
Message-ID: <ae3f172d49bcf1af3c0e566bbc4f2967c9e65f2e.camel@gmx.de> (raw)
In-Reply-To: <ZKuxdVJcsHdcbmYs@localhost.localdomain>

On Mon, 2023-07-10 at 09:21 +0200, Juri Lelli wrote:
> Hi!
>
> On 23/01/23 17:04, Juri Lelli wrote:
> > Hi,
> >
> > I've just noticed the following while testing v6.2-rc3-rt1.
>
> I'm still seeing the following on v6.4-rt6.
>
> I believe 20211006164628.s2mtsdd2jdbfyf7g@linutronix.de should cure it,
> but I don't think it did go anywhere?

The raw lock cyclictest deltas don't look great.  I shut it up with the
below.  For my i915 equipped lappy, a raw lock fix would be just fine,
its cyclictest numbers already being well south of 'oh dear'.

Subject: drm,i915: Don't disable preemption in __intel_gt_reset() for PREEMPT_RT
From: Mike Galbraith <efault@gmx.de>
Date: Wed Dec  7 10:13:21 CET 2022

 BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:46
 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 330, name: systemd-udevd
 preempt_count: 1, expected: 0
 RCU nest depth: 0, expected: 0
 Preemption disabled at:
 [<ffffffffa090e08e>] __intel_gt_reset+0x6e/0xe0 [i915]
 CPU: 0 PID: 330 Comm: systemd-udevd Tainted: G          I E      6.1.0.g8ed710d-master-rt #27
 Hardware name: HP HP Spectre x360 Convertible/804F, BIOS F.47 11/22/2017
 Call Trace:
  <TASK>
  dump_stack_lvl+0x33/0x46
  ? __intel_gt_reset+0x6e/0xe0 [i915]
  __might_resched+0x162/0x1b0
  ? __gen11_reset_engines.isra.21+0x2d0/0x2d0 [i915]
  rt_spin_lock+0x2d/0x70
  gen8_reset_engines+0x33/0x220 [i915]
  ? __gen11_reset_engines.isra.21+0x2d0/0x2d0 [i915]
  __intel_gt_reset+0x79/0xe0 [i915]
  sanitize_gpu.part.17+0x2d/0x40 [i915]
  i915_driver_probe+0x7b8/0xf20 [i915]
  ...

Replace the preempt_disable()/enable() with a local_lock()/unlock().

Signed-off-by: Mike Galbraith <efault@gmx.de>
---
 drivers/gpu/drm/i915/gt/intel_reset.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/i915/gt/intel_reset.c
+++ b/drivers/gpu/drm/i915/gt/intel_reset.c
@@ -6,6 +6,7 @@
 #include <linux/sched/mm.h>
 #include <linux/stop_machine.h>
 #include <linux/string_helpers.h>
+#include <linux/local_lock.h>

 #include "display/intel_display_reset.h"
 #include "display/intel_overlay.h"
@@ -766,6 +767,14 @@ wa_14015076503_end(struct intel_gt *gt,
 			 HECI_H_GS1_ER_PREP, 0);
 }

+struct reset_lock {
+	local_lock_t lock;
+};
+
+static DEFINE_PER_CPU(struct reset_lock, reset_lock) = {
+	.lock	= INIT_LOCAL_LOCK(lock),
+};
+
 int __intel_gt_reset(struct intel_gt *gt, intel_engine_mask_t engine_mask)
 {
 	const int retries = engine_mask == ALL_ENGINES ? RESET_MAX_RETRIES : 1;
@@ -788,9 +797,9 @@ int __intel_gt_reset(struct intel_gt *gt
 		reset_mask = wa_14015076503_start(gt, engine_mask, !retry);

 		GT_TRACE(gt, "engine_mask=%x\n", reset_mask);
-		preempt_disable();
+		local_lock(&reset_lock.lock);
 		ret = reset(gt, reset_mask, retry);
-		preempt_enable();
+		local_unlock(&reset_lock.lock);

 		wa_14015076503_end(gt, reset_mask);
 	}


  reply	other threads:[~2023-07-10 10:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 16:04 [RT] i915 sleeping function from atomic in gen6_reset_engines() Juri Lelli
2023-07-10  7:21 ` Juri Lelli
2023-07-10 10:09   ` Mike Galbraith [this message]
2023-07-10 11:56     ` Juri Lelli

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=ae3f172d49bcf1af3c0e566bbc4f2967c9e65f2e.camel@gmx.de \
    --to=efault@gmx.de \
    --cc=bigeasy@linutronix.de \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).