Re: [PATCH] 8139too: fix a TX timeout watchdog thread against NAPI softirq race

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Francois Romieu <[email protected]> wrote:
>
> +	unsigned int watchdog_fired : 1;
>  	unsigned int default_port : 4;	/* Last dev->if_port value. */
>  	unsigned int have_thread : 1;

Bear in mind that the compiler will put these three fields into the same
word and will use non-atomic RMWs when they are modified.

In this particualr case it's hard to see how an SMP or IRQ race can occur,
but it's a trap.   Which won't show up on x86.


struct x {
	unsigned int a:1;
	unsigned int b:1;
};

void foo(struct x *a)
{
	a->a = 1;
}

void bar(struct x *a)
{
	a->b = 1;
}


On ppc:


foo:
        lwz 0,0(3)
        oris 0,0,0x8000
        stw 0,0(3)
        blr
        .size   foo, .-foo
        .align 2
        .globl bar
        .type   bar, @function
bar:
        lwz 0,0(3)
        oris 0,0,0x4000
        stw 0,0(3)
        blr
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux