From owner-svn-src-all@freebsd.org Wed May 10 15:44:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CE75D66BE1; Wed, 10 May 2017 15:44:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AD09FB2; Wed, 10 May 2017 15:44:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id C06E310A7DB; Wed, 10 May 2017 11:44:39 -0400 (EDT) From: John Baldwin To: Colin Percival Cc: Roger Pau =?ISO-8859-1?Q?Monn=E9?= , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r301198 - head/sys/dev/xen/netfront Date: Tue, 09 May 2017 13:59:24 -0700 Message-ID: <1571628.UQhQsSBvqn@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <0100015beeed2f38-6246d7db-7f23-4b8a-ba50-b97ec0953457-000000@email.amazonses.com> References: <201606021116.u52BGajD047287@repo.freebsd.org> <20170509100912.h3ylwugahvfi5cc2@dhcp-3-128.uk.xensource.com> <0100015beeed2f38-6246d7db-7f23-4b8a-ba50-b97ec0953457-000000@email.amazonses.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 10 May 2017 11:44:39 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 May 2017 15:44:41 -0000 On Tuesday, May 09, 2017 08:36:13 PM Colin Percival wrote: > On 05/09/17 03:09, Roger Pau Monn=EF=BF=BD wrote: > > On Wed, May 03, 2017 at 05:13:40AM +0000, Colin Percival wrote: > >> On 06/02/16 04:16, Roger Pau Monn=EF=BF=BD wrote: > >>> Author: royger > >>> Date: Thu Jun 2 11:16:35 2016 > >>> New Revision: 301198 > >>> URL: https://svnweb.freebsd.org/changeset/base/301198 > >> > >> I think this commit is responsible for panics I'm seeing in EC2 on= T2 family > >> instances. [...] > >> but under high traffic volumes I think a separate thread can alrea= dy be > >> running in xn_rxeof, having dropped the RX lock while it passes a = packet > >> up the stack. This would result in two different threads trying t= o process > >> the same set of responses from the ring, with (unsurprisingly) bad= results. > >=20 > > Hm, right, xn_rxeof drops the lock while pushing the packet up the = stack. > > There's a "XXX" comment on top of that, could you try to remove the= lock > > dripping and see what happens? > >=20 > > I'm not sure there's any reason to drop the lock here, I very much = doubt > > if_input is going to sleep. >=20 > Judging by > $ grep -R -B 1 -A 1 if_input /usr/src/sys/dev > I'm pretty sure that we do indeed need to drop the lock. If it's pos= sible > to enter if_input while holding locks, there are a *lot* of network i= nterface > drivers which are dropping locks unnecessarily... It depends on how the locks are used. If a NIC driver uses a single lo= ck for both TX and RX, then it needs to drop the lock as on the TX side, if_transmit/if_start will be invoked with various network stack locks h= eld. However, if a driver uses separate locks for RX and TX and doesn't acqu= ire the RX lock while holding a TX lock, then it should be safe to hold the= lock across if_input. A lot of the older 100Mbps PCI NIC drivers only use a single lock and t= hus need to drop the lock. Many multiqueue NIC drivers use separate locks however and probably don't need to drop them around if_input. --=20 John Baldwin