From owner-svn-src-head@freebsd.org  Fri Nov 30 07:11:01 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC244115AEC9;
 Fri, 30 Nov 2018 07:11:01 +0000 (UTC)
 (envelope-from arybchik@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 23C69728CA;
 Fri, 30 Nov 2018 07:11:01 +0000 (UTC)
 (envelope-from arybchik@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53215252C6;
 Fri, 30 Nov 2018 07:10:55 +0000 (UTC)
 (envelope-from arybchik@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wAU7AtnO084648;
 Fri, 30 Nov 2018 07:10:55 GMT (envelope-from arybchik@FreeBSD.org)
Received: (from arybchik@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id wAU7At8p084647;
 Fri, 30 Nov 2018 07:10:55 GMT (envelope-from arybchik@FreeBSD.org)
Message-Id: <201811300710.wAU7At8p084647@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: arybchik set sender to
 arybchik@FreeBSD.org using -f
From: Andrew Rybchenko <arybchik@FreeBSD.org>
Date: Fri, 30 Nov 2018 07:10:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r341326 - head/sys/dev/sfxge/common
X-SVN-Group: head
X-SVN-Commit-Author: arybchik
X-SVN-Commit-Paths: head/sys/dev/sfxge/common
X-SVN-Commit-Revision: 341326
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: 23C69728CA
X-Spamd-Result: default: False [0.50 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_SPAM_MEDIUM(0.26)[0.256,0];
 NEURAL_HAM_SHORT(-0.06)[-0.063,0];
 NEURAL_SPAM_LONG(0.31)[0.307,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]
X-Rspamd-Server: mx1.freebsd.org
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Nov 2018 07:11:02 -0000

Author: arybchik
Date: Fri Nov 30 07:10:54 2018
New Revision: 341326
URL: https://svnweb.freebsd.org/changeset/base/341326

Log:
  sfxge(4): ensure EvQ poll stops when abort is requested
  
  If an event handler requested an abort, only the inner loop was
  guarenteed to be broken out of - the outer loop could continue
  if total == batch.
  
  Fix this by poisoning batch to ensure it is different to total.
  
  Submitted by:   Mark Spender <mspender at solarflare.com>
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:      1 week
  Differential Revision:  https://reviews.freebsd.org/D18287

Modified:
  head/sys/dev/sfxge/common/efx_ev.c

Modified: head/sys/dev/sfxge/common/efx_ev.c
==============================================================================
--- head/sys/dev/sfxge/common/efx_ev.c	Fri Nov 30 07:10:43 2018	(r341325)
+++ head/sys/dev/sfxge/common/efx_ev.c	Fri Nov 30 07:10:54 2018	(r341326)
@@ -509,6 +509,14 @@ efx_ev_qpoll(
 			if (should_abort) {
 				/* Ignore subsequent events */
 				total = index + 1;
+
+				/*
+				 * Poison batch to ensure the outer
+				 * loop is broken out of.
+				 */
+				EFSYS_ASSERT(batch <= EFX_EV_BATCH);
+				batch += (EFX_EV_BATCH << 1);
+				EFSYS_ASSERT(total != batch);
 				break;
 			}
 		}