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 63919A0556; Mon, 17 Oct 2022 09:24:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 02D2A40143; Mon, 17 Oct 2022 09:24:03 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 8459A400D7 for ; Mon, 17 Oct 2022 09:24:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665991440; x=1697527440; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=d3HSECXkD0pLBVfKFAjHnavcWAQZH7Dvq7Xj8Rch6pc=; b=mZUFIcIQSK7kCXyh+0P7jKf4UuqdviKdO0xoaXvJ8UIHvPy8Es346dHM 0qMZY2BmMFYMmYFpsE2GR7XdHI+ZsJ9KUq5CMHT2w8ggu/UqYSqEE/6GP c5cK1Eo2kU4EFEI0hYYzLcawqfpvPkAZqXR3oqnvj3b3nF3OS3D2o6HKp yvH0qBEKJGlhDVty9Le0iDbK1n5ehjwp+M2UA4cxEmq9ipv013eeLV1Ph sCxdd9OPHccCjPoqwK0JKD55/sLYDBtgPEfSYBOvA+nOg6dYWslUhZJCq TPEkUKP+FpktIhcCGh58coAcVkHesCZqb7YIsmdg+gHHKrWhCZ7q8qV5t w==; X-IronPort-AV: E=McAfee;i="6500,9779,10502"; a="293094463" X-IronPort-AV: E=Sophos;i="5.95,190,1661842800"; d="scan'208";a="293094463" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2022 00:23:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10502"; a="691250957" X-IronPort-AV: E=Sophos;i="5.95,190,1661842800"; d="scan'208";a="691250957" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga008.fm.intel.com with ESMTP; 17 Oct 2022 00:23:59 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 17 Oct 2022 00:23:58 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 17 Oct 2022 00:23:58 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Mon, 17 Oct 2022 00:23:58 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.173) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Mon, 17 Oct 2022 00:23:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PCjPnLP5uG0FJeTBdMrL0zQXEy5U9MChvzaywN+IeubHIsOl+q0b8BrPcmeNt/G6TeEp5ELsLhuv9xn/s7UZoAuIo3YMO30U23l7WgY4tOneX6RB6vG6LZbSjvPas1J/zvDc1rt9maqmnTjM9jNoZorKn3ioVtR8L9kHh0H8l/54C867BxylNaLXzqETwnVWm/2zI3GBFVz7Q0ePafgIEt6DdhWHLVZSq+nYf56qI6EPuYkFTfORUkJlcz8JnhIiZ0KcbMc0Bcykc+Jyf5urnyCZJggn6WJb1JfDQ/3HJqPTXIqcAX9Q8bBy3RpA1krNTaG2c2OsrdtXSLWYIzMLDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=94TcEIA6AZJcyIdMY9MBJjLxZGF++2JfPxdarxaRQpc=; b=j6tgUhMD9IsBLtO81n+hcBCW6C22KTgK2E24mG/5br3XtyQMbXjewSLYpPBlMfY7jSl9aRdMk0nNtmVdya6umPIKo0aECZbOVkDT5iBWZsUsggQdbYcoJdBaH0RVGNd8mbknX0Tf3oHce2whTjZo/fpgW+R+q5Jp2MA3lsPdwQXULn07u+U82SxrEl+P+klOCIseYVAUIzd2T8rVOi26zlaE/EUShPi6WPLPu+qFlJXEymVzN9Pkcf3lMVhzecfOA8LbywJQoU2BkE7t33FnGC75dM/t6pahIC7cTi/2Z4p0beiT/VCTNZk+S1/f6iNVFrmG6zvsCfEPazNwF0PMTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SN6PR11MB3504.namprd11.prod.outlook.com (2603:10b6:805:d0::17) by PH8PR11MB6803.namprd11.prod.outlook.com (2603:10b6:510:1cb::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Mon, 17 Oct 2022 07:23:56 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::39bf:57b1:4824:d40d]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::39bf:57b1:4824:d40d%6]) with mapi id 15.20.5723.030; Mon, 17 Oct 2022 07:23:56 +0000 From: "Xia, Chenbo" To: Hao Chen , "maxime.coquelin@redhat.com" CC: "dev@dpdk.org" , "houyl@yusur.tech" , "zy@yusur.tech" Subject: RE: [PATCH] example: vdpa: support run in nested virtualization environment Thread-Topic: [PATCH] example: vdpa: support run in nested virtualization environment Thread-Index: AQHY3Rz0CdMLiUGZVkypzXHjUaDw5a4SNg6g Date: Mon, 17 Oct 2022 07:23:56 +0000 Message-ID: References: <20221011025531.887043-1-chenh@yusur.tech> In-Reply-To: <20221011025531.887043-1-chenh@yusur.tech> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN6PR11MB3504:EE_|PH8PR11MB6803:EE_ x-ms-office365-filtering-correlation-id: b354671e-84a3-41e1-4ca4-08dab0108d60 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MhYuCuOuF4m1ySQGhkPkZCe6alr2U/+bQLQmBv+VmTzrtd1YfCviB+ZPVvXX8ZWzG5fZIAnEtprSoeDumb/vBX6vKg0rPxXqjGkiob2KuiYB7Frpp3ncXh7E9qyqrfYnf0fiXl76qaz/NDgeORnukfDxmKScLZMxqxGyfcP9w8u+uYOFxrbAGfBDQxMduAZxWpGi0wMlmTBGgGla+ljIsLpPOiBX8nR8fQyWY0tj9PxXYwuZuZ0X4+m6s4FYI66R1jCSotLWm31McSWsV3y+NxIBwNdYKLkr0+yGdZRAbPJHq2bfs8BBCVRu7rk44lUKumAGU80Oqf4pjUioCMIzwnuSFqe44651Hk3NRLi0x5a2006DJx86xO51uhTGd1TnzZ6gPoIqAYgRPJsL7MGwwxNcIn53AKirIZgHJE0w7p8DlJCVyZSm+cen37RPSyRjNf+mT8z0pJnyPY3ibvGyJnWunftK33RHHq54MjkWrE/J/JKRsIkfiea1RluFCbZgdkUpoQwq5rtjOfW5u8w/W4PLJKpKJR4NsqxPYVV1LbaqRzm+c1GRozuu2tR6uVmrQJCkKZMvfYUV0qi/kbBIg9nZMKCV+FmNV3VYa39nObUskqrD4Knc3ZPkYNJ6WlYCp6fNmB0G8eibSG686C55QjjHhGyYyGcVk044JDYAiBMZAZigQeVIKmHgY76mJyh8sQKUXVpRWpBMWCgYR0SXbtNW//2Am8ZkI7fABGRji/0K20zq+LAaSqyHfGH4hSNjPVI7mnWrEGm9uvzZ0lSWog== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3504.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(136003)(346002)(376002)(39860400002)(366004)(451199015)(38070700005)(86362001)(82960400001)(33656002)(55016003)(4326008)(41300700001)(53546011)(26005)(64756008)(66446008)(7696005)(6506007)(8676002)(5660300002)(52536014)(9686003)(66476007)(8936002)(66556008)(478600001)(71200400001)(110136005)(66946007)(76116006)(54906003)(316002)(38100700002)(122000001)(186003)(83380400001)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?JXoL71v6dSofa5/rl1eozXlUVqXxnZvz/3nY2mpdkE1dfcYeutPAEXZkU4YE?= =?us-ascii?Q?09vN++sxUaf8wdPH+FHokaafUxrCv/q2xAM3J3jlqCis6ShSCdXCZF1QD/v6?= =?us-ascii?Q?bx2uSPPk2a9fOWlAVBur2wuH/f0pzKk0c+M0AC+g9dIH/53jg+pyHNI2Xn3y?= =?us-ascii?Q?75zhEHmOt4I6dqqEor2/pl4WAFzenmdwYXeKykYV+tQ/6Bc5WL4kF7kgISgn?= =?us-ascii?Q?2+bBibXxCLruSe/fTlHz6pmGMjHhhqDqlabH5tjnN2UVwSa6fE/tdBZsa5fs?= =?us-ascii?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MR1F80LekRm5oWWJFlb?= =?us-ascii?Q?En3TNimk8uMm4UzeJEgGU+9zWCgI/tftesSri1g7VWeNNT9U/p4A1800a+ox?= =?us-ascii?Q?XkiiQAoxHvRGZ+sdn6teNT8RAUw15LHkyFXKNCDj7CLYH7d2q7nl1q1qBu6H?= =?us-ascii?Q?7dVByPgOeKqFP4bxnIUKF2DbMthDzg10JcGQzillsZ6OBmimkhoR8Wgz4PTZ?= =?us-ascii?Q?roy+iHp9yYWVkHacKMSclCuEUX7a78nHqNlrWpHcsGWPYaGCIt5O6m9Sh7YI?= =?us-ascii?Q?YwkpAuNksQqUJWqzQnBIjdDaQMmkpfIiDXyyNdECcUntM6FnuOSCovc+PaJB?= =?us-ascii?Q?qzM6qHmbEANnC6aPUrV7q6mY5Ijx7+LKi0N372LQz6zVzUUGsv3MYQBIRWle?= =?us-ascii?Q?EM1CAbguQ8cIg5O68pNKopaqixyW6x9/0cGHgmKl?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB3504.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b354671e-84a3-41e1-4ca4-08dab0108d60 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Oct 2022 07:23:56.3741 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HTgpRAIg+nvQB5CQAi7uWOYWEuVeXJtwVwPhoPdCvbwbvqiPivqhxRWNOug3Re3W1sIQXCc9K2cYXhdh7FX0IA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR11MB6803 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Hao Chen > Sent: Tuesday, October 11, 2022 10:56 AM > To: maxime.coquelin@redhat.com; Xia, Chenbo > Cc: dev@dpdk.org; houyl@yusur.tech; zy@yusur.tech > Subject: [PATCH] example: vdpa: support run in nested virtualization > environment Title should be: examples/vdpa: support running in nested virtualization environment >=20 > 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 > 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. >=20 > 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. >=20 > Signed-off-by: Hao Chen > --- > examples/vdpa/main.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) >=20 > diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c > index 4c7e81d7b6..a24c78d7a4 100644 > --- a/examples/vdpa/main.c > +++ b/examples/vdpa/main.c > @@ -43,16 +43,20 @@ static char iface[MAX_PATH_LEN]; > static int devcnt; > static int interactive; > static int client_mode; > +static int iommu_support; >=20 > /* 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); > + printf("Usage: %s [EAL options] --\n", prgname); > + const char *usage_str =3D " --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, "%s", usage_str); Why not use fprintf all string including the eal one? > + exit(1); I believe the exit should happen outside of the function. Thanks, Chenbo > } >=20 > static int > @@ -63,6 +67,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 +225,10 @@ start_vdpa(struct vdpa_port *vport) > socket_path); > return -1; > } > + > + if (iommu_support) > + vport->flags |=3D RTE_VHOST_USER_IOMMU_SUPPORT; > + > ret =3D rte_vhost_driver_register(socket_path, vport->flags); > if (ret !=3D 0) > rte_exit(EXIT_FAILURE, > -- > 2.27.0