From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8km0-0007Fa-3E for qemu-devel@nongnu.org; Tue, 15 Dec 2015 03:15:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8klw-0007Ou-U4 for qemu-devel@nongnu.org; Tue, 15 Dec 2015 03:15:52 -0500 Received: from e28smtp01.in.ibm.com ([125.16.236.1]:48513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8klw-0007Oa-8M for qemu-devel@nongnu.org; Tue, 15 Dec 2015 03:15:48 -0500 Received: from localhost by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 15 Dec 2015 13:45:44 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id B8B4AE0061 for ; Tue, 15 Dec 2015 13:46:34 +0530 (IST) Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay01.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tBF8F1gV590108 for ; Tue, 15 Dec 2015 13:45:02 +0530 Received: from d28av05.in.ibm.com (localhost [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tBF8F102016560 for ; Tue, 15 Dec 2015 13:45:01 +0530 Date: Tue, 15 Dec 2015 13:44:47 +0530 From: Bharata B Rao Message-ID: <20151215081447.GH18759@in.ibm.com> References: <1449728144-6223-1-git-send-email-bharata@linux.vnet.ibm.com> <1449728144-6223-9-git-send-email-bharata@linux.vnet.ibm.com> <20151214174406.GE3774@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151214174406.GE3774@thinpad.lan.raisama.net> Subject: Re: [Qemu-devel] [RFC PATCH v0 8/9] target-i386: Set apic_id during CPU initfn Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: peter.maydell@linaro.org, agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, imammedo@redhat.com, pbonzini@redhat.com, afaerber@suse.de, david@gibson.dropbear.id.au On Mon, Dec 14, 2015 at 03:44:06PM -0200, Eduardo Habkost wrote: > On Thu, Dec 10, 2015 at 11:45:43AM +0530, Bharata B Rao wrote: > > Move back the setting of apic_id to instance_init routine (x86_cpu_initfn) > > This is needed to initialize X86 CPUs using generic cpu-package device. > > Could you explain where exactly apic_id will be used, to make it > necessary to initialize it earlier? There is a check in x86_cpu_realizefn() to see if apic_id has been initialized properly. Hence I thought x86 target will require apic_id to have been initialized before CPU realization and that is what the existing code does via pc_cpus_init() and pc_new_cpu(). i.e., apic_id property is set before setting the realize property to true. However... > > > > > TODO: I am not fully aware of the general direction in which apic_id > > changes in X86 have evolved and hence not sure if this is indeed aligned with > > the X86 way of doing things. This is just to help the PoC implementation > > that I have in this patchset to convert PC CPUs initialization into > > cpu-package device based initialization. > > You shouldn't initialize apic_id on initfn. APIC ID depends (and > will depend) on different CPU properties related to topology, > including (but not limited to) CPU index and CPU topology > properties we may introduce in the future, so it should be done > later (at realize time), not on initfn. ... with the current patchset, I just experimented now by moving the setting of apic_id to x86_cpu_realizefn() and things work just fine. I was in fact pleasantly surprised to see that I could hot add a cpu core by hot plugging the cpu-core device on x86 too. > > Also, cpu_index is initialized by cpu_exec_init(), and > cpu_exec_init() must not be called by initfn. The cpu_exec_init() > call should (and will) be moved to realize in x86 and all other > architectures. Right, I have already moved cpu_exec_init() call to realizefn for PowerPC. Regards, Bharata.