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 3509E45EF3 for ; Fri, 20 Dec 2024 03:17:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2D794402B5; Fri, 20 Dec 2024 03:17:22 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 78E1440144; Fri, 20 Dec 2024 03:17:18 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4YDrZc4rdVzFrfj; Fri, 20 Dec 2024 10:14:16 +0800 (CST) Received: from dggemv704-chm.china.huawei.com (unknown [10.3.19.47]) by mail.maildlp.com (Postfix) with ESMTPS id 9A972140154; Fri, 20 Dec 2024 10:17:13 +0800 (CST) Received: from kwepemn200012.china.huawei.com (7.202.194.135) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 20 Dec 2024 10:17:13 +0800 Received: from kwepemd500024.china.huawei.com (7.221.188.194) by kwepemn200012.china.huawei.com (7.202.194.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 20 Dec 2024 10:17:12 +0800 Received: from kwepemd500024.china.huawei.com ([7.221.188.194]) by kwepemd500024.china.huawei.com ([7.221.188.194]) with mapi id 15.02.1544.011; Fri, 20 Dec 2024 10:17:12 +0800 From: "Wangyunjian(wangyunjian,TongTu)" To: Stephen Hemminger CC: "dev@dpdk.org" , "maxime.coquelin@redhat.com" , "chenbox@nvidia.com" , "Lilijun (Jerry)" , "xiawei (H)" , wangzengyuan , "stable@dpdk.org" Subject: RE: [PATCH 1/1] vhost: fix a double fetch when dequeue offloading Thread-Topic: [PATCH 1/1] vhost: fix a double fetch when dequeue offloading Thread-Index: AQHbUeCfDFMb3moSS0+hMQxlUzfoA7LtOJYAgAEthxA= Date: Fri, 20 Dec 2024 02:17:12 +0000 Message-ID: References: <91dc12662805a3867413940f856ba9454b91c579.1734588243.git.wangyunjian@huawei.com> <20241219081532.345c7536@hermes.local> In-Reply-To: <20241219081532.345c7536@hermes.local> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.242.157] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org > -----Original Message----- > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Friday, December 20, 2024 12:16 AM > To: Wangyunjian(wangyunjian,TongTu) > Cc: dev@dpdk.org; maxime.coquelin@redhat.com; chenbox@nvidia.com; > Lilijun (Jerry) ; xiawei (H) ; > wangzengyuan ; stable@dpdk.org > Subject: Re: [PATCH 1/1] vhost: fix a double fetch when dequeue offloadin= g >=20 > On Thu, 19 Dec 2024 14:38:28 +0800 > Yunjian Wang wrote: >=20 > > - hdr =3D (struct virtio_net_hdr *)((uintptr_t)buf_vec[0].buf_addr); > > + rte_memcpy((void *)(uintptr_t)&tmp_hdr, > > + (void *)(uintptr_t)buf_vec[0].buf_addr, > > + sizeof(struct virtio_net_hdr)); > > } >=20 > Do not introduce more rte_memcpy of a fixed size. > You don't need that many casts! > Why can you not use a structure assignment here. The virtio_hdr is a shared component, and other fields within it are read multiple times. This can potentially result in a double fetch scenario.