kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] kvm tools: Move -O2 back to CFLAGS
@ 2012-09-12 15:03 Asias He
  2012-09-12 15:03 ` [PATCH 2/2] kvm tools: Bring SMP back Asias He
  0 siblings, 1 reply; 3+ messages in thread
From: Asias He @ 2012-09-12 15:03 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Sasha Levin, Ingo Molnar, Cyrill Gorcunov, kvm

commit 06e66483d54e58eca70abc52ca74f1489226cdbe
chagned to -O0 accidentally. Change it back.

Signed-off-by: Asias He <asias.hejun@gmail.com>
---
 tools/kvm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile
index efa3d4f..0e2fa66 100644
--- a/tools/kvm/Makefile
+++ b/tools/kvm/Makefile
@@ -243,7 +243,7 @@ DEFINES	+= -DKVMTOOLS_VERSION='"$(KVMTOOLS_VERSION)"'
 DEFINES	+= -DBUILD_ARCH='"$(ARCH)"'
 
 KVM_INCLUDE := include
-CFLAGS	+= $(CPPFLAGS) $(DEFINES) -I$(KVM_INCLUDE) -I$(ARCH_INCLUDE) -I$(KINCL_PATH)/include -I$(KINCL_PATH)/arch/$(ARCH)/include/ -O0 -fno-strict-aliasing -g -flto
+CFLAGS	+= $(CPPFLAGS) $(DEFINES) -I$(KVM_INCLUDE) -I$(ARCH_INCLUDE) -I$(KINCL_PATH)/include -I$(KINCL_PATH)/arch/$(ARCH)/include/ -O2 -fno-strict-aliasing -g -flto
 
 WARNINGS += -Wall
 WARNINGS += -Wcast-align
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] kvm tools: Bring SMP back
  2012-09-12 15:03 [PATCH 1/2] kvm tools: Move -O2 back to CFLAGS Asias He
@ 2012-09-12 15:03 ` Asias He
  2012-09-12 15:10   ` Cyrill Gorcunov
  0 siblings, 1 reply; 3+ messages in thread
From: Asias He @ 2012-09-12 15:03 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Sasha Levin, Ingo Molnar, Cyrill Gorcunov, kvm

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 <asias.hejun@gmail.com>
---
 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))
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] kvm tools: Bring SMP back
  2012-09-12 15:03 ` [PATCH 2/2] kvm tools: Bring SMP back Asias He
@ 2012-09-12 15:10   ` Cyrill Gorcunov
  0 siblings, 0 replies; 3+ messages in thread
From: Cyrill Gorcunov @ 2012-09-12 15:10 UTC (permalink / raw)
  To: Asias He; +Cc: Pekka Enberg, Sasha Levin, Ingo Molnar, kvm

On Wed, Sep 12, 2012 at 11:03:36PM +0800, Asias He wrote:
> 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 <asias.hejun@gmail.com>

Good catch!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-12 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-12 15:03 [PATCH 1/2] kvm tools: Move -O2 back to CFLAGS Asias He
2012-09-12 15:03 ` [PATCH 2/2] kvm tools: Bring SMP back Asias He
2012-09-12 15:10   ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).