Re: Removing an SDHC card causes a kernel panic on -current

2012-06-27 Thread Michael Butler
On 06/26/12 22:29, Kenneth D. Merry wrote:
 On Tue, Jun 26, 2012 at 19:41:07 -0400, Benjamin Kaduk wrote:
 On Tue, 26 Jun 2012, Michael Butler wrote:

 As follows, in g_disk_providergone, a NULL pointer reference?:

 g_disk_providergone() is new in r237518 (by ken); ken cc'd.
 
 Can you try the attached patch to sys/geom/geom_disk.c?

This fixes the panic :-)

 
 Also, do you have full dmesg information for when the panic happened?
 
 It looks like disk_destroy() has already been called in this case, and I
 suppose that's likely to happen for any of the users of the GEOM disk class
 that haven't been updated with the reference count changes I made in da(4).
 (i.e. all of the rest of them.)
 
 Let me know whether this works for you.

All I have is the following leading up to my removal of the card (and
the restart afterwards):

Jun 26 08:57:11 toshi kernel: sdhci0-slot0: Card inserted
Jun 26 08:57:11 toshi kernel: mmc0: MMC/SD bus on sdhci0
Jun 26 08:57:11 toshi kernel: mmc0: Probing bus
Jun 26 08:57:11 toshi kernel: mmc0: SD probe: OK (OCR: 0x00ff8000)
Jun 26 08:57:11 toshi kernel: mmc0: Current OCR: 0x00ff8000
Jun 26 08:57:11 toshi kernel: mmc0: Probing cards
Jun 26 08:57:11 toshi kernel: mmc0: New card detected (CID
03534453553136478080d4290400a300)
Jun 26 08:57:11 toshi kernel: mmc0: New card detected (CSD
400e00325b5976b27f800a404000)
Jun 26 08:57:11 toshi kernel: mmc0: Card at relative address 36832 added:
Jun 26 08:57:11 toshi kernel: mmc0:  card: SDHC SU16G 8.0 SN -2133579516
MFG 03/2010 by 3 SD
Jun 26 08:57:11 toshi kernel: mmc0:  bus: 4bit, 50MHz, high speed timing
Jun 26 08:57:11 toshi kernel: mmc0:  memory: 31116288 blocks, erase
sector 8192 blocks
Jun 26 08:57:12 toshi kernel: mmc0: setting transfer rate to 25.000MHz
Jun 26 08:57:12 toshi kernel: mmcsd0: 14GB SDHC SU16G 8.0 SN
-2133579516 MFG 03/2010 by 3 SD at mmc0 24.0MHz/4bit/65535-block
Jun 26 08:57:12 toshi kernel: GEOM: new disk mmcsd0
Jun 26 08:57:12 toshi kernel: mmc0: setting bus width to 4 bits

Jun 26 08:58:44 toshi syslogd: kernel boot file is /boot/kernel/kernel
Jun 26 08:58:44 toshi kernel: Copyright (c) 1992-2012 The FreeBSD Project.
Jun 26 08:58:44 toshi kernel: Copyright (c) 1979, 1980, 1983, 1986,
1988, 1989, 1991, 1992, 1993, 1994
Jun 26 08:58:44 toshi kernel: The Regents of the University of
California. All rights reserved.
Jun 26 08:58:44 toshi kernel: FreeBSD is a registered trademark of The
FreeBSD Foundation.


___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Removing an SDHC card causes a kernel panic on -current

2012-06-27 Thread Kenneth D. Merry
On Wed, Jun 27, 2012 at 10:22:59 -0400, Michael Butler wrote:
 On 06/26/12 22:29, Kenneth D. Merry wrote:
  On Tue, Jun 26, 2012 at 19:41:07 -0400, Benjamin Kaduk wrote:
  On Tue, 26 Jun 2012, Michael Butler wrote:
 
  As follows, in g_disk_providergone, a NULL pointer reference?:
 
  g_disk_providergone() is new in r237518 (by ken); ken cc'd.
  
  Can you try the attached patch to sys/geom/geom_disk.c?
 
 This fixes the panic :-)

