From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier MATZ Subject: Re: [memnic PATCH v2] pmd: fix race condition Date: Fri, 11 Apr 2014 16:41:42 +0200 Message-ID: <7724767.rVnlBRSiNS@platinum> References: <7F861DC0615E0C47A872E6F3C5FCDDBD0109D398@BPXM14GP.gisp.nec.co.jp> 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: <7F861DC0615E0C47A872E6F3C5FCDDBD0109D398-ZmjkEB1lVlLt6d3pZDjeaEtBU8KWyXPq@public.gmane.org> 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" 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