[dpdk-dev] [memnic PATCH] linux: fix race condition
Olivier MATZ
olivier.matz at 6wind.com
Fri Apr 11 11:41:46 CEST 2014
On Thursday, April 03, 2014 07:35:50 AM Hiroshi Shimamoto wrote:
> From: Hiroshi Shimamoto <h-shimamoto at ct.jp.nec.com>
>
> 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 <h-shimamoto at ct.jp.nec.com>
> ---
> linux/memnic_net.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
Reviewed-by: Olivier Matz <olivier.matz at 6wind.com>
More information about the dev
mailing list