From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anup Patel Subject: Re: [PATCH 1/5] kvmtool: ARM: Use KVM_ARM_PREFERRED_TARGET vm ioctl to determine target cpu Date: Thu, 7 Aug 2014 14:14:37 +0530 Message-ID: References: <1407228599-25065-1-git-send-email-anup.patel@linaro.org> <1407228599-25065-2-git-send-email-anup.patel@linaro.org> <20140806124821.GM25953@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: "kvmarm@lists.cs.columbia.edu" , "kvm@vger.kernel.org" , "patches@apm.com" , Marc Zyngier , "penberg@kernel.org" , "christoffer.dall@linaro.org" , "pranavkumar@linaro.org" To: Will Deacon Return-path: Received: from mail-we0-f169.google.com ([74.125.82.169]:35114 "EHLO mail-we0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754016AbaHGIoi (ORCPT ); Thu, 7 Aug 2014 04:44:38 -0400 Received: by mail-we0-f169.google.com with SMTP id u56so3825869wes.28 for ; Thu, 07 Aug 2014 01:44:37 -0700 (PDT) In-Reply-To: <20140806124821.GM25953@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 6 August 2014 18:18, Will Deacon wrote: > On Tue, Aug 05, 2014 at 09:49:55AM +0100, Anup Patel wrote: >> Instead, of trying out each and every target type we should use >> KVM_ARM_PREFERRED_TARGET vm ioctl to determine target type >> for KVM ARM/ARM64. >> >> We bail-out target type returned by KVM_ARM_PREFERRED_TARGET vm ioctl >> is not known to kvmtool. > > -ENOPARSE OK, I will fix the wordings here. > >> Signed-off-by: Pranavkumar Sawargaonkar >> Signed-off-by: Anup Patel >> --- >> tools/kvm/arm/kvm-cpu.c | 21 ++++++++++++++++----- >> 1 file changed, 16 insertions(+), 5 deletions(-) >> >> diff --git a/tools/kvm/arm/kvm-cpu.c b/tools/kvm/arm/kvm-cpu.c >> index aeaa4cf..7478f8f 100644 >> --- a/tools/kvm/arm/kvm-cpu.c >> +++ b/tools/kvm/arm/kvm-cpu.c >> @@ -34,6 +34,7 @@ struct kvm_cpu *kvm_cpu__arch_init(struct kvm *kvm, unsigned long cpu_id) >> struct kvm_cpu *vcpu; >> int coalesced_offset, mmap_size, err = -1; >> unsigned int i; >> + struct kvm_vcpu_init preferred_init; >> struct kvm_vcpu_init vcpu_init = { >> .features = ARM_VCPU_FEATURE_FLAGS(kvm, cpu_id) >> }; >> @@ -46,6 +47,10 @@ struct kvm_cpu *kvm_cpu__arch_init(struct kvm *kvm, unsigned long cpu_id) >> if (vcpu->vcpu_fd < 0) >> die_perror("KVM_CREATE_VCPU ioctl"); >> >> + err = ioctl(kvm->vm_fd, KVM_ARM_PREFERRED_TARGET, &preferred_init); >> + if (err < 0) >> + die_perror("KVM_ARM_PREFERRED_TARGET ioctl"); > > Is this ioctl always available? If not, I don't like dying here as that > could cause a regression under older hosts. The KVM_ARM_PREFERRED_TARGET ioctl is available from 3.13 onwards. I think we should first try KVM_ARM_PREFERRED_TARGET. If it fails then we should fallback to old method of trying each and every target type. What say? -- Anup > > Will