Great!  I just committed it.

  Also, do you have full dmesg information for when the panic happened?
  
  It looks like disk_destroy() has already been called in this case, and I
  suppose that's likely to happen for any of the users of the GEOM disk class
  that haven't been updated with the reference count changes I made in da(4).
  (i.e. all of the rest of them.)
  
  Let me know whether this works for you.
 
 All I have is the following leading up to my removal of the card (and
 the restart afterwards):

Thanks!

Ken
-- 
Kenneth Merry
k...@freebsd.org
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Removing an SDHC card causes a kernel panic on -current

2012-06-26 Thread Michael Butler
As follows, in g_disk_providergone, a NULL pointer reference?:

imb@toshi:/home/imb sudo less /var/crash/core.txt.4
toshi.auburn.protected-networks.net dumped core - see /var/crash/vmcore.4

Tue Jun 26 08:59:01 EDT 2012

FreeBSD toshi.auburn.protected-networks.net 10.0-CURRENT FreeBSD
10.0-CURRENT #12 r237599M: Tue Jun 26 07:52:01 EDT 2012
i...@toshi.auburn.protected-networks.net:/usr/obj/usr/home/imb/svn/head/sys/TOSHI
 i386

panic: page fault

[ .. ]

Unread portion of the kernel message buffer:
sdhci0-slot0: Card removed
mmc0: detached

Fatal trap 12: page fault while in kernel mode
cpuid = 1; apic id = 01
fault virtual address   = 0x0
fault code  = supervisor read, page not present
instruction pointer = 0x20:0xc070a4bc
stack pointer   = 0x28:0xc6fb7c54
frame pointer   = 0x28:0xc6fb7c54
code segment= base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, def32 1, gran 1
processor eflags= interrupt enabled, resume, IOPL = 0
current process = 14 (g_event)
trap number = 12
panic: page fault
cpuid = 1
Uptime: 7m8s
Physical memory: 3045 MB
Dumping 265 MB: 250 234 218 202 186 170 154 138 122 106 90 74 58 42 26 10

Reading symbols from /boot/kernel/drm.ko...Reading symbols from
/boot/kernel/drm.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/drm.ko
Reading symbols from /boot/kernel/i915.ko...Reading symbols from
/boot/kernel/i915.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/i915.ko
Reading symbols from /boot/modules/vboxdrv.ko...done.
Loaded symbols for /boot/modules/vboxdrv.ko
Reading symbols from /boot/modules/cuse4bsd.ko...done.
Loaded symbols for /boot/modules/cuse4bsd.ko
Reading symbols from /boot/modules/vboxnetflt.ko...done.
Loaded symbols for /boot/modules/vboxnetflt.ko
Reading symbols from /boot/modules/vboxnetadp.ko...done.
Loaded symbols for /boot/modules/vboxnetadp.ko
Reading symbols from /usr/local/modules/fuse.ko...done.
Loaded symbols for /usr/local/modules/fuse.ko
#0  doadump (textdump=1) at pcpu.h:244
244 pcpu.h: No such file or directory.
in pcpu.h
(kgdb) #0  doadump (textdump=1) at pcpu.h:244
#1  0xc07ae76c in kern_reboot (howto=260)
at /usr/home/imb/svn/head/sys/kern/kern_shutdown.c:449
#2  0xc07aee41 in panic (fmt=0x104 Address 0x104 out of bounds)
at /usr/home/imb/svn/head/sys/kern/kern_shutdown.c:637
#3  0xc0af13d1 in trap_fatal (frame=0xc6fb7c14, eva=40)
at /usr/home/imb/svn/head/sys/i386/i386/trap.c:1022
#4  0xc0af16a8 in trap_pfault (frame=0xc6fb7c14, usermode=0, eva=0)
at /usr/home/imb/svn/head/sys/i386/i386/trap.c:936
#5  0xc0af29ef in trap (frame=0xc6fb7c14)
at /usr/home/imb/svn/head/sys/i386/i386/trap.c:546
#6  0xc0adcbdc in calltrap ()
at /usr/home/imb/svn/head/sys/i386/i386/exception.s:169
#7  0xc070a4bc in g_disk_providergone (pp=0xcb33ab80)
at /usr/home/imb/svn/head/sys/geom/geom_disk.c:505
#8  0xc070f8ba in g_destroy_provider (pp=0xcb33ab80)
at /usr/home/imb/svn/head/sys/geom/geom_subr.c:643
#9  0xc070fb6e in g_wither_washer ()
at /usr/home/imb/svn/head/sys/geom/geom_subr.c:462
#10 0xc070cb62 in g_run_events ()
at /usr/home/imb/svn/head/sys/geom/geom_event.c:289
#11 0xc077bd8b in fork_exit (callout=0xc070de54 g_event_procbody,
arg=0x0,
frame=0xc6fb7d08) at /usr/home/imb/svn/head/sys/kern/kern_fork.c:995
#12 0xc0adcc84 in fork_trampoline ()
at /usr/home/imb/svn/head/sys/i386/i386/exception.s:276
(kgdb)
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Removing an SDHC card causes a kernel panic on -current

