From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0074.outbound.protection.outlook.com [104.47.38.74]) by dpdk.org (Postfix) with ESMTP id 5D7DA239; Tue, 28 Nov 2017 05:40:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=studentuml.onmicrosoft.com; s=selector1-student-uml-edu; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tQedlDrRidDnSkRLlYWqRwpSTLbghU8vtT7yyNNFvUc=; b=w5+If0/bHGPmxknMvESydQ2KWahYwj3vzZrWKQS4NSZwNkHPZhEyiS9bZbQeRtcoJaeULdzAre0IcXA0x/XuD+sctNaL8RMR7XDP/povp59itmTTkafpL0JkKjWRV9ADByzYw4N+RyGp6Poow+VQSGPbX9223vaasRM9Ay/rkXA= Received: from BN6PR02MB2689.namprd02.prod.outlook.com (10.175.95.15) by BN6PR02MB2690.namprd02.prod.outlook.com (10.175.95.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Tue, 28 Nov 2017 04:39:58 +0000 Received: from BN6PR02MB2689.namprd02.prod.outlook.com ([10.175.95.15]) by BN6PR02MB2689.namprd02.prod.outlook.com ([10.175.95.15]) with mapi id 15.20.0239.012; Tue, 28 Nov 2017 04:39:58 +0000 From: "Wu, Xiaoban" To: Stephen Hemminger CC: "users@dpdk.org" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] A question about the possible race condition in the l3fwd example? Thread-Index: AQHTZ+33jKE+NJVCl0+UXPVbQfpA+6MpLJmAgAAIp3o= Date: Tue, 28 Nov 2017 04:39:58 +0000 Message-ID: References: , <20171127200613.74783eff@xeon-e3> In-Reply-To: <20171127200613.74783eff@xeon-e3> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Xiaoban_Wu@student.uml.edu; x-originating-ip: [129.63.253.96] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BN6PR02MB2690; 6:W8klg/GiiHBsyZ04CN95iD5Dkp9zmGIExf1uLfrW1HJhQg+8Q3eFJhKiNZ0sniIyo3brB/nFF/urkQxg6niAC3pknytAd2fouY9/0kioRiLrxmu/pg+9+Fe+cg/YePioN1e3WE4Ojj/GdwqTnS/FqA7qUwUnLBrQIyAAh6gzak825KK1cBDcp5iYO7WUTRCNPpvmdqvPKCjMBvH6b4oxBjXgiFQTqityyXcH15UFkC2xaYbrkjPJp2yuAoVRiNEt1oJCWM4hv5HpEdS1PTdPYl2L/csGEfQcBTiJiJJ5dKR8VPiCpcyU8AJx705F589c9VbO9AVNPUpHc2QS3sVTpFyXhCX4GglPdWS5R7xVXtM=; 5:u1NZg4nld63Z/J/jXGz/GRMjFw9Yb12+DBEuzPNB3PiFfYdmS2JJmqVi1H8J4kQYLUrFphpzm9OTEdJoNN/pCsISs1YrelizRFO//4pOCSAfpduKcmYYYs+M8A+XtZBIBbSp7eLdMA9iimvbiyQjKJwsuVlxdnrIhUrhxFNFuuQ=; 24:0LWuuJUeYnqjRbHtTMPVXnL6GgBWdixJRAA51bC0Sif+NRC2q+N75FITVb1zU8A3e8M13w8PDUM/B4Xi1UEYf16CmiaMarAEeqkMjoVo3ro=; 7:QuLF9NXjhgY2PBpOGv7x5LDE4pMPD4gWLBrdl2OJ+/tLdFM8bMc67cPQapNCIPj66PGAEOUa/Mtc/Fi66ehbFIqbre5PEVLeNxUjrQVAzX+o5LSgIc8RakLwWMR9HFMbxKalui2OJr9j+nmuEv2MQBdDqN2ZXzD1NmYB6Sm4DL9VpZyWT0LBzFWqtVtr9rzMHLu0eHvI3E1WKWL9LZwBcGP1/dfzXw7iB9+BU4SZC7EHmAzxL6wEkn7FhJoEoAmG x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 3facee87-842b-409e-d1f4-08d5361a149e x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603199); SRVR:BN6PR02MB2690; x-ms-traffictypediagnostic: BN6PR02MB2690: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(192823040165218)(269151656437849); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(10201501046)(3231022)(3002001)(93006095)(93001095)(6041248)(20161123560025)(20161123564025)(201703131423075)(201702281529075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123562025)(6072148)(201708071742011); SRVR:BN6PR02MB2690; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BN6PR02MB2690; x-forefront-prvs: 0505147DDB x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(366004)(24454002)(199003)(189002)(2900100001)(53936002)(2906002)(229853002)(54896002)(6436002)(6506006)(3660700001)(97736004)(478600001)(19627405001)(3280700002)(8676002)(102836003)(88552002)(7696005)(6116002)(786003)(81156014)(53546010)(81166006)(3846002)(77096006)(9686003)(7736002)(86362001)(54906003)(316002)(74316002)(6916009)(2950100002)(101416001)(54356999)(50986999)(76176999)(42882006)(8936002)(6606003)(413944005)(5660300001)(99286004)(55016002)(105586002)(66066001)(14454004)(72206003)(25786009)(75432002)(33656002)(6246003)(4326008)(106356001)(189998001)(68736007)(42413003)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR02MB2690; H:BN6PR02MB2689.namprd02.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: student.uml.edu does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: student.uml.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 3facee87-842b-409e-d1f4-08d5361a149e X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Nov 2017 04:39:58.3764 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4c25b8a6-17f7-46f9-83f0-54734ab81fb1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB2690 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-users] [dpdk-dev] A question about the possible race condition in the l3fwd example? X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 04:40:00 -0000 Dear Stephen, Yes, you are right. Thanks very much for your help, very appreciated. It is= much more clear to me now. extern struct lcore_conf lcore_conf[RTE_MAX_LCORE]; Best wishes, Xiaoban ________________________________ From: Stephen Hemminger Sent: Monday, November 27, 2017 11:06:13 PM To: Wu, Xiaoban Cc: users@dpdk.org; dev@dpdk.org Subject: Re: [dpdk-dev] A question about the possible race condition in the= l3fwd example? On Tue, 28 Nov 2017 02:22:57 +0000 "Wu, Xiaoban" wrote: > Dear All, > > > I am studying the source code of the l3fwd example. I am confused about a= possible race condition in the l3fwd_lpm_simple_forward(). > > > In this function it calls send_single_packet(), which executes the follow= ing code, > > len =3D qconf->tx_mbufs[port].len; > qconf->tx_mbufs[port].m_table[len] =3D m; > len++; > > As you can see, if two threads are trying to call send_single_packet() at= the same time and send different packets to the same port, which writes t= he value to the same array and updates the same counter 'len', then the rac= e condition happens, so we might lose packets. > > Can anybody please clarify if this indeed brings race condition? If yes, = then why we want to design it in this way, just for high performance? If no= , why? > > Thanks very much for your help. > > Best wishes, > Xiaoban > > > qconf is in in a per core data structure, so it is impossible for sharing t= o happen.