panic: negative refcount 0xfffffe0007f1b4d4

Arnaud Lacombe lacombar at gmail.com
Wed Jul 18 17:24:34 UTC 2012


Hi,

On Wed, Jul 18, 2012 at 2:56 AM, Andrey Zonov <andrey at zonov.org> wrote:
> Index: sys/sys/refcount.h
> ===================================================================
> --- sys/sys/refcount.h  (revision 234600)
> +++ sys/sys/refcount.h  (working copy)
> @@ -51,6 +51,7 @@ static __inline void
>  refcount_acquire(volatile u_int *count)
>  {
>
> +       KASSERT(*count < 0xffffff00, ("refcount %p is overflowed", count));
>         atomic_add_acq_int(count, 1);
>  }
>
>
> It will give better diagnostic when refcount is overflowed, instead of
> "negative refcount".
>
this is completely bogus. Why arbitrarily use 0xffffff00, why not
0xdeadbeef or 0xbabeb00b ? 0xfffffffe is a perfectly valid reference
count value. The only logical assertion would be to check if the
increment is to trigger an overflow of the underlying type used to
store the reference count value. That is (*count < 0xffffffff).
Moreover, advertising the current value of the counter in the panic
message is absolutely useless...

 - Arnaud


More information about the freebsd-net mailing list