From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: Re: [PATCH v2] ring: check for zero objects mc dequeue / mp enqueue Date: Fri, 25 Mar 2016 12:15:23 +0100 Message-ID: <56F51DCB.5020502@6wind.com> References: <1458229783-15547-1-git-send-email-l@nofutznetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: Thomas Monjalon To: Lazaros Koromilas , dev@dpdk.org Return-path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id 4E6DA2BA1 for ; Fri, 25 Mar 2016 12:15:25 +0100 (CET) Received: by mail-wm0-f42.google.com with SMTP id p65so22241746wmp.1 for ; Fri, 25 Mar 2016 04:15:25 -0700 (PDT) In-Reply-To: <1458229783-15547-1-git-send-email-l@nofutznetworks.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Lazaros, On 03/17/2016 04:49 PM, Lazaros Koromilas wrote: > Issuing a zero objects dequeue with a single consumer has no effect. > Doing so with multiple consumers, can get more than one thread to succeed > the compare-and-set operation and observe starvation or even deadlock in > the while loop that checks for preceding dequeues. The problematic piece > of code when n = 0: > > cons_next = cons_head + n; > success = rte_atomic32_cmpset(&r->cons.head, cons_head, cons_next); > > The same is possible on the enqueue path. Just a question about this patch (that has been applied). Thomas retitled the commit from your log message: ring: fix deadlock in zero object multi enqueue or dequeue http://dpdk.org/browse/dpdk/commit/?id=d0979646166e I think this patch does not fix a deadlock, or did I miss something? As explained in the following links, the ring may not perform well if several threads running on the same cpu use it: http://dpdk.org/ml/archives/dev/2013-November/000714.html http://www.dpdk.org/ml/archives/dev/2014-January/001070.html http://www.dpdk.org/ml/archives/dev/2014-January/001162.html http://dpdk.org/ml/archives/dev/2015-July/020659.html A deadlock could occur if the threads running on the same core have different priority. Regards, Olivier