Why isn't this a bug in run_bottom_halves() (2.2.5)?

Scott Maxwell (s-max@pacbell.net)
Sun, 06 Jun 1999 14:05:18 -0700


(I'm not subscribed to the list, so CC me on replies if you want, but
I plan to follow the discussion using DejaNews either way. Thanks.)

Looking at the 2.2.5 kernel, I saw what seems to be a bug in
run_bottom_halves(). The big fat comment describes my thinking:

static inline void run_bottom_halves(void)
{
unsigned long active;
void (**bh)(void);

active = get_active_bhs();
/*
* Interrupts are enabled here. So suppose an interrupt occurs when
* we're right here and its top half marks a previously unmarked
* bottom half. do_IRQ() won't execute run_bottom_halves() after
* servicing the new interrupt's top half because we already have the
* lock for run_bottom_halves(), but when we return to this point, we
* zero bh_active in the next line, so the newly marked BH never gets
* run. I know we don't promise to service BHs right away (that's the
* point), but we shouldn't overlook them entirely, right?
*/
clear_active_bhs(active);
bh = bh_base;
do {
if (active & 1)
(*bh)();
bh++;
active >>= 1;
} while (active);
}

This looks like it would be a really obvious bug, so I'd think it
would have been fixed long ago if there really were a bug here. On
the other hand, I don't understand where my analysis went wrong. Any
insight?

-- 
-------------------------+--------------------------------------------
R H L U  Scott Maxwell:  | ``Life results from the non-random survival
E A I X      s-max@      |   of randomly varying replicators.''
D T N 5    pacbell.net   |     -- Richard Dawkins

- 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/