public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests] kvmclock_test: fix smp initialization
@ 2011-01-13  9:19 Avi Kivity
  0 siblings, 0 replies; only message in thread
From: Avi Kivity @ 2011-01-13  9:19 UTC (permalink / raw)
  To: Marcelo Tosatti, kvm

cpu_count() is not valid before smp_init().

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-13  9:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-13  9:19 [PATCH kvm-unit-tests] kvmclock_test: fix smp initialization Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox