Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	jani.saarinen@intel.com,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFT] Revert "lockdep: Enable PROVE_RAW_LOCK_NESTING with PROVE_LOCKING."
Date: Thu, 12 Dec 2024 10:31:23 +0100	[thread overview]
Message-ID: <20241212093123.GV21636@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <c5r46che35oqieotvytdfj2utelhtidnbjgyfijfik64mtgmlt@6mi42dmtz2wh>

On Tue, Dec 10, 2024 at 06:00:33PM -0600, Lucas De Marchi wrote:

> 	raw_spin_lock_init(&guc->timestamp.lock);
> 	raw_spin_lock_init(&pmu->lock);
> 	raw_spin_lock_init(&i915->mmio_debug.lock);
> 	raw_spin_lock_init(&uncore->lock);
> 
> And it's still not sufficient, because intel_ref_tracker tries to
> allocate while holding one of those and I'm not confident on making that
> pass GFP_ATOMIC.

You cannot allocate memory under raw_spinlock_t at all, ever. Nor free
for that matter. The allocators use spinlock internally.


> [  204.835058]  __kmalloc_cache_noprof+0x277/0x480
> [  204.839554]  ? __kmalloc_cache_noprof+0x277/0x480
> [  204.844221]  ref_tracker_alloc+0xd7/0x270
> [  204.848206]  ? ref_tracker_alloc+0xd7/0x270
> [  204.852357]  guc_engine_busyness+0x122/0x2c0 [i915]
> 
> 
> > 
> > > 
> > > It's a real problem only for PREEMPT_RT since otherwise there's
> > > no difference between the 2 lock types. However fixing this may involve
> > > quite a few changes: if we convert the lock to raw we may need to
> > > cascade the conversions to additional locks.  The ones I identified are:
> > > pmu->lock, which would also need to have uncore->lock converted, which
> > > would then probably cascade to quite a few others :-/. I'm not sure
> > > converting uncore->lock will actually be a good thing.
> > 
> > hmm raw_spinlocks for the lowlevel might not be a bad idea, but perhaps
> > we need to convert the other way around the upper levels?
> 
> that would mean:
> 
> <4> [96.733606]  #0: ffff88885f432038 (&cpuctx_lock){....}-{2:2}, at: __perf_install_in_context+0x3f/0x360
> 
> so inside the perf event infra, that has been using raw_spinlock_t
> since forever. I'm surprised we got this only 10 years later :-/.
> I don't think perf can sleep in that context, but Cc'ing a few people
> and lkml for that question.

You very much cannot sleep here. This is hardirq context.

      reply	other threads:[~2024-12-12  9:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09 13:53 [RFT] Revert "lockdep: Enable PROVE_RAW_LOCK_NESTING with PROVE_LOCKING." Luca Coelho
2024-12-09 13:58 ` Luca Coelho
2024-12-09 14:44 ` ✓ CI.Patch_applied: success for " Patchwork
2024-12-09 14:44 ` ✓ CI.checkpatch: " Patchwork
2024-12-09 14:44 ` ✗ CI.KUnit: failure " Patchwork
2024-12-10 11:17 ` ✓ CI.Patch_applied: success for Revert "lockdep: Enable PROVE_RAW_LOCK_NESTING with PROVE_LOCKING." (rev2) Patchwork
2024-12-10 11:17 ` ✓ CI.checkpatch: " Patchwork
2024-12-10 11:19 ` ✓ CI.KUnit: " Patchwork
2024-12-10 11:45 ` ✓ CI.Build: " Patchwork
2024-12-10 11:48 ` ✓ CI.Hooks: " Patchwork
2024-12-10 11:51 ` ✓ CI.checksparse: " Patchwork
2024-12-10 12:19 ` ✓ Xe.CI.BAT: " Patchwork
2024-12-10 13:24 ` ✗ Xe.CI.Full: failure " Patchwork
2024-12-10 17:00 ` [RFT] Revert "lockdep: Enable PROVE_RAW_LOCK_NESTING with PROVE_LOCKING." Lucas De Marchi
2024-12-10 22:55   ` Rodrigo Vivi
2024-12-11  0:00     ` Lucas De Marchi
2024-12-12  9:31       ` Peter Zijlstra [this message]

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=20241212093123.GV21636@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jani.saarinen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.demarchi@intel.com \
    --cc=luciano.coelho@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox