From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [memnic PATCH v2] pmd: fix race condition Date: Fri, 11 Apr 2014 17:46:24 +0200 Message-ID: <1404995.PT3YR8Coxx@xps13> References: <7F861DC0615E0C47A872E6F3C5FCDDBD0109D398@BPXM14GP.gisp.nec.co.jp> <7724767.rVnlBRSiNS@platinum> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev-VfR2kkLFssw@public.gmane.org, Hayato Momma To: Hiroshi Shimamoto Return-path: In-Reply-To: <7724767.rVnlBRSiNS@platinum> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 2014-04-11 16:41, Olivier MATZ: > 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 > > Reviewed-by: Olivier Matz Applied Thanks -- Thomas