public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: [PATCH kvm-unit-tests] kvmclock_test: fix smp initialization
Date: Thu, 13 Jan 2011 11:19:42 +0200	[thread overview]
Message-ID: <1294910382-29485-1-git-send-email-avi@redhat.com> (raw)

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


                 reply	other threads:[~2011-01-13  9:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1294910382-29485-1-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.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