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 5E50AA00C4; Fri, 1 Jul 2022 15:06:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 037A54069D; Fri, 1 Jul 2022 15:06:00 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id EB92F40156; Fri, 1 Jul 2022 15:05:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656680759; x=1688216759; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=E3sqj1GAAaoLa6eOPW6vwXi1CpC6/nbUpzaR0JNPnYA=; b=QUtRRtSQEo4lhIDawDBIsgoFRjY5bYexic4UouN46rUO3KBfaO44dXGb xC0ychwZaPHfWO3jJB73bILXI3CrOUPcxFdkgV9Uk/twNY+Wa7B3aMDdB J/hUOBv1BaXDSA5+KFSuZ5Q9LOYVuySJc2uerErG0b8aYz+ngMr4Xukcf UqDKSz80jlAGQWxVCgrOZMmkvFhJVW0Kj3z1bOzZnfTI7TDnlnDE34rpi S8Djd77RDgXkdVhzLf32VhzGqU3Wqlt3T8VdlhFuL8sfo4ATphVsbX3DA wAS2/HfxYun2bWzI5NdPjqusCRqyeQCtzG3hMEDz0d+mYcbuxsXtBR3xh g==; X-IronPort-AV: E=McAfee;i="6400,9594,10394"; a="283748399" X-IronPort-AV: E=Sophos;i="5.92,237,1650956400"; d="scan'208";a="283748399" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2022 06:05:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,237,1650956400"; d="scan'208";a="768498978" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by orsmga005.jf.intel.com with ESMTP; 01 Jul 2022 06:05:58 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 1 Jul 2022 06:05:57 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 1 Jul 2022 06:05:57 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Fri, 1 Jul 2022 06:05:57 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.105) 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.2308.27; Fri, 1 Jul 2022 06:05:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aRE2PN89IQ34rIl7wjtJCfkA5+QRsvJD2QaxdbZ4BGEsEH04vHHZkUSpmaELy7tRfcvqGjMGQJAG7VOUgt/z4MwxhsgHCbsQHJXzcVtu3R6l2RjUTKBPRXF1RzA0imwlAhVzW/38T0S39Q0JoXLD6kksJrcRIx+VdEUWSPWRJlN8y3sLgUSrHR9E01BnITX1pIAYirQJU2CuRLFkaI1pXO690NCyFdpuQ8O/BLkAxPdQQGG8dYn/5LPC3g1o5jN7XdLeYlBwERb0bonsOuBv7bcV841H5ZdmpcGLFFEgigzK/wjme+1Mkee0Fme71x6LZLqOFI/RXG9W7zxkoUzM6Q== 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=FyIyF2lDoMzQU3G+gJp0Dz84Inf5KtkW2i3HJ80Ol7g=; b=jxJ0rASe1a7/SuRZfKmokaMwVooweg+kG+ngDyZebFCNUD7fccKA8g5P5VMDgI+ogL/ROybmb0/VrjZovC1RTxZIb/OrFuXnxoVoZl1t+iuIDpO1uI8P+O2ry7HgQPklHQsBn0GKNi7bqe7sTQSmzGCZQ6EkhKVL+ZqGdx1BFHoUz5u6EHav/uFsv5gZS6bikgIJIg/HYkvzorYCW0LTtt5sXuwb7/r8wQKRFTmIyCVzdK9zyD6C5xme2UstFM78EiL6/eznQzTym+U911DJ2pynQygatR297N+WF7rR+3huf55ou0a7lngLM4n+jdjjT6FcPCLhF1ZYHzha5naweQ== 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 MN2PR11MB3965.namprd11.prod.outlook.com (2603:10b6:208:13c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.17; Fri, 1 Jul 2022 13:05:54 +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.5373.018; Fri, 1 Jul 2022 13:05:54 +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: AQHYhdZuBdpQoYGq5ES5PKtj1eTY8q1phhgw Date: Fri, 1 Jul 2022 13:05:54 +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: 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-office365-filtering-correlation-id: c110304d-bfcf-4f08-369e-08da5b626eab x-ms-traffictypediagnostic: MN2PR11MB3965:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: gcsKWdkZtvEZgbGqUIbk+Aok8F2UsrX9LzyFjveeLgbI9GBlAj1W4odW2NmLVREGnFXGaWaL2dRQagTFf2l1iKtmIk1BLS83CseDuNxukNWCs/Jz1xqyI8y7mE92btnXjjYFzYTbgNIF5HGY02qpaqP+UhnmoKwJbqwZmzE8u9C2InQH6xioRIllwHSIiK8Svm0u3oCXsk1SZ0ouAqHswZZq1MCJNq/zWnm5u7yxHYYNaf1vdkCa7llLSo1N5Ybv+O3r9p0zn4jz2gpLzJaKq+9B93VtjEoS3qGpwHE+/7AmLXoP1p13o4ow1qDYpbsKc8cO3C8OI9PSqOedaWroDK9b380cssZQ20XLKycLknjIrWprWrc1uBayAFw4LhbhyDmIZ4ceEsWRB4TzKUCgpafuq96RdaqJxz63eySioUjQZYZKVIeIMDB/fqW4A2Br2ctHoliJ7egi0nh7TVWVw4QAtSSGfkCDUbAwo/rF7XQTICVH7FQPNBQEDZPrB0rXrBiyYtmWBBVHhkcSEQ4H2u88Hxnp2/FxsFyuCZV7+7hHWjgTft/dcgN2Z5xaXnuGqBr5OAkdEGcrWQbTVZcz/rnzdGBPCLPRmKoKTwqMCVh1JJbjzHALwMvQG2nm9/oRw5pR7dmil3yiSNt3gR5iV+3KkfDIa4Hr4tHUQnbBB/h5u2H5ShIXNMizyeGsy/o8C7N31H8Vfyij2R4CFjqUTAecamcC5M0TaiiA+ETLbeCLPPhtfNr5ybyD1JOQS8e0Ie86jtFlBcsRybpWVfLCM0NRKx5ord28gnx9u1H+6e1ufh3TWGRVaEBu6FveiyMN 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)(396003)(376002)(136003)(39860400002)(366004)(346002)(82960400001)(83380400001)(122000001)(38070700005)(38100700002)(4326008)(66446008)(8676002)(64756008)(66476007)(66556008)(76116006)(66946007)(316002)(15650500001)(8936002)(2906002)(52536014)(53546011)(9686003)(41300700001)(26005)(186003)(7696005)(6506007)(5660300002)(54906003)(71200400001)(110136005)(33656002)(478600001)(86362001)(55016003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?fJWOwZdt0Z7Q2MmPWILt3icvZ2IUenrrXYpkNLzIx3Z6tinEOiGbnZFEi/n9?= =?us-ascii?Q?hFo7zQIromLmoGPSENjWkf3VahfpgJDgnDMspu7CR5KPUis9YPQuKKJSEWOX?= =?us-ascii?Q?TBgFdMX7KKPzFMaRzIxuC5VQFTIw9A1ranwjGq2DtUr0hIi5O/9XxFQPDLQw?= =?us-ascii?Q?I3slhIWp0zoZwVaT+dIL9+5nyWqdvQW7eLuCwDPtW/eJQWS7jNyWUj6NUwB0?= =?us-ascii?Q?Guu1i9kZbBGmJ5Bh+Lg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ascii?Q?lLiK1Bve5QggdVLogvQ8uRXRWtiDm1vrLmgTDnVGEUACv9BOv7XhCzxOMk73?= =?us-ascii?Q?7ikdkQXncLwT9iX0HUTQE40oI0tFgysY6onjWabxmRmFbq6pAFZnLicuJOM1?= =?us-ascii?Q?zsDuKFEV2Jtt+RXaqkOS7n2cQRZDxoTC+fOV4J0ZOn1nfGM3A+9wW33Wtf03?= =?us-ascii?Q?nylrhGtn29xV4jjEluTr0M8rU2k2Cb/zMfRJ92w3TQ7QnQzcZHyTgpvBENOr?= =?us-ascii?Q?M5Avr5mG8CD8hfzUP5fE4CNFGEdImlAykMp9QOACzxxD6gM1U9GdnwNyVZsK?= =?us-ascii?Q?pfQBeP9+rXu0lrXK91BBxfF3ahl+qQa6WLBNjWb7ZOmRcDR7Ptd78HpDlVWP?= =?us-ascii?Q?7aj5XCC0wtXP02rXYxc0TOynla3e7VXaKoNNqbE9MX1hC5j6UTcGhnYMNx83?= =?us-ascii?Q?JeNEDzxxYWs2yygbC13r6ERceoeW2TGkJuh182Br?= 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: c110304d-bfcf-4f08-369e-08da5b626eab X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jul 2022 13:05:54.7358 (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: 0DtJaBbaSvUcoVjjpAxLt4coyLHaWUxhzTMD/fGuBPzw+d5vx1N/WRKo85nFXcl85L2qbnkYg8SwfsFmmrRITg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3965 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: 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. Function name now is desc_to_mbuf > 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. Could you help elaborate more? Do you mean first mbuf len is zero as it's dropped? And where does the segfault happen? APP? Please describe more to help understand the issue. But I do notice one problem here is if vhost APP does not handle the mbuf array correctly, some packets will be missed in the case of pkts got dropped in the middle of a burst. Thanks, 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