Date: Wed, 18 Jul 2012 13:24:33 -0400 From: Arnaud Lacombe <lacombar@gmail.com> To: Andrey Zonov <andrey@zonov.org> Cc: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org> Subject: Re: panic: negative refcount 0xfffffe0007f1b4d4 Message-ID: <CACqU3MW%2BmBhs_Jn%2B10JzNWKF76LDQ6bD5oXOfySCivQO6r-6Cg@mail.gmail.com> In-Reply-To: <50065E0E.50903@zonov.org> References: <5003EDC4.3050100@zonov.org> <50048A34.10304@zonov.org> <50065E0E.50903@zonov.org>
index | next in thread | previous in thread | raw e-mail
Hi,
On Wed, Jul 18, 2012 at 2:56 AM, Andrey Zonov <andrey@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
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACqU3MW%2BmBhs_Jn%2B10JzNWKF76LDQ6bD5oXOfySCivQO6r-6Cg>
