From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v9 1/8] ethdev: use locks to protect Rx/Tx callback lists Date: Wed, 15 Jun 2016 10:48:52 +0200 Message-ID: <2907169.iIEIeOfXh7@xps13> References: <1465575534-23605-1-git-send-email-reshma.pattan@intel.com> <10886152.VH5xYhdqG2@xps13> <2601191342CEEE43887BDE71AB97725836B714ED@irsmsx105.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: "Pattan, Reshma" , dev@dpdk.org To: "Ananyev, Konstantin" Return-path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 599FEADEC for ; Wed, 15 Jun 2016 10:48:54 +0200 (CEST) Received: by mail-wm0-f41.google.com with SMTP id v199so153155890wmv.0 for ; Wed, 15 Jun 2016 01:48:54 -0700 (PDT) In-Reply-To: <2601191342CEEE43887BDE71AB97725836B714ED@irsmsx105.ger.corp.intel.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" 2016-06-15 08:37, Ananyev, Konstantin: > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > > 2016-06-15 05:30, Pattan, Reshma: > > > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > > > > 2016-06-14 10:38, Reshma Pattan: > > > > > Added spinlocks around add/remove logic of Rx and Tx callbacks to > > > > > avoid corruption of callback lists in multithreaded context. > > > > > > > > > > Signed-off-by: Reshma Pattan > > > > > > > > Why cb->next is not locked in burst functions? > > > It is safe to do "read access" here and doesn't require any locking as rx/tx burst is initiated by only local user(control plane) thread. > > > > > > > Just protecting add/remove but not its usage seems useless. > > > Here locks were required around add/remove to protect "write access" because write to callback list is now done from 2 threads > > > i.e. one from local user thread(control plane) and another from pdump control thread(initiated by remote pdump request). > > > > So read and write can be done by different threads. > > Yes, and this is possible even in current DPDK version (16.04). > What is added by Reshma's patch - now it is possible to have concurrent write > from 2 different thread to that list. > > > I think the read access would need locking but we do not want it > > in fast path. > > I don't think it would be needed. > As I said - read/write interaction didn't change from what we have right now. > But if you have some particular scenario in mind that you believe would cause > a race condition - please speak up. If we add/remove a callback during a burst? Is it possible that the next pointer would have a wrong value leading to a crash? Maybe we need a comment to state that we should not alter burst callbacks while running burst functions.