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 2354B5961 for ; Fri, 11 Apr 2014 11:40:39 +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 1WYXzl-0001Wh-Vx for dev@dpdk.org; Fri, 11 Apr 2014 11:43:44 +0200 From: Olivier MATZ To: dev@dpdk.org Date: Fri, 11 Apr 2014 11:41:46 +0200 Message-ID: <2469493.IGjSGz2PDr@platinum> Organization: 6WIND User-Agent: KMail/4.11.3 (Linux/3.12.6; KDE/4.11.3; x86_64; ; ) In-Reply-To: <7F861DC0615E0C47A872E6F3C5FCDDBD0109D69F@BPXM14GP.gisp.nec.co.jp> References: <7F861DC0615E0C47A872E6F3C5FCDDBD0109D69F@BPXM14GP.gisp.nec.co.jp> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [memnic PATCH] linux: 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 09:40:39 -0000 On Thursday, April 03, 2014 07:35:50 AM Hiroshi Shimamoto wrote: > From: Hiroshi Shimamoto > > Same as PMD, there is a race condition between host and guest > in the guest MEMNIC kernel driver. > > 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 > > Signed-off-by: Hiroshi Shimamoto > --- > linux/memnic_net.c | 9 +++++++++ > 1 file changed, 9 insertions(+) Reviewed-by: Olivier Matz