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. > > Cc: Badari Pulavarty <pbad...@linux.vnet.ibm.com> > Cc: Paul Mackerras <pau...@samba.org> > Cc: David Gibson <da...@gibson.dropbear.id.au> > Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org> > Cc: Andreas Färber <afaer...@suse.de> > Signed-off-by: Alexey Kardashevskiy <a...@ozlabs.ru> > > --- > > Normall CPUState::cpu_index is used to pick the right CPU for various > operations. However default consecutive numbering does not always work > for PPC64. > > For example, on POWER7 (which supports 4 threads per core), > "-smp 8,threads=4" should create CPUs with indexes 0,1,2,3,4,5,6,7 and > "-smp 8,threads=1" should create CPUs with indexes 0,4,8,12,16,20,24,28. > > 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