Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/arch/x86/x86 Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/2123a2b5c5d9
branches:  netbsd-8
changeset: 851518:2123a2b5c5d9
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Mar 26 11:19:39 2018 +0000

description:
Pull up following revision(s) (requested by knakahara in ticket #658):
        sys/arch/x86/x86/intr.c: revision 1.124
Fix "intrctl list" causes panic while attaching MSI/MSI-X devices.
When there are devices which is already pci_intr_alloc'ed, however is not
established yet, "intrctl list" causes panic. E.g.
    # while true; do intrctl list > /dev/null ; done&
    # drvctl -d ixg0 && drvctl -r pci0
And add some KASSERTMSG to similar but not the same code.
Pointed out by msaitoh@n.o.
XXX pullup-8

diffstat:

 sys/arch/x86/x86/intr.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (52 lines):

diff -r a933c9db9c5a -r 2123a2b5c5d9 sys/arch/x86/x86/intr.c
--- a/sys/arch/x86/x86/intr.c   Sat Mar 24 18:13:25 2018 +0000
+++ b/sys/arch/x86/x86/intr.c   Mon Mar 26 11:19:39 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.c,v 1.101.2.3 2018/03/16 13:17:56 martin Exp $    */
+/*     $NetBSD: intr.c,v 1.101.2.4 2018/03/26 11:19:39 martin Exp $    */
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.101.2.3 2018/03/16 13:17:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.101.2.4 2018/03/26 11:19:39 martin Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -1839,6 +1839,9 @@
                return;
        }
 
+       KASSERTMSG(isp->is_handlers != NULL,
+           "Don't get affinity for the device which is not established.");
+
        ci = isp->is_handlers->ih_cpu;
        if (ci == NULL) {
                kcpuset_zero(cpuset);
@@ -1891,6 +1894,9 @@
        }
 
        ih = isp->is_handlers;
+       KASSERTMSG(ih != NULL,
+           "Don't set affinity for the device which is not established.");
+
        oldci = ih->ih_cpu;
        if (newci == oldci) /* nothing to do */
                return 0;
@@ -1957,6 +1963,13 @@
 
        KASSERT(mutex_owned(&cpu_lock));
 
+       /*
+        * The device is already pci_intr_alloc'ed, however it is not
+        * established yet.
+        */
+       if (isp->is_handlers == NULL)
+               return false;
+
        ci = isp->is_handlers->ih_cpu;
        KASSERT(ci != NULL);
 



Home | Main Index | Thread Index | Old Index