From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id 092F468CA for ; Fri, 11 Apr 2014 16:40:29 +0200 (CEST) Received: from was59-1-82-226-113-214.fbx.proxad.net ([82.226.113.214] helo=platinum.localnet) by mail.droids-corp.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WYcfu-0001jX-7p; Fri, 11 Apr 2014 16:43:32 +0200 From: Olivier MATZ To: Hiroshi Shimamoto Date: Fri, 11 Apr 2014 16:41:42 +0200 Message-ID: <7724767.rVnlBRSiNS@platinum> Organization: 6WIND User-Agent: KMail/4.11.3 (Linux/3.12.6; KDE/4.11.3; x86_64; ; ) In-Reply-To: <7F861DC0615E0C47A872E6F3C5FCDDBD0109D398@BPXM14GP.gisp.nec.co.jp> References: <7F861DC0615E0C47A872E6F3C5FCDDBD0109D398@BPXM14GP.gisp.nec.co.jp> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: "dev@dpdk.org" , Hayato Momma Subject: Re: [dpdk-dev] [memnic PATCH v2] pmd: fix race condition X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Apr 2014 14:40:29 -0000 On Thursday, April 03, 2014 06:35:06 AM Hiroshi Shimamoto wrote: > From: Hiroshi Shimamoto > > There is a race condition, on transmit to host. > > Guest PMD Host > Thread-A Thread-B vSwitch > > |idx=0 |idx=0 |p[0] st!=2 > |cmpxchg | | > |p[0] st->1 | | > |idx=1 | | > |fill data | | > |p[0] st->2 | |p[0] st==2 > | > | | |receive data > | | |p[0] st->0 > | | > | |cmpxchg | > | |success |p[1] st!=2 > | |p[0] st->1 | > > This is BAD > > That causes traffic stop. > > We have to take care about that race condition with checking > whether current index is correct. > > Signed-off-by: Hiroshi Shimamoto > Reviewed-by: Hayato Momma > --- > pmd/pmd_memnic.c | 9 +++++++++ > 1 file changed, 9 insertions(+) Reviewed-by: Olivier Matz