strange buildworld failure
Hi, I am trying to buildworld but it fails here: === usr.bin/ypwhich (all) cc -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized - Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno- unused-function -Wno-conversion -Wno-switch -Wno-switch-enum -c /usr/src/usr.bin/ypwhich/ypwhich.c gzip -cn /usr/src/usr.bin/ypwhich/ypwhich.1 ypwhich.1.gz cc -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized - Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno- unused-function -Wno-conversion -Wno-switch -Wno-switch-enum -o ypwhich ypwhich.o 1 error *** [everything] Error code 2 1 error *** [buildworld] Error code 2 1 error My make.conf has these: WITHOUT_X11=1 MALLOC_PRODUCTION=1 NO_CLEAN=1 Also, my src.conf had WITHOUT_CLANG but I deleted it and then I also deleted /usr/obj when it failed for the first time. But that didn't work. I am building with -j3. Thanks for any ideas/pointers, Nikos ___ 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: strange buildworld failure
On 23 November 2012 12:34, Nikos Vassiliadis nv...@gmx.com wrote: Hi, I am trying to buildworld but it fails here: === usr.bin/ypwhich (all) cc -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized - Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno- unused-function -Wno-conversion -Wno-switch -Wno-switch-enum -c /usr/src/usr.bin/ypwhich/ypwhich.c gzip -cn /usr/src/usr.bin/ypwhich/ypwhich.1 ypwhich.1.gz cc -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized - Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno- unused-function -Wno-conversion -Wno-switch -Wno-switch-enum -o ypwhich ypwhich.o 1 error *** [everything] Error code 2 1 error *** [buildworld] Error code 2 1 error My make.conf has these: WITHOUT_X11=1 MALLOC_PRODUCTION=1 NO_CLEAN=1 Also, my src.conf had WITHOUT_CLANG but I deleted it and then I also deleted /usr/obj when it failed for the first time. But that didn't work. I am building with -j3. Does it always fail there at usr.bin/ypwhich? It's likely that -j3 is the culprit of why you do not see the actual build error because it might be lost off the screen. Try to restart without -jN. -- wbr, pluknet ___ 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: after upgrade, can't restart apache via cron
On Thu, Nov 22, 2012 at 10:17:54PM -0500, Michael W. Lucas wrote: FreeBSD bewilderbeast.blackhelicopters.org 10.0-CURRENT FreeBSD 10.0-CURRENT #15: Thu Nov 8 14:02:45 EST 2012 mwlu...@bewilderbeast.blackhelicopters.org:/usr/obj/usr/src/sys/GENERIC amd64 I can manually restart apache22 with the following /etc/rc.conf entries: apache22_enable=YES apache22_fib=0 I have a cron entry that restarts apache regularly, to compensate for some mysql daftness. 13 * * * * /usr/local/etc/rc.d/apache22 restart When this job runs, I get the following email: [..] eval: setfib: not found [..] If I run /usr/local/etc/rc.d/apache22 restart from the command line, I can restart httpd without trouble. As others pointers out already it is a PATH issue, but I don't think that restoring /usr/sbin in PATH is the answer here. You should be using service(8) script since it does The Right Thing(tm). Apache will be started in more-or-less same environment that was used during boot time. (My personal opinion is that startup scripts should prepare such environment on their own unless explicitly told otherwise, and by environment I mean more that 'environment' variables.) If this is a bug or not I cannot say. /etc/rc.subr contains lines like: SYSCTL=/sbin/sysctl ID=/usr/bin/id for few tools, rest is assumed to work with provided PATH. To sum up, use service(8) and you will be fine. -- Mateusz Guzik mjguzik gmail.com ___ 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: after upgrade, can't restart apache via cron
Michael W. Lucas mwlu...@michaelwlucas.com wrote in 20121123031753.ga59...@bewilderbeast.blackhelicopters.org: mw eval: setfib: not found mw /usr/local/etc/rc.d/apache22: WARNING: failed to start apache22 mw mw If I run /usr/local/etc/rc.d/apache22 restart from the command line, I mw can restart httpd without trouble. mw mw Any thoughts? This was due to $PATH in the cron job as already pointed out, but this should not happen. I attached a patch to use full-path for external commands in rc.subr. If there is no objection to this change I will commit it. -- Hiroki Index: etc/rc.subr === --- etc/rc.subr (revision 243327) +++ etc/rc.subr (working copy) @@ -49,6 +49,18 @@ IDCMD=if [ -x $ID ]; then $ID -un; fi PS=/bin/ps -ww JID=`$PS -p $$ -o jid=` +CHROOT_CMD=/usr/sbin/chroot +DEVFS_CMD=/sbin/devfs +EGREP_CMD=/usr/bin/egrep +GREP_CMD=/usr/bin/grep +KLDSTAT_CMD=/sbin/kldstat +KLDLOAD_CMD=/sbin/kldload +LOGGER_CMD=/usr/bin/logger +MDMFS_CMD=/sbin/mdmfs +MOUNT_CMD=/sbin/mount +NICE_CMD=/usr/bin/nice +SETFIB_CMD=/usr/sbin/setfib +SU_CMD=/usr/bin/su # # functions @@ -181,7 +193,7 @@ if $_ismounted; then : else -mount $_fs /dev/null 21 +${MOUNT_CMD} $_fs /dev/null 21 fi ) done @@ -726,17 +738,17 @@ check_startmsgs echo Starting ${name}. if [ -n $_chroot ]; then _doit=\ -${_nice:+nice -n $_nice }\ -${_fib:+setfib -F $_fib }\ -chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ +${_nice:+${NICE_CMD} -n $_nice }\ +${_fib:+${SETFIB_CMD} -F $_fib }\ +${CHROOT_CMD} ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ $_chroot $command $rc_flags $command_args else _doit=\ ${_chdir:+cd $_chdir }\ -${_fib:+setfib -F $_fib }\ +${_fib:+${SETFIB_CMD} -F $_fib }\ $command $rc_flags $command_args if [ -n $_user ]; then -_doit=su -m $_user -c 'sh -c \$_doit\' +_doit=${SU_CMD} -m $_user -c 'sh -c \$_doit\' fi if [ -n $_nice ]; then if [ -z $_user ]; then @@ -953,7 +965,7 @@ _cmd=kill -$1 $rc_pid if [ -n $_user ]; then - _cmd=su -m ${_user} -c 'sh -c \${_cmd}\' + _cmd=${SU_CMD} -m ${_user} -c 'sh -c \${_cmd}\' fi echo $_cmd } @@ -1110,8 +1122,8 @@ exitval=$1 shift - if [ -x /usr/bin/logger ]; then - logger $0: ERROR: $* + if [ -x ${LOGGER_CMD} ]; then + ${LOGGER_CMD} $0: ERROR: $* fi echo 12 $0: ERROR: $* exit $exitval @@ -1123,8 +1135,8 @@ # warn() { - if [ -x /usr/bin/logger ]; then - logger $0: WARNING: $* + if [ -x ${LOGGER_CMD} ]; then + ${LOGGER_CMD} $0: WARNING: $* fi echo 12 $0: WARNING: $* } @@ -1137,8 +1149,8 @@ { case ${rc_info} in [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) - if [ -x /usr/bin/logger ]; then - logger $0: INFO: $* + if [ -x ${LOGGER_CMD} ]; then + ${LOGGER_CMD} $0: INFO: $* fi echo $0: INFO: $* ;; @@ -1155,8 +1167,8 @@ { case ${rc_debug} in [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) - if [ -x /usr/bin/logger ]; then - logger $0: DEBUG: $* + if [ -x ${LOGGER_CMD} ]; then + ${LOGGER_CMD} $0: DEBUG: $* fi echo 12 $0: DEBUG: $* ;; @@ -1320,7 +1332,7 @@ fi eval $rulename=\$rulenum debug found ruleset: $rulename=$rulenum - if ! /sbin/devfs rule -s $rulenum delset; then + if ! ${DEVFS_CMD} rule -s $rulenum delset; then _err=1 break fi @@ -1331,7 +1343,7 @@ # other rules if [ -n $rulecmd ]; then debug adding rule ($rulecmd) -if ! eval /sbin/devfs rule -s $rulenum $rulecmd +if ! eval ${DEVFS_CMD} rule -s $rulenum $rulecmd then _err=1 break @@ -1389,7 +1401,7 @@ return 1 fi debug $_me: setting ruleset ($rs) on mount-point (${devdir#-m }) - if ! /sbin/devfs $devdir ruleset $rs; then + if ! ${DEVFS_CMD} $devdir ruleset $rs; then warn $_me: unable to set ruleset $rs to ${devdir#-m } return 1 fi @@ -1414,7 +1426,7 @@ return 1 fi debug $_me: applying ruleset ($rs) to mount-point (${devdir#-m }) - if ! /sbin/devfs $devdir rule -s $rs applyset; then + if ! ${DEVFS_CMD} $devdir rule -s $rs applyset; then warn $_me: unable to apply ruleset $rs to ${devdir#-m } return 1 fi @@ -1438,14 +1450,14 @@ return 1 fi debug $_me: mount-point is ($devdir), ruleset is ($rs) - if ! mount -t devfs dev $devdir; then + if ! ${MOUNT_CMD} -t devfs dev $devdir; then warn $_me: Unable to mount devfs on $devdir return 1 fi if [ -n $rs ]; then devfs_init_rulesets devfs_set_ruleset $rs $devdir - devfs -m $devdir rule applyset + ${DEVFS_CMD} -m $devdir rule applyset fi return 0 } @@ -1483,7 +1495,7 @@ if [ -n $3 ]; then flags=$3 fi - /sbin/mdmfs $flags -s $1 md $2 + ${MDMFS_CMD} $flags -s $1 md $2 } # Code common to scripts that need to load a kernel module @@ -1512,16 +1524,16 @@ _mod=${_mod:-$1} _loaded=false if [ -n $_re ]; then - if kldstat -v | egrep -q -e $_re; then + if ${KLDSTAT_CMD} -v | ${EGREP_CMD} -q -e $_re; then
Re: after upgrade, can't restart apache via cron
On Thu, Nov 22, 2012 at 09:33:34PM -0600, Adam Vande More wrote: I would guess you need*/usr/sbin/ in cron's path. Thanks everyone. The real problem here was, I didn't know setfib was a command... ==ml -- Michael W. Lucas http://www.MichaelWLucas.com/, http://blather.MichaelWLucas.com/ Latest book: SSH Mastery http://www.michaelwlucas.com/nonfiction/ssh-mastery mwlu...@michaelwlucas.com, Twitter @mwlauthor ___ 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: prompt w/ uid 0 for cshrc
On Nov 19, 2012, at 8:46 AM, jb wrote: Eitan Adler lists at eitanadler.com writes: On 18 November 2012 18:44, Mateusz Guzik mjguzik at gmail.com wrote: Just take user name from id -nu. While that does provide the $user value I want, id is in /usr/bin/ which may not be mounted. /rescue/id Bad idea: * /rescue tools are not part of the standard world * /rescue tools are sometimes not installed * Quite a few people have customized the rescue tools to adding or omitting things suitable for their particular installation. * /rescue tools are not guaranteed to be functionally identical to the non-rescue versions. Better to invoke 'id' in a way that produces reasonable results if 'id' is unavailable. For example: /bin/sh -c 'id -nu 2/dev/null' || echo '?' prints '?' if the id command fails or is unavailable. Tim ___ 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: strange buildworld failure
On 11/23/2012 1:34 PM, Sergey Kandaurov wrote: Also, my src.conf had WITHOUT_CLANG but I deleted it and then I also deleted /usr/obj when it failed for the first time. But that didn't work. I am building with -j3. Does it always fail there at usr.bin/ypwhich? It's likely that -j3 is the culprit of why you do not see the actual build error because it might be lost off the screen. Try to restart without -jN. Thanks, that worked. Nikos ___ 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: ath0: unable to attach hardware
Hello everyone, since this problem hasn't got any attention in the last 14 days, I decided to file a bug report, so that this issue doesn't sink into oblivion: http://www.freebsd.org/cgi/query-pr.cgi?pr=173883 I'm still very glad for any attempt to help, and willing to provide more information and/or test things if you provide some guidance. Thanks! On Samstag, 10. November 2012 at 2:39 PM, hu...@hush.com wrote: Hello everyone, I took both the i386 and amd64 November snapshots of 10.0-CURRENT from https://snapshots.glenbarber.us/Latest/, and when the bootloader on the DVD appeared, I selected the verbose boot option, waited for the installer to come up, dropped to a shell and issued dmesg, the output of which I piped to two files which hopefully are attached to this e-mail. In case they are stripped from the mailing list, I've posted their contents to a nopaste: http://nopaste.info/a445c43d6a.html for amd64 http://nopaste.info/bac000949c.html for i386 I hope this is the information you were asking for. Please let me know if I can do anything else. Thank you very much. On Samstag, 10. November 2012 at 7:49 AM, Adrian Chadd adr...@freebsd.org wrote: Hi, I'm CC'ing jhb@ (who is likely busy after Hurricane Sandy..) who spends time in the PCI bridge code. That looks correct (ie, the BAR(0) entry matches your dmesg entry.) The 0x register response however means that it isn't mapped into that particular region correctly. An asleep NIC will return 0xdeadbeef, 0xdeadc0de, etc. It doesn't return 0x for registers (well, except for AR_ISR, but that isn't being probed at this point.) Did you post a boot -v to -current, showing what all the PCI bridges are? I'd like to ensure that they're all setup right. Unfortunately I don't have time to try and figure out what's going on with the PCI bridge and resource allocation side of things. John - I think this is a PCI-PCI bridge resource allocation / setup problem. The BAR(0) for the NIC matches what the probe/attach line for ath0 says. but the register value of 0x to me indicates the NIC isn't mapped into that space correctly. The internal PCI glue in the NIC will return 0xdeadbeef, 0xdeadc0de, etc as register contents if the device is asleep and hasn't been woken up or reset correctly. It won't return 0x. I would really appreciate any help you or others can provide on this. Thanks, Adrian On 9 November 2012 15:25, hu...@hush.com wrote: Hello, thank you for your reply. I've entered the following pciconf -r ath0@pci0:2:4:0 0:255 and received this output: 001b168c 02900406 0201 2008 fdee 5001 500111ad 0044 1c0a0110 01c20001 c6004000 I hope this helps you out. If not, please let me know what else I can do. Thanks! On Freitag, 9. November 2012 at 5:45 PM, Adrian Chadd adr...@freebsd.org wrote: Can you use pciconf to dump the config space? I think its pciconf -r ath pci device string 0:255 thanks! adrian On 9 November 2012 01:57, hu...@hush.com wrote: Hello again, the mail I'm replying to (and which is cited below) hasn't caused a reaction yet. Seeing that this mailing list has quite a lot of traffic, I'm worried that the mail, and the issue it tries to point out, will be forgotten. Should I file a bug report in hopes that the issue will somewhen be investigated/resolved? Again, I'm offering any kind of help I'm able to provide, i.e. delivering more information upon (hopefully detailed enough for me to understand) request, testing proposed fixes and doing some progamming on my own; for the latter, please keep in mind that I have no experience with the FreeBSD codebase or hardware programming. Thanks! On Samstag, 3. November 2012 at 11:43 AM, hu...@hush.com wrote: Hello everyone, I'm new to FreeBSD and wanted to install 9.0-RELEASE amd64 on a PC I was given. At first glance, it seems like everything is working, except the wireless LAN PCI card. I started a thread on freebsd-wireless on the 31st of October (see here: http://lists.freebsd.org/pipermail/freebsd- wireless/2012- October/002511.html or a repost of my original message with proper formatting: http://lists.freebsd.org/pipermail/freebsd- wireless/2012-October/002513.html ) Short summary: The card has the strings Anatel, WN5301A-H1-V02 and KN160562*7 printed on it, although I'm not sure which, if any, of those is a proper product number. After setting hw.ath.debug=1 hw.ath.hal.debug=1 I receive
pkg - Shared object libarchive.so.5 not found, required by pkg
I just upgraded a machine from 9.1-RC3 to 10-CURRENT. pkg was installed on 9.1, but after an upgrade to 10-CURRENT pkg no longer runs due to missing shared library. 10-CURRENT was built (and installed) twice. I guess the library was installed when I was at 9.1-RC3 but was deleted during make delete-old. Rebuilding pkg from src/usr.sbin/pkg did not do the trick. For some reason it was still linking to the old library. Any hints? -- chs, ___ 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: ath0: unable to attach hardware
Thanks for this! I'm sorry it hasn't gotten any more attention. I've cc'ed john because he understands the PCI-PCI resource allocation stuff and I currently don't; I'm hoping he can stare at this and see what's going on. But yes, if it were an ath(4) problem, the NIC would be returning 0xdeadbeef, 0xdeadc0de, etc. It wouldn't return 0x - that happens when there's nothing mapped at that address. The PCI config space that you've provided shows BAR(0) is programmed correctly.. adrian On 23 November 2012 13:35, hu...@hush.com wrote: Hello everyone, since this problem hasn't got any attention in the last 14 days, I decided to file a bug report, so that this issue doesn't sink into oblivion: http://www.freebsd.org/cgi/query-pr.cgi?pr=173883 I'm still very glad for any attempt to help, and willing to provide more information and/or test things if you provide some guidance. Thanks! On Samstag, 10. November 2012 at 2:39 PM, hu...@hush.com wrote: Hello everyone, I took both the i386 and amd64 November snapshots of 10.0-CURRENT from https://snapshots.glenbarber.us/Latest/, and when the bootloader on the DVD appeared, I selected the verbose boot option, waited for the installer to come up, dropped to a shell and issued dmesg, the output of which I piped to two files which hopefully are attached to this e-mail. In case they are stripped from the mailing list, I've posted their contents to a nopaste: http://nopaste.info/a445c43d6a.html for amd64 http://nopaste.info/bac000949c.html for i386 I hope this is the information you were asking for. Please let me know if I can do anything else. Thank you very much. On Samstag, 10. November 2012 at 7:49 AM, Adrian Chadd adr...@freebsd.org wrote: Hi, I'm CC'ing jhb@ (who is likely busy after Hurricane Sandy..) who spends time in the PCI bridge code. That looks correct (ie, the BAR(0) entry matches your dmesg entry.) The 0x register response however means that it isn't mapped into that particular region correctly. An asleep NIC will return 0xdeadbeef, 0xdeadc0de, etc. It doesn't return 0x for registers (well, except for AR_ISR, but that isn't being probed at this point.) Did you post a boot -v to -current, showing what all the PCI bridges are? I'd like to ensure that they're all setup right. Unfortunately I don't have time to try and figure out what's going on with the PCI bridge and resource allocation side of things. John - I think this is a PCI-PCI bridge resource allocation / setup problem. The BAR(0) for the NIC matches what the probe/attach line for ath0 says. but the register value of 0x to me indicates the NIC isn't mapped into that space correctly. The internal PCI glue in the NIC will return 0xdeadbeef, 0xdeadc0de, etc as register contents if the device is asleep and hasn't been woken up or reset correctly. It won't return 0x. I would really appreciate any help you or others can provide on this. Thanks, Adrian On 9 November 2012 15:25, hu...@hush.com wrote: Hello, thank you for your reply. I've entered the following pciconf -r ath0@pci0:2:4:0 0:255 and received this output: 001b168c 02900406 0201 2008 fdee 5001 500111ad 0044 1c0a0110 01c20001 c6004000 I hope this helps you out. If not, please let me know what else I can do. Thanks! On Freitag, 9. November 2012 at 5:45 PM, Adrian Chadd adr...@freebsd.org wrote: Can you use pciconf to dump the config space? I think its pciconf -r ath pci device string 0:255 thanks! adrian On 9 November 2012 01:57, hu...@hush.com wrote: Hello again, the mail I'm replying to (and which is cited below) hasn't caused a reaction yet. Seeing that this mailing list has quite a lot of traffic, I'm worried that the mail, and the issue it tries to point out, will be forgotten. Should I file a bug report in hopes that the issue will somewhen be investigated/resolved? Again, I'm offering any kind of help I'm able to provide, i.e. delivering more information upon (hopefully detailed enough for me to understand) request, testing proposed fixes and doing some progamming on my own; for the latter, please keep in mind that I have no experience with the FreeBSD codebase or hardware programming. Thanks! On Samstag, 3. November 2012 at 11:43 AM, hu...@hush.com wrote: Hello everyone, I'm new to FreeBSD and wanted to install 9.0-RELEASE amd64 on a PC I was given. At first glance, it seems like everything is working, except the wireless LAN PCI
Re: pkg - Shared object libarchive.so.5 not found, required by pkg
On Nov 23, 2012, at 2:13 PM, Christer Solskogen wrote: 10-CURRENT was built (and installed) twice. I guess the library was installed when I was at 9.1-RC3 but was deleted during make delete-old. delete-old should not have deleted any libraries. I think you must have also done delete-old-libs. That often requires you to reinstall all your ports as well. Rebuilding pkg from src/usr.sbin/pkg did not do the trick. For some reason it was still linking to the old library. Any hints? /usr/sbin/pkg mostly just runs /usr/local/sbin/pkg You need to reinstall the pkg port as well. Tim ___ 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: strange buildworld failure
On Fri, 23 Nov 2012, Nikos Vassiliadis wrote: On 11/23/2012 1:34 PM, Sergey Kandaurov wrote: Also, my src.conf had WITHOUT_CLANG but I deleted it and then I also deleted /usr/obj when it failed for the first time. But that didn't work. I am building with -j3. Does it always fail there at usr.bin/ypwhich? It's likely that -j3 is the culprit of why you do not see the actual build error because it might be lost off the screen. Try to restart without -jN. Thanks, that worked. Hmm, buildworld is supposed to be parallel-make-safe. Perhaps a full log of the failing buildworld (e.g., with script(1)) could be posted for analysis? -Ben Kaduk ___ 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
Spurious witness warning when destroying spin mtx
Today I saw a spurious witness warning for acquiring duplicate lock of same type. The root cause is that when running mtx_destroy on a spinlock that is held by the current thread, mtx_destroy calls spinlock_exit() before calling WITNESS_UNLOCK, which opens up a window in which the CPU can be interrupted and attempt to acquire another spinlock of the same type as the one being destroyed. This patch should fix it: diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index 2f13863..96f43f8 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -918,16 +918,16 @@ _mtx_destroy(volatile uintptr_t *c) else { MPASS((m-mtx_lock (MTX_RECURSED|MTX_CONTESTED)) == 0); + lock_profile_release_lock(m-lock_object); + /* Tell witness this isn't locked to make it happy. */ + WITNESS_UNLOCK(m-lock_object, LOP_EXCLUSIVE, __FILE__, + __LINE__); + /* Perform the non-mtx related part of mtx_unlock_spin(). */ if (LOCK_CLASS(m-lock_object) == lock_class_mtx_spin) spinlock_exit(); else curthread-td_locks--; - - lock_profile_release_lock(m-lock_object); - /* Tell witness this isn't locked to make it happy. */ - WITNESS_UNLOCK(m-lock_object, LOP_EXCLUSIVE, __FILE__, - __LINE__); } m-mtx_lock = MTX_DESTROYED ___ 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