From owner-svn-src-all@freebsd.org Tue May 24 12:14:20 2016 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 D994EB43F93; Tue, 24 May 2016 12:14:20 +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 mx1.freebsd.org (Postfix) with ESMTPS id 828F61D72; Tue, 24 May 2016 12:14:20 +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 u4OCEJhP069473; Tue, 24 May 2016 12:14:19 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4OCEJ9E069471; Tue, 24 May 2016 12:14:19 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201605241214.u4OCEJ9E069471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Tue, 24 May 2016 12:14:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300605 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 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: Tue, 24 May 2016 12:14:21 -0000 Author: arybchik Date: Tue May 24 12:14:19 2016 New Revision: 300605 URL: https://svnweb.freebsd.org/changeset/base/300605 Log: sfxge(4): be ready to receive events immediately after event queues are created Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6507 Modified: head/sys/dev/sfxge/common/ef10_ev.c head/sys/dev/sfxge/common/efx_ev.c Modified: head/sys/dev/sfxge/common/ef10_ev.c ============================================================================== --- head/sys/dev/sfxge/common/ef10_ev.c Tue May 24 12:06:56 2016 (r300604) +++ head/sys/dev/sfxge/common/ef10_ev.c Tue May 24 12:14:19 2016 (r300605) @@ -275,6 +275,11 @@ ef10_ev_qcreate( /* Set up the event queue */ irq = index; /* INIT_EVQ expects function-relative vector number */ + + /* + * Interrupts may be raised for events immediately after the queue is + * created. See bug58606. + */ if ((rc = efx_mcdi_init_evq(enp, index, esmp, n, irq)) != 0) goto fail3; Modified: head/sys/dev/sfxge/common/efx_ev.c ============================================================================== --- head/sys/dev/sfxge/common/efx_ev.c Tue May 24 12:06:56 2016 (r300604) +++ head/sys/dev/sfxge/common/efx_ev.c Tue May 24 12:14:19 2016 (r300605) @@ -251,16 +251,27 @@ efx_ev_qcreate( eep->ee_mask = n - 1; eep->ee_esmp = esmp; - if ((rc = eevop->eevo_qcreate(enp, index, esmp, n, id, eep)) != 0) - goto fail2; - + /* + * Set outputs before the queue is created because interrupts may be + * raised for events immediately after the queue is created, before the + * function call below returns. See bug58606. + * + * The eepp pointer passed in by the client must therefore point to data + * shared with the client's event processing context. + */ enp->en_ev_qcount++; *eepp = eep; + if ((rc = eevop->eevo_qcreate(enp, index, esmp, n, id, eep)) != 0) + goto fail2; + return (0); fail2: EFSYS_PROBE(fail2); + + *eepp = NULL; + enp->en_ev_qcount--; EFSYS_KMEM_FREE(enp->en_esip, sizeof (efx_evq_t), eep); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc);