From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 650C537A0 for ; Fri, 30 Jun 2017 12:18:47 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP; 30 Jun 2017 03:18:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,286,1496127600"; d="scan'208";a="1166573318" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by fmsmga001.fm.intel.com with ESMTP; 30 Jun 2017 03:18:45 -0700 Received: from irsmsx111.ger.corp.intel.com (10.108.20.4) by IRSMSX152.ger.corp.intel.com (163.33.192.66) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 30 Jun 2017 11:18:44 +0100 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.211]) by irsmsx111.ger.corp.intel.com ([169.254.2.25]) with mapi id 14.03.0319.002; Fri, 30 Jun 2017 11:18:44 +0100 From: "Van Haaren, Harry" To: Thomas Monjalon CC: "dev@dpdk.org" , 'Jerin Jacob' , "Wiles, Keith" , "Richardson, Bruce" Thread-Topic: Service lcores and Application lcores Thread-Index: AdLw4cih5pwlzbSuRKKmF+/821WngAAAHVUAAAPYppAABrlnAAAcDVPQ///8dYD//+X2QA== Date: Fri, 30 Jun 2017 10:18:43 +0000 Message-ID: References: <25008072.aWAPEDBPgL@xps> <2363216.DczB0HHKeo@xps> In-Reply-To: <2363216.DczB0HHKeo@xps> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDA2MjgwNGEtMGU0MC00NGFhLWJlOGMtY2Y0NWMyZjNjZGI2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Im56QkZRclFIUjRGc2V5ZFd2V0x2OFB6OW9lMEJURDJEb1BwSTJSQmJraHc9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] Service lcores and Application lcores 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, 30 Jun 2017 10:18:48 -0000 > From: Thomas Monjalon [mailto:thomas@monjalon.net] > Sent: Friday, June 30, 2017 10:29 AM > To: Van Haaren, Harry > Cc: dev@dpdk.org; 'Jerin Jacob' ; Wiles, = Keith > ; Richardson, Bruce > Subject: Re: Service lcores and Application lcores >=20 > 30/06/2017 10:52, Van Haaren, Harry: > > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > > 29/06/2017 18:35, Van Haaren, Harry: > > > > 3) The problem; > > > > If a service core runs the SW PMD schedule() function (option 2)= *AND* > > > > the application lcore runs schedule() func (option 1), the resul= t is that > > > > two threads are concurrently running a multi-thread unsafe funct= ion. > > > > > > Which function is multi-thread unsafe? > > > > With the current design, the service-callback does not have to be multi= -thread safe. > > For example, the eventdev SW PMD is not multi-thread safe. > > > > The service library handles serializing access to the service-callback = if multiple cores > > are mapped to that service. This keeps the atomic complexity in one pla= ce, and keeps > > services as light-weight to implement as possible. > > > > (We could consider forcing all service-callbacks to be multi-thread saf= e by using > atomics, > > but we would not be able to optimize away the atomic cmpset if it is no= t required. This > > feels heavy handed, and would cause useless atomic ops to execute.) >=20 > OK thank you for the detailed explanation. >=20 > > > Why the same function would be run by the service and by the schedule= r? > > > > The same function can be run concurrently by the application, and a ser= vice core. > > The root cause that this could happen is that an application can *think= * it is the > > only one running threads, but in reality one or more service-cores may = be running > > in the background. > > > > The service lcores and application lcores existence without knowledge o= f the others > > behavior is the cause of concurrent running of the multi-thread unsafe = service function. >=20 > That's the part I still don't understand. > Why an application would run a function on its own core if it is already > run as a service? Can we just have a check that the service API exists > and that the service is running? The point is that really it is an application / service core mis-match. The application should never run a PMD that it knows also has a service cor= e running it. However, porting applications to the service-core API has an over-lap time = where an application on 17.05 will be required to call eg: rte_eventdev_schedule() i= tself, and depending on startup EAL flags for service-cores, it may-or-may-not have to= call schedule() manually. This is pretty error prone, and mis-configuration would cause A) deadlock d= ue to no CPU cycles, B) segfault due to two cores. As per the other thread re service-lcores[1], removing rte_eventdev_schedul= e() from the API would force apps to use the service-core infrastructure fo= r eventdev instead of the possibility of mis-match. [1] http://dpdk.org/ml/archives/dev/2017-June/069492.html