Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp962067imm; Fri, 15 Jun 2018 08:58:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK3K6v9vIR4mtiqXbbKt1wudcK0Dv9Xc6QgqQZFyq7lnr1isUACU6+vz6i8n9oaRf9E5Pzw X-Received: by 2002:a17:902:b28:: with SMTP id 37-v6mr2616754plq.201.1529078316531; Fri, 15 Jun 2018 08:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529078316; cv=none; d=google.com; s=arc-20160816; b=WKEt0DRPMjLkrC51pGpCzhsA3P9QBZ6dvjZEQ2ZIsMHgmp4LCnheXAipI6/RjeM7nT ALwGR3vz5nAN4WntbUatTeqyikE60dDJDFuzbQM/xXB4I3FniAjL1TlOcqE/vQPom6jT lZrQ05Je9yBhfQmVqi/nCm2NJSwklcezlkoKOaS5kRi9kU9HE8ZYFpucB6V5IWZxQnTf W0plTQBnfTe3ES0FqSUjcl8tcA6LFouLQGrfqAe5ASN6ax3U97o62Jk1CXxURpmbHh40 B7YVQaIuo+kkVTQ+ZGzw65WlGW7kqULXyRtF8KYtN6vQjumK4V8zoZxzeNOObw4JX/e+ PPdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=5czp6B3aOHTvB1SzjigSAOItdTeE4xenrfQqXrEUZgA=; b=novzR/zUn6/T2LsyGXa3mWBAFyvme2inHFq5PnAZCZP1HegC3hI8G9/xXr6cWLfD7f Onzn6Vd3WvAVmJ4i2NnaoR5KvjSiG58f/vnECEtQn0sWDe9rMdBvfGFSACHjTK/DQqnq iHLlWkMCb5y8KtjxD0JEh4rA60oWM9A/Pw8qtgCUf2Qi59MlfK9O+B49ayNJoHKAvaNt gnPjdUjrvUrMnKikVrYIHQBwJw5k+qnzGONSry8nt4U8KthKenHdV5hfy5xHD4AZbohz S7wYuXwq/srEst5lxa3GjTH4gnKEtHAp2hVqU62kBTH3ouftrDOVRMC87RfVvoc/5a/0 Y3gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z23-v6si7615894pfh.266.2018.06.15.08.58.21; Fri, 15 Jun 2018 08:58:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965970AbeFOP5z (ORCPT + 99 others); Fri, 15 Jun 2018 11:57:55 -0400 Received: from foss.arm.com ([217.140.101.70]:43846 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965593AbeFOP5x (ORCPT ); Fri, 15 Jun 2018 11:57:53 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4AB271529; Fri, 15 Jun 2018 08:57:53 -0700 (PDT) Received: from [10.1.206.34] (melchizedek.cambridge.arm.com [10.1.206.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ADBE43F557; Fri, 15 Jun 2018 08:57:50 -0700 (PDT) Subject: Re: [PATCH RESEND v4 2/2] arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS To: gengdongjiu Cc: rkrcmar@redhat.com, corbet@lwn.net, christoffer.dall@arm.com, marc.zyngier@arm.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org References: <1528487320-2873-1-git-send-email-gengdongjiu@huawei.com> <1528487320-2873-3-git-send-email-gengdongjiu@huawei.com> <45e94aae-ed9f-1fb7-f10e-d95c2f969ddd@arm.com> <6887237f-d252-5b9e-02cb-5a44fef27080@arm.com> <2455dc33-ae8d-79e6-e915-4181050e1e65@huawei.com> From: James Morse Message-ID: <9e5be3fe-e6df-ca56-5eab-9ab7e18d9a99@arm.com> Date: Fri, 15 Jun 2018 16:57:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <2455dc33-ae8d-79e6-e915-4181050e1e65@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi gengdongjiu, On 12/06/18 16:48, gengdongjiu wrote: > On 2018/6/12 23:29, James Morse wrote: >> On 12/06/18 15:50, gengdongjiu wrote: >>> On 2018/6/11 21:36, James Morse wrote: >>>> On 08/06/18 20:48, Dongjiu Geng wrote: >>>>> diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h >>>>> index caae484..c3e6975 100644 >>>>> --- a/arch/arm/include/uapi/asm/kvm.h >>>>> +++ b/arch/arm/include/uapi/asm/kvm.h >>>>> @@ -124,6 +124,18 @@ struct kvm_sync_regs { >>>>> struct kvm_arch_memory_slot { >>>>> }; >>>>> >>>>> +/* for KVM_GET/SET_VCPU_EVENTS */ >>>>> +struct kvm_vcpu_events { >>>>> + struct { >>>>> + __u8 serror_pending; >>>>> + __u8 serror_has_esr; >>>>> + /* Align it to 8 bytes */ >>>>> + __u8 pad[6]; >>>>> + __u64 serror_esr; >>>>> + } exception; >>>>> + __u32 reserved[12]; >>>>> +}; >>>>> + >>>> >>>> You haven't defined __KVM_HAVE_VCPU_EVENTS for 32bit, so presumably this struct >>>> will never be used. Why is it here? >> >>> if not add it for 32 bits. the 32 arm platform will build Fail, whether you have good >>> idea to avoid this Failure if not add this struct for the 32 bit? >> >> How does this 32bit code build without this patch? >> If do you provide the struct, how will that code build with older headers? >> >> As far as I can see, this is what the __KVM_HAVE_VCPU_EVENTS define is for. >> >> This should be both, or neither. Having just the struct is useless. > It because the caller of kvm_arm_vcpu_get/set_events() is in "virt/kvm/arm/arm.c". > the virt/kvm/arm/arm.c will used by both arm64 and arm. > so It needs to add kvm_arm_vcpu_get/set_events() for the 32 bits, however, kvm_arm_vcpu_get/set_events() will directly return, So you are adding a uapi struct that user-space can't actually use, to avoid a kernel build-error. Fine, it just looks really strange. 32bit user-space shouldn't try to call this as check-extension reports it as not present. If it does, it gets -EINVAL back, which is also the default for kvm_arch_vcpu_ioctl(). Thanks, James