2012-06-26 Thread Benjamin Kaduk

On Tue, 26 Jun 2012, Michael Butler wrote:


As follows, in g_disk_providergone, a NULL pointer reference?:


g_disk_providergone() is new in r237518 (by ken); ken cc'd.

-Ben Kaduk



imb@toshi:/home/imb sudo less /var/crash/core.txt.4
toshi.auburn.protected-networks.net dumped core - see /var/crash/vmcore.4

Tue Jun 26 08:59:01 EDT 2012

FreeBSD toshi.auburn.protected-networks.net 10.0-CURRENT FreeBSD
10.0-CURRENT #12 r237599M: Tue Jun 26 07:52:01 EDT 2012
i...@toshi.auburn.protected-networks.net:/usr/obj/usr/home/imb/svn/head/sys/TOSHI
i386

panic: page fault

[ .. ]

Unread portion of the kernel message buffer:
sdhci0-slot0: Card removed
mmc0: detached

Fatal trap 12: page fault while in kernel mode
cpuid = 1; apic id = 01
fault virtual address   = 0x0
fault code  = supervisor read, page not present
instruction pointer = 0x20:0xc070a4bc
stack pointer   = 0x28:0xc6fb7c54
frame pointer   = 0x28:0xc6fb7c54
code segment= base 0x0, limit 0xf, type 0x1b
   = DPL 0, pres 1, def32 1, gran 1
processor eflags= interrupt enabled, resume, IOPL = 0
current process = 14 (g_event)
trap number = 12
panic: page fault
cpuid = 1
Uptime: 7m8s
Physical memory: 3045 MB
Dumping 265 MB: 250 234 218 202 186 170 154 138 122 106 90 74 58 42 26 10

Reading symbols from /boot/kernel/drm.ko...Reading symbols from
/boot/kernel/drm.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/drm.ko
Reading symbols from /boot/kernel/i915.ko...Reading symbols from
/boot/kernel/i915.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/i915.ko
Reading symbols from /boot/modules/vboxdrv.ko...done.
Loaded symbols for /boot/modules/vboxdrv.ko
Reading symbols from /boot/modules/cuse4bsd.ko...done.
Loaded symbols for /boot/modules/cuse4bsd.ko
Reading symbols from /boot/modules/vboxnetflt.ko...done.
Loaded symbols for /boot/modules/vboxnetflt.ko
Reading symbols from /boot/modules/vboxnetadp.ko...done.
Loaded symbols for /boot/modules/vboxnetadp.ko
Reading symbols from /usr/local/modules/fuse.ko...done.
Loaded symbols for /usr/local/modules/fuse.ko
#0  doadump (textdump=1) at pcpu.h:244
244 pcpu.h: No such file or directory.
   in pcpu.h
