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 C753DA0C41; Sun, 24 Oct 2021 07:54:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 54DC14003E; Sun, 24 Oct 2021 07:54:18 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2042.outbound.protection.outlook.com [40.107.220.42]) by mails.dpdk.org (Postfix) with ESMTP id 5DBE24003C for ; Sun, 24 Oct 2021 07:54:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P9AuO6RQeCas92zDFJL0ftXzi2FLwe+MlHSEzkhOwhTH8x3BEa+fTn0QCMcilKffhvuPJ5DuJDSww+O1EpbZpiBnugA+QeF4BjocVQWaWmh5+URontgViz4MCE7DFwsawccnUqNeSEDWlSSq8NLDj4L1ckFC5KZs+q2/TIOBAFFv37TqvFfOVEXZoqoAOJaPDVST5rfW0TkRWaZMSY3ZhncoaWGNdE1PIht2bo79wKyoWmOyZus+zyvcKi6DhGyRkHNvr74ZP08cYW8uTQQRVKXPpFrTm1y1+8P60fZh+eCraYw8ZLDfGb3VBr12cHUiDQFcdl1wubTlKuNseN88Mg== 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=E7yJrwZmAnBxj1i4FJMDetPZIsDysNCbZwtPuzem0eA=; b=GadHSoTaMu+JkMIFPRsu04O1UWQkAkSfNn9/ZPJ52uUdcok3ND6LfpAudmghHNB7NOBK2DYGsAPDPkXO5hFgBDp41JuDvLpTHRSsUcICyn36haLWbnagjF7uhdkJ5u9UWyOhnFcIXzHy4bTnmKXVTIwCajUeYb2lr1++YBqgqAECaJCxisG8+lZxUka18kI1ThxtQ9INxabJI+ofe7P8V9oMyXYwqiLsJD9al0o4xGuRoxnlqTYNhRlYQ8TaFgULhy34a9sWEcY+roertv9pViSc6IUKt5wC9QkE861Wu5r4T7a+W8QeXqy6YVsnR4dOP5Ixt8Qqb2yoqd/2vb9IgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E7yJrwZmAnBxj1i4FJMDetPZIsDysNCbZwtPuzem0eA=; b=hvJONeYFi+1yHGBrniv1Nc7RZt9YUnTB+UqEyPBNPJ5KT7o50UIewcmyUZQoZwIARPW068U8BEqlbvPbITA/tNmVRG0T2xJBY5k3ZXiciKO4qhMhUQ8nI96YZJg+moDArYJYJ8ZgNckNSCtVp0pF0Bwc73FbDp8IR+OPpX0wkJgk1yZ1a/zaj39IBeKzjg13RPTAI3jvzB1d7K17Qr9eEAntnOrH6FppOFy1I+/Aiv/MBe6wxQU4v1QLqeGSEiGbOvvEEsx1+ZGl5Grhp9ihhD6NzRa6K8eeUZzVxuknEi3jwrBvaULiMdHbuKIoRjWG08eTHqY23d6G8mIxSoAk6Q== Received: from DM5PR12MB1755.namprd12.prod.outlook.com (2603:10b6:3:107::9) by DM6PR12MB3740.namprd12.prod.outlook.com (2603:10b6:5:1c3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Sun, 24 Oct 2021 05:54:15 +0000 Received: from DM5PR12MB1755.namprd12.prod.outlook.com ([fe80::f0d0:7b3c:2e7f:cf1e]) by DM5PR12MB1755.namprd12.prod.outlook.com ([fe80::f0d0:7b3c:2e7f:cf1e%10]) with mapi id 15.20.4628.020; Sun, 24 Oct 2021 05:54:14 +0000 From: Bing Zhao To: Stephen Hemminger CC: NBU-Contact-Thomas Monjalon , "ferruh.yigit@intel.com" , "andrew.rybchenko@oktetlabs.ru" , "dev@dpdk.org" , "konstantin.ananyev@intel.com" Thread-Topic: [dpdk-dev] [PATCH 2/2] ethdev: fix the race condition for fp ops reset Thread-Index: AQHXx4nSmTN1UxQJJEaZjEivYAajzavgwryAgADjw2A= Date: Sun, 24 Oct 2021 05:54:14 +0000 Message-ID: References: <20211022211407.315068-1-bingz@nvidia.com> <20211022211407.315068-2-bingz@nvidia.com> <20211023091325.0120256c@hermes.local> In-Reply-To: <20211023091325.0120256c@hermes.local> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: networkplumber.org; dkim=none (message not signed) header.d=none;networkplumber.org; dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6ce7949f-f094-49bc-5984-08d996b2b5d5 x-ms-traffictypediagnostic: DM6PR12MB3740: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: D/jxT+Wr2YYLOHnK40Z7UuvEWlxY/K2/2VyKTxDx10ZCTBXsTXp0a+SA9WRXLfGTJ1TyM1sioVgkzTt4AeOdC/F8K/teTjGJiiBebjbZMlUh2xw22RXIM4lV2g/nYLS9qatVSwvjKhjl02dqG2FSTdDukP1i4vEXstFFZHdFA/McJaPDlPNI766jSpjiI6H2BZcJiGK9fHx9gA5e3J/GpwTCRr1ybQ+BjXjjTK0nqNuJfkTgNQFwP0EBFAr0NZ65hBeR2qDZStiT3aH2QR27m/XkHuMFraOLwwnFw/qOMZ2InR3fzrnxC14fKNxiGy7mg03FbsXwpOWnwzl1NK2IybIK8NzUqxA+VvQ8fatxGUrpv5PPOpgq0kmzl5wWNYknHLWXdqvvfQ+LUzi591tzftdhnuPvaseyFI455ltc47OXu4464eEk59mJD9ovMS3o2008/Dx0wevJQ41qeUxJ70iHgJSyyhEXuKofE3Z53KZ+8aeKgHXUqOB4JROaJhTgiWTZA0h7ycbqlcFZ9JcJoaqlTA13+nLPpsOxLDwHNKRNB6pQk+PYZl0ERsYf90cvNa6AVMm3YmDHA1ptHZ3WRLU1zKnHf8kZv45emDhU62p2twWt0VoZYsYjVdyBRMc/oEadrNGwQi5NFK3daAVcezbCWEVMgbHiXFNAYRujr1CjbBOO9IX08UBSJ1bIZY2mm4GvwiN+/v+use/r7cROEw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR12MB1755.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(7696005)(52536014)(71200400001)(9686003)(8936002)(8676002)(38070700005)(4326008)(316002)(6506007)(53546011)(83380400001)(54906003)(2906002)(55016002)(186003)(38100700002)(66946007)(66476007)(66446008)(5660300002)(6916009)(508600001)(122000001)(26005)(76116006)(64756008)(86362001)(66556008)(33656002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?U8f+ibAeESYoZT5fJXy7O9LfPaY51I+MOa0teqO0D+9XnFMa07zg7xzkyZea?= =?us-ascii?Q?kg1uSiHw6Er+y/+RbajyOZZAbsQEzF/2xn60NigQMXvQW7m3xyfoecrWdwLx?= =?us-ascii?Q?mnbbGSp0JW04V4UsfLo4PfrXlSMUsi+QpHqWLAA8+ti2d2/IOmQrGdkYZMnO?= =?us-ascii?Q?YQ7+WkvRtHeO6HIpe6pPHxcnZNeZLjD5iXnwobytLer6fMx9yU6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LXrNUto0O5goeKlrnAhPXRdIXxIVaz?= =?us-ascii?Q?UMx5GBhhbeKnsNvqMuMhDtyxMqbzVH+LJ+9i1vZNVgjGC8Qmg/pDhjTrmCwU?= =?us-ascii?Q?TMHhUYfss9sLmc/j8LKgLxUMdMU9FLhi1H3xrH6ZGescPRlUvb4yOpMWZ442?= =?us-ascii?Q?WF/D4/mYk9+dVk/Q0tB3xpbAsy/BOfmaEDdhgknppvRg1caYv95D80kd8OKs?= =?us-ascii?Q?q3s1QmYWngZC+ZYt4iID3IoZLTilsGypMBtzMf5LcE4t8AxjjYZUuJN/hh9Q?= =?us-ascii?Q?ZjLwPwdgjLdonH94I6eu/y/itew1EOph/pQpU4MIersaHcWP1fzrJaD6kORn?= =?us-ascii?Q?R7ccaJlcVKghRXzGciRyezg1zkiYEJq389WtanYpBg98ifum7kOxYnqbCy4k?= =?us-ascii?Q?VXFpLhiWtAVFhNzxleAZd7za5sMPK/bKYwviSNJTws3a8S4rVT5h3prZh8+Q?= =?us-ascii?Q?LSvVD2/t2dIxAHPSs9kA+iitDS1mnC7q9iihh32vnJCpHsJupZ7CKLId25HM?= =?us-ascii?Q?Cw=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1755.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ce7949f-f094-49bc-5984-08d996b2b5d5 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Oct 2021 05:54:14.7319 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: A0mOFervPquded1XG9o6xCKQ7Gs5PmhGUkIvBeDGx8+McePJ+K7858aPPLIZsBzvmo8n7plRldJURi9QthOOTg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3740 Subject: Re: [dpdk-dev] [PATCH 2/2] ethdev: fix the race condition for fp ops reset 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 Sender: "dev" Hi Stephen, > -----Original Message----- > From: Stephen Hemminger > Sent: Sunday, October 24, 2021 12:13 AM > To: Bing Zhao > Cc: NBU-Contact-Thomas Monjalon ; > ferruh.yigit@intel.com; andrew.rybchenko@oktetlabs.ru; dev@dpdk.org; > konstantin.ananyev@intel.com > Subject: Re: [dpdk-dev] [PATCH 2/2] ethdev: fix the race condition > for fp ops reset >=20 > External email: Use caution opening links or attachments >=20 >=20 > On Sat, 23 Oct 2021 00:14:07 +0300 > Bing Zhao wrote: >=20 > > diff --git a/lib/ethdev/ethdev_private.c > b/lib/ethdev/ethdev_private.c > > index fbc3df91ad..cda9a6e228 100644 > > --- a/lib/ethdev/ethdev_private.c > > +++ b/lib/ethdev/ethdev_private.c > > @@ -206,7 +206,7 @@ eth_dev_fp_ops_reset(struct rte_eth_fp_ops > *fpo) > > .txq =3D {.data =3D dummy_data, .clbk =3D dummy_data,}, > > }; > > > > - *fpo =3D dummy_ops; > > + rte_memcpy(fpo, &dummy_ops, sizeof(struct rte_eth_fp_ops)); >=20 > memcpy is not thread safe either. Sorry for my commit log and it may not be that clear. The reason is the thr= ead-safe, it is because the structure assignment and initialization. Then t= he pointer will be set to 0 and then set to the new value again. I am not quite sure if it is OK so use part of the old values and part of t= he new values in the same function (rx/tx burst). However, changing a point= er to NULL (0) is risk and would cause a crash of the whole application. Us= ing memcpy will keep the old value still value and change is into the new v= alue immediately w/o setting it to 0 fist. But YES again, the application should avoid such case. BR. Bing