Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Fix x86's pci_intr_disestablish clean up ro...



details:   https://anonhg.NetBSD.org/src/rev/ddd3f7fb8304
branches:  trunk
changeset: 980792:ddd3f7fb8304
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Fri Feb 19 05:34:37 2021 +0000

description:
Fix x86's pci_intr_disestablish clean up routine.  Pointed out by t-kusaba@IIJ, thanks.

Fix panic on x86 by the following code.
====================
    sc_ih = pci_intr_establish_xname(sc_pc, ...);
    pci_intr_disestablish(sc_pc, sc_ih);
    sc_ih = pci_intr_establish(sc_pc, ...);
====================
ena(4) do such processing when ifconfig down/up.

XXX pullup-8,9

diffstat:

 sys/arch/x86/x86/intr.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (44 lines):

diff -r 3b8b52fa6c21 -r ddd3f7fb8304 sys/arch/x86/x86/intr.c
--- a/sys/arch/x86/x86/intr.c   Fri Feb 19 05:23:53 2021 +0000
+++ b/sys/arch/x86/x86/intr.c   Fri Feb 19 05:34:37 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.c,v 1.153 2020/11/18 16:36:43 bouyer Exp $        */
+/*     $NetBSD: intr.c,v 1.154 2021/02/19 05:34:37 knakahara Exp $     */
 
 /*
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.153 2020/11/18 16:36:43 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.154 2021/02/19 05:34:37 knakahara Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -636,6 +636,9 @@
        ci->ci_isources[slot] = NULL;
        if (pic != &i8259_pic)
                idt_vec_free(iv, idtvec);
+
+       isp->is_recurse = NULL;
+       isp->is_resume = NULL;
 }
 
 #ifdef MULTIPROCESSOR
@@ -1136,12 +1139,12 @@
        else if (source->is_mask_count == 0)
                (*pic->pic_hwunmask)(pic, ih->ih_pin);
 
+       /* If the source is free we can drop it now. */
+       intr_source_free(ci, ih->ih_slot, pic, idtvec);
+
        /* Re-enable interrupts. */
        x86_write_psl(psl);
 
-       /* If the source is free we can drop it now. */
-       intr_source_free(ci, ih->ih_slot, pic, idtvec);
-
        DPRINTF(("%s: remove slot %d (pic %s pin %d vec %d)\n",
            device_xname(ci->ci_dev), ih->ih_slot, pic->pic_name,
            ih->ih_pin, idtvec));



Home | Main Index | Thread Index | Old Index