From: Yong Zhang <yong.zhang0@gmail.com>
To: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
ralf@linux-mips.org, sshtylyov@mvista.com,
david.daney@cavium.com
Subject: Re: [PATCH 6/8] MIPS: call set_cpu_online() on the uping cpu with irq disabled
Date: Tue, 22 May 2012 14:21:27 +0800 [thread overview]
Message-ID: <20120522062126.GB12098@zhy> (raw)
In-Reply-To: <4FBA1B54.3@linux.vnet.ibm.com>
On Mon, May 21, 2012 at 04:09:16PM +0530, Srivatsa S. Bhat wrote:
> On 05/21/2012 11:30 AM, Yong Zhang wrote:
>
> > From: Yong Zhang <yong.zhang@windriver.com>
> >
> > To prevent a problem as commit 5fbd036b [sched: Cleanup cpu_active madness]
> > and commit 2baab4e9 [sched: Fix select_fallback_rq() vs cpu_active/cpu_online]
> > try to resolve, move set_cpu_online() to the brought up CPU and with irq
> > disabled.
> >
> > Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
> > Acked-by: David Daney <david.daney@cavium.com>
> > ---
> > arch/mips/kernel/smp.c | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
> > index 73a268a..042145f 100644
> > --- a/arch/mips/kernel/smp.c
> > +++ b/arch/mips/kernel/smp.c
> > @@ -122,6 +122,8 @@ asmlinkage __cpuinit void start_secondary(void)
> >
> > notify_cpu_starting(cpu);
> >
> > + set_cpu_online(cpu, true);
> > +
>
>
> You will also need to use ipi_call_lock/unlock() around this.
> See how x86 does it. (MIPS also selects USE_GENERIC_SMP_HELPERS).
Hmm... But look at the comments in arch/x86/kernel/smpboot.c::start_secondary()
start_secondary()
{
...
/*
* We need to hold call_lock, so there is no inconsistency
* between the time smp_call_function() determines number of
* IPI recipients, and the time when the determination is made
* for which cpus receive the IPI. Holding this
* lock helps us to not include this cpu in a currently in progress
* smp_call_function().
*
* We need to hold vector_lock so there the set of online cpus
* does not change while we are assigning vectors to cpus. Holding
* this lock ensures we don't half assign or remove an irq from a cpu.
*/
ipi_call_lock();
lock_vector_lock();
set_cpu_online(smp_processor_id(), true);
unlock_vector_lock();
ipi_call_unlock();
...
}
which ipi_call_lock()/ipi_call_unlock() is to pretect race with concurrent
smp_call_function(), but it seems that is already broken, because
1) The comments is alread there before we switch to generic smp helper(commit
3b16cf87), and at that time the comments is true because
smp_call_function_interrupt() doesn't test if a cpu should handle the
IPI interrupt.
But in the gereric smp helper, we have checked if a cpu should handle the IPI
in generic_smp_call_function_interrupt():
if (!cpumask_test_cpu(cpu, data->cpumask))
continue;
2) call_function.lock used in smp_call_function_many() is just to protect
call_function.queue and &data->refs, cpu_online_mask is outside of the
lock. And I don't think it's necessary to protect cpu_online_mask,
because data->cpumask is pre-calculate and even if a cpu is brougt up
when calling arch_send_call_function_ipi_mask(), it's harmless because
validation test in generic_smp_call_function_interrupt() will take care
of it.
3) For cpu down issue, stop_machine() will guarantee that no concurrent
smp_call_fuction() is processing.
So it seems ipi_call_lock()/ipi_call_unlock() is not needed and could be
removed IMHO.
Or am I missing something?
Thanks,
Yong
next prev parent reply other threads:[~2012-05-22 6:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-21 6:00 [V1 PATCH 0/8] patchset focus on MIPS SMP woes Yong Zhang
2012-05-21 6:00 ` [PATCH 1/8] MIPS: Octeon: delay enable irq to ->smp_finish() Yong Zhang
2012-05-21 6:00 ` [PATCH 2/8] MIPS: BMIPS: delay irq enable " Yong Zhang
2012-05-21 6:00 ` [PATCH 3/8] MIPS: SMTC: " Yong Zhang
2012-05-21 6:00 ` [PATCH 4/8] MIPS: Yosemite: " Yong Zhang
2012-05-21 6:00 ` [PATCH 5/8] MIPS: call ->smp_finish() a little late Yong Zhang
2012-05-21 6:00 ` [PATCH 6/8] MIPS: call set_cpu_online() on the uping cpu with irq disabled Yong Zhang
2012-05-21 10:30 ` Sergei Shtylyov
2012-05-22 5:33 ` Yong Zhang
2012-05-21 10:39 ` Srivatsa S. Bhat
2012-05-22 6:21 ` Yong Zhang [this message]
2012-05-28 12:04 ` Srivatsa S. Bhat
2012-05-29 6:52 ` Yong Zhang
2012-05-21 6:00 ` [PATCH 7/8] MIPS: smp: Warn on too early irq enable Yong Zhang
2012-05-21 6:00 ` [PATCH 8/8] MIPS: sync-r4k: remove redundant irq operation Yong Zhang
-- strict thread matches above, loose matches on Subject: below --
2012-05-17 10:10 [PATCH 0/8] patchset focus on MIPS SMP woes Yong Zhang
2012-05-17 10:10 ` [PATCH 6/8] MIPS: call set_cpu_online() on the uping cpu with irq disabled Yong Zhang
2012-05-17 10:59 ` Sergei Shtylyov
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=20120522062126.GB12098@zhy \
--to=yong.zhang0@gmail.com \
--cc=david.daney@cavium.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=sshtylyov@mvista.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