From: Ingo Molnar <mingo@elte.hu>
To: Tejun Heo <tj@kernel.org>
Cc: Nick Piggin <npiggin@suse.de>, Jiri Kosina <jkosina@suse.cz>,
Peter Zijlstra <peterz@infradead.org>,
Yinghai Lu <yhlu.kernel@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
cl@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: irq lock inversion
Date: Fri, 6 Nov 2009 09:40:41 +0100 [thread overview]
Message-ID: <20091106084041.GA22505@elte.hu> (raw)
In-Reply-To: <4AF3DD30.8050200@kernel.org>
* Tejun Heo <tj@kernel.org> wrote:
> Hello, Ingo.
>
> Ingo Molnar wrote:
> > I havent looked deeply but at first sight i'm not 100% sure that even
> > the lock dance hack is safe - doesnt vfree() do TLB flushes, which must
> > be done with irqs enabled in general? If yes, then the whole notion of
> > using the allocator from irqs-off sections is wrong and the flags
> > save/restore is misguided (or at least incomplete).
>
> The only place where any v*() call is nested under pcpu_lock is in the
> alloc path, specifically pcpu_extend_area_map() ends up calling
> vfree(). pcpu_free() path which can be called from irq context never
> calls any vmalloc function directly. The reclaiming is deferred to a
> work. Breaking the single nesting completely decouples the two locks
> and nobody would be calling vfree() with irq disabled, so I don't
> think there will be any problem.
My question is, why do we do flags save/restore in pcpu-alloc? Do we
ever call it with irqs disabled? If yes, then the vfree might be unsafe
due to vfree() potentially flushing TLBs (on all CPUs) and that act of
sending IPIs requiring irqs to be enabled.
( Now, Nick has optimized vfree recently to lazy-free areas, but that
was a statistical optimization: TLB flushes are still possible, just
done more rarely. So we might end up calling flush_tlb_kernel_range()
from vfree(). I've Cc:-ed Nick. )
Ingo
next prev parent reply other threads:[~2009-11-06 8:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <86802c440911041008q4969b9bdk15b4598c40bb84bd@mail.gmail.com>
[not found] ` <4AF25FC7.4000502@kernel.org>
[not found] ` <20091105082102.GA2870@elte.hu>
[not found] ` <4AF28D7A.6020209@kernel.org>
2009-11-05 14:31 ` irq lock inversion Jiri Kosina
2009-11-06 5:53 ` Tejun Heo
2009-11-06 7:17 ` Ingo Molnar
2009-11-06 7:45 ` Tejun Heo
2009-11-06 7:58 ` Ingo Molnar
2009-11-06 8:24 ` Tejun Heo
2009-11-06 8:40 ` Ingo Molnar [this message]
2009-11-06 8:52 ` Tejun Heo
2009-11-06 16:08 ` Christoph Lameter
2009-11-06 16:38 ` Tejun Heo
2009-11-06 17:03 ` Christoph Lameter
2009-11-07 16:13 ` Peter Zijlstra
2009-11-09 5:46 ` [PATCH percpu#for-linus] percpu: fix possible deadlock via " Tejun Heo
2009-11-06 9:59 ` Jens Axboe
2009-11-08 9:38 ` Ingo Molnar
2009-11-09 15:34 ` Jens Axboe
2009-11-09 15:45 ` Ingo Molnar
2009-11-09 15:49 ` Jens Axboe
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=20091106084041.GA22505@elte.hu \
--to=mingo@elte.hu \
--cc=cl@linux-foundation.org \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=yhlu.kernel@gmail.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