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 587DCA0545; Thu, 23 Jun 2022 05:07:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F2A8540A82; Thu, 23 Jun 2022 05:07:08 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id E2D814069D; Thu, 23 Jun 2022 05:07:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655953627; x=1687489627; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=0hPALpswXN/uBTMZ1ilbhI0kF9yRfo1ubJ7Z7OJ09W0=; b=JMn7j+/Bt3BipzMu60WMhzJv7lDcVVxm/+i2Ur0T4qVRHzDkf4XIZU4T 5ogZLwcSwIpM20n2b5cvUI/qsKDxWkXeFVay8q2RrhGSrswY10siHWfGL Q/PIbryhLQjJ83ex/tyPFmfDzBJzqUj6kAOWTDiNuI11u+wq4jxjUw5Uw DEgiI65vyiOZkalXlgGy4szWZYWho10zCYUMwQBKJ3oQRh6iHjms/3Nae KeGgzNnViFWHcdSePDFiPVVs+Wn0rjvFy4RbcyJckayEiX2JjXt8zd36v EXr5/OPm4cIvAMjA9dN3uXUGx8f4UYZM8ZOFFGuvVSZNFdYZ3NlSug2EP g==; X-IronPort-AV: E=McAfee;i="6400,9594,10386"; a="260427724" X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="260427724" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 20:07:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="690819745" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga002.fm.intel.com with ESMTP; 22 Jun 2022 20:07:06 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 22 Jun 2022 20:07:05 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 22 Jun 2022 20:07:05 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.102) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Wed, 22 Jun 2022 20:07:05 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XKRXjKYaa7/RvHHBvx7chjajV1pn7DsF5to7o9f+d2zu65pM8YWo4Kf6Wt82gcz+L5MCpnEFISu0sjGLjCVTzgOX9MrolcSvyPeAo1svUZRmuZJZFqRmpp53GXHYEeUKRHAalzY0lbGr4Svzo3/UbzaKqpB2BD8Nqd35tTXD4MxlevDIDlIPhRSlFcakE350rc+hGOkDdn4fdNdsCQ+suyvJWJkzR/vD8XxdzIczE+3VGrMau8lA7yFsc1JFf+h92pT1wm/x3R/7tmZHlG4csM2l8PYXG417/Hl1rsmmOI+eYj43JYS19PayDrfu40/bgCnNDXtt83ZPUIwziQB/Kg== 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=7ijKnAw95/0DYvIN7+HuX4BPa9t5uoUFF/P0xtO5Fwc=; b=RdySnA/kgKOIKtBx64rFUQHcCckliTlWXdX/Fdh0UxG8ki1ywHWzDYxMCFu2QRVYOPkt7k1h0LbfaZciLhRKl+jNqDfjWMLEXZ1ze9GS27M8DSdGBjPP2wpHXEH1JHMma2ToPZUD3XSJ616v5EybAAQE7SwaxehSTg8versMB9yItn0m4zzD1sYoH7P6LU0zxxCIUXJi6oCCSJuyJQVJ/UyKmJ/gG23y/8jrc8n9SsACHM05NF67rFPl0gCygEI+mEG+AWv6ykGrCw0EXyClU0rW/Fs/xRFcebhk2q9Fum6FKYip03zPxKJTX+cCUa25XCj7scJgLzkppq3FBz8jpw== 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 SN6PR11MB3392.namprd11.prod.outlook.com (2603:10b6:805:c5::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Thu, 23 Jun 2022 03:07:03 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::54a0:2dbc:18b7:2aa9]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::54a0:2dbc:18b7:2aa9%7]) with mapi id 15.20.5353.022; Thu, 23 Jun 2022 03:07:03 +0000 From: "Xia, Chenbo" To: Gaoxiang Liu , "maxime.coquelin@redhat.com" CC: "dev@dpdk.org" , "liugaoxiang@huawei.com" , "stable@dpdk.org" Subject: RE: [PATCH v2] vhost: fix avail idx update error when desc copy failed Thread-Topic: [PATCH v2] vhost: fix avail idx update error when desc copy failed Thread-Index: AQHYhdZuBdpQoYGq5ES5PKtj1eTY8q1cUIOQ Date: Thu, 23 Jun 2022 03:07:03 +0000 Message-ID: References: <20220622005600.5920-1-gaoxiangliu0@163.com> <20220622011944.6115-1-gaoxiangliu0@163.com> In-Reply-To: <20220622011944.6115-1-gaoxiangliu0@163.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-office365-filtering-correlation-id: 2b207b11-0d57-45d8-63ba-08da54c572e4 x-ms-traffictypediagnostic: SN6PR11MB3392:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bwPzs6qhDEgpddpQciAhFrE0z8PF+BjshXwwYZ4eVkhvtG38+MVxhDBEx7bnLloTYFW1AB9qIIYCEYtyjLH5ikdNzDougiOCZDcrB16rAKu/KDyEO7kC6wXqf4ljskwRx0Y+O93YCqT1dQKvvpHAUDFtr+VkBHruErOlfY3mIE3VoVuZLNVcU4bIT0/YqCfnfaUzODjALGMtUBEIzr2cNRVaAq+DkMbRHqrzH1ytemDHwbQJ0kSZarxiBAnx2u30rxx7AscF1IO5jBhnyj6jbcrtI0LWmZvNpXDq+12fG8dr209yT3fkvOwI2C+gr4Q+HSKH29bHHUSDNpzPrOBuFkpfBS80VCRSQwwETlfoDiEH8s5Lfk0Lq01okfAr5l8itfrzDX9ywAtsf5szKef1f+tZYg677nv1CzJ4kFjh8ohzuQIfKLix3dH8PtnB2GXBRnkf4im1vhVm5LC7VAba9d1b5jW/HARvI5MmjPBMRmat52NXWG4a1IfspCVOMsOu4uAnkxTHQOLMMJKm2P+PvFh+XHCNXNW0S5aW4Nq9z5UZbdpiLj3dc1JBgPbth7VXiodDThORqbZjQDL1x7TmSjgDHrK2oMbsy/NlgZi2X7yT53m05LmWib6+d5euf3XYtI9Y5yN/T0SgUtUR7Kx+hz3no0XyHcs7n3I9sv5YdrMHWQu7QrADcTCFsOw+4IDLwNCpRW29hre/bURK/EpTycfiNDgODNQ1kpq6lYGoWI9/wOid12H067XXQa46r3ZL3kq2ddcJc+N6HNIQ7kdUkWaypn4PGJerSoXmMyd30GA= 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:(13230016)(346002)(376002)(136003)(39860400002)(366004)(396003)(966005)(53546011)(52536014)(478600001)(186003)(8936002)(7696005)(55016003)(6506007)(86362001)(9686003)(5660300002)(26005)(33656002)(2906002)(82960400001)(83380400001)(15650500001)(316002)(4326008)(76116006)(64756008)(8676002)(66946007)(66476007)(41300700001)(66446008)(66556008)(122000001)(38070700005)(38100700002)(110136005)(54906003)(71200400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?X8p5rVYqiYZtZjFYmTLcV6z4ma0+sG+lJz+k+l0at2xXnTj2HUXHHS+LWIBT?= =?us-ascii?Q?xk2GXrSXpJ2h7WcR7VFoOQi6IvbxfYE1VdlUDhp7miXc/S4jCA115GQAKYk/?= =?us-ascii?Q?KN3HEv7lYbO1m5pKz7r5NvVOG4P4p4DQkXXvXN5bIEMwWL3SW0NXiXqY0Nj+?= =?us-ascii?Q?zIw+S9Z1FfY1ko8UUeYDPyUQHYWCEiRQMRpK5sr+Y4Hmx0DCFK+SRoQLYKcv?= =?us-ascii?Q?togwkB6bmJAmPWzGHsX7qbSfgb7uFP3RP6cswhum/fV2PvqTH1ffZ9cVbNnR?= =?us-ascii?Q?8TjiA+vP8ue0YS29SxDMUyw/aDZalXpOxZ+WgV+AmceUHgcUrokBNKqVvhk3?= =?us-ascii?Q?A5cjRSz0bN84Ork/h3pRmY3DwWe0rDU8cq7l4hVs/mDfzq4gIsCPg2n44hxw?= =?us-ascii?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n1uvPegpzLne8UEten2QmNkCbD?= =?us-ascii?Q?LNfRDtUZZjEIoxI8ycQD65+Bnpu137iFVynPrmu9rD6mnbFGIfixX/InyQum?= =?us-ascii?Q?Qxw6b94KqiKmgAxC14MrtR3/sNhH/ZmO5ypmxAnbLaSpsvl1I3ihqfH7Fvvp?= =?us-ascii?Q?Yw31le2BGbJPRa4sEyxyWkH7OacT3Sfz27SVAj2eGmmuHpON4GXenDElA1g8?= =?us-ascii?Q?dmoWWsyTNsXjObjHA5IPoQWbHEhlAEdYYhEFiwLPXE4pcwkyiYfT7t7yBiUP?= =?us-ascii?Q?tAbKDU58TwhokFK5vsTn2F33/eF5NPhWiOqLMkRuyryIDiBFdVQSv431kwn/?= =?us-ascii?Q?NnGbE6PKhzAl+8g4kgVGMaty7hFFqpp4uWiYOiG8OaizSQR7+0TfuTrdAeEs?= =?us-ascii?Q?FfSl1SvkIPOIa4GUETsufL+B99ILocnsHJi+vXoCG+pmfpXjD2/dxyYlmmZu?= =?us-ascii?Q?rcuYGM21Ag=3D=3D?= 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: 2b207b11-0d57-45d8-63ba-08da54c572e4 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jun 2022 03:07:03.8894 (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: qu1OjOaNDM2O7rAXw7HHDDQmMpa0/Vy3iCXZBqxsy7VknoVG4sR2K/cX6BL8p+iNROM9pEGupFaWhSyW+Me02g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3392 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 Hi Gaoxiang, > -----Original Message----- > From: Gaoxiang Liu > Sent: Wednesday, June 22, 2022 9:20 AM > To: maxime.coquelin@redhat.com; Xia, Chenbo > Cc: dev@dpdk.org; liugaoxiang@huawei.com; Gaoxiang Liu > ; stable@dpdk.org > Subject: [PATCH v2] vhost: fix avail idx update error when desc copy > failed >=20 > When copy_desc_to_mbuf function failed, i added 1. > And last_avail_idx added i, other than i - 1. > It may cause that the first mbuf in mbuf-list is dropped, > the second mbuf in mbuf-list is received in the following > rx procedure. > And The pkt_len of the second mbuf is zero, resulting in > segment fault when parsing the mbuf. Guess this one is the latest? I believe something is wrong when you forward= this, it generates another patch because of your mail forwarding: http://patchwork.dpdk.org/project/dpdk/list/?series=3D&submitter=3D&state= =3D&q=3D&archive=3D&delegate=3D2642 /Chenbo >=20 > Fixes: 0fd5608ef97f ("vhost: handle mbuf allocation failure") > Cc: stable@dpdk.org >=20 > Signed-off-by: Gaoxiang Liu >=20 > --- > v2: > * Fixed other idx update errors. > --- > lib/vhost/virtio_net.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c > index 68a26eb17d..eb254e1024 100644 > --- a/lib/vhost/virtio_net.c > +++ b/lib/vhost/virtio_net.c > @@ -2850,11 +2850,11 @@ virtio_dev_tx_split(struct virtio_net *dev, struc= t > vhost_virtqueue *vq, > if (dropped) > rte_pktmbuf_free_bulk(&pkts[i - 1], count - i + 1); >=20 > - vq->last_avail_idx +=3D i; > + vq->last_avail_idx +=3D i - dropped; >=20 > do_data_copy_dequeue(vq); > - if (unlikely(i < count)) > - vq->shadow_used_idx =3D i; > + if (unlikely((i - dropped) < count)) > + vq->shadow_used_idx =3D i - dropped; > if (likely(vq->shadow_used_idx)) { > flush_shadow_used_ring_split(dev, vq); > vhost_vring_call_split(dev, vq); > -- > 2.32.0