From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 7C8C81B1EF for ; Thu, 3 Jan 2019 20:53:09 +0100 (CET) Received: by mail-pg1-f195.google.com with SMTP id w7so16410379pgp.13 for ; Thu, 03 Jan 2019 11:53:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hr7512j5k/fviksWWGUtMAa3+KR/jjGWq9cJEdpSvBE=; b=TfeBdqOWc6lRRKjLVEVm7gMij+4OVOF+3uqX6SyzUSW2UGCOwmN8f8w7+NjEefQyeB wuhC+MBvdkKSMwzxY0489X8kMeKS1Z7h7OhYd0IlIHuXWLVY9O/j21soz7lDHQzRFWIQ +ncVQJYj8m1IQK/bCFgPg3XZi9Goz5zIEPrnC4ZVNb5TulwJ0vf65pzXt/x2kQtPm0KU PUqriFNu/ow4K/AX/FNE6+cnOXZ2J3ozx6qKrE9EIcb7/WVXjFVQtldnkbb6sHAfZQ// u3AVuileVSpi9TLqdP1h43Ta8kWXYerdKUecu4kcAG3zft7ROiEiYOd8vzGME8QjvQwc jZow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hr7512j5k/fviksWWGUtMAa3+KR/jjGWq9cJEdpSvBE=; b=sW1FN8xmtl+o/sllp2qVF70yDFBYERCChHXBLnnaYXlYOakFkEx3fFqWR1MRGa+44X NpTxzNwMSgMV6nWMHCboUc1njwiIR8HrTSgwKvX93E7M4uH4oFqm0KxVFIbnulSLOaba ErMF2L7XH6k4vnFwmlNDbl0I5pwSS+Qh3xpi4wHTFrzg5YhkR7fcrE372hzxFzNHFZB+ kPhoZ48rXOJA01F16Nh1egWWPG/DhX6Q8u4nElXqAYDP5Cc62w3Rn7B1Vh/88W1sWXZs vJyfEJ5IefeZ7iMbdhWhwITOnPk9sD9rVfgrUuaAP4gdvrZ90Rdce6EREwYyn8xZM8wu X8fw== X-Gm-Message-State: AJcUukcgCRD7CEVvOrWGcMoFwCfYV26K9UfjD3BdBD/z06nhUBIGTN1Y Efh66RxvbwGrN+rrZM/PcmYUOA== X-Google-Smtp-Source: AFSGD/UN3+LyYJM9ivPxIqanFljpX+FMknOhS7kVBak+Gxvd3CkNXs2omeHknIwdJQr9fpDf/3Co1A== X-Received: by 2002:a62:7792:: with SMTP id s140mr49346289pfc.26.1546545188549; Thu, 03 Jan 2019 11:53:08 -0800 (PST) Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id e131sm89388397pfg.75.2019.01.03.11.53.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Jan 2019 11:53:08 -0800 (PST) Date: Thu, 3 Jan 2019 11:53:04 -0800 From: Stephen Hemminger To: Honnappa Nagarahalli Cc: Jerin Jacob Kollanukkaran , "david.marchand@redhat.com" , "chaozhu@linux.vnet.ibm.com" , nd , "bruce.richardson@intel.com" , "thomas@monjalon.net" , "dev@dpdk.org" , "Joyce Kong (Arm Technology China)" , "hemant.agrawal@nxp.com" , "Gavin Hu (Arm Technology China)" Message-ID: <20190103115304.7e6547a0@shemminger-XPS-13-9360> In-Reply-To: References: <20181227041349.3058-1-gavin.hu@arm.com> <20181227041349.3058-7-gavin.hu@arm.com> <47217c425060db295626c741b9e83f17b63a39bd.camel@marvell.com> <235244228ee4d6b30f268fc72837c6b0790d7037.camel@marvell.com> <20181227154143.7eb56fcc@shemminger-XPS-13-9360> <7918c83453f4d57af83c5b79eae2932a8bf5173f.camel@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [EXT] [PATCH v3 6/6] spinlock: ticket based to improve fairness 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: Thu, 03 Jan 2019 19:53:09 -0000 On Thu, 3 Jan 2019 18:35:31 +0000 Honnappa Nagarahalli wrote: > > > > > > > > > > > > On Thu, 2018-12-27 at 12:13 +0800, Gavin Hu wrote: > > > > > > > ----------------------------------------------------------- > > > > > > > ---- > > > > > > > ---- > > > > > > > --- > > > > > > > From: Joyce Kong > > > > > > > > > > > > > > The old implementation is unfair, some threads may take locks > > > > > > > aggressively > > > > > > > > > > > > I think, one issue here is x86 and ppc follows traditional > > > > > > spinlock and > > > > > > arm64 will be following ticket lock for spinlock implementation. > > > > > > This would change application behaviour on arm64 compared to > > > > > > x86 > > > > > > and > > > > > > ppc. > > > > > > > > > > > > How about having a separate API for ticket lock? That would > > > > > > give, # application choice to use the locking strategy # > > > > > > application behaviour will be same across all arch. > > > > > > > > > > Ok, will do in v4 to have a new named rte_ticket_spinlock API. > > > > > > > > I would prefer rte_ticketlock_[lock/unlock/trylock/is_locked] name > > > > instead of rte_ticket_spinlock_lock etc to reduce the length of the > > > > API. > > > > > > NAK to adding new API for this. > > > > > > I want the best possible locks for all applications and all > > > architectures. > > > These should be called spinlock so there is no requirement for > > > application to change to get better performance. Why not just > > > implement the best algorithm across the board. Yes, this means > > > collaboration or working on the other guys architecture. > IMO, the ticket lock should be a separate API. Spin lock (as implemented today) and ticket lock have different characteristics in terms of behavior as well as resources required. For ex: spin lock might be sufficient for a low contention use case and it requires less number of cache lines. Ticket lock needs more number of cache lines and might be good for use cases with more contention. The decision to use spin lock vs ticket lock should be left to the application. The problem is that changing applications is hard. Real world applications are non-trivial and large. That is while doing things global or at the library level are easier. Do you want to go back and evaluate every lock in VPP, NFF-go, OVS, Tungsten Fabric, .... Either a config or runtime option seems best to me.