From patchwork Wed Sep 12 15:03:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 1444621 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id D2DC74025E for ; Wed, 12 Sep 2012 15:03:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758857Ab2ILPDl (ORCPT ); Wed, 12 Sep 2012 11:03:41 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:60069 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755549Ab2ILPDk (ORCPT ); Wed, 12 Sep 2012 11:03:40 -0400 Received: by mail-ob0-f174.google.com with SMTP id uo13so2764198obb.19 for ; Wed, 12 Sep 2012 08:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=SJLgsj4OMrAAO49I4AhQdbhWsQBTDyuIypDQ8hRmrVk=; b=qFBSa+UvD+bhKNY0lybQrFm9jn5I3DBMUeIaY/BUI5nky6JeQ9722vvtam2GzgKt+X K+AZhenV/SFfLf3JRF39dXBkDxWxQkOdBLi3ja4RTtcXuBpTe/VhPBL+P3IuwzpPjoJy 7yPN2RJdXFzus6gcB9eio5cKaSxYftyfRop2hxOiyziwVAw0a5/QMF7Z7CWpxXxHLUMq 520ERRU5D1ta+mxE+xMN0p5xgeq9/GYLGQHLfWCOF2DG2gq798x2DD1LSkbhjxt5CK6d yVpuddIHaEAMeIpCk/W8AmHpyOQJgojuIISUiUdJBg4hLMKBsWTFE/bIp8JCFBotU0RY UNzg== Received: by 10.182.187.98 with SMTP id fr2mr22857065obc.73.1347462219952; Wed, 12 Sep 2012 08:03:39 -0700 (PDT) Received: from hj.localdomain.com ([58.194.229.103]) by mx.google.com with ESMTPS id qd7sm20379284obc.5.2012.09.12.08.03.35 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Sep 2012 08:03:39 -0700 (PDT) From: Asias He To: Pekka Enberg Cc: Sasha Levin , Ingo Molnar , Cyrill Gorcunov , kvm@vger.kernel.org Subject: [PATCH 2/2] kvm tools: Bring SMP back Date: Wed, 12 Sep 2012 23:03:36 +0800 Message-Id: <1347462216-18641-2-git-send-email-asias.hejun@gmail.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1347462216-18641-1-git-send-email-asias.hejun@gmail.com> References: <1347462216-18641-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We have this currently: kvm__init() kvm__arch_setup_firmware() mptable__init() using kvm->nrcpus kvm_cpu__init() kvm->nrcpus = kvm->cfg.nrcpus kvm->nrcpus is used in mptable__init() before it is initialized, so mptable__init() will setup a wrong mp table. Before: $ ./lkvm -c 4 $ cat /proc/cpuinfo |grep ^processor|wc -l 1 After: $ ./lkvm -c 4 $ cat /proc/cpuinfo |grep ^processor|wc -l 4 Signed-off-by: Asias He --- tools/kvm/builtin-run.c | 7 ------- tools/kvm/kvm.c | 6 ++++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c index 5ddffaa..790b496 100644 --- a/tools/kvm/builtin-run.c +++ b/tools/kvm/builtin-run.c @@ -656,19 +656,12 @@ static int kvm_cmd_run_init(int argc, const char **argv) goto fail; } - r = ioeventfd__init(kvm); if (r < 0) { pr_err("ioeventfd__init() failed with error %d\n", r); goto fail; } - r = kvm_cpu__init(kvm); - if (r < 0) { - pr_err("kvm_cpu__init() failed with error %d\n", r); - goto fail; - } - r = irq__init(kvm); if (r < 0) { pr_err("irq__init() failed with error %d\n", r); diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c index cca2e93..4fdad92 100644 --- a/tools/kvm/kvm.c +++ b/tools/kvm/kvm.c @@ -248,6 +248,12 @@ int kvm__init(struct kvm *kvm) kvm__init_ram(kvm); + ret = kvm_cpu__init(kvm); + if (ret < 0) { + pr_err("kvm_cpu__init() failed with error %d\n", ret); + goto err_vm_fd; + } + if (!kvm->cfg.firmware_filename) { if (!kvm__load_kernel(kvm, kvm->cfg.kernel_filename, kvm->cfg.initrd_filename, kvm->cfg.real_cmdline, kvm->cfg.vidmode))