From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [PATCH kvm-unit-tests] kvmclock_test: fix smp initialization Date: Thu, 13 Jan 2011 11:19:42 +0200 Message-ID: <1294910382-29485-1-git-send-email-avi@redhat.com> To: Marcelo Tosatti , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:47377 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932532Ab1AMJT4 (ORCPT ); Thu, 13 Jan 2011 04:19:56 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0D9Jt4s004097 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 13 Jan 2011 04:19:55 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0D9Jst9007097 for ; Thu, 13 Jan 2011 04:19:55 -0500 Sender: kvm-owner@vger.kernel.org List-ID: cpu_count() is not valid before smp_init(). Signed-off-by: Avi Kivity --- x86/kvmclock_test.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/x86/kvmclock_test.c b/x86/kvmclock_test.c index 5b14ae2..52a43fb 100644 --- a/x86/kvmclock_test.c +++ b/x86/kvmclock_test.c @@ -115,7 +115,7 @@ static int cycle_test(int ncpus, long loops, int check, struct test_info *ti) int main(int ac, char **av) { - int ncpus = cpu_count(); + int ncpus; int nerr = 0, i; long loops = DEFAULT_TEST_LOOPS; long sec = 0; @@ -130,6 +130,7 @@ int main(int ac, char **av) smp_init(); + ncpus = cpu_count(); if (ncpus > MAX_CPU) ncpus = MAX_CPU; for (i = 0; i < ncpus; ++i) -- 1.7.1