From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJm7p-0005Ic-DV for qemu-devel@nongnu.org; Fri, 06 Feb 2015 11:51:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJm7l-0004uB-7F for qemu-devel@nongnu.org; Fri, 06 Feb 2015 11:51:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJm7k-0004u5-V6 for qemu-devel@nongnu.org; Fri, 06 Feb 2015 11:51:21 -0500 Date: Fri, 6 Feb 2015 16:51:15 +0000 From: Stefan Hajnoczi Message-ID: <20150206165115.GA31443@stefanha-thinkpad.redhat.com> 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> <54D4D3D2.9040300@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline In-Reply-To: <54D4D3D2.9040300@redhat.com> 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: Paolo Bonzini Cc: Stefan Hajnoczi , qemu-devel@nongnu.org --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 06, 2015 at 03:46:42PM +0100, Paolo Bonzini wrote: >=20 >=20 > 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 =3D qemu_find_net_clients_except(nc->name, ncs, > >>>>> NET_CLIENT_OPTIONS_KIND_NIC, > >>>>> MAX_QUEUE_NUM); > >>>>> assert(queues !=3D 0); <-- fail if type =3D=3D NET_CLIENT_OPTIONS= _KIND_NIC > >>> I left it on purpose for documentation, but I'll send v2 next week th= at > >>> removes it. > >> > >> Actually it's not the same. If you have "-netdev user,id=3De1000 -dev= ice > >> e1000,netdev=3De1000" you will be able to call qemu_del_net_client on = the > >> NIC, and it will _not_ fail if the assertion is removed. > >=20 > > I don't follow. > >=20 > > 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 !=3D 0) to fai= l. >=20 > NICs and other clients are in separate namespaces. So if you do >=20 > -netdev user,id=3De1000 > -device e1000,netdev=3De1000,id=3De1000 >=20 > 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. Thanks for explaining. Applied to my net tree: https://github.com/stefanha/qemu/commits/net --7AUc2qLy4jB3hD7Z Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJU1PEDAAoJEJykq7OBq3PIpMgH/2AEKIiYysL/FTDyvT0Aj3c6 IVJM1wFCiUcHl5VBHUaCrVr4Bpj4oel78qTi5/Amuhr9rZCA+xi3ljR9/UR/fjEv DbzAq4ohV4RC7w08ncPJlzdTqPMwj33Ch4yk+BiFsMtz+iNJdYUaf+k1s78xlIXG DpczLFyx6pz7V2l3fDw6e4uWCZ2M/hQAMP3IxO3jiRifJixV0/dup6ZPqZwnMUn8 r3mjiQIc+XSdiSp0I2kjOmfjDnR0bx74wCzSqfflc6E65uep0G6XBboBDY5rW/MM rEz7XoiVGD4/rWeWOk6OHw58YVwftCOVDV3zwRV9EuvRvY9XnXRMeXdlugVdk58= =EafW -----END PGP SIGNATURE----- --7AUc2qLy4jB3hD7Z--