From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdIDQ-0005ra-BN for qemu-devel@nongnu.org; Mon, 04 Nov 2013 06:21:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdIDH-0001Lz-Po for qemu-devel@nongnu.org; Mon, 04 Nov 2013 06:21:04 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:58514) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdIDH-0001Lk-Jm for qemu-devel@nongnu.org; Mon, 04 Nov 2013 06:20:55 -0500 Received: by mail-pa0-f44.google.com with SMTP id fb1so6784962pad.17 for ; Mon, 04 Nov 2013 03:20:54 -0800 (PST) Message-ID: <52778310.3050106@ozlabs.ru> Date: Mon, 04 Nov 2013 22:20:48 +1100 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1383276076-4630-1-git-send-email-aik@ozlabs.ru> <5277702A.7010908@redhat.com> In-Reply-To: <5277702A.7010908@redhat.com> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] ppc: introduce CPUPPCState::cpu_dt_id List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Alexander Graf , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Badari Pulavarty , Paul Mackerras , David Gibson On 11/04/2013 09:00 PM, Paolo Bonzini wrote: > Il 01/11/2013 04:21, Alexey Kardashevskiy ha scritto: >> Normally CPUState::cpu_index is used to pick the right CPU for various >> operations. However default consecutive numbering does not always work >> for POWERPC. >> >> 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 ioctls. In order to achieve this, >> kvmppc_fixup_cpu() was introduced. Roughly speaking, it multiplies >> cpu_index by the number of threads per core. >> >> This approach has disadvantages such as: >> 1. NUMA configuration stays broken after the fixup; >> 2. CPU-related commands from QEMU Monitor do not work properly as >> the accept fixed CPU indexes and the user does not really know >> what they are after fixup as the number of threads per core changes >> between CPU versions and via QEMU command line. >> >> This introduces a new @cpu_dt_id field in the CPUPPCState struct which >> is set from @cpu_index by default but can be fixed later to the value >> which a hypervisor can accept. This also introduces two POWERPC-arch >> specific functions: >> 1. int ppc_get_vcpu_dt_id(CPUState *cs) - returns a device-tree ID >> for a CPU; >> 2. CPUState *ppc_get_vcpu_by_dt_id(int cpu_dt_id) - finds CPUState by >> a device-tree CPU ID. >> >> This uses the new functions to: >> 1. fix emulated XICS hypercall handlers as they receive fixed CPU indexes; >> 2. fix XICS-KVM to enable in-kernel XICS on right CPU; >> 3. compose correct device-tree. >> >> This removes @cpu_index fixup as @cpu_dt_id is used instead so QEMU monitor >> can accept command-line CPU indexes again. >> >> Cc: Badari Pulavarty >> Cc: Paul Mackerras >> Cc: David Gibson >> Cc: Benjamin Herrenschmidt >> Cc: Paolo Bonzini >> Signed-off-by: Alexey Kardashevskiy >> --- >> Changes: >> v2: >> * added PPC-specific ppc_get_vcpu_dt_id() and ppc_get_vcpu_by_dt_id() >> * fixed kvm_arch_vcpu_id() to use ppc_get_vcpu_dt_id() >> * fixed emulated XICS >> * removed kvm_arch_vcpu_id() stub for non-KVM case > > Not having non-PPC code in the patch is definitely a good sign! > > Acked-by: Paolo Bonzini Heh. Mr. Graf has objections against v3 of this patch in another thread :) -- Alexey