From owner-freebsd-current@FreeBSD.ORG Thu Aug 23 15:55:17 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92635106573C for ; Thu, 23 Aug 2012 15:55:07 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id C9A808FC14 for ; Thu, 23 Aug 2012 15:55:06 +0000 (UTC) Received: by lage12 with SMTP id e12so637981lag.13 for ; Thu, 23 Aug 2012 08:55:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=Uc7DEvbaQiAUYekN6MMLqfd68Tvv9MJ0rGLuVRoWS44=; b=c3MjBzX1GsxOTZLivJb1w7fABLX3m152Oy+9IjJUxpwetQMKAkHcUZ69+NIcCTfkLt 7xbb6t0JYnIUqqD96GxHDqOh6+SC1QrHGo1IuorKxGi0KyjpJ5UVmvnJwO4ZG1SHalZD gLbLRiZ7juQcgd9NdNvzLMMjOD4q5gX+OSh03LOBK6a2/+/NbpX8B+fmclxf3lE3e80m 8IsBEcc0ItlpFupWkJeijw+b/Fkp5mpWjv+OQEtvqBHueFPITTlwbxT4R0H7YQjNiJ2S M4uUXkbgK7ZuE7TRzwrxm3M1HSSKZuVmf6iy2aOLcB2lU5cPCRBDe9UBW+XkVbtEJt5d 63BQ== MIME-Version: 1.0 Received: by 10.112.104.3 with SMTP id ga3mr1117751lbb.77.1345737305227; Thu, 23 Aug 2012 08:55:05 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.112.102.39 with HTTP; Thu, 23 Aug 2012 08:55:05 -0700 (PDT) In-Reply-To: <20120823160543.GD3391@onelab2.iet.unipi.it> References: <20120823145420.GB3103@onelab2.iet.unipi.it> <20120823160543.GD3391@onelab2.iet.unipi.it> Date: Thu, 23 Aug 2012 16:55:05 +0100 X-Google-Sender-Auth: X1yG5nDoXfn0Qp-dxZ5fVG24yww Message-ID: From: Attilio Rao To: Luigi Rizzo Content-Type: text/plain; charset=UTF-8 Cc: current@freebsd.org Subject: Re: TUNABLE_INT vs TUNABLE_INT_FETCH X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2012 15:55:17 -0000 On Thu, Aug 23, 2012 at 5:05 PM, Luigi Rizzo wrote: > On Thu, Aug 23, 2012 at 03:52:56PM +0100, Attilio Rao wrote: >> On 8/23/12, Luigi Rizzo wrote: >> > Hi, >> > I am a bit unclear on what are the pros and cons of using >> > TUNABLE_INT vs TUNABLE_INT_FETCH within a device driver. >> >> TUNABLE_INT is basically the "statically initializer" version of >> TUNABLE_INT_FETCH. >> In short terms, you will use TUNABLE_INT_FETCH() in normal functions, >> while TUNABLE_INT() in data declaration. > > The thing is, do we need the data declaration at all ? What do you mean with "data declaration"? We need to mimic a "static initialization" usage, so what we do is to use the first SYSINIT() family available (SI_SUB_TUNABLES). You also need the env to look for and the static variable to initialize, so for SYSINIT's sake you need to pack them up in a single argument. Attilio -- Peace can only be achieved by understanding - A. Einstein