(kgdb) #0  doadump (textdump=1) at pcpu.h:244
#1  0xc07ae76c in kern_reboot (howto=260)
   at /usr/home/imb/svn/head/sys/kern/kern_shutdown.c:449
#2  0xc07aee41 in panic (fmt=0x104 Address 0x104 out of bounds)
   at /usr/home/imb/svn/head/sys/kern/kern_shutdown.c:637
#3  0xc0af13d1 in trap_fatal (frame=0xc6fb7c14, eva=40)
   at /usr/home/imb/svn/head/sys/i386/i386/trap.c:1022
#4  0xc0af16a8 in trap_pfault (frame=0xc6fb7c14, usermode=0, eva=0)
   at /usr/home/imb/svn/head/sys/i386/i386/trap.c:936
#5  0xc0af29ef in trap (frame=0xc6fb7c14)
   at /usr/home/imb/svn/head/sys/i386/i386/trap.c:546
#6  0xc0adcbdc in calltrap ()
   at /usr/home/imb/svn/head/sys/i386/i386/exception.s:169
#7  0xc070a4bc in g_disk_providergone (pp=0xcb33ab80)
   at /usr/home/imb/svn/head/sys/geom/geom_disk.c:505
#8  0xc070f8ba in g_destroy_provider (pp=0xcb33ab80)
   at /usr/home/imb/svn/head/sys/geom/geom_subr.c:643
#9  0xc070fb6e in g_wither_washer ()
   at /usr/home/imb/svn/head/sys/geom/geom_subr.c:462
#10 0xc070cb62 in g_run_events ()
   at /usr/home/imb/svn/head/sys/geom/geom_event.c:289
#11 0xc077bd8b in fork_exit (callout=0xc070de54 g_event_procbody,
arg=0x0,
   frame=0xc6fb7d08) at /usr/home/imb/svn/head/sys/kern/kern_fork.c:995
#12 0xc0adcc84 in fork_trampoline ()
   at /usr/home/imb/svn/head/sys/i386/i386/exception.s:276
(kgdb)
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Removing an SDHC card causes a kernel panic on -current

2012-06-26 Thread Kenneth D. Merry
On Tue, Jun 26, 2012 at 19:41:07 -0400, Benjamin Kaduk wrote:
 On Tue, 26 Jun 2012, Michael Butler wrote:
 
 As follows, in g_disk_providergone, a NULL pointer reference?:
 
 g_disk_providergone() is new in r237518 (by ken); ken cc'd.

Can you try the attached patch to sys/geom/geom_disk.c?

Also, do you have full dmesg information for when the panic happened?

It looks like disk_destroy() has already been called in this case, and I
suppose that's likely to happen for any of the users of the GEOM disk class
that haven't been updated with the reference count changes I made in da(4).
(i.e. all of the rest of them.)

Let me know whether this works for you.

Thanks,

Ken
-- 
Kenneth Merry
k...@freebsd.org
 //depot/users/kenm/FreeBSD-test2/sys/geom/geom_disk.c#7 - 
/usr/home/kenm/perforce4/kenm/FreeBSD-test2/sys/geom/geom_disk.c 
*** /tmp/tmp.75357.20   Tue Jun 26 20:25:44 2012
--- /usr/home/kenm/perforce4/kenm/FreeBSD-test2/sys/geom/geom_disk.cTue Jun 
26 20:25:29 2012
***
*** 502,507 
--- 502,515 
struct g_disk_softc *sc;
  
sc = (struct g_disk_softc *)pp-geom-softc;
+ 
+   /*
+* If the softc is already NULL, then we've probably been through
+* g_disk_destroy already; there is nothing for us to do anyway.
+*/
+   if (sc == NULL)
+   return;
+ 
dp = sc-dp;
  
if (dp-d_gone != NULL)
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org