From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJkBJ-0001jn-8B for qemu-devel@nongnu.org; Fri, 06 Feb 2015 09:46:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJkBG-0008Tt-2m for qemu-devel@nongnu.org; Fri, 06 Feb 2015 09:46:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJkBF-0008TU-Sg for qemu-devel@nongnu.org; Fri, 06 Feb 2015 09:46:50 -0500 Message-ID: <54D4D3D2.9040300@redhat.com> Date: Fri, 06 Feb 2015 15:46:42 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1419353600-30519-2-git-send-email-pbonzini@redhat.com> <20150102140658.GL10823@stefanha-thinkpad.redhat.com> <54A6C53E.3050905@redhat.com> <54BCEA0F.8070707@redhat.com> <20150206135433.GB18729@stefanha-thinkpad.redhat.com> In-Reply-To: <20150206135433.GB18729@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] net: synchronize net_host_device_remove with host_net_remove_completion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, stefanha@redhat.com On 06/02/2015 14:54, Stefan Hajnoczi wrote: > On Mon, Jan 19, 2015 at 12:27:11PM +0100, Paolo Bonzini wrote: >> On 02/01/2015 17:20, Paolo Bonzini wrote: >>>>> >>>>> The assert can be dropped completely since the code already has an >>>>> equivalent assert: >>>>> >>>>> queues = qemu_find_net_clients_except(nc->name, ncs, >>>>> NET_CLIENT_OPTIONS_KIND_NIC, >>>>> MAX_QUEUE_NUM); >>>>> assert(queues != 0); <-- fail if type == NET_CLIENT_OPTIONS_KIND_NIC >>> I left it on purpose for documentation, but I'll send v2 next week that >>> removes it. >> >> Actually it's not the same. If you have "-netdev user,id=e1000 -device >> e1000,netdev=e1000" you will be able to call qemu_del_net_client on the >> NIC, and it will _not_ fail if the assertion is removed. > > I don't follow. > > If you call qemu_del_net_client(e1000_nic) then > qemu_find_net_clients_except(nc->name, ncs, NET_CLIENT_OPTIONS_KIND_NIC, > MAX_QUEUE_NUM) returns 0. This causes the assert(queues != 0) to fail. NICs and other clients are in separate namespaces. So if you do -netdev user,id=e1000 -device e1000,netdev=e1000,id=e1000 you have two NetClients named "e1000". If you call (by mistake) qemu_del_net_client(e1000_nic), qemu_find_net_clients_except will return the SLIRP client and the assertion will not fail. So you need a separate assertion. Paolo