From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCXAe-0002rX-Ir for qemu-devel@nongnu.org; Mon, 04 Mar 2013 10:19:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCXAd-0005Xl-BY for qemu-devel@nongnu.org; Mon, 04 Mar 2013 10:19:20 -0500 Received: from mail-bk0-f46.google.com ([209.85.214.46]:54977) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCXAd-0005Xd-5P for qemu-devel@nongnu.org; Mon, 04 Mar 2013 10:19:19 -0500 Received: by mail-bk0-f46.google.com with SMTP id j5so2478061bkw.33 for ; Mon, 04 Mar 2013 07:19:18 -0800 (PST) Date: Mon, 4 Mar 2013 16:19:15 +0100 From: Stefan Hajnoczi Message-ID: <20130304151915.GA16196@stefanha-thinkpad.redhat.com> References: <1362316883-7948-1-git-send-email-qemulist@gmail.com> <1362316883-7948-4-git-send-email-qemulist@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1362316883-7948-4-git-send-email-qemulist@gmail.com> Subject: Re: [Qemu-devel] [PATCH 3/3] net: make netclient re-entrant with refcnt List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: mdroth , Paolo Bonzini , qemu-devel@nongnu.org, Anthony Liguori , "Michael S. Tsirkin" On Sun, Mar 03, 2013 at 09:21:22PM +0800, Liu Ping Fan wrote: > diff --git a/net/hub.c b/net/hub.c > index 97c3ac3..ab4448e 100644 > --- a/net/hub.c > +++ b/net/hub.c > @@ -36,6 +36,7 @@ typedef struct NetHubPort { > } NetHubPort; > > struct NetHub { > + QemuMutex lock; Please document what this lock protects. I think it only protects the ports list. > diff --git a/net/net.c b/net/net.c > index 0acb933..5a8bb6a 100644 > --- a/net/net.c > +++ b/net/net.c > @@ -45,6 +45,7 @@ > # define CONFIG_NET_BRIDGE > #endif > > +static QemuMutex net_clients_lock; > static QTAILQ_HEAD(, NetClientState) net_clients; I'm not sure what net_clients_lock protects since this lock is not taken by all net_clients users. The lock should be destroyed in net_cleanup(). This should be a separate patch that fully explains the purpose of the lock and uses it consistently in net.c.