From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4B7A6A0542; Wed, 26 Oct 2022 08:10:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E53F140E28; Wed, 26 Oct 2022 08:10:26 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 83D3040A7F for ; Wed, 26 Oct 2022 08:10:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666764625; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pnr5oG/FaOkv9MejzHZJJcOeyRXgd6DTG0x1cNwZjvA=; b=PaPkLNp00hg1NzFdWQs7+R/avjuJM7xUskkWIfCqII42+IZ4zQ8u8imXSavqaEhZVHdW/4 Z5hk6Otic5A0HeUqHTH31Ye5238npxC2Pz3Pv3kBZjVZ7Ecdtm7fJZVByx90ZRLkainKOc iUcYTW3emfbY66m0GBpFc+/tnjpAqF0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-294-M92G2cULOnm8tNkK5x9E_A-1; Wed, 26 Oct 2022 02:10:18 -0400 X-MC-Unique: M92G2cULOnm8tNkK5x9E_A-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4D889811E67; Wed, 26 Oct 2022 06:10:18 +0000 (UTC) Received: from [10.39.208.48] (unknown [10.39.208.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76E9749BB60; Wed, 26 Oct 2022 06:10:16 +0000 (UTC) Message-ID: <9be2c87a-bbab-1187-93c9-1fc2a42cc7b9@redhat.com> Date: Wed, 26 Oct 2022 08:10:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 To: Hao Chen , dev@dpdk.org Cc: zy@yusur.tech, Chenbo Xia References: <20221025060848.3227766-1-chenh@yusur.tech> <20221025061939.3229676-1-chenh@yusur.tech> From: Maxime Coquelin Subject: Re: [PATCH v3] examples/vdpa: support running in nested virtualization environment In-Reply-To: <20221025061939.3229676-1-chenh@yusur.tech> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Hao On 10/25/22 08:19, Hao Chen wrote: > When we run dpdk vdpa in the nested virtual machine vm-L1 and ping > test in vm-L2, the ping is NG. The reason for troubleshooting is NG == not good? Please don't use abbreviations. > that the virtio net in vm-L2 sends control information to the vring, > and the qemu back-end device in vm-L1 cannot obtain correct data > from the vring. This problem is related to the opening of the vIOMMU. > > This patch add option '--iommu-support' to use guest vIOMMU to > protect vhost, then the ping test in vm-L2 is OK. > This option is required in a nested virtualization environment. I'm wondering whether the flag shouldn't just be set by default, as the feature negotiation will be done between the vDPA driver & the guest driver anyways? > Signed-off-by: Hao Chen > --- > v3: > *Modify mail title. > > v2: > *fprintf all string including the eal one. > *remove exit(1). > > examples/vdpa/main.c | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c > index 4c7e81d7b6..71149461c6 100644 > --- a/examples/vdpa/main.c > +++ b/examples/vdpa/main.c > @@ -43,16 +43,18 @@ static char iface[MAX_PATH_LEN]; > static int devcnt; > static int interactive; > static int client_mode; > +static int iommu_support; > > /* display usage */ > static void > vdpa_usage(const char *prgname) > { > - printf("Usage: %s [EAL options] -- " > - " --interactive|-i: run in interactive mode.\n" > - " --iface : specify the path prefix of the socket files, e.g. /tmp/vhost-user-.\n" > - " --client: register a vhost-user socket as client mode.\n", > - prgname); > + const char *usage_str = " --interactive|-i: run in interactive mode.\n" > + " --iface : specify the path prefix of the socket files, e.g. /tmp/vhost-user-.\n" > + " --client: register a vhost-user socket as client mode.\n" > + " --iommu-support: use guest vIOMMU to protect vhost.\n"; > + > + fprintf(stderr, "Usage: %s [EAL options] --\n%s", prgname, usage_str); > } > > static int > @@ -63,6 +65,7 @@ parse_args(int argc, char **argv) > {"iface", required_argument, NULL, 0}, > {"interactive", no_argument, &interactive, 1}, > {"client", no_argument, &client_mode, 1}, > + {"iommu-support", no_argument, &iommu_support, 1}, > {NULL, 0, 0, 0}, > }; > int opt, idx; > @@ -220,6 +223,10 @@ start_vdpa(struct vdpa_port *vport) > socket_path); > return -1; > } > + > + if (iommu_support) > + vport->flags |= RTE_VHOST_USER_IOMMU_SUPPORT; > + > ret = rte_vhost_driver_register(socket_path, vport->flags); > if (ret != 0) > rte_exit(EXIT_FAILURE,