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 0049CA00C2; Mon, 26 Sep 2022 09:29:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A250F400D7; Mon, 26 Sep 2022 09:29:05 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id E3C1A400D5 for ; Mon, 26 Sep 2022 09:29:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664177344; x=1695713344; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=81mdOMfpDapnU2bd2JQEuKu7vEU1y3QpE6du913n1uI=; b=Mtm34ZYdPsLFCxqXIYtO+W3xjtXJ/SgDeufYPsa+aUH/fsIuCgYzUNVv R9eJfkWxKijSU7j3qwy8fQV50JE5FdluRIS6kWA2lxD0uCIdKiMxcPs43 TAgkvwxIl0EfuJJP51bm8Kv5FBu2mhR2BiVNCc/f+MGr4cuS+HNXn0Iew 38OxO3GFPN1U3rRuyrjnjYZFsrNxXPX+7kxgcFZl5Tb1xdbuPx3AyU6h0 M9JehYX/KqygK1MUH/1Q4PiM0+zbsUhxYyE9pKEukYERvxCDMGTDjBP35 TxiI2j/iI2DJvbMLKy/AoGd/SoBobwmFg96Pbn80YACDIdMXVhnmtbmRB w==; X-IronPort-AV: E=McAfee;i="6500,9779,10481"; a="302429037" X-IronPort-AV: E=Sophos;i="5.93,345,1654585200"; d="scan'208";a="302429037" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2022 00:28:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10481"; a="710021675" X-IronPort-AV: E=Sophos;i="5.93,345,1654585200"; d="scan'208";a="710021675" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by FMSMGA003.fm.intel.com with ESMTP; 26 Sep 2022 00:28:36 -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, 26 Sep 2022 00:28:35 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) 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 via Frontend Transport; Mon, 26 Sep 2022 00:28:35 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.173) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Mon, 26 Sep 2022 00:28:35 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VE/C5D+VLJCp3+Ys/OFvR+Nt1t2nMph2HPiGxQKjB2MrVR3MNllyBR0bBx5KH+K1O83qcfYEzHettT+h7WGnUPHHVxj3GbLhAWjj21vy5G0AP3H8tbxNqG1NAgnXL7dfF0Zb4uFlzINe0pRBXj84SK42Gn5g2QS3vUeMmLkPVQEZ5+uVh1y+NXjhu0AbtjnZgJhRbcE3iRW/caS89r+3uXMOA/w3mQ/pFkEDS0+edjJKJGi4Tgif7wHaLjlhAfa8Vpur1nWZap0dMwT1ch5dBhJZEaNbYcpm8ThimoKI6MxGY+E1GiJw/o0hZUlXM7K0ANPfhZEaddmaNLDsMWvZbQ== 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=KE54zS5PN17qgq0RyVTndiqkgpRLrT8cWqNTMShgEms=; b=FpsvQCBMkqxGLduQHbVOlJYL42jIEEABWeQTI0NbPi7Eo4Eg5ivBdxepvnxUxO9rKjKznoT98FucEoh41CdmS3Gqe5GzI/WP6XQoKt7N0G4zlWY9Fv5SglBc3k8TgwOIzGIkvwe5JSmgxPMq1+WLEegpV/MB72BUSBw1pei4MDkLQgXO9oSiMKHQWgFa1Tke0BvtO+6NbXXfQCZpCHKB/mlZ1uX/XDf/tq3ccj4KtNkRg+qa8TWTCheqHu8CIWdNeeUiAcxrWjBJozAOqMMKB5ZcjwQpf5BkLTas39Xl59SHPEWV049VAJdktkpYgBik0o52CxOntcx0zXpdXFBuCQ== 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 DM8PR11MB5640.namprd11.prod.outlook.com (2603:10b6:8:3f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.25; Mon, 26 Sep 2022 07:28:33 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::408e:79cb:b715:b8ac]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::408e:79cb:b715:b8ac%4]) with mapi id 15.20.5654.025; Mon, 26 Sep 2022 07:28:33 +0000 From: "Xia, Chenbo" To: Xuan Zhuo CC: "dev@dpdk.org" , "hengqi@linux.alibaba.com" , "jasonwang@redhat.com" , "mst@redhat.com" , Kangjie Xu , "maxime.coquelin@redhat.com" Subject: RE: RE: [PATCH v2 2/2] vhost: introduce VHOST_USER_RESET_VRING Thread-Topic: RE: [PATCH v2 2/2] vhost: introduce VHOST_USER_RESET_VRING Thread-Index: AQHYwNpXqyDLL9Gn8EWeD4O0LScN663rSgjQgAEPgICABRepkA== Date: Mon, 26 Sep 2022 07:28:33 +0000 Message-ID: References: <1663897297.0251951-1-xuanzhuo@linux.alibaba.com> In-Reply-To: <1663897297.0251951-1-xuanzhuo@linux.alibaba.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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_|DM8PR11MB5640:EE_ x-ms-office365-filtering-correlation-id: 5182a764-b2bd-45dc-85cc-08da9f90b812 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RjtnkyCkrGZ+Gm0lsrPX7FFHIagMDRwgAr8O/4ZxwRN5DFulKQ7ZkdAkKGMlkc7CJFzWs8ug4BVp2ZNoQJBFPj2YgeAaFrP7UeyNIwRK6dq3OpeV4OJwCrkHsvymEiEOKRqL7B+5HoQFXzbczZjoWR5Zb9DB/AxiydNK+6ru2sCua+8Qkeu2wDR4fk+HaAdvMrzQ5udBQCqw15aOm6C8pA7X80eFeSV5ZE5JyL/rrXd2z6/dggp7XKJywLvWllbrPrJnCE2nL186KPOqFWre49eOJJalO2cKvLxmKgy0KXhMoALoYZYX8J3dDZfcwBvR49R5URr8cnTtLGb3Gq5vU6MTL3wGasm5cH0pc6WEzoovgzYptDFyQmaT0xMMo4V8p2YMTUp+ylstvAMZGQeUVmQLA9PFPh7Ru5PI5N49DBerP6mUaqgJOz+3N7uSXKRCYY3qHpO+He4G27VM8YLqvo+RyOfSZRGlZOcudCwJdh2psUSC2bGyxOCwhNm+p+Zdlp4iMED2uVFgEPZqPORtek9ECWpPHFl4PuUDxFHLcZds3q/EeK3BRGijn0D+9u0XzwR6M8zdDj7uPJPZ6JUFhXW1SSrwDn28RmiA+WbTikiNBMFogf6bKmBzXJElyoZI6YYtFr6rhsf4Y05xYDcynlDRbnRI+zmVHhCishb4OXX9M6Wt3RjDhOarOvrNNBF9vUghW+ICUS0Qif3NhGt9IKE9sKiwl73OZRa8cJM89kuStMtctVyZs3Ne3j4QPf7YpPw0p8cLyeXbVJegajQKhA== 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)(39860400002)(376002)(136003)(346002)(366004)(451199015)(9686003)(53546011)(26005)(5660300002)(33656002)(2906002)(38070700005)(66476007)(66556008)(66946007)(76116006)(64756008)(4326008)(8676002)(66446008)(7696005)(8936002)(52536014)(6506007)(41300700001)(38100700002)(86362001)(55016003)(186003)(122000001)(82960400001)(6916009)(54906003)(71200400001)(83380400001)(316002)(478600001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?iDxhmB5dMFgrxJR2DsNmkXj6YRMtSEHMOPXk9gQiwyuOig7Tk4sFTiQMJmFT?= =?us-ascii?Q?naOFWFcRsPQojTUSXomL0YBnfMHvCCx5H8IS+Wo8Ebb3fzjGZ5mGeoTPtOdc?= =?us-ascii?Q?jIQG02ghIAFWfWflzyjCqx9P8IK7bJpsr1DwNWl/ZhvM4gd+w4wcVdGq3TBs?= =?us-ascii?Q?PRrCFWQcI50vF0CjkrtJv3W94YRneZ+jBiORjTo0A+tUh/9tIYqGdlCu6Zlp?= =?us-ascii?Q?9r5k8LGLk2Eun2gfV7ybzMXeQyBxk53VBB8F5LsK83HJFZEruYffM+jyz7MO?= =?us-ascii?Q?XamnsQ83WUJIgMqwgx43pAPDg6f6xemEQ3rrq0tiqlE4ZahZA5edchVpNO82?= =?us-ascii?Q?49Aq0x4k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ascii?Q?Rfp5N5oEjZ9UVVy7fHW+ZC4DYDCQHeKqv86FR7/kO12h0Erv9eUNOs0SS9z4?= =?us-ascii?Q?Za94VTpw9qQOOQJi8HxfOrMdYcq11qvfgYyYA3hNLHBZ2fyarDO0e0K2JUkZ?= =?us-ascii?Q?a84T4rnFA5Ze+tUqQDpjLVAxc1Txswwbq5tiSEmZTGdk6S83ETUaFAApMgRG?= =?us-ascii?Q?U4wnCH06x9GDLvQGIfrG5l2QVNwSSwuNFdeBKtvt4pTQhOL6yPWEhkrkOsCF?= =?us-ascii?Q?LD2XQxClv7xg91AzQi5eqrIGfG3w4AA36En8CZseBmV6GL2wDUbJCZdiHoo2?= =?us-ascii?Q?xd6q1S+79zxObzuhkS+QU+zDXoqo3XsCsOMB1KPr?= 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: 5182a764-b2bd-45dc-85cc-08da9f90b812 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Sep 2022 07:28:33.8518 (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: yaIDkC32ryS2V1F0Pdz/CDfVpxP2zmNkLBcbM/xkLHgh0fzlOnTkW46ZA8L/cisB/qVTXH9F3Rs6ivM53572qA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR11MB5640 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: Xuan Zhuo > Sent: Friday, September 23, 2022 9:42 AM > To: Xia, Chenbo > Cc: dev@dpdk.org; hengqi@linux.alibaba.com; jasonwang@redhat.com; > mst@redhat.com; Kangjie Xu ; > maxime.coquelin@redhat.com > Subject: Re: RE: [PATCH v2 2/2] vhost: introduce VHOST_USER_RESET_VRING >=20 > On Thu, 22 Sep 2022 09:35:35 +0000, "Xia, Chenbo" > wrote: > > > -----Original Message----- > > > From: Kangjie Xu > > > Sent: Monday, September 5, 2022 11:48 AM > > > To: maxime.coquelin@redhat.com; Xia, Chenbo > > > Cc: dev@dpdk.org; xuanzhuo@linux.alibaba.com; hengqi@linux.alibaba.co= m; > > > jasonwang@redhat.com; mst@redhat.com > > > Subject: [PATCH v2 2/2] vhost: introduce VHOST_USER_RESET_VRING > > > > > > To support the reset operation for an individual virtqueue, we > > > introduce a new message VHOST_USER_RESET_VRING. When the feature > > > VIRTIO_F_RING_RESET feature has been successfully negotiated, This > > > message is submitted by the front-end to reset an individual > > > virtqueue to initial states in the back-end. The reply is needed > > > to ensure that the reset operation is complete. > > > > completed > > > > > > > > Signed-off-by: Kangjie Xu > > > Signed-off-by: Xuan Zhuo > > > --- > > > lib/vhost/vhost.c | 2 +- > > > lib/vhost/vhost.h | 1 + > > > lib/vhost/vhost_user.c | 27 ++++++++++++++++++++++++++- > > > lib/vhost/vhost_user.h | 1 + > > > 4 files changed, 29 insertions(+), 2 deletions(-) > > > > > > diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c > > > index 60cb05a0ff..215a1ca355 100644 > > > --- a/lib/vhost/vhost.c > > > +++ b/lib/vhost/vhost.c > > > @@ -610,7 +610,7 @@ init_vring_queue(struct virtio_net *dev, uint32_t > > > vring_idx) > > > vhost_user_iotlb_init(dev, vring_idx); > > > } > > > > > > -static void > > > +void > > > reset_vring_queue(struct virtio_net *dev, uint32_t vring_idx) > > > { > > > struct vhost_virtqueue *vq; > > > diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h > > > index 76461a3406..eccb52842d 100644 > > > --- a/lib/vhost/vhost.h > > > +++ b/lib/vhost/vhost.h > > > @@ -791,6 +791,7 @@ get_device(int vid) > > > > > > int vhost_new_device(void); > > > void cleanup_device(struct virtio_net *dev, int destroy); > > > +void reset_vring_queue(struct virtio_net *dev, uint32_t vring_idx); > > > void reset_device(struct virtio_net *dev); > > > void vhost_destroy_device(int); > > > void vhost_destroy_device_notify(struct virtio_net *dev); > > > diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c > > > index 4ad28bac45..5f7743d9d9 100644 > > > --- a/lib/vhost/vhost_user.c > > > +++ b/lib/vhost/vhost_user.c > > > @@ -2771,6 +2771,30 @@ vhost_user_set_status(struct virtio_net **pdev= , > > > return RTE_VHOST_MSG_RESULT_OK; > > > } > > > > > > +static int > > > +vhost_user_reset_vring(struct virtio_net **pdev, > > > + struct vhu_msg_context *ctx __rte_unused, > > > + int main_fd __rte_unused) > > > +{ > > > + struct virtio_net *dev =3D *pdev; > > > + int index =3D (int)ctx->msg.payload.state.index; > > > > Why not just use unsigned int? > > > > > + > > > + VHOST_LOG_CONFIG(dev->ifname, INFO, "reset queue: queue idx: %d\n", > > > index); > > > + > > > + if (!(dev->features & (1ULL << VIRTIO_F_RING_RESET))) { > > > + return RTE_VHOST_MSG_RESULT_ERR; > > > + } > > > > braces {} are not necessary for single statement blocks > > > > > + > > > + dev->virtqueue[index]->enabled =3D false; > > > + reset_vring_queue(dev, index); > > > + > > > + ctx->msg.payload.state.num =3D 0; > > > + ctx->msg.size =3D sizeof(ctx->msg.payload.u64); > > > + ctx->fd_num =3D 0; > > > + > > > + return RTE_VHOST_MSG_RESULT_REPLY; > > > +} > > > > IIUC, before this handler, we need to lock the queue? Using > vhost_user_lock_all_queue_pairs > > > > BTW, is this support merged in QEMU now? I remember for similar cases, > > we wait for QEMU to merge first and then merge in DPDK. > > > > Maxime, do I remember this correctly? >=20 >=20 > Yes, we are simultaneously pushing this feature to QEMU. >=20 > We have a patch for v3, maybe you missed it. >=20 > Thanks. Oops, sorry. I did miss that. And please ping when the QEMU side is merged. Thanks, Chenbo >=20 >=20 > > > > Thanks, > > Chenbo > > > > > + > > > #define VHOST_MESSAGE_HANDLERS \ > > > VHOST_MESSAGE_HANDLER(VHOST_USER_NONE, NULL, false) \ > > > VHOST_MESSAGE_HANDLER(VHOST_USER_GET_FEATURES, > vhost_user_get_features, > > > false) \ > > > @@ -2803,7 +2827,8 @@ VHOST_MESSAGE_HANDLER(VHOST_USER_POSTCOPY_END, > > > vhost_user_postcopy_end, false) \ > > > VHOST_MESSAGE_HANDLER(VHOST_USER_GET_INFLIGHT_FD, > > > vhost_user_get_inflight_fd, false) \ > > > VHOST_MESSAGE_HANDLER(VHOST_USER_SET_INFLIGHT_FD, > > > vhost_user_set_inflight_fd, true) \ > > > VHOST_MESSAGE_HANDLER(VHOST_USER_SET_STATUS, vhost_user_set_status, > false) > > > \ > > > -VHOST_MESSAGE_HANDLER(VHOST_USER_GET_STATUS, vhost_user_get_status, > false) > > > +VHOST_MESSAGE_HANDLER(VHOST_USER_GET_STATUS, vhost_user_get_status, > false) > > > \ > > > +VHOST_MESSAGE_HANDLER(VHOST_USER_RESET_VRING, vhost_user_reset_vring= , > > > false) > > > > > > #define VHOST_MESSAGE_HANDLER(id, handler, accepts_fd) \ > > > [id] =3D { #id, handler, accepts_fd }, > > > diff --git a/lib/vhost/vhost_user.h b/lib/vhost/vhost_user.h > > > index 8ecca68597..51cb2fc74a 100644 > > > --- a/lib/vhost/vhost_user.h > > > +++ b/lib/vhost/vhost_user.h > > > @@ -60,6 +60,7 @@ typedef enum VhostUserRequest { > > > VHOST_USER_SET_INFLIGHT_FD =3D 32, > > > VHOST_USER_SET_STATUS =3D 39, > > > VHOST_USER_GET_STATUS =3D 40, > > > + VHOST_USER_RESET_VRING =3D 41 > > > } VhostUserRequest; > > > > > > typedef enum VhostUserSlaveRequest { > > > -- > > > 2.32.0 > >