[dpdk-dev] [memnic PATCH v2] pmd: fix race condition

Thomas Monjalon thomas.monjalon at 6wind.com
Fri Apr 11 17:46:24 CEST 2014


2014-04-11 16:41, Olivier MATZ:
> On Thursday, April 03, 2014 06:35:06 AM Hiroshi Shimamoto wrote:
> > From: Hiroshi Shimamoto <h-shimamoto at ct.jp.nec.com>
> > 
> > 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 <h-shimamoto at ct.jp.nec.com>
> > Reviewed-by: Hayato Momma <h-momma at ce.jp.nec.com>
> 
> Reviewed-by: Olivier Matz <olivier.matz at 6wind.com>

Applied

Thanks
-- 
Thomas


More information about the dev mailing list