From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Xu Subject: Re: [kvm-unit-tests PATCH 02/14] x86: smp: allow multiple init for smp setup Date: Thu, 20 Oct 2016 16:27:33 +0800 Message-ID: <20161020082733.GJ15168@pxdev.xzpeter.org> References: <1476448852-30062-1-git-send-email-peterx@redhat.com> <1476448852-30062-3-git-send-email-peterx@redhat.com> <20161020082030.bsoekdpkw4g2difi@kamzik.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: kvm@vger.kernel.org, jan.kiszka@web.de, agordeev@redhat.com, rkrcmar@redhat.com, pbonzini@redhat.com To: Andrew Jones Return-path: Received: from mx1.redhat.com ([209.132.183.28]:49916 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752401AbcJTI1i (ORCPT ); Thu, 20 Oct 2016 04:27:38 -0400 Content-Disposition: inline In-Reply-To: <20161020082030.bsoekdpkw4g2difi@kamzik.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Oct 20, 2016 at 10:20:30AM +0200, Andrew Jones wrote: > On Fri, Oct 14, 2016 at 08:40:40PM +0800, Peter Xu wrote: > > Signed-off-by: Peter Xu > > --- > > lib/x86/smp.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/lib/x86/smp.c b/lib/x86/smp.c > > index 1eb49f2..bb74087 100644 > > --- a/lib/x86/smp.c > > +++ b/lib/x86/smp.c > > @@ -111,8 +111,13 @@ void on_cpu_async(int cpu, void (*function)(void *data), void *data) > > void smp_init(void) > > { > > int i; > > + bool smp_inited = false; > > void ipi_entry(void); > > > > + if (smp_inited) { > > + return; > > + } > > + > > _cpu_count = fwcfg_get_nb_cpus(); > > > > setup_idt(); > > @@ -122,4 +127,5 @@ void smp_init(void) > > for (i = 1; i < cpu_count(); ++i) > > on_cpu(i, setup_smp_id, 0); > > > > + smp_inited = true; > > } > > -- > > 2.7.4 > > Same comment as last patch. How about > > assert(!_cpu_count) Will fix. Thanks! -- peterx