Re: Compile-time check for clock_nanosleep()

2017-07-03 Thread Chris Ross

> On Jul 3, 2017, at 14:46, Kurt Jaeger  wrote:
> 
> Use __FreeBSD_version from sys/param.h:
> 
> https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html

  Thanks.  That looks great.  Also, for my specific case of the addition of 
clock_nanosleep(), it looks from time.h like I could use "__POSIX_VISIBLE >= 
200112”.  Maybe that isn’t safe, since later looking at time.h on 11.0 and on 
11.1, the latter has a definition for clock_nanosleep() in that block, but the 
former does not.

  Yeah, digging around it appears that stable/11/sys/sys/param.h at r316498 had 
__FreeBSD_version at 1100512, and it was raised to 1100513 in revision 318197.  
And, clock_nanosleep was MFC’d into 11-stable in-between the two, at revision 
317618.  So, not a precise match there, but >= 1100513 should be safe.

  Thanks!

  - Chris



signature.asc
Description: Message signed with OpenPGP


[Bug 213903] Kernel crashes from turnstile_broadcast (/usr/src/sys/kern/subr_turnstile.c:837)

2017-07-03 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213903

--- Comment #44 from Cassiano Peixoto  ---
(In reply to Mateusz Guzik from comment #43)
Ok patch applied. I'll let you know the results.

Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


[Bug 213903] Kernel crashes from turnstile_broadcast (/usr/src/sys/kern/subr_turnstile.c:837)

2017-07-03 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213903

--- Comment #43 from Mateusz Guzik  ---
Yes, apply the patch to a clean tree. Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


11.1-RC1 kernel panic (zfs recv)

2017-07-03 Thread John Kennedy
I've had a kernel crash with 3 different RC1 kernels.

kernel: FreeBSD 11.1-RC1 #71 r313908+b08656c3ba28(releng/11.1): Sun Jul  2 
23:15:23 PDT 2017
kernel: FreeBSD 11.1-RC1 #72 r313908+64e0abde4c70(releng/11.1): Mon Jul  3 
07:43:42 PDT 2017
kernel: FreeBSD 11.1-RC1 #73 r313908+ff3a058c4f83(releng/11.1): Mon Jul  3 
11:56:29 PDT 2017

# kldstat
Id Refs AddressSize Name
 1   42 0x8020 1f67128  kernel
 21 0x82169000 3161c0   zfs.ko
 32 0x8248 c9e8 opensolaris.ko
 41 0x8248d000 21c68geom_eli.ko
 51 0x824af000 bc68 aesni.ko
 61 0x824bb000 114f58   nvidia-modeset.ko
 73 0x825d ab7f8linux.ko
 83 0x8267c000 ddc0 linux_common.ko
 92 0x8268a000 1056708  nvidia.ko
101 0x83821000 3602 ums.ko
111 0x83825000 3c35clinux64.ko
121 0x83862000 eb0d iscsi.ko

Excuse human-induced typos in stack-trace:

panic: avl_find() succeeded inside avl_add()
cpuid=5
KDB: stack backgrace:
#0 0x80aad9c7 at kdb_backtrace+0x67
#1 0x80a6baa6 at vpanic+0x186
#2 0x80a6b913 at panic+0x43
#3 0x82169df4 at avl_add+0x134
#4 0x821a9bed at dmu_recv_end+0x16d
#5 0x82231e0f at zfs_ioc_recv+0xb1f
#6 0x82233c36 at zfsdev_ioctl+0x6d6
#7 0x8093ad38 at devfs_ioctl_f+0x128
#8 0x80ac9315 at kern_ioctl+0x255
#9 0x80ac904f at sys_ioctl+0x16f
#10 0x80ee0394 at amd64_syscall+0x6c4
#11 0x80ec35cb at Xfast_syscall+0xfb

It is reproducible.  Initially saw it with zfs send | zfs recv (kernel #71),
reproduced outside of X so I could see the panic, installed kernel #72 to be
more current (had it compiled but not installed since I was doing lots of I/O).
Didn't happen with zfs send to file, happened on zfs recv from file, grabbed
#73 since it looked like it might apply since I have a da* via ISCSI, and
can still reproduce the problem.
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


[Bug 213903] Kernel crashes from turnstile_broadcast (/usr/src/sys/kern/subr_turnstile.c:837)

2017-07-03 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213903

--- Comment #42 from Cassiano Peixoto  ---
(In reply to Mateusz Guzik from comment #41)
Ok you are right. I reverted all files touched by previous patch. Am i right?
And then should i apply only this last patch?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Compile-time check for clock_nanosleep()

2017-07-03 Thread Kurt Jaeger
Hi!

>   Some time ago, I ported a linux program that was using clock_nanosleep().
> I see now that the extra code I'd put in isn't needed anymore in 11-stable,
> as it appears this call was added in 11.1.  My question is, to
> properly protect these changes, what is the best way to know at
> compile time, either (a) that that call is in libc, or (b) that
> I'm compiling on FreeBSD 11.1 or later ?

Use __FreeBSD_version from sys/param.h:

https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html

-- 
p...@opsec.eu+49 171 3101372 3 years to go !
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Compile-time check for clock_nanosleep()

2017-07-03 Thread Chris Ross

  Some time ago, I ported a linux program that was using clock_nanosleep().  I 
see now that the extra code I’d put in isn’t needed anymore in 11-stable, as it 
appears this call was added in 11.1.  My question is, to properly protect these 
changes, what is the best way to know at compile time, either (a) that that 
call is in libc, or (b) that I’m compiling on FreeBSD 11.1 or later ?

  Thanks.

   - Chris


signature.asc
Description: Message signed with OpenPGP


[Bug 213903] Kernel crashes from turnstile_broadcast (/usr/src/sys/kern/subr_turnstile.c:837)

2017-07-03 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213903

--- Comment #41 from Mateusz Guzik  ---
This looks like leftovers from the previous patch. Just restore the original
state of the tree and patch that.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


[Bug 213903] Kernel crashes from turnstile_broadcast (/usr/src/sys/kern/subr_turnstile.c:837)

2017-07-03 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213903

--- Comment #40 from Cassiano Peixoto  ---
(In reply to Mateusz Guzik from comment #39)
Mateusz,

I can test it, but my 10-STABLE version has a different code:

/* Release a write lock. */
#define __rw_wunlock(rw, tid, file, line) do {  \
uintptr_t _tid = (uintptr_t)(tid);  \
uintptr_t _v;   \
\
if ((rw)->rw_recurse)   \
(rw)->rw_recurse--; \
else {  \
_v = (rw)->rw_lock; \
if (_v != _tid || !_rw_write_unlock_fetch((rw), &_v))   \
_rw_wunlock_hard((rw), _v, _tid, (file), (line));\
}   \
} while (0)

How shoukd i adapt your patch in this code?

Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"