mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: jgarzik@pobox.com, herbert@gondor.apana.org.au, mingo@elte.hu,
	linux-kernel@vger.kernel.org, davem@redhat.com
Subject: Re: [PATCH] 8139too: fix a TX timeout watchdog thread against NAPI softirq race
Date: Tue, 31 Jan 2006 16:55:25 -0800	[thread overview]
Message-ID: <20060131165525.3e741285.akpm@osdl.org> (raw)
In-Reply-To: <20060131002418.GA917@electric-eye.fr.zoreil.com>

Francois Romieu <romieu@fr.zoreil.com> 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

      parent reply	other threads:[~2006-02-01  1:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-26 22:43 [lock validator] drivers/net/8139too.c: deadlock? Ingo Molnar
2006-01-27  0:35 ` Francois Romieu
2006-01-27  2:22   ` Herbert Xu
2006-01-27  2:44     ` Jeff Garzik
2006-01-31  0:24       ` [PATCH] 8139too: fix a TX timeout watchdog thread against NAPI softirq race Francois Romieu
2006-01-31 18:49         ` Ingo Molnar
2006-01-31 18:57           ` Ingo Molnar
2006-02-01  0:55         ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060131165525.3e741285.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=davem@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=romieu@fr.zoreil.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®