Current-Users archive

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

Panic in ahci_detach



 Hi.

 One of my machine panics in ahci_detach while shutdown.

dmesg related to ahci:
ci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
pchb0 at pci0 dev 0 function 0: vendor 8086 product 1980 (rev. 0x10)
pchb1 at pci0 dev 4 function 0: vendor 8086 product 19a1 (rev. 0x10)
ppb5 at pci0 dev 14 function 0: vendor 8086 product 19a8 (rev. 0x10)
ppb5: PCI Express capability version 2 <Root Port of PCI-E Root Complex> x2 @ 8.0GT/s
pci6 at ppb5 bus 6
pci6: i/o space, memory space enabled, rd/line, wr/inv ok
allocated pic msi5 type edge pin 0 level 6 to cpu0 slot 21 idt entry 110
ahcisata0: interrupting at msi5 vec 0
ahcisata0: 64-bit DMA
ahcisata0: AHCI revision 1.31, 1 port, 32 slots, CAP 0xc3369f40<EMS,PMD,SPM,SAM,ISS=0x3=Gen3,SCLO,SAL,SNCQ,S64A>
atabus0 at ahcisata0 channel 3
ahcisata1 at pci0 dev 20 function 0: vendor 8086 product 19c2 (rev. 0x10)
allocated pic msi6 type edge pin 0 level 6 to cpu0 slot 22 idt entry 111
ahcisata1: interrupting at msi6 vec 0
ahcisata1: 64-bit DMA
ahcisata1: AHCI revision 1.31, 2 ports, 32 slots, CAP 0xc3369f41<EMS,PMD,SPM,SAM,ISS=0x3=Gen3,SCLO,SAL,SNCQ,S64A>
atabus1 at ahcisata1 channel 4
atabus2 at ahcisata1 channel 5

ahcisata1 has two channels. channel 4 and 5.

ahcisata1 port 5: device present, speed: 6.0Gb/s
wd0 at atabus2 drive 0
wd0: <INTEL SSDSC2CW240A3>
wd0: drive supports 16-sector PIO transfers, LBA48 addressing
wd0: 223 GB, 465141 cyl, 16 head, 63 sec, 512 bytes/sect x 468862128 sectors
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133), WRITE DMA FUA, NCQ (32 tags)
wd0(ahcisata1:5:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133) (using DMA), NCQ (31 tags)


diff for debugging:
Index: sys/kern/subr_autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/kern/subr_autoconf.c,v
retrieving revision 1.263
diff -u -p -r1.263 subr_autoconf.c
--- sys/kern/subr_autoconf.c	18 Sep 2018 01:25:09 -0000	1.263
+++ sys/kern/subr_autoconf.c	1 Nov 2018 05:33:15 -0000
@@ -1711,6 +1711,9 @@ config_detach(device_t dev, int flags)
 	device_t d __diagused;
 	int rv = 0;
