From owner-freebsd-net@FreeBSD.ORG Wed Jul 18 17:24:34 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B22BF106566C for ; Wed, 18 Jul 2012 17:24:34 +0000 (UTC) (envelope-from lacombar@gmail.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 3D6E78FC08 for ; Wed, 18 Jul 2012 17:24:34 +0000 (UTC) Received: by wgbds11 with SMTP id ds11so1570996wgb.31 for ; Wed, 18 Jul 2012 10:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=BSNTrszUKQ2VvXtt2cAfEZkPjJMEuv+TXF3jN6dg5Qg=; b=i0gyuX0UHAm4RQmWIM1AtXAIcecNaqHxqaRXzOykp1q48ZO9WxkY2L79Gcw1ZiLTP3 Hns7D3NHLU0/BfX0mq2h2aILTu1KFez1i3LpnWuvo9f5vEJ90Ka244Qpwqojh0O2HWtW Ptpeh2Ccrs4US6EiFBcn8IMDdZKuxXhRNWvo0zyAK/N7av1faJuGEZtZK32tj5/v5VHW JkGRINP3LKESUwXi7G3MejHCMPhg5TxdkSuh8xE/zmaqIRj9AosKYgrbDkMZvq6xabmh bWk37JgmImuSyvP3u23OL4d2RBINSffWucjTfXEcX60PXPCFBdszjkCFmTWmLo2lHcrw 4Gfg== MIME-Version: 1.0 Received: by 10.216.133.200 with SMTP id q50mr78235wei.166.1342632273156; Wed, 18 Jul 2012 10:24:33 -0700 (PDT) Received: by 10.216.79.81 with HTTP; Wed, 18 Jul 2012 10:24:33 -0700 (PDT) In-Reply-To: <50065E0E.50903@zonov.org> References: <5003EDC4.3050100@zonov.org> <50048A34.10304@zonov.org> <50065E0E.50903@zonov.org> Date: Wed, 18 Jul 2012 13:24:33 -0400 Message-ID: From: Arnaud Lacombe To: Andrey Zonov Content-Type: text/plain; charset=ISO-8859-1 Cc: "freebsd-net@freebsd.org" Subject: Re: panic: negative refcount 0xfffffe0007f1b4d4 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 17:24:34 -0000 Hi, On Wed, Jul 18, 2012 at 2:56 AM, Andrey Zonov 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