From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B44E32C2A for ; Fri, 30 Jun 2017 10:52:06 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jun 2017 01:52:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,285,1496127600"; d="scan'208";a="1146421103" Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by orsmga001.jf.intel.com with ESMTP; 30 Jun 2017 01:52:04 -0700 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.211]) by IRSMSX107.ger.corp.intel.com ([169.254.10.129]) with mapi id 14.03.0319.002; Fri, 30 Jun 2017 09:52:03 +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 Date: Fri, 30 Jun 2017 08:52:02 +0000 Message-ID: References: <7268949.8nYIVvgy1g@xps> <25008072.aWAPEDBPgL@xps> In-Reply-To: <25008072.aWAPEDBPgL@xps> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDc5YWRlYjMtOGEzZC00YjM1LWIwYTQtYmU1MmZlNmJjNThkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImV4SlVHUVR3STdJN3RmZzlmQmxlTmtVN3Z0QXAwTVdFWjJ4SHhMU2F3SUk9In0= 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 08:52:07 -0000 > From: Thomas Monjalon [mailto:thomas@monjalon.net] > Sent: Thursday, June 29, 2017 9:19 PM > To: Van Haaren, Harry > Cc: dev@dpdk.org; 'Jerin Jacob' ; Wiles, = Keith > ; Richardson, Bruce > Subject: Re: Service lcores and Application lcores >=20 > 29/06/2017 18:35, Van Haaren, Harry: > > 3) The problem; > > If a service core runs the SW PMD schedule() function (option 2) *AN= D* > > the application lcore runs schedule() func (option 1), the result is= that > > two threads are concurrently running a multi-thread unsafe function. >=20 > Which function is multi-thread unsafe? With the current design, the service-callback does not have to be multi-thr= ead safe. For example, the eventdev SW PMD is not multi-thread safe. The service library handles serializing access to the service-callback if m= ultiple cores are mapped to that service. This keeps the atomic complexity in one place, = and keeps services as light-weight to implement as possible. (We could consider forcing all service-callbacks to be multi-thread safe by= using atomics, but we would not be able to optimize away the atomic cmpset if it is not re= quired. This feels heavy handed, and would cause useless atomic ops to execute.) > Why the same function would be run by the service and by the scheduler? The same function can be run concurrently by the application, and a service= 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 r= unning in the background. The service lcores and application lcores existence without knowledge of th= e others behavior is the cause of concurrent running of the multi-thread unsafe serv= ice function.