> -----Original Message-----
> From: Yuanhan Liu [mailto:[email protected]]
> Sent: Monday, January 8, 2018 9:04 PM
> To: Wang, Xiao W <[email protected]>
> Cc: Bie, Tiwei <[email protected]>; [email protected];
> [email protected]
> 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

Reply via email to