From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LvSeX-0003IC-Lc for qemu-devel@nongnu.org; Sun, 19 Apr 2009 04:45:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LvSeS-0003F0-Ke for qemu-devel@nongnu.org; Sun, 19 Apr 2009 04:45:28 -0400 Received: from [199.232.76.173] (port=39718 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LvSeS-0003Ex-Ds for qemu-devel@nongnu.org; Sun, 19 Apr 2009 04:45:24 -0400 Received: from mx2.redhat.com ([66.187.237.31]:59711) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LvSeR-0000Vc-Q3 for qemu-devel@nongnu.org; Sun, 19 Apr 2009 04:45:24 -0400 Message-ID: <49EAE499.4010203@redhat.com> Date: Sun, 19 Apr 2009 11:45:13 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1239945321-3903-1-git-send-email-glommer@redhat.com> In-Reply-To: <1239945321-3903-1-git-send-email-glommer@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] return default values for apic probe functions. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Glauber Costa Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, kvm@vger.kernel.org Glauber Costa wrote: > As KVM cpus runs on threads, it is possible that > we call kvm_load_registers() from a cpu thread, while the > apic has not yet fully initialized. kvm_load_registers() is called > from ap_main_loop. > > This is not a problem when we're starting the whole machine together, > but is a problem for hotplug, since we don't have the protection > of the locks that protect machine initialization. Currently, some executions > of cpu hotplug on rainy sundays fail with a segfault. > > Moving apic initialization to before kvm_init_vpcu proved fruitful, > as there are some dependencies involved. (kvm irqchip would fail to > initialize). > I presume you mean unfruitful (or perhaps a nasty kind of fruit). > This patch provides default values to be used for tpr and apic_base, > that will be returned when the apic is not yet properly initialized. > It is aimed at kvm, where the problem exists, but it could equally be > used for qemu too, if there is agreement. > Seems like a hack... can you try not to make the vcpu visible until it is completely initialized? (and what is the problem exactly - someone accessing the registers from a different thread? that shouldn't happen) -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.