[dpdk-dev] [PATCH v6 2/3] net/virtio: add packet injection method

Wang, Xiao W xiao.w.wang at intel.com
Mon Jan 8 16:11:58 CET 2018



> -----Original Message-----
> From: Yuanhan Liu [mailto:yliu at fridaylinux.org]
> Sent: Monday, January 8, 2018 9:04 PM
> To: Wang, Xiao W <xiao.w.wang at intel.com>
> Cc: Bie, Tiwei <tiwei.bie at intel.com>; dev at dpdk.org;
> stephen at networkplumber.org
> Subject: Re: [PATCH v6 2/3] net/virtio: add packet injection method
> 
> On Sun, Jan 07, 2018 at 04:05:12AM -0800, Xiao Wang wrote:
> > +	/*
> > +	 * App management thread and virtio interrupt handler thread
> > +	 * both can change the 'started' flag, this lock is meant to
> > +	 * avoid such a contention.
> > +	 */
> > +	rte_spinlock_t state_lock;
> 
> Why not turning the "started" to atomic type, so that you don't need
> the lock?
> 
> 	--yliu

To avoid impacting datapath performance, this patch doesn't change "started" to atomic 
type.

During the interrupt handler routine, there are a series of instructions between lock acquire and release. An atomic value is not suitable for this scenario.

BRs,
Xiao


More information about the dev mailing list