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;
                        }
                }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to