+ if (dev->dv_cfdata != NULL && (flags & DETACH_QUIET) == 0)
+		aprint_normal_dev(dev, "detaching\n");
+
 	cf = dev->dv_cfdata;
 	KASSERTMSG((cf == NULL || cf->cf_fstate == FSTATE_FOUND ||
 		cf->cf_fstate == FSTATE_STAR),
Index: sys/dev/ic/ahcisata_core.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/ahcisata_core.c,v
retrieving revision 1.65
diff -u -p -r1.65 ahcisata_core.c
--- sys/dev/ic/ahcisata_core.c	24 Oct 2018 19:38:00 -0000	1.65
+++ sys/dev/ic/ahcisata_core.c	1 Nov 2018 05:33:15 -0000
@@ -508,15 +508,21 @@ ahci_detach(struct ahci_softc *sc, int f
 	atac = &sc->sc_atac;
 	adapt = &atac->atac_atapi_adapter._generic;
+ printf("%s: sc_ahci_ports = %08x\n", __func__, sc->sc_ahci_ports);
+	printf("%s: sc_atac.atac_nchannels = %08x\n", __func__,
+	    sc->sc_atac.atac_nchannels);
 	for (i = 0; i < AHCI_MAX_PORTS; i++) {
 		achp = &sc->sc_channels[i];
 		chp = &achp->ata_channel;
+ printf("%s: port %d\n", __func__, i);
 		if ((sc->sc_ahci_ports & (1U << i)) == 0)
 			continue;
+		printf("%s: detach %d (atac_nchannels = %d)\n", __func__, i,
+			sc->sc_atac.atac_nchannels);
 		if (i >= sc->sc_atac.atac_nchannels) {
-			aprint_error("%s: more ports than announced\n",
-			    AHCINAME(sc));
+			aprint_error("%s: %s: more ports than announced\n",
+			    __func__, AHCINAME(sc));
 			break;
 		}

console output:
[ 837.8647946] pci8: detaching
[ 837.8647946] pci8: detached
[ 837.8647946] pci7: detaching
[ 837.8748051] pci7: detached
[ 837.8748051] usb1: detaching
[ 837.8748051] usb1: detached
[ 837.8748051] usb0: detaching
[ 837.8848152] usb0: detached
[ 837.8848152] atabus2: detaching
[ 837.8848152] wd0: detaching
[ 837.8948259] atabus1: detaching
[ 837.8948259] atabus1: detached
[ 837.8948259] atabus0: detaching
[ 837.9048363] atabus0: detached
[ 837.9048363] pci6: detaching
[ 837.9048363] pci6: detached
[ 837.9048363] pci5: detaching
[ 837.9148468] pci5: detached
[ 837.9148468] pci4: detaching
[ 837.9148468] pci4: detached
[ 837.9148468] pci3: detaching
[ 837.9248570] pci3: detached
[ 837.9248570] pci2: detaching
[ 837.9248570] pci2: detached
[ 837.9348674] pci1: detaching
[ 837.9348674] pci1: detached
[ 837.9348674] coretemp3: detaching
[ 837.9348674] acpicpu3: detaching
[ 837.9448781] coretemp2: detaching
[ 837.9448781] acpicpu2: detaching
[ 837.9448781] coretemp1: detaching
[ 837.9548884] acpicpu1: detaching
[ 837.9548884] coretemp0: detaching
[ 837.9548884] acpicpu0: detaching
[ 837.9648986] ichsmb0: detaching
[ 837.9648986] pcib0: detaching
[ 837.9648986] isa0: detaching
[ 837.9648986] sdhc0: detaching
[ 837.9749091] ppb7: detaching
[ 837.9749091] ppb7: detached
[ 837.9749091] ppb6: detaching
[ 837.9849196] ppb6: detached
[ 837.9849196] xhci0: detaching
[ 837.9849196] xhci0: detached
[ 837.9849196] ahcisata1: detaching
[ 837.9972751] ahci_detach: sc_ahci_ports = 00000030
[ 837.9972751] ahci_detach: sc_atac.atac_nchannels = 00000002
[ 838.0074157] ahci_detach: port 0
[ 838.0074157] ahci_detach: port 1
[ 838.0074157] ahci_detach: port 2
[ 838.0167754] ahci_detach: port 3
[ 838.0167754] ahci_detach: port 4
[ 838.0167754] ahci_detach: detach 4 (atac_nchannels = 2)
ahci_detach: ahcisata1: more ports than announced
[ 838.0281284] config_detach: detached device ahcisata1 has children atabus2
[ 838.0393092] Skipping crash dump on recursive panic
[ 838.0393092] panic: config_detach
[ 838.0459817] cpu0: Begin traceback...
[ 838.0459817] vpanic() at netbsd:vpanic+0x16f
[ 838.0549961] snprintf() at netbsd:snprintf
[ 838.0549961] config_detach() at netbsd:config_detach+0x24f
[ 838.0665574] config_detach_all() at netbsd:config_detach_all+0x97
[ 838.0750123] cpu_reboot() at netbsd:cpu_reboot+0x195
[ 838.0750123] sys_reboot() at netbsd:sys_reboot+0x75
[ 838.0852250] syscall() at netbsd:syscall+0x173
[ 838.0852250] --- syscall (number 208) ---
[ 838.0955909] 7f7ff743ef3a:
[ 838.0955909] cpu0: End traceback...
[ 838.0955909] fatal breakpoint trap in supervisor mode
[ 838.1066406] trap type 1 code 0 rip 0xffffffff8021de45 cs 0x8 rflags 0x202 cr2 0x7f7ff396d6d8 ilevel 0 rsp 0xffff98014ac9dd90
[ 838.1178205] curlwp 0xffffdc4ddbd1a280 pid 817.1 lowest kstack 0xffff98014ac9a2c0
Stopped in pid 817.1 (reboot) at        netbsd:breakpoint+0x5:  leave
db{0}>

The meaning of atac_nchannels changed or numbering of channel
changed?

--
-----------------------------------------------
                SAITOH Masanobu (msaitoh%execsw.org@localhost
                                 msaitoh%netbsd.org@localhost)


Home | Main Index | Thread Index | Old Index