Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 04 Apr 2004 15:27:59 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        bde@zeta.org.au
Cc:        nate@root.org
Subject:   Re: cvs commit: src/sys/pci if_ste.c
Message-ID:  <20040404.152759.13025361.imp@bsdimp.com>
In-Reply-To: <20040404134458.C2452@gamplex.bde.org>
References:  <20040401135011.GB378@ip.net.ua> <20040403200844.GA18516@regency.nsu.ru> <20040404134458.C2452@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20040404134458.C2452@gamplex.bde.org>
            Bruce Evans <bde@zeta.org.au> writes:
: Using sysctl in device drivers is bad practice, but fixing this is
: nontrivial.

I'm curious, what makes it bad practice?  Is there a layering
violation?  Is there something else?

I ask because I think that there's support for having both a hw.*
heirarchy to control the global aspects of drivers (which is wide
spread) and dev.* to reflect the dev tree to userland (DES' set of
patches, or similar, have been warmly received on arch@), as well as
provide per-interface tunables and statistics.

: Bugs result from this bad practice even for the new sysctl in if_ste.c:
: - the counter is global but the problem is per-interface.  Sysctls
:   using globals are easy to hack up, but this don't work so well for
:   multiple interfaces.

This is true.

: - accesses to the global counter are not locked.  SE_LOCK() is
:   per-interface.

This is also true.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040404.152759.13025361.imp>