From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpZZM-0003M2-4m for qemu-devel@nongnu.org; Thu, 20 Jun 2013 03:46:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpZZJ-0002zp-9p for qemu-devel@nongnu.org; Thu, 20 Jun 2013 03:46:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54897) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpZZJ-0002zj-1o for qemu-devel@nongnu.org; Thu, 20 Jun 2013 03:46:09 -0400 Date: Thu, 20 Jun 2013 09:46:03 +0200 From: Stefan Hajnoczi Message-ID: <20130620074603.GC15082@stefanha-thinkpad.redhat.com> References: <1371114186-8854-1-git-send-email-qemulist@gmail.com> <1371114186-8854-3-git-send-email-qemulist@gmail.com> <20130618122507.GI7649@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v2 2/6] net: introduce lock to protect NetClientState's peer's access List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, mdroth 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) > >> +{ > >> + NetClientState *peer; > >> + > >> + /* reader of self's peer field , fixme? the deleters are not concurrent, > >> + * so this pair lock can save. > >> + */ > > > > Indentation, also please resolve the fixme. > > > So, here can I take the assumption that the deleters are serialized by > biglock, and remove the lock following this comment? Ah, I understand the comment now. Is there any advantage to dropping the lock? IMO it's clearer to take the lock consistently instead of "optimizing" cases we think only get called from the main loop.