From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vbrho-000084-W6 for qemu-devel@nongnu.org; Thu, 31 Oct 2013 08:50:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vbrhk-0007Jx-QN for qemu-devel@nongnu.org; Thu, 31 Oct 2013 08:50:32 -0400 Message-ID: <527251FD.3000002@redhat.com> Date: Thu, 31 Oct 2013 13:50:05 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1383211692-25020-1-git-send-email-aik@ozlabs.ru> In-Reply-To: <1383211692-25020-1-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] RFC: spapr: introduce smt_cpu_index List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Alexander Graf , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Badari Pulavarty , Paul Mackerras , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , David Gibson Il 31/10/2013 10:28, Alexey Kardashevskiy ha scritto: > This is not really a patch to accept or review, this is a conversation > starter. >=20 > Cc: Badari Pulavarty > Cc: Paul Mackerras > Cc: David Gibson > Cc: Benjamin Herrenschmidt > Cc: Andreas F=C3=A4rber > Signed-off-by: Alexey Kardashevskiy >=20 > --- >=20 > Normall CPUState::cpu_index is used to pick the right CPU for various > operations. However default consecutive numbering does not always work > for PPC64. >=20 > For example, on POWER7 (which supports 4 threads per core), > "-smp 8,threads=3D4" should create CPUs with indexes 0,1,2,3,4,5,6,7 an= d > "-smp 8,threads=3D1" should create CPUs with indexes 0,4,8,12,16,20,24,= 28. >=20 > These indexes are reflected in /proc/device-tree/cpus/PowerPC,POWER7@XX > and used to call KVM VCPU's ioctl. I think these two uses should be separated, even if they use the same formula. Define a PPC-specific concept, used by TCG as well, and make kvm_arch_vcpu_id use it. In other words: - the hw/ppc/spapr* changes should not use kvm_arch_vcpu_id and kvm_arch_get_vcpu_by_id, but something like ppc_get_vcpu_dt_id and ppc_get_vcpu_by_dt_id. - the comment for the new field should be something like /* The CPU index used in the device tree. KVM uses this index too. */ - kvm_arch_vcpu_id can be a simple wrapper for ppc_get_vcpu_dt_id; no need for the new kvm_arch_get_vcpu_by_id, and no kvm-stub.c changes should be necessary either. - everything else seems fine. > 2. Apply the patch below and make sure it does not break x86/ARM/s390 > with and without KVM (does not it?); If you do it right (i.e. do not touch kvm-stub.c) it should "obviously" not break anything outside PPC. Paolo