From patchwork Thu Dec 2 18:27:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 74010 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 D7E27B70AF for ; Fri, 3 Dec 2010 05:31:16 +1100 (EST) Received: from localhost ([127.0.0.1]:54842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PODw1-00062c-4W for incoming@patchwork.ozlabs.org; Thu, 02 Dec 2010 13:31:13 -0500 Received: from [140.186.70.92] (port=54678 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PODtb-0003u7-DJ for qemu-devel@nongnu.org; Thu, 02 Dec 2010 13:29:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PODsb-0001bT-LJ for qemu-devel@nongnu.org; Thu, 02 Dec 2010 13:28:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:10376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PODsb-0001b6-DW for qemu-devel@nongnu.org; Thu, 02 Dec 2010 13:27:41 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oB2IRdkx026487 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 2 Dec 2010 13:27:40 -0500 Received: from redhat.com (vpn-200-18.tlv.redhat.com [10.35.200.18]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id oB2IRa2K027727; Thu, 2 Dec 2010 13:27:37 -0500 Date: Thu, 2 Dec 2010 20:27:22 +0200 From: "Michael S. Tsirkin" To: Jason Wang , kwolf@redhat.com Subject: Re: [Qemu-devel] [PATCHv3 4/6] virtio-net: stop/start bh when appropriate Message-ID: <20101202182722.GA7211@redhat.com> References: <20101129153718.GA2494@redhat.com> <19701.57573.766694.450729@gargle.gargle.HOWL> <20101201060252.GB9199@redhat.com> <19703.38782.929586.869640@gargle.gargle.HOWL> <20101202130823.GD2454@redhat.com> <19703.43787.213477.834653@gargle.gargle.HOWL> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <19703.43787.213477.834653@gargle.gargle.HOWL> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: mtosatti@redhat.com, qemu-devel@nongnu.org, quintela@redhat.com 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 Thu, Dec 02, 2010 at 10:19:55PM +0800, Jason Wang wrote: > Michael S. Tsirkin writes: > > On Thu, Dec 02, 2010 at 08:56:30PM +0800, Jason Wang wrote: > > > Michael S. Tsirkin writes: > > > > On Wed, Dec 01, 2010 at 01:45:09PM +0800, Jason Wang wrote: > > > > > Michael S. Tsirkin writes: > > > > > > Avoid sending out packets, and modifying > > > > > > device state, when VM is stopped. > > > > > > Add assert statements to verify this does not happen. > > > > > > > > > > > > Avoid scheduling bh when vhost-net is started. > > > > > > > > > > > > Stop bh when driver disabled bus mastering > > > > > > (we must not access memory after this). > > > > > > > > > > > > Signed-off-by: Michael S. Tsirkin > > > > > > > > > > > > > > > > There's no need to disable it bh we call qemu_aio_flush() after > > > > > vm_state_notify() in do_vm_stop(). And for timer, looks like every device should > > > > > stop its timer in vm state change handler, not only for virtio-net? > > > > > > > > BTW I fixed some typos. Here a fixed version. > > > > Jason, could you review/test please? > > > > > > > > > > Have done the test, it's more stable than before but still get small deltas in > > > cpu section. > > > > And just to clarify: no more deltas in the memory section? > > > > Yes. > > And the offset for cpu section is 1161-1165 and sometimes I get deltas for ide > section at offset 295 and 314. Kevin, could you take a look please? Jason, does the following do anything? Subject: ide: cancel bh on vm stop If bh is running on vm stop, ide state might change after vm stop is completed. Solve by deleting bh on stop. Signed-off-by: Michael S. Tsirkin diff --git a/hw/ide/core.c b/hw/ide/core.c index 484e0ca..8d86114 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -698,8 +698,13 @@ void ide_dma_restart_cb(void *opaque, int running, int reason) { BMDMAState *bm = opaque; - if (!running) + if (!running) { + if (bm->bh) { + qemu_bh_delete(bm->bh); + bm->bh = NULL; + } return; + } if (!bm->bh) { bm->bh = qemu_bh_new(ide_dma_restart_bh, bm);