From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3rRp-0000Ee-FR for qemu-devel@nongnu.org; Mon, 29 Jul 2013 13:41:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3rRl-00040S-9A for qemu-devel@nongnu.org; Mon, 29 Jul 2013 13:41:29 -0400 Sender: Richard Henderson Message-ID: <51F6A93E.2000807@twiddle.net> Date: Mon, 29 Jul 2013 07:41:18 -1000 From: Richard Henderson MIME-Version: 1.0 References: <1375111939-19577-1-git-send-email-afaerber@suse.de> <1375111939-19577-2-git-send-email-afaerber@suse.de> In-Reply-To: <1375111939-19577-2-git-send-email-afaerber@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PULL for-1.6 1/3] cpu: Partially revert "cpu: Change qemu_init_vcpu() argument to CPUState" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: Peter Maydell , Jia Liu , Anthony Green , qemu-devel@nongnu.org, Alexander Graf , Blue Swirl , Max Filippov , Michael Walle , PowerPC , Paul Brook , "Edgar E. Iglesias" , Guan Xuetao , Aurelien Jarno On 07/29/2013 05:32 AM, Andreas Färber wrote: > Commit c643bed99 moved qemu_init_vcpu() calls to common CPUState code. > This causes x86 cpu-add to fail with "KVM: setting VAPIC address failed". > > The reason for the failure is that CPUClass::kvm_fd is not yet > initialized in the following call graph: > ->x86_cpu_realizefn > ->x86_cpu_apic_realize > ->qdev_init > ->device_set_realized > ->device_reset (hotplugged == 1) > ->apic_reset_common > ->vapic_base_update > ->kvm_apic_vapic_base_update > This causes attempted KVM vCPU ioctls to fail. > > By contrast, in the non-hotplug case the APIC is reset much later, when > the vCPU is already initialized. > > As a quick and safe solution, move the qemu_init_vcpu() call back into > the targets' realize functions. > > Reported-by: Chen Fan > Acked-by: Igor Mammedov (for i386) > Tested-by: Jia Liu (for openrisc) > Signed-off-by: Andreas Färber Tested-by: Richard Henderson (for Alpha) r~