From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 9710B567E for ; Fri, 30 Jun 2017 11:29:18 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 4D94220AC1; Fri, 30 Jun 2017 05:29:18 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Fri, 30 Jun 2017 05:29:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=LCulhWc/SQQWFm4 4SZq8D07EOAh/nzYfAnjfzX976iE=; b=GX/pv333ZrmRxnEw/AOOsUB5Lo2DM5h +uFeTdCG1lqtUKDtST9Ms6fW6xOJMxetLpffHQTOW6SYVav9JIaCqQ3NPBIOOoMz tYKcQ8grU4ufT+IUB+jRDGeHS/LY/1Uzr/nlow+Smrm3rg0BWUpWrqFzQ2CGRV00 /9g0PX8MmI5k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=LCulhWc/SQQWFm44SZq8D07EOAh/nzYfAnjfzX976iE=; b=KpPaZ8kN /u1k9Aq/Xhtf651rClfXlFIIB1IVanqSqaOMCkcs8HdLSKSH3lBDZH8P2/pGUU7p ARDPUCz7mbtyTSQm9AGwG2l58fvH2BW+KmhhPSrMzRNEc51D8AOXWtJuaNX5p/KA lMWVXBpO5tacp/wjeQ7A8IbYMcidJxGHQzkrbI0kqveL7+NG9200LUyuAXpUFy+8 2VNas6YaJ3biZPIH3EN5iJ6+E8ba7J1fO5Eu10P66uiHajyFA9kWRLX3kJCqC4tv tk7TJcsgdv9QrAHaL3kCKz+TypjNYT2fY209ElHXsrn2f1JVFl3TFPyplRKaBZpP /zppKjkKFKAgoQ== X-ME-Sender: X-Sasl-enc: cmB3SgdLd4xjbZBIBZOOBuNWblhyEMFQ2/ZHYxNFCrk8 1498814957 Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id F06697E622; Fri, 30 Jun 2017 05:29:17 -0400 (EDT) From: Thomas Monjalon To: "Van Haaren, Harry" Cc: dev@dpdk.org, 'Jerin Jacob' , "Wiles, Keith" , "Richardson, Bruce" Date: Fri, 30 Jun 2017 11:29:17 +0200 Message-ID: <2363216.DczB0HHKeo@xps> In-Reply-To: References: <25008072.aWAPEDBPgL@xps> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 09:29:18 -0000 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 result is that > > > two threads are concurrently running a multi-thread unsafe function. > > > > 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 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 required. This > feels heavy handed, and would cause useless atomic ops to execute.) OK thank you for the detailed explanation. > > 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 running > in the background. > > The service lcores and application lcores existence without knowledge of the others > behavior is the cause of concurrent running of the multi-thread unsafe service function. 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?