From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA511C636CC for ; Wed, 8 Feb 2023 08:50:32 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4PBYc672sDz3f40 for ; Wed, 8 Feb 2023 19:50:30 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=c10snEK9; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IOxtEDt1; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=cohuck@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=c10snEK9; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IOxtEDt1; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4PBYb25ZyGz3c8f for ; Wed, 8 Feb 2023 19:49:33 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675846170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xhxVetMf39eyBYLaK7+c2bWPPz3BvXeYT/Jkcp+eZuU=; b=c10snEK9vF8ECjjRg9e1Iu2URR9jXd6YXDRwgubfArnWgtQAEV0s4AAcPKIvFlFrTTNXSR TwCicuQwb5yHnMVIuWpyEk5H7fyg5GKSIvLlEMbPDIfJbwatRHgFUN+NfoGx4NwolV9g1j JWdeMskI+0VDik9xS9lHOrCMqlSYHcE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675846171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xhxVetMf39eyBYLaK7+c2bWPPz3BvXeYT/Jkcp+eZuU=; b=IOxtEDt1gz/6atPwjprZXNTFj9TtD2ibbOl4ecYUlg2VKQ/vf2kBiHRGVtazrGbZwA7Un1 oMAE/DwjQBWOliAo37ZzcMA4h+ghQEMMZ8Z6GrWT8+qyUexVJnS+FbsLqqCYZ7ZMQR7yEI K9b7V1pTbP1G4eulZ0GFqDBe1pbIu/E= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-114-5dvcoJ_qPimOmvke9wf4xA-1; Wed, 08 Feb 2023 03:49:26 -0500 X-MC-Unique: 5dvcoJ_qPimOmvke9wf4xA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C25D61C07581; Wed, 8 Feb 2023 08:49:25 +0000 (UTC) Received: from localhost (unknown [10.39.193.252]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1A495C15BAE; Wed, 8 Feb 2023 08:49:18 +0000 (UTC) From: Cornelia Huck To: Gavin Shan , Thomas Huth , kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Steven Price Subject: Re: [PATCH 6/7] KVM: arm64: Change return type of kvm_vm_ioctl_mte_copy_tags() to "int" In-Reply-To: Organization: Red Hat GmbH References: <20230203094230.266952-1-thuth@redhat.com> <20230203094230.266952-7-thuth@redhat.com> <7b32d58b-846f-b8d7-165b-9f505e5f00f0@redhat.com> User-Agent: Notmuch/0.37 (https://notmuchmail.org) Date: Wed, 08 Feb 2023 09:49:16 +0100 Message-ID: <87zg9oleyb.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Claudio Imbrenda , Janosch Frank , Suzuki K Poulose , Marc Zyngier , David Hildenbrand , linux-kernel@vger.kernel.org, Oliver Upton , Zenghui Yu , James Morse , kvm-riscv@lists.infradead.org, kvmarm@lists.linux.dev, Christian Borntraeger , linuxppc-dev@lists.ozlabs.org, Eric Auger Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, Feb 08 2023, Gavin Shan wrote: > On 2/7/23 9:09 PM, Thomas Huth wrote: >> Oh, drat, I thought I had checked all return statements ... this must have fallen through the cracks, sorry! >> >> Anyway, this is already a problem now: The function is called from kvm_arch_vm_ioctl() (which still returns a long), which in turn is called from kvm_vm_ioctl() in virt/kvm/kvm_main.c. And that functions stores the return value in an "int r" variable. So the upper bits are already lost there. >> >> Also, how is this supposed to work from user space? The normal "ioctl()" libc function just returns an "int" ? Is this ioctl already used in a userspace application somewhere? ... at least in QEMU, I didn't spot it yet... >> We will need it in QEMU to implement migration with MTE (the current proposal simply adds a migration blocker when MTE is enabled, as there are various other things that need to be figured out for this to work.) But maybe other VMMs already use it (and have been lucky because they always dealt with shorter lengths?) > > The ioctl command KVM_ARM_MTE_COPY_TAGS was merged recently and not used > by QEMU yet. I think struct kvm_arm_copy_mte_tags::length needs to be > '__u32' instead of '__u64' in order to standardize the return value. > Something like below. Documentation/virt/kvm/api.rst::section-4.130 > needs update accordingly. > > struct kvm_arm_copy_mte_tags { > __u64 guest_ipa; > __u32 pad; > __u32 length; > void __user *addr; > __u64 flags; > __u64 reserved[2]; > }; Can we do this in a more compatible way, as we are dealing with an API? Like returning -EINVAL if length is too big?