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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D315C433F5 for ; Mon, 1 Nov 2021 10:36:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D2B5D60F56 for ; Mon, 1 Nov 2021 10:36:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D2B5D60F56 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:55370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhUgM-0004h8-J6 for qemu-devel@archiver.kernel.org; Mon, 01 Nov 2021 06:36:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhUej-0002Kg-4l for qemu-devel@nongnu.org; Mon, 01 Nov 2021 06:35:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:21545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhUee-0003XY-2R for qemu-devel@nongnu.org; Mon, 01 Nov 2021 06:35:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635762902; 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=UcnOXXiFU7VISMVVErqlaATJPJKb1zICDskpnoTXODE=; b=Jd5vyl7avZIpNknmGIspXZZyX/pLAtWRrENpGxKupD/40GTn5KwvBWdrklyyrxkjRDfFel FSWCp7NF/DlY5sl4LjkIMvkOwdSXp2mriraKxguGo1N8ph+PEigFwsIJgW0jRv5la6+WNt YmeKhA82Da5sJAi3lF9V1NkBxITnsMY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-107-e-ws1lGvNdKgk1zQ66DPZA-1; Mon, 01 Nov 2021 06:34:59 -0400 X-MC-Unique: e-ws1lGvNdKgk1zQ66DPZA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D5FE610B3940; Mon, 1 Nov 2021 10:34:57 +0000 (UTC) Received: from localhost (unknown [10.39.192.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80DCF1816A; Mon, 1 Nov 2021 10:34:48 +0000 (UTC) Date: Mon, 1 Nov 2021 10:34:47 +0000 From: Stefan Hajnoczi To: Jag Raman Subject: Re: [PATCH v3 03/12] vfio-user: define vfio-user-server object Message-ID: References: <13dba991f1de91711e5c3cad9a332d6e7c5eee7b.1633929457.git.jag.raman@oracle.com> <6346833B-469B-487B-8382-62EA03BA56C2@oracle.com> MIME-Version: 1.0 In-Reply-To: <6346833B-469B-487B-8382-62EA03BA56C2@oracle.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5Dl9VgW+VMc/PSfq" Content-Disposition: inline Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.736, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Elena Ufimtseva , John Johnson , "thuth@redhat.com" , "swapnil.ingle@nutanix.com" , "john.levon@nutanix.com" , "philmd@redhat.com" , qemu-devel , Markus Armbruster , Alex Williamson , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , "thanos.makatos@nutanix.com" , "pbonzini@redhat.com" , "alex.bennee@linaro.org" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --5Dl9VgW+VMc/PSfq Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 29, 2021 at 02:42:49PM +0000, Jag Raman wrote: > > On Oct 27, 2021, at 11:40 AM, Stefan Hajnoczi wro= te: > > On Mon, Oct 11, 2021 at 01:31:08AM -0400, Jagannathan Raman wrote: > >> diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c > >> new file mode 100644 > >> index 0000000000..c2a300f0ff > >> --- /dev/null > >> +++ b/hw/remote/vfio-user-obj.c > >> @@ -0,0 +1,173 @@ > >> +/** > >> + * QEMU vfio-user-server server object > >> + * > >> + * Copyright =C2=A9 2021 Oracle and/or its affiliates. > >> + * > >> + * This work is licensed under the terms of the GNU GPL-v2, version 2= or later. > >> + * > >> + * See the COPYING file in the top-level directory. > >> + * > >> + */ > >> + > >> +/** > >> + * Usage: add options: > >> + * -machine x-remote > >> + * -device ,id=3D > >> + * -object vfio-user-server,id=3D,type=3Dunix,path=3D, > >=20 > > I expected socket.type=3D and socket.path=3D based on the QAPI schema. = Is > > this command-line example correct? >=20 > When I tried the =E2=80=9Csocket.path=E2=80=9D approach, QEMU was not abl= e to parse the > arguments. So I had to break it down to a series of individual members. >=20 > If =E2=80=9Csocket.path=E2=80=9D is the expected way, I=E2=80=99ll see wh= y the parser is not working > as expected.=20 CCing Markus regarding QAPI. I'm surprised because the QAPI schema for vfio-user-server objects is: { 'struct': 'VfioUserServerProperties', 'data': { 'socket': 'SocketAddress', 'device': 'str' } } It's not clear to me why the command-line parser flattens the 'socket' field into its 'type' and 'path' sub-fields in your example: -object vfio-user-server,id=3D,type=3Dunix,path=3D,devic= e=3D Maybe because SocketAddress is an enum instead of a struct? Imagine a second SocketAddress field is added to vfio-user-server. How can the parser know which field 'type' and 'path' belong to? I tried it: { 'struct': 'VfioUserServerProperties', 'data': { 'socket': 'SocketAddress', 'socket2': 'SocketAddress', 'devic= e': 'str' } } Now the parser refuses any input I've tried. For example: $ build/qemu-system-x86_64 -object vfio-user-server,id=3Ds,device=3Dasdf,= type=3Dunix,path=3Dasdf,type=3Dunix qemu-system-x86_64: -object vfio-user-server,id=3Ds,device=3Dasdf,type=3D= unix,path=3Dasdf,type=3Dunix: Parameter 'type' is missing A similar case happens if the parent struct has 'type' or 'path' fields. They collide with the SocketAddress union fields. I didn't test this though. Questions for Markus: 1. Do you know why the parser behaves like this? 2. Is it good practice to embed SocketAddress into parent structs or should we force it into a struct? Stefan --5Dl9VgW+VMc/PSfq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmF/wscACgkQnKSrs4Gr c8jJswf+PpzFei9WIr6MQ8HHScLg01Ltn4c6LLbGq3zN4mJgXzHiboZ5NJZmBB0y rXwQabcQWL6YXyswSGLcUpEq2+Q2m+fcR7NyGIGraRgFBdycZU7TV6sqxKTNZmHW Lfz14rYhPbFznWBlel3vIoVJR0X9x5G71E7bEd/2fRlPo2D+vM9zsaQVXAEELGXb 96J9ncotPzNwaGUAi52aj9/WxUQzmGfTeejPvc1hkDUESwuAF2BUmgQ+Be2wY3Ie /fO8lTKqq7DH0eRuVkphUNCMnv2mQ5oQNaUGo6PLrNPQttRiKSJUQ+YZvxIUeWuU jO5evPdcBm6AcVoVlfOsXY6t5QR8uw== =nkoY -----END PGP SIGNATURE----- --5Dl9VgW+VMc/PSfq--