From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0084.outbound.protection.outlook.com [104.47.2.84]) by dpdk.org (Postfix) with ESMTP id 633B41B29D for ; Fri, 19 Jan 2018 14:35:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=kegaATgqYrdi95pEIs1fR1PhHKLpEtpnLIKyqeUG4Kw=; b=KrbqPNEHO1qi6yxYT7SDRZdACfFUHBlS+BAGxmOqRrYFxv81GjJ0N53/JbQIO291sZr3W9QmnKfMY1Xq8AKZW/ntS+/wRuTJNM+HjX6sngmqPRc3djqwdEtZ+HPWIK2JgZYzmHq4ogftj3G2/aa/IhOjW4D8xNx/K62O3VoVC9Y= Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com (52.133.21.26) by AM6PR0502MB4038.eurprd05.prod.outlook.com (52.133.30.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Fri, 19 Jan 2018 13:35:10 +0000 Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com ([fe80::6c28:c6b3:de94:a733]) by AM6PR0502MB3797.eurprd05.prod.outlook.com ([fe80::6c28:c6b3:de94:a733%13]) with mapi id 15.20.0428.014; Fri, 19 Jan 2018 13:35:10 +0000 From: Matan Azrad To: "Ananyev, Konstantin" , Thomas Monjalon , Gaetan Rivet , "Wu, Jingjing" CC: "dev@dpdk.org" , Neil Horman , "Richardson, Bruce" Thread-Topic: [PATCH v3 7/7] app/testpmd: adjust ethdev port ownership Thread-Index: AQHTkSJSs9wv4iQCB0Cv+2LP7vySOKN7IsfQgAAIKACAAAHXQA== Date: Fri, 19 Jan 2018 13:35:10 +0000 Message-ID: References: <1515318351-4756-1-git-send-email-matan@mellanox.com> <1516293317-30748-1-git-send-email-matan@mellanox.com> <1516293317-30748-8-git-send-email-matan@mellanox.com> <2601191342CEEE43887BDE71AB97725886280A68@irsmsx105.ger.corp.intel.com> <2601191342CEEE43887BDE71AB97725886280AE8@irsmsx105.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB97725886280AE8@irsmsx105.ger.corp.intel.com> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-originating-ip: [85.64.136.190] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR0502MB4038; 7:LaRSmsYi99j042FlrGYpjUVnc6b7mDrH6FjCzKpCM4XyDaoG+s//XUhOFLkeY1G+JJD5LGT8EWoSIR0IBdkSgrgUUIbEqYyvbveRaGXazJbGdyciOV45By5ybsrSZWK6eplG35MXn2qANKXoIiHV0Z3xmPYUJgSbzRHYpQA+xSqyzLns7lR4wqHvIw1RRrTpUI11UEi+aHvEoue9ZFdGWs09ANgzeE83kUGoZmvFl+PzyDztLOZCtSJg5kcrqCaU x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: d18877cd-5643-4e83-f0d4-08d55f41761a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(48565401081)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB4038; x-ms-traffictypediagnostic: AM6PR0502MB4038: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(60795455431006)(278428928389397)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(3231023)(2400078)(944501161)(10201501046)(93006095)(93001095)(6055026)(6041268)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:AM6PR0502MB4038; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB4038; x-forefront-prvs: 0557CBAD84 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(376002)(346002)(39380400002)(366004)(39860400002)(13464003)(57704003)(199004)(189003)(2950100002)(6116002)(4326008)(93886005)(7736002)(33656002)(74316002)(3846002)(305945005)(54906003)(6246003)(5250100002)(86362001)(110136005)(6506007)(97736004)(99286004)(105586002)(53546011)(5660300001)(2906002)(14454004)(68736007)(102836004)(478600001)(81156014)(2900100001)(66066001)(8676002)(106356001)(26005)(25786009)(53936002)(55016002)(3280700002)(316002)(76176011)(9686003)(229853002)(3660700001)(81166006)(8936002)(6436002)(7696005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB4038; H:AM6PR0502MB3797.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: /uZtrh2XUCXzLimvIYgu4ug+vfppI497eVhNAIzO2uDPZsgu884kFiJfODaV955/gavZU9LFc0LRcm+VTyRj4A== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d18877cd-5643-4e83-f0d4-08d55f41761a X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jan 2018 13:35:10.0689 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB4038 Subject: Re: [dpdk-dev] [PATCH v3 7/7] app/testpmd: adjust ethdev port ownership X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jan 2018 13:35:12 -0000 Hi Konstantin From: Ananyev, Konstantin, Friday, January 19, 2018 3:09 PM > > -----Original Message----- > > From: Matan Azrad [mailto:matan@mellanox.com] > > Sent: Friday, January 19, 2018 12:52 PM > > To: Ananyev, Konstantin ; Thomas > > Monjalon ; Gaetan Rivet > ; > > Wu, Jingjing > > Cc: dev@dpdk.org; Neil Horman ; Richardson, > > Bruce > > Subject: RE: [PATCH v3 7/7] app/testpmd: adjust ethdev port ownership > > > > Hi Konstantin > > > > From: Ananyev, Konstantin, Friday, January 19, 2018 2:38 PM > > > To: Matan Azrad ; Thomas Monjalon > > > ; Gaetan Rivet ; > Wu, > > > Jingjing > > > Cc: dev@dpdk.org; Neil Horman ; Richardson, > > > Bruce > > > Subject: RE: [PATCH v3 7/7] app/testpmd: adjust ethdev port > > > ownership > > > > > > Hi Matan, > > > > > > > -----Original Message----- > > > > From: Matan Azrad [mailto:matan@mellanox.com] > > > > Sent: Thursday, January 18, 2018 4:35 PM > > > > To: Thomas Monjalon ; Gaetan Rivet > > > > ; Wu, Jingjing > > > > Cc: dev@dpdk.org; Neil Horman ; > Richardson, > > > > Bruce ; Ananyev, Konstantin > > > > > > > > Subject: [PATCH v3 7/7] app/testpmd: adjust ethdev port ownership > > > > > > > > Testpmd should not use ethdev ports which are managed by other > > > > DPDK entities. > > > > > > > > Set Testpmd ownership to each port which is not used by other > > > > entity and prevent any usage of ethdev ports which are not owned by > Testpmd. > > > > > > > > Signed-off-by: Matan Azrad > > > > --- > > > > app/test-pmd/cmdline.c | 89 +++++++++++++++++++--------------= --- > ---- > > > ----- > > > > app/test-pmd/cmdline_flow.c | 2 +- > > > > app/test-pmd/config.c | 37 ++++++++++--------- > > > > app/test-pmd/parameters.c | 4 +- > > > > app/test-pmd/testpmd.c | 63 ++++++++++++++++++++------------ > > > > app/test-pmd/testpmd.h | 3 ++ > > > > 6 files changed, 103 insertions(+), 95 deletions(-) > > > > > > > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index > > > > 31919ba..6199c64 100644 > > > > --- a/app/test-pmd/cmdline.c > > > > +++ b/app/test-pmd/cmdline.c > > > > @@ -1394,7 +1394,7 @@ struct cmd_config_speed_all { > > > > &link_speed) < 0) > > > > return; > > > > > > > > - RTE_ETH_FOREACH_DEV(pid) { > > > > + RTE_ETH_FOREACH_DEV_OWNED_BY(pid, my_owner.id) { > > > > > > Why do we need all these changes? > > > As I understand you changed definition of RTE_ETH_FOREACH_DEV(), so > > > no testpmd should work ok default (no_owner case). > > > Am I missing something here? > > > > Now, After Gaetan suggestion RTE_ETH_FOREACH_DEV(pid) will iterate > over all valid and ownerless ports. >=20 > Yes. >=20 > > Here Testpmd wants to iterate over its owned ports. >=20 > Why? Why it can't just iterate over all valid and ownerless ports? > As I understand it would be enough to fix current problems and would allo= w > us to avoid any changes in testmpd (which I think is a good thing). Yes, I understand that this big change is very daunted, But I think the cur= rent a lot of bugs in testpmd(regarding port ownership) even more daunted. Look, Testpmd initiates some of its internal databases depends on specific port i= teration, In some time someone may take ownership of Testpmd ports and testpmd will c= ontinue to touch them. In addition Using the old iterator in some places in testpmd will cause a race for run-= time new ports(can be created by failsafe or any hotplug code): - testpmd finds an ownerless port(just now created) by the old iterator and= start traffic there, - failsafe takes ownership of this new port and start traffic there. Problem! =20 In addition As a good example for well-done application (free from ownership bugs) I tr= ied here to adjust Tespmd to the new rules and BTW to fix a lot of bugs. = =20 So actually applications which are not aware to the port ownership still ar= e exposed to races, but if there use the old iterator(with the new change) = the amount of races decreases.=20 Thanks, Matan. > Konstantin >=20 > > > > I added to Testpmd ability to take an ownership of ports as the new > > ownership and synchronization rules suggested, Since Tespmd is a DPDK > > entity which wants that no one will touch its owned ports, It must allo= cate > an unique ID, set owner for its ports (see in main function) and recogniz= es > them by its owner ID. > > > > > Konstantin > > >