From owner-freebsd-net@FreeBSD.ORG Fri Apr 19 17:48:46 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4927070E; Fri, 19 Apr 2013 17:48:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id 24820880; Fri, 19 Apr 2013 17:48:46 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C90ABB992; Fri, 19 Apr 2013 12:29:08 -0400 (EDT) From: John Baldwin To: freebsd-net@freebsd.org Subject: Re: kern/176446: [netinet] [patch] Concurrency in ixgbe driving out-of-order packet process and spurious RST Date: Fri, 19 Apr 2013 12:09:11 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <201303141500.r2EF01EQ079753@freefall.freebsd.org> In-Reply-To: <201303141500.r2EF01EQ079753@freefall.freebsd.org> MIME-Version: 1.0 Message-Id: <201304191209.11316.jhb@freebsd.org> Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 19 Apr 2013 12:29:08 -0400 (EDT) Cc: Jack Vogel , bug-followup@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2013 17:48:46 -0000 I want to make some progress on this, so let's break this up into smaller parts. First, I think both calls to rearm_queues() should be removed. In the case of the local timer, this can only re-enable interrupts if the interrupt handler is already scheduled or running or its associated task is running. In the last case this means the ithread can run concurrently with the interrupt handler causing out-of-order processing. The rxeof case has the same issue. Normally the code calling rxeof is going to re-enable the interrupt if rxeof runs to completion, and if not it is going to schedule the taskqueue. The effect of the rxeof change was to always re-enable interrupts before scheduling the taskqueue which can result in those running concurrently. Index: /home/jhb/work/freebsd/svn/head/sys/dev/ixgbe/ixgbe.c =================================================================== --- /home/jhb/work/freebsd/svn/head/sys/dev/ixgbe/ixgbe.c (revision 249553) +++ /home/jhb/work/freebsd/svn/head/sys/dev/ixgbe/ixgbe.c (working copy) @@ -1386,23 +1386,6 @@ } } -static inline void -ixgbe_rearm_queues(struct adapter *adapter, u64 queues) -{ - u32 mask; - - if (adapter->hw.mac.type == ixgbe_mac_82598EB) { - mask = (IXGBE_EIMS_RTX_QUEUE & queues); - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, mask); - } else { - mask = (queues & 0xFFFFFFFF); - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS_EX(0), mask); - mask = (queues >> 32); - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS_EX(1), mask); - } -} - - static void ixgbe_handle_que(void *context, int pending) { @@ -2069,7 +2055,6 @@ goto watchdog; out: - ixgbe_rearm_queues(adapter, adapter->que_mask); callout_reset(&adapter->timer, hz, ixgbe_local_timer, adapter); return; @@ -4596,14 +4577,8 @@ /* ** We still have cleaning to do? - ** Schedule another interrupt if so. */ - if ((staterr & IXGBE_RXD_STAT_DD) != 0) { - ixgbe_rearm_queues(adapter, (u64)(1 << que->msix)); - return (TRUE); - } - - return (FALSE); + return ((staterr & IXGBE_RXD_STAT_DD) != 0); } -- John Baldwin