Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Mar 2001 23:51:56 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        mjacob@feral.com
Cc:        tlambert@primenet.com (Terry Lambert), jhb@FreeBSD.ORG (John Baldwin), arch@FreeBSD.ORG
Subject:   Re: man pages
Message-ID:  <200103162351.QAA19187@usr07.primenet.com>
In-Reply-To: <Pine.LNX.4.21.0103161525550.773-100000@zeppo.feral.com> from "Matthew Jacob" at Mar 16, 2001 03:33:24 PM

next in thread | previous in thread | raw e-mail | index | archive | help
> > Rather than doing this, wouldn't it just be easier to say that it
> > can not be uses for inter-CPU synchronization, but may result in
> > inter-CPU synchronization as a side effect on some architectures?
> 
> I wouldn't even go that far.

[ ... ]

> Let's assume we have a broadcast interrupt platform, but disable_intr only
> disables interrupt recognition for the calling CPU. One might say it's a
> useless function- I'd say not. You *still* use locks to keep threads on other
> cpus out of critical regions- but you may have wanted to make sure you
> wouldn't be getting any ithreads pending on the *calling* cpu- I'm sure jhb
> can think of a number of cases this would help.

Sounds like you want something like these:

	intr_disable_this_cpu()
	ithread_diable_this_cpu()
	...

It seems to me that the function ou are documenting is machine
specific, and should be named for the architecture/CPU/etc. to
which it applies.


> > Given that it's going to be used, and it's vaue, you might even
> > go so far as to claim "as an undesirable side effect"...
> 
> In order to address some other folks' expressed concerns that this might be
> 'useless', some very careful wording has to occur. I don't think we want to
> say anything at all about using this as a synchronization mechanism, unless to
> say "Do *not* consider this to be a method for synchronization"

I'd even say:

	Do *not* consider this to be a method for synchronization
	Do *not* invert inter-cpu lock ordering after calling this
		function, as it may result in a starvation deadlock

Personally, I thinkit's useless to name a function after something
which it does, rather than naming it after something which you want
it to do.  The distinction is subtle, I grant you, but people will
be wanting to use it for what it does _in order to get a resulting
desirable effect_.  If it isn't cross-platform, it isn't cross
platform.

I don't think it's reasonable to require an English degree or a
Juris Doctorate or both to be able to tell why you would want to
call a function with a name that seems to imply an incorrect
usage might be reasonable and safely used cross-platform.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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