On Wed, 5 Oct 2016 16:09:40 +0300 Andriy Gapon <avg at FreeBSD.org> wrote:> > Seems like this is a clang vs gcc issue as I didn't get warnings here. > Could you please simply add initialization to those variables in aibs_attach_ggrp()? > E.g.: > s_idx = NULL; > so = NULL;I ended up adding s_idx = NULL; so = NULL; name = NULL; to aibs_attach_ggrp(), that made the module compile. Unfortunately, my machines panics as soon as this module is loaded: root at kg-core1# cat /var/crash/info.0 Dump header from device /dev/ada0p3 Architecture: amd64 Architecture Version: 2 Dump Length: 1466040320B (1398 MB) Blocksize: 512 Dumptime: Wed Oct 5 21:48:42 2016 Hostname: kg-core1.kg4.no Magic: FreeBSD Kernel Dump Version String: FreeBSD 9.3-STABLE #3 r304838: Fri Aug 26 12:11:25 CEST 2016 root at kg-core1.kg4.no:/usr/obj/usr/src/sys/GENERIC Panic String: page fault Dump Parity: 1914870814 Bounds: 0 Dump Status: good core.txt.0 attached HTH -- Torfinn Ingolfsen <torfinn.ingolfsen at getmail.no> -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: core.txt.0.txt URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20161005/a646ad77/attachment-0001.txt>
On 05/10/2016 23:28, Torfinn Ingolfsen wrote:> Unfortunately, my machines panics as soon as this module is loaded:Not good...> (kgdb) #0 doadump (textdump=<value optimized out>) at pcpu.h:235 > #1 0xffffffff80900b06 in kern_reboot (howto=260) > at /usr/src/sys/kern/kern_shutdown.c:454 > #2 0xffffffff80901007 in panic (fmt=0x1 <Address 0x1 out of bounds>) > at /usr/src/sys/kern/kern_shutdown.c:642 > #3 0xffffffff80ce6887 in trap_fatal (frame=0xc, eva=<value optimized out>) > at /usr/src/sys/amd64/amd64/trap.c:876 > #4 0xffffffff80ce6bd1 in trap_pfault (frame=0xffffff88b8554380, usermode=0) > at /usr/src/sys/amd64/amd64/trap.c:798 > #5 0xffffffff80ce7199 in trap (frame=0xffffff88b8554380) > at /usr/src/sys/amd64/amd64/trap.c:462 > #6 0xffffffff80cd0081 in calltrap () > at /usr/src/sys/amd64/amd64/exception.S:238 > #7 0xffffffff81bcb078 in aibs_add_sensor () from /boot/kernel/aibs.ko > #8 0xffffffff81bcb4b4 in aibs_attach_sif () from /boot/kernel/aibs.ko > #9 0xffffffff81bcb901 in aibs_attach () from /boot/kernel/aibs.koI see that line numbers are not reported for the module, so it probably lacks debug symbols. But it seems that you compile your kernel with them. Please try to compile the module using make KERNBUILDDIR=/usr/obj/...> #10 0xffffffff8093424c in device_attach (dev=0x0) at device_if.h:180 > #11 0xffffffff8033bd43 in acpi_driver_added (dev=<value optimized out>, > driver=<value optimized out>) at /usr/src/sys/dev/acpica/acpi.c:841 > #12 0xffffffff809323d5 in devclass_driver_added (dc=0xfffffe00093c5900, > driver=0xffffffff81bcbe9c) at bus_if.h:204 > #13 0xffffffff80932f13 in devclass_add_driver (dc=0xfffffe00093c5900, > driver=0xffffffff81bcc140, pass=2147483647, dcp=0xffffffff81bcc1e0) > at /usr/src/sys/kern/subr_bus.c:1086 > #14 0xffffffff808ebef8 in module_register_init (arg=<value optimized out>) > at /usr/src/sys/kern/kern_module.c:123 > #15 0xffffffff808e38ae in linker_load_module (kldname=<value optimized out>, > modname=0xfffffe03ec774000 "aibs", parent=0x0, verinfo=0x0, > lfpp=0xffffff88b8554aa0) at /usr/src/sys/kern/kern_linker.c:233 > #16 0xffffffff808e3fc4 in kern_kldload (td=<value optimized out>, > file=0xfffffe03ec774000 "aibs", fileid=0xffffff88b8554af4) > at /usr/src/sys/kern/kern_linker.c:1038 > #17 0xffffffff808e40d4 in sys_kldload (td=0xfffffe020f434490, > uap=<value optimized out>) at /usr/src/sys/kern/kern_linker.c:1064 > #18 0xffffffff80ce5ffa in amd64_syscall (td=0xfffffe020f434490, traced=0) > at subr_syscall.c:142 > #19 0xffffffff80cd0367 in Xfast_syscall () > at /usr/src/sys/amd64/amd64/exception.S:398 > #20 0x000000080085d10c in ?? () > Previous frame inner to this frame (corrupt stack?) > (kgdb)
On 05/10/2016 23:28, Torfinn Ingolfsen wrote:> On Wed, 5 Oct 2016 16:09:40 +0300 > Andriy Gapon <avg at FreeBSD.org> wrote: > >> >> Seems like this is a clang vs gcc issue as I didn't get warnings here. >> Could you please simply add initialization to those variables in aibs_attach_ggrp()? >> E.g.: >> s_idx = NULL; >> so = NULL; > > I ended up adding > s_idx = NULL; > so = NULL; > name = NULL; > > to aibs_attach_ggrp(), that made the module compile.Okay, thank for letting me know.> Unfortunately, my machines panics as soon as this module is loaded:Not good...> root at kg-core1# cat /var/crash/info.0 > Dump header from device /dev/ada0p3 > Architecture: amd64 > Architecture Version: 2 > Dump Length: 1466040320B (1398 MB) > Blocksize: 512 > Dumptime: Wed Oct 5 21:48:42 2016 > Hostname: kg-core1.kg4.no > Magic: FreeBSD Kernel Dump > Version String: FreeBSD 9.3-STABLE #3 r304838: Fri Aug 26 12:11:25 CEST 2016 > root at kg-core1.kg4.no:/usr/obj/usr/src/sys/GENERIC > Panic String: page fault > Dump Parity: 1914870814 > Bounds: 0 > Dump Status: good > > core.txt.0 attached > HTHSeems like the module got built without debug symbols. Please try make KERNBUILDDIR=/usr/obj/... -- Andriy Gapon
On 05/10/2016 23:28, Torfinn Ingolfsen wrote:> #6 0xffffffff80cd0081 in calltrap () > at /usr/src/sys/amd64/amd64/exception.S:238 > #7 0xffffffff81bcb078 in aibs_add_sensor () from /boot/kernel/aibs.ko > #8 0xffffffff81bcb4b4 in aibs_attach_sif () from /boot/kernel/aibs.koArgh, I've just spotted a very silly typo. Could you please replace '0' with 'o' in err = aibs_add_sensor(sc, 0, &as[i], &descr); ? I wish compilers were more noisy about passing a scalar as a pointer argument. Thanks! -- Andriy Gapon