From owner-svn-src-stable@freebsd.org Wed Aug 3 13:19:59 2016 Return-Path: Delivered-To: svn-src-stable@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 D4EABBAC3FD; Wed, 3 Aug 2016 13:19:59 +0000 (UTC) (envelope-from royger@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 B03351989; Wed, 3 Aug 2016 13:19:59 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u73DJwbR091476; Wed, 3 Aug 2016 13:19:58 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u73DJw6N091474; Wed, 3 Aug 2016 13:19:58 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201608031319.u73DJw6N091474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Wed, 3 Aug 2016 13:19:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r303711 - in stable/11/sys/x86: x86 xen X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 13:19:59 -0000 Author: royger Date: Wed Aug 3 13:19:58 2016 New Revision: 303711 URL: https://svnweb.freebsd.org/changeset/base/303711 Log: MFC r303490, r303491: xen-intr: fix removal of event channels during resume Revert r291022: x86/intr: allow mutex recursion in intr_remove_handler Approved by: re (kib) Modified: stable/11/sys/x86/x86/intr_machdep.c stable/11/sys/x86/xen/xen_intr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/intr_machdep.c ============================================================================== --- stable/11/sys/x86/x86/intr_machdep.c Wed Aug 3 11:49:17 2016 (r303710) +++ stable/11/sys/x86/x86/intr_machdep.c Wed Aug 3 13:19:58 2016 (r303711) @@ -197,28 +197,19 @@ int intr_remove_handler(void *cookie) { struct intsrc *isrc; - int error, mtx_owned; + int error; isrc = intr_handler_source(cookie); error = intr_event_remove_handler(cookie); if (error == 0) { - /* - * Recursion is needed here so PICs can remove interrupts - * while resuming. It was previously not possible due to - * intr_resume holding the intr_table_lock and - * intr_remove_handler recursing on it. - */ - mtx_owned = mtx_owned(&intr_table_lock); - if (mtx_owned == 0) - mtx_lock(&intr_table_lock); + mtx_lock(&intr_table_lock); isrc->is_handlers--; if (isrc->is_handlers == 0) { isrc->is_pic->pic_disable_source(isrc, PIC_NO_EOI); isrc->is_pic->pic_disable_intr(isrc); } intrcnt_updatename(isrc); - if (mtx_owned == 0) - mtx_unlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } return (error); } Modified: stable/11/sys/x86/xen/xen_intr.c ============================================================================== --- stable/11/sys/x86/xen/xen_intr.c Wed Aug 3 11:49:17 2016 (r303710) +++ stable/11/sys/x86/xen/xen_intr.c Wed Aug 3 13:19:58 2016 (r303711) @@ -130,8 +130,6 @@ struct xenisrc { u_int xi_masked:1; }; -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) - static void xen_intr_suspend(struct pic *); static void xen_intr_resume(struct pic *, bool suspend_cancelled); static void xen_intr_enable_source(struct intsrc *isrc); @@ -422,7 +420,7 @@ xen_intr_bind_isrc(struct xenisrc **isrc mtx_unlock(&xen_intr_isrc_lock); /* Assign the opaque handler (the event channel port) */ - *port_handlep = &isrc->xi_port; + *port_handlep = &isrc->xi_vector; #ifdef SMP if (type == EVTCHN_TYPE_PORT) { @@ -468,16 +466,17 @@ xen_intr_bind_isrc(struct xenisrc **isrc static struct xenisrc * xen_intr_isrc(xen_intr_handle_t handle) { - evtchn_port_t port; + int vector; if (handle == NULL) return (NULL); - port = *(evtchn_port_t *)handle; - if (!is_valid_evtchn(port) || port >= NR_EVENT_CHANNELS) - return (NULL); + vector = *(int *)handle; + KASSERT(vector >= FIRST_EVTCHN_INT && + vector < (FIRST_EVTCHN_INT + xen_intr_auto_vector_count), + ("Xen interrupt vector is out of range")); - return (xen_intr_port_to_isrc[port]); + return ((struct xenisrc *)intr_lookup_source(vector)); } /** @@ -780,10 +779,6 @@ xen_intr_resume(struct pic *unused, bool xen_rebind_virq(isrc); break; default: - intr_remove_handler(isrc->xi_cookie); - isrc->xi_cpu = 0; - isrc->xi_type = EVTCHN_TYPE_UNBOUND; - isrc->xi_cookie = NULL; break; } }