Re: [patch] race-fix for bottom-half-functions

Colin Plumb (colin@nyx.net)
Fri, 15 Jan 1999 10:13:23 -0700 (MST)


> I dont see why you need locks at all
>
>
> enable_bh
> load pointer
> mb_w()
> set flag
>
> disable_bh
> load pointer to a null func ie foofunc(){}
> clear flag
> mb_w()
> clear pointer (optional)
>
> running a bh
>
> load pointer
> mb_r()
> test flag
> if true call pointer
>
> No locks needed.

Problem #1 - you just moved the race to enable_bh.
(You also might not want to use "load" so confusingly.)

Problem #2 - You need to lock down the code and data used by the
function call while the call is in progress. It would be just peachy
if, after the disable_bh call, the module memory got freed while a
bottom half was running in it.

Since this is not a heavily contended lock, it makes sense to lock
around all bottom-half processing rather than each handler separately.
That's why I was assuming that the locking I saw there was doing the
right thing.

-- 
	-Colin

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/