From patchwork Thu Aug 28 11:19:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 383796 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B88F140119 for ; Thu, 28 Aug 2014 21:24:06 +1000 (EST) Received: from localhost ([::1]:35868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMxoC-0000sA-6C for incoming@patchwork.ozlabs.org; Thu, 28 Aug 2014 07:24:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMxjQ-0000XB-29 for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:19:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMxjK-0007gV-1l for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:19:08 -0400 Received: from mail.ispras.ru ([83.149.199.45]:55520) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMxjJ-0007gN-Qh for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:19:01 -0400 Received: from [10.10.150.96] (unknown [80.250.189.177]) by mail.ispras.ru (Postfix) with ESMTPSA id 2FC78540151; Thu, 28 Aug 2014 15:19:01 +0400 (MSK) To: qemu-devel@nongnu.org From: Pavel Dovgalyuk Date: Thu, 28 Aug 2014 15:19:03 +0400 Message-ID: <20140828111903.1624.46920.stgit@PASHA-ISP> In-Reply-To: <20140828111822.1624.24556.stgit@PASHA-ISP> References: <20140828111822.1624.24556.stgit@PASHA-ISP> User-Agent: StGit/0.16 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Cc: pbonzini@redhat.com, zealot351@gmail.com, maria.klimushenkova@ispras.ru, pavel.dovgaluk@ispras.ru Subject: [Qemu-devel] [PATCH v2 07/12] apic_common: vapic_paddr synchronization fix X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch postpones vapic_paddr initialization, which is perfromed by the migration functions. When vapic_paddr is synchronized within the migration process, apic_common functions could operate with incorrect apic state, if it hadn't loaded yet. This patch postpones the synchronization until whole virtual machine state is loaded. Signed-off-by: Pavel Dovgalyuk --- hw/intc/apic_common.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index 2d2dfcb..c3590a6 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -91,13 +91,21 @@ void apic_enable_tpr_access_reporting(DeviceState *dev, bool enable) } } +static void do_apic_enable_vapic(void *data) +{ + APICCommonState *s = APIC_COMMON(data); + APICCommonClass *info = APIC_COMMON_GET_CLASS(s); + + info->vapic_base_update(s); +} + void apic_enable_vapic(DeviceState *dev, hwaddr paddr) { APICCommonState *s = APIC_COMMON(dev); APICCommonClass *info = APIC_COMMON_GET_CLASS(s); s->vapic_paddr = paddr; - info->vapic_base_update(s); + run_on_cpu(CPU(s->cpu), do_apic_enable_vapic, s); } void apic_handle_tpr_access_report(DeviceState *dev, target_ulong ip,