From patchwork Thu Dec 2 12:56:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 73961 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 12AF3B708B for ; Thu, 2 Dec 2010 23:58:32 +1100 (EST) Received: from localhost ([127.0.0.1]:48219 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PO8jw-00019W-BM for incoming@patchwork.ozlabs.org; Thu, 02 Dec 2010 07:58:24 -0500 Received: from [140.186.70.92] (port=53018 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PO8iP-000175-C5 for qemu-devel@nongnu.org; Thu, 02 Dec 2010 07:56:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PO8iG-0004Qv-IW for qemu-devel@nongnu.org; Thu, 02 Dec 2010 07:56:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:27359) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PO8iG-0004QI-AE for qemu-devel@nongnu.org; Thu, 02 Dec 2010 07:56:40 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oB2Cuc7r023786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 2 Dec 2010 07:56:38 -0500 Received: from FreeLancer (dhcp-65-73.nay.redhat.com [10.66.65.73]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oB2CuVLn001727; Thu, 2 Dec 2010 07:56:33 -0500 From: Jason Wang MIME-Version: 1.0 Message-ID: <19703.38782.929586.869640@gargle.gargle.HOWL> Date: Thu, 2 Dec 2010 20:56:30 +0800 To: "Michael S. Tsirkin" Subject: Re: [Qemu-devel] [PATCHv3 4/6] virtio-net: stop/start bh when appropriate In-Reply-To: <20101201060252.GB9199@redhat.com> References: <20101129153718.GA2494@redhat.com> <19701.57573.766694.450729@gargle.gargle.HOWL> <20101201060252.GB9199@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Jason Wang , 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 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. I didn't find any interesting difference by checking the CPUX86State in the dest in kvm_arch_load_regs(), any thought on this? BTW, looks like the error_code was missed in saving the cpu state: diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 35a1a51..145bb38 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -687,7 +687,7 @@ typedef struct CPUX86State { uint64_t pat; /* exception/interrupt handling */ - int error_code; + uint32_t error_code; int exception_is_int; target_ulong exception_next_eip; target_ulong dr[8]; /* debug registers */ @@ -935,7 +935,7 @@ CPUState *pc_new_cpu(const char *cpu_model); #define cpu_list_id x86_cpu_list #define cpudef_setup x86_cpudef_setup -#define CPU_SAVE_VERSION 12 +#define CPU_SAVE_VERSION 13 /* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel diff --git a/target-i386/machine.c b/target-i386/machine.c index 4398801..fa231d8 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -474,6 +474,8 @@ static const VMStateDescription vmstate_cpu = { VMSTATE_UINT64_V(xcr0, CPUState, 12), VMSTATE_UINT64_V(xstate_bv, CPUState, 12), VMSTATE_YMMH_REGS_VARS(ymmh_regs, CPUState, CPU_NB_REGS, 12), + + VMSTATE_UINT32_V(error_code, CPUState, 13), VMSTATE_END_OF_LIST() /* The above list is not sorted /wrt version numbers, watch out! */ }