Re: [Qemu-devel] [PATCH v2 2/6] net: introduce lock to protect NetClientState's peer's access

2013-06-20 Thread liu ping fan
On Thu, Jun 20, 2013 at 3:46 PM, Stefan Hajnoczi wrote: > On Thu, Jun 20, 2013 at 02:30:30PM +0800, liu ping fan wrote: >> On Tue, Jun 18, 2013 at 8:25 PM, Stefan Hajnoczi wrote: >> > On Thu, Jun 13, 2013 at 05:03:02PM +0800, Liu Ping Fan wrote: >> >> + * And flush out peer's queue. >> >> + */ >>

Re: [Qemu-devel] [PATCH v2 2/6] net: introduce lock to protect NetClientState's peer's access

2013-06-20 Thread Stefan Hajnoczi
On Thu, Jun 20, 2013 at 02:30:30PM +0800, liu ping fan wrote: > On Tue, Jun 18, 2013 at 8:25 PM, Stefan Hajnoczi wrote: > > On Thu, Jun 13, 2013 at 05:03:02PM +0800, Liu Ping Fan wrote: > >> + * And flush out peer's queue. > >> + */ > >> +static void qemu_net_client_detach_flush(NetClientState *nc

Re: [Qemu-devel] [PATCH v2 2/6] net: introduce lock to protect NetClientState's peer's access

2013-06-19 Thread liu ping fan
On Tue, Jun 18, 2013 at 8:25 PM, Stefan Hajnoczi wrote: > On Thu, Jun 13, 2013 at 05:03:02PM +0800, Liu Ping Fan wrote: >> @@ -67,6 +67,10 @@ struct NetClientState { >> NetClientInfo *info; >> int link_down; >> QTAILQ_ENTRY(NetClientState) next; >> +/* protect the race access of

Re: [Qemu-devel] [PATCH v2 2/6] net: introduce lock to protect NetClientState's peer's access

2013-06-18 Thread Stefan Hajnoczi
On Thu, Jun 13, 2013 at 05:03:02PM +0800, Liu Ping Fan wrote: > @@ -67,6 +67,10 @@ struct NetClientState { > NetClientInfo *info; > int link_down; > QTAILQ_ENTRY(NetClientState) next; > +/* protect the race access of peer only between reader and writer. > + * to resolve t

[Qemu-devel] [PATCH v2 2/6] net: introduce lock to protect NetClientState's peer's access

2013-06-13 Thread Liu Ping Fan
From: Liu Ping Fan Introduce nc->peer_lock to shield off the race of nc->peer's reader and deleter. With it, after deleter finish, no new qemu_send_packet_xx() will append packet to peer->send_queue, therefore no new reference from packet->sender to nc will exist in nc->peer->send_queue. Signed-