Re: [patch] shaper fix for timer SMP races

Regis Duchesne (regis@via.ecp.fr)
Wed, 17 Feb 1999 15:21:50 +0100 (CET)


Andrea Arcangeli <andrea@e-mind.com> wrote:
>I developed a new patch that I sent to Alex now for testing.
> --- shaper.c 1999/01/18 01:28:09 1.1.1.1
> +++ linux/drivers/net/shaper.c 1999/02/16 13:25:36
> [...]
> @@ -405,7 +394,9 @@
> {
> struct shaper *shaper=dev->priv;
> shaper_flush(shaper);
> + start_bh_atomic();
> del_timer(&shaper->timer);
> + end_bh_atomic();
> MOD_DEC_USE_COUNT;
> return 0;
> }

Isn't that part of the patch overkill?

As I understand things, del_timer() must acquire the timerlist_lock
spinlock to modify the timer list. I guess that all other code
(including the code in bottom half handlers) that want to modify the
timer list do the same.

So why do we need to use [start|end]_bh_atomic() to guarantee that no
BH on any CPU will execute while we modify the timer list?

Best regards,

-- 
Regis "HPReg" Duchesne - InfoVista US technical support
        www              http://www.InfoVista.com/
       (O o)             I use Linux (1135 KB/s over 10Mb/s ethernet)
--.oOO--(_)--OOo.----------------------------------------------------
If cryptography is outlawed, only outlaws will have cryptography

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