From patchwork Fri Apr 9 16:12:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jun Koi X-Patchwork-Id: 49853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 557C0B7CF7 for ; Sat, 10 Apr 2010 02:19:50 +1000 (EST) Received: from localhost ([127.0.0.1]:42039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0Gvr-00084f-Ha for incoming@patchwork.ozlabs.org; Fri, 09 Apr 2010 12:19:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O0GpD-0000y3-9I for qemu-devel@nongnu.org; Fri, 09 Apr 2010 12:12:55 -0400 Received: from [140.186.70.92] (port=54462 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0GpA-0000w2-BX for qemu-devel@nongnu.org; Fri, 09 Apr 2010 12:12:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O0Gp8-0007Ol-T0 for qemu-devel@nongnu.org; Fri, 09 Apr 2010 12:12:51 -0400 Received: from mail-pw0-f45.google.com ([209.85.160.45]:54020) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0Gp7-0007OV-SM for qemu-devel@nongnu.org; Fri, 09 Apr 2010 12:12:50 -0400 Received: by pwi6 with SMTP id 6so2816056pwi.4 for ; Fri, 09 Apr 2010 09:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:received:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=UVT3jbrNmet4kmmTLJEekfzIVjKKERkUUXpH8ipxwl4=; b=AW6Nq9fBi8tmLQQgJoLGy3UDvNVxgrFmHxkoy05goMq3SWe+nXiueJwwPczKnccDp+ oT8EscnTIyoD3L779u6XFV36WIbbT7kyXe3SURnD8dB6GVLxjLXAkgGQDIqnYiQTnTgU ig+JkhTmGKZ/7/DAY0CK0bQkL9qsGCyfckpqI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=SnaiTfeTzNP3qmY2YvPhU6jRE208oXpVKbLx1A5/H0vdJNrsz3/F75sO2p0eJwkS4K NnQ77aDtu4d3AwpbCJN1C0s6mFsOWwJ9bhTriAI6MGpCHeyxCrhewuHOVrtBKbYdFoZW l/8q3QFFj8eggQ3gJJ5O86pjJ6fM2lr0aqaOk= MIME-Version: 1.0 Received: by 10.114.80.15 with HTTP; Fri, 9 Apr 2010 09:12:27 -0700 (PDT) In-Reply-To: <20100409102051.532ce0e8@redhat.com> References: <20100409102051.532ce0e8@redhat.com> From: Jun Koi Date: Sat, 10 Apr 2010 01:12:27 +0900 Received: by 10.114.237.24 with SMTP id k24mr476618wah.29.1270829567408; Fri, 09 Apr 2010 09:12:47 -0700 (PDT) Message-ID: Subject: Re: [Qemu-devel] Weird thing happen when the VM is stop! (0.12.3) To: Luiz Capitulino , mtosatti@redhat.com, pbonzini@redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: qemu-devel@nongnu.org X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Fri, Apr 9, 2010 at 10:20 PM, Luiz Capitulino wrote: > On Fri, 9 Apr 2010 18:32:21 +0900 > Jun Koi wrote: > >> Hi, >> >> I found something very funny happening with 0.12.3: it seems the VM is >> still running even I already stopped it. >> >> Here is how I verified that: Boot any OS (I checked with Windows XP >> and Ubuntu) with 0.12.3, and stop it any time after it booted up. Use >> "stop" command on monitor interface. >> >> Now the VM stops. Then in the same monitor interface, run "info >> registers" again and again. You can see that the value of EIP and >> EFLAGS still change once in a while. This should not happen, becaues >> the VM already stopped. >> >> I checked, and dont see this problem with 0.11.1. And this doesnt >> happen with the latest code in the git tree, either. >> >> Any idea on why this happens??? > >  Can you try commit 55274a305 ? If it fixes the problem we need it > in stable, if it doesn't you can try to find the fix by using git bisect. > This hint makes sense, but the point is that I tried with some commits before that 55274a305, and didnt see the problem. Still I am not sure the problem is already fixed before 55274a305, or I am just unlucky enough not see the problem when testing. After bisecting, I can say that the culprit is the below patch, from Marcelo. Now I am wondering if the above commit 55274a305 of Paolo Bonzini fixed the bug, or other commit before that?? We should find the correct fix, and port it to 0.12.4. Thanks, J commit 535d2eb34a0f1908dc694c51ce8d4ec6dccc7807 Author: Marcelo Tosatti Date: Tue Feb 9 12:49:04 2010 -0200 iothread: fix vcpu stop with smp tcg Round robin vcpus in tcg_cpu_next even if the vm stopped. This allows all cpus to enter stopped state. Signed-off-by: Marcelo Tosatti Signed-off-by: Anthony Liguori (cherry picked from commit c37cc7b072fa4ca8d8d21ac31d26baff5f47f9f9) diff --git a/vl.c b/vl.c index 007709a..3b5a8e0 100644 --- a/vl.c +++ b/vl.c @@ -4042,14 +4042,15 @@ static void tcg_cpu_exec(void) for (; next_cpu != NULL; next_cpu = next_cpu->next_cpu) { CPUState *env = cur_cpu = next_cpu; - if (!vm_running) - break; if (timer_alarm_pending) { timer_alarm_pending = 0; break; } if (cpu_can_run(env)) ret = qemu_cpu_exec(env); + else if (env->stop) + break; + if (ret == EXCP_DEBUG) { gdb_set_stop_cpu(env); debug_requested = 1;