From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yqex6-0008AC-9U for qemu-devel@nongnu.org; Fri, 08 May 2015 05:52:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yqex1-0006Db-TV for qemu-devel@nongnu.org; Fri, 08 May 2015 05:52:16 -0400 Received: from e28smtp05.in.ibm.com ([122.248.162.5]:49145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yqex1-0006DC-9t for qemu-devel@nongnu.org; Fri, 08 May 2015 05:52:11 -0400 Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 8 May 2015 15:22:07 +0530 Received: from d28relay04.in.ibm.com (d28relay04.in.ibm.com [9.184.220.61]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 627AE1258068 for ; Fri, 8 May 2015 15:24:11 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay04.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t489pgwo66584758 for ; Fri, 8 May 2015 15:21:44 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t489GsTO019640 for ; Fri, 8 May 2015 14:46:54 +0530 From: Bharata B Rao Date: Fri, 8 May 2015 15:21:33 +0530 Message-Id: <1431078696-29519-1-git-send-email-bharata@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC v1 PATCH 0/3] cpus: Convert cpu_index into a bitmap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: zhugh.fnst@cn.fujitsu.com, ehabkost@redhat.com, agraf@suse.de, Bharata B Rao , imammedo@redhat.com, afaerber@suse.de, david@gibson.dropbear.id.au This patch changes the way cpu_index is handed out to newly created CPUs by tracking the allocted CPUs in a bitmap. More information and the need for this patch is described in patch 2/3 of this series. These generic changes are needed to support CPU hot plug/unplug on PowerPC. cpu_index is allocated in cpu_exec_init() and freed (during CPU unplug) in the newly added API cpu_exec_exit(). Currently all architectures call cpu_exec_init() from instance_init and hence cpu_exec_exit() is called from instance_finalize for all archs in this series. Instead of adding instance_finalize to all archs, we could call cpu_exec_exit() from the parent class (CPUClass.instance_finalize). However archs like x86 and PowerPC want cpu_exec_init() to be moved to realizefn from instance_init. Such movement will become easy with the current approach. Eudardo's suggested alternative of making cpu_exec_exit() idempotent (http://lists.nongnu.org/archive/html/qemu-devel/2015-05/msg01241.html) will also simplify this movement, but I think that would compilicate the deallocation logic. Another open question is about handling of holes correctly in the allocated bitmap to support VM migration after CPU unplug. This was briefly discussed here: https://lists.gnu.org/archive/html/qemu-devel/2015-04/msg00560.html Should cpu_exec_init() API support specifying of a particular cpu_index in addition to returning the next available cpu_index by default ? I know that QEMU cmdline semantics for CPU device add/delele haven't been defined yet, but should we now make provision in cpu_exec_init() to allocate the required cpu_index ? Changes in v1 ------------- - Added Error argument to cpu_exec_init() so that it callers calling it from realizefn can collect errors. v0: https://lists.gnu.org/archive/html/qemu-devel/2015-03/msg02950.html Bharata B Rao (3): cpus: Add Error argument to cpu_exec_init() cpus: Convert cpu_index into a bitmap ppc: Move cpu_exec_init() call to realize function exec.c | 39 +++++++++++++++++++++++++++++++++++---- include/exec/exec-all.h | 2 +- include/qom/cpu.h | 8 ++++++++ target-alpha/cpu.c | 8 +++++++- target-arm/cpu.c | 3 ++- target-cris/cpu.c | 8 +++++++- target-i386/cpu.c | 8 +++++++- target-lm32/cpu.c | 8 +++++++- target-m68k/cpu.c | 8 +++++++- target-microblaze/cpu.c | 8 +++++++- target-mips/cpu.c | 8 +++++++- target-moxie/cpu.c | 8 +++++++- target-openrisc/cpu.c | 8 +++++++- target-ppc/translate_init.c | 15 +++++++++++++-- target-s390x/cpu.c | 3 ++- target-sh4/cpu.c | 8 +++++++- target-sparc/cpu.c | 3 ++- target-tricore/cpu.c | 7 ++++++- target-unicore32/cpu.c | 8 +++++++- target-xtensa/cpu.c | 8 +++++++- 20 files changed, 153 insertions(+), 23 deletions(-) -- 2.1.0