From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suraj Jitindar Singh Subject: Re: [PATCH 1/4] kvm/ppc/book3s_hv: Change vcore element runnable_threads from linked-list to array Date: Wed, 29 Jun 2016 14:44:22 +1000 Message-ID: <57735226.6010904@gmail.com> References: <1465982468-18833-1-git-send-email-sjitindarsingh@gmail.com> <20160624095923.GG26584@fergus.ozlabs.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, mpe@ellerman.id.au, benh@kernel.crashing.org, kvm@vger.kernel.org, pbonzini@redhat.com, agraf@suse.com, rkrcmar@redhat.com To: Paul Mackerras Return-path: Received: from mail-pa0-f66.google.com ([209.85.220.66]:33567 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752676AbcF2Eof (ORCPT ); Wed, 29 Jun 2016 00:44:35 -0400 In-Reply-To: <20160624095923.GG26584@fergus.ozlabs.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 24/06/16 19:59, Paul Mackerras wrote: > On Wed, Jun 15, 2016 at 07:21:05PM +1000, Suraj Jitindar Singh wrote: >> The struct kvmppc_vcore is a structure used to store various informa= tion >> about a virtual core for a kvm guest. The runnable_threads element o= f the >> struct provides a list of all of the currently runnable vcpus on the= core >> (those in the KVMPPC_VCPU_RUNNABLE state). The previous implementati= on of >> this list was a linked_list. The next patch requires that the list b= e able >> to be iterated over without holding the vcore lock. >> >> Reimplement the runnable_threads list in the kvmppc_vcore struct as = an >> array. Implement function to iterate over valid entries in the array= and >> update access sites accordingly. >> >> Signed-off-by: Suraj Jitindar Singh > Unfortunately I get a compile error when compiling for either a 32-bi= t > powerpc config (e.g. pmac32_defconfig with KVM turned on) or a Book E > config. The error is: > > In file included from /home/paulus/kernel/kvm/include/linux/kvm_host.= h:36:0, > from /home/paulus/kernel/kvm/arch/powerpc/kernel/asm= -offsets.c:54: > /home/paulus/kernel/kvm/arch/powerpc/include/asm/kvm_host.h:299:36: e= rror: =E2=80=98MAX_SMT_THREADS=E2=80=99 undeclared here (not in a funct= ion) > struct kvm_vcpu *runnable_threads[MAX_SMT_THREADS]; > ^ > /home/paulus/kernel/kvm/./Kbuild:81: recipe for target 'arch/powerpc/= kernel/asm-offsets.s' failed > > You are using MAX_SMT_THREADS in kvm_host.h, but it is defined in > kvm_book3s_asm.h, which gets included by asm-offsets.c after it > include kvm_host.h. I don't think we can just make kvm_host.h includ= e > book3s.h. The best solution might be to move the definition of struc= t > kvmppc_vcore to kvm_book3s.h. Thanks for catching that, yeah I see. I don't think we can trivially move the struct kvmppc_vcore definition = into=20 kvm_book3s.h as other code in kvm_host.h (i.e. struct kvm_vcpu_arch) re= quires the definition. I was thinking that I could just put runnable_threads i= nside an #ifdef. #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE struct kvm_vcpu *runnable_threads[MAX_SMT_THREADS]; #endif Suraj. > > Paul.