From: Peter Zijlstra <peterz@infradead.org>
To: Rik van Riel <riel@surriel.com>
Cc: Borislav Petkov <bp@alien8.de>,
linux-kernel@vger.kernel.org, dave.hansen@linux.intel.com,
luto@kernel.org, tglx@linutronix.de, mingo@redhat.com,
x86@kernel.org, kernel-team@meta.com, hpa@zytor.com,
bigeasy@linutronix.de
Subject: Re: [PATCh 0/3] x86,tlb: context switch optimizations
Date: Thu, 14 Nov 2024 12:33:03 +0100 [thread overview]
Message-ID: <20241114113303.GN6497@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20241113093826.667c4918@imladris.surriel.com>
On Wed, Nov 13, 2024 at 09:38:26AM -0500, Rik van Riel wrote:
> On Wed, 13 Nov 2024 10:55:50 +0100
> Borislav Petkov <bp@alien8.de> wrote:
> On Fri, Nov 08, 2024 at 07:27:47PM -0500, Rik van Riel wrote:
> > > While profiling switch_mm_irqs_off with several workloads,
> > > it appears there are two hot spots that probably don't need
> > > to be there.
> >
> > One of those three is causing the below here, zapping them from tip.
> >
>
> This is interesting, and unexpected.
>
> > [ 3.186469] ------------[ cut here ]------------
> > [ 3.186469] WARNING: CPU: 16 PID: 97 at kernel/smp.c:807
> > smp_call_function_many_cond+0x188/0x720
>
> This is the lockdep_assert_irqs_enabled() from this branch:
>
> if (cpu_online(this_cpu) && !oops_in_progress &&
> !early_boot_irqs_disabled)
> lockdep_assert_irqs_enabled();
>
> > [ 3.186469] Call Trace:
> > [ 3.186469] <TASK>
> > [ 3.186469] on_each_cpu_cond_mask+0x50/0x90
> > [ 3.186469] flush_tlb_mm_range+0x1a8/0x1f0
> > [ 3.186469] __text_poke+0x366/0x5d0
>
> ... and sure enough, it looks like __text_poke() calls
> flush_tlb_mm_range() with IRQs disabled!
>
> > [ 3.186469] text_poke_bp_batch+0xa1/0x3d0
> > [ 3.186469] text_poke_finish+0x1b/0x30
> > [ 3.186469] arch_jump_label_transform_apply+0x18/0x30
> > [ 3.186469] static_key_slow_inc_cpuslocked+0x55/0xa0
> ...
>
> I have no good explanation for why that lockdep_assert_irqs_enabled()
> would not be firing without my patches applied.
>
> We obviously should not be sending out any IPIs with IRQs disabled.
>
> However, __text_poke has been sending IPIs with interrupts disabled
> for 4 years now! No wonder we see deadlocks involving __text_poke
> on a semi-regular basis.
I don't think we have. Isn't the problem with patch 1, where we
unuse_temporary_mm() now fails to clear the bit, with the direct result
being that flush_tlb_mm_range() now thinks it should be doing IPIs,
where previously it was a strict CPU local affair.
next prev parent reply other threads:[~2024-11-14 11:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-09 0:27 [PATCh 0/3] x86,tlb: context switch optimizations Rik van Riel
2024-11-09 0:27 ` [PATCH 1/3] x86,tlb: update mm_cpumask lazily Rik van Riel
2024-11-13 2:59 ` [tip: x86/mm] x86/mm/tlb: Update " tip-bot2 for Rik van Riel
2024-11-09 0:27 ` [PATCH 2/3] x86,tlb: add tracepoint for TLB flush IPI to stale CPU Rik van Riel
2024-11-13 2:59 ` [tip: x86/mm] x86/mm/tlb: Add " tip-bot2 for Rik van Riel
2024-11-09 0:27 ` [PATCH 3/3] x86,tlb: put cpumask_test_cpu in prev == next under CONFIG_DEBUG_VM Rik van Riel
2024-11-13 2:59 ` [tip: x86/mm] x86/mm/tlb: Put cpumask_test_cpu() check in switch_mm_irqs_off() " tip-bot2 for Rik van Riel
2024-11-13 9:55 ` [PATCh 0/3] x86,tlb: context switch optimizations Borislav Petkov
2024-11-13 10:00 ` Ingo Molnar
2024-11-13 14:38 ` Rik van Riel
2024-11-14 11:33 ` Peter Zijlstra [this message]
2024-11-13 14:55 ` Rik van Riel
2024-11-14 9:52 ` Ingo Molnar
2024-11-14 11:36 ` Peter Zijlstra
2024-11-14 14:27 ` Rik van Riel
2024-11-14 14:40 ` Peter Zijlstra
2024-11-14 11:36 ` Peter Zijlstra
2024-11-14 11:43 ` Peter Zijlstra
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=20241114113303.GN6497@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bigeasy@linutronix.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=riel@surriel.com \
--cc=tglx@linutronix.de \
--cc=x86@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