From: Jeremy Fitzhardinge <jeremy@goop.org>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>, hpa <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: x86: unify genapic code, unify subarchitectures, remove old subarchitecture code
Date: Sun, 15 Feb 2009 14:48:42 -0800 [thread overview]
Message-ID: <49989BCA.9090606@goop.org> (raw)
In-Reply-To: <1234719693.3299.7.camel@localhost.localdomain>
James Bottomley wrote:
> Agree this is a nasty problem. However, I can't see any reason why
> smp_call_function_many() needs to allocate in the wait case ... and the
> tlb flushing code would be using the wait case. What about this fix to
> the generic SMP code (cc'd Jens) that would allow us to take on stack
> data and the fast path all the time?
>
That's how it used to be, but there's a subtle race. When using
allocated list elements, the lifetime of the allocated blocks is managed
via rcu. When an element is deleted with list_del_rcu(), another cpu
can still be using its ->next pointer, and so the memory for that list
entry can't be freed early. If it is stack-allocated, then the memory
will get re-allocated when the calling function returns, which will
trash the ->next pointer that another cpu is still relying on.
> By the way, I can see us building up stack runoff danger for the large
> CPU machines, so the on stack piece could be limited to a maximal CPU
> cap beyond which it has to kmalloc ... the large CPU machines would
> still probably pick up scaling benefits in that case ... thoughts?
>
It looks like Peter Z just posted some patches to remove kmalloc from
this path ("generic smp helpers vs kmalloc"). Ah, he's addressed the
point above:
Also, since we cannot simply remove an item from the global queue
(another
cpu might be observing it), a quiesence of sorts needs to be
observed. The
current code uses regular RCU for that purpose.
However, since we'll be wanting to quickly reuse an item, we need
something
with a much faster turn-around. We do this by simply observing the
global
queue quiesence. Since there are a limited number of elements, it
will auto
force a quiecent state if we wait for it.
(Haven't read the patches in detail yet.)
> Yes ... will do. If we can't make the unified non-IPI version work fast
> enough, then both of us can share the call function version.
>
Xen does cross-cpu tlb flush via hypercall, because Xen knows which real
CPUs (if any) have stale vcpu tlb state (there's no point scheduling a
non-running vcpu just to flush its tlb).
J
> - data = kmalloc(sizeof(*data) + cpumask_size(), GFP_ATOMIC);
> + if (wait)
> + data = &stack_data.d;
> + else
> + data = kmalloc(sizeof(*data) + cpumask_size(), GFP_ATOMIC);
>
You're still leaving CSD_FLAG_ALLOC set?
> if (unlikely(!data)) {
> /* Slow path. */
> for_each_online_cpu(cpu) {
>
>
next prev parent reply other threads:[~2009-02-15 22:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-08 14:16 x86: unify genapic code, unify subarchitectures, remove old subarchitecture code James Bottomley
2009-02-08 16:56 ` Jeremy Fitzhardinge
2009-02-15 17:41 ` James Bottomley
2009-02-15 22:48 ` Jeremy Fitzhardinge [this message]
2009-02-22 23:25 ` Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2009-01-28 23:41 Ingo Molnar
2009-01-29 1:52 ` Suresh Siddha
2009-01-29 11:27 ` Ingo Molnar
2009-01-29 20:11 ` Suresh Siddha
2009-01-29 20:26 ` Ingo Molnar
2009-01-29 14:02 ` Andi Kleen
2009-01-29 20:36 ` Yinghai Lu
2009-01-29 21:04 ` H. Peter Anvin
2009-01-29 21:24 ` Tim Pepper
2009-01-29 22:14 ` Ingo Molnar
2009-01-29 22:19 ` Valdis.Kletnieks
2009-01-29 22:58 ` Tim Pepper
2009-01-29 23:27 ` Ingo Molnar
2009-01-30 9:01 ` Andi Kleen
2009-01-29 22:29 ` Ingo Molnar
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=49989BCA.9090606@goop.org \
--to=jeremy@goop.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=a.p.zijlstra@chello.nl \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.