From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier MATZ Subject: Re: [memnic PATCH] linux: fix race condition Date: Fri, 11 Apr 2014 11:41:46 +0200 Message-ID: <2469493.IGjSGz2PDr@platinum> References: <7F861DC0615E0C47A872E6F3C5FCDDBD0109D69F@BPXM14GP.gisp.nec.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit To: dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <7F861DC0615E0C47A872E6F3C5FCDDBD0109D69F-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 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