netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@redhat.com>
To: george@mvista.com
Cc: niv@us.ibm.com, kuznet@ms2.inr.ac.ru, ak@suse.de,
	netdev@oss.sgi.com, linux-net@vger.kernel.org, ak@muc.de,
	pekkas@netcore.fi
Subject: Re: System crash in tcp_fragment()
Date: Mon, 20 May 2002 23:00:21 -0700 (PDT)	[thread overview]
Message-ID: <accom8$9i4$2@main.gmane.org> (raw)
In-Reply-To: <3CE9E466.AC2358EE@mvista.com>

   From: george anzinger <george@mvista.com>
   Date: Mon, 20 May 2002 23:08:38 -0700

   Nivedita Singhvi wrote:
   > 
   > On Mon, 20 May 2002, David S. Miller wrote:
   > 
   > > Such rule does not even make this piece of code legal.  Consider:
   > >
   > > task1:cpu0:   x = counters[smp_processor_id()];
   > >       cpu0:   PREEMPT
   > > task2:cpu0:   x = counters[smp_processor_id()];
   > > task2:cpu0:   counters[smp_processor_id()] = x + 1;
   > >       cpu0:   PREEMPT
   > > task1:cpu0:   counters[smp_processor_id()] = x + 1;
   > >               full garbage
   
   May be someone could tell me if these matter.  If you are
   bumping a counter and you switch cpus in the middle, a.)
   does it matter? and b.) if so which cpu should get the
   count?  I sort of thought that, if this were going on, it
   did not really matter as long as some counter was bumped.

That's not the problem.  We use per-cpu values for each counter (and
when the user asks for the value, we add together the values from
each processor).

Please review the example I quote above, you aren't reading it
carefully enough.

Let us imagine that we are dealing with counter "X", and
that the values at the beginning of the example are:

	X[0] = 5
	X[1] = 7
	X[2] = ...

Actually, no values matter for the purposes of this example
except the one for cpu 0.  Here is what happens, watch carefully:

   > > task1:cpu0:   x = counters[smp_processor_id()];
   > >       cpu0:   PREEMPT

task1 sees 'x' as '5'

   > > task2:cpu0:   x = counters[smp_processor_id()];
   > > task2:cpu0:   counters[smp_processor_id()] = x + 1;
   > >       cpu0:   PREEMPT

task2 bumps the counter to '6'

   > > task1:cpu0:   counters[smp_processor_id()] = x + 1;
   > >               full garbage

task1 also bumps the counter to '6'

This is the problem.  We make these counters non-atomic on purpose
for performance reasons, so do not mention that as a possible fix.

       reply	other threads:[~2002-05-21  6:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.33.0205201836160.9301-100000@w-nivedita2.des.beaverton.ibm.com>
     [not found] ` <3CE9E466.AC2358EE@mvista.com>
2002-05-21  6:00   ` David S. Miller [this message]
     [not found]   ` <20020520.230021.29510217.davem@redhat.com>
2002-05-21  7:25     ` System crash in tcp_fragment() george anzinger
2002-05-21  9:49     ` Andi Kleen
     [not found]     ` <3CE9F679.90ACF597@mvista.com>
2002-05-21  7:22       ` David S. Miller
2002-05-21 12:47       ` kuznet
2002-05-21 15:42         ` george anzinger
2002-05-21 12:54       ` Andi Kleen
2002-05-21  6:08 ` george anzinger
     [not found] <20020520.173416.105610032.davem@redhat.com>
2002-05-21  1:00 ` kuznet
2002-05-21  1:49 ` Nivedita Singhvi
     [not found] <3CE9960D.15D41380@mvista.com>
     [not found] ` <200205210041.EAA04407@sex.inr.ac.ru>
2002-05-21  0:34   ` David S. Miller
2002-05-21  0:41 ` kuznet
     [not found] <20020521015407.A1296@wotan.suse.de>
2002-05-21  0:11 ` kuznet
     [not found]   ` <3CE99434.20E7479C@mvista.com>
2002-05-21  0:18     ` David S. Miller
2002-05-21  0:39     ` Andi Kleen
2002-05-21  0:20   ` Andi Kleen
2002-05-21  0:26   ` george anzinger
     [not found]   ` <20020521022007.A6248@wotan.suse.de>
2002-05-21  0:34     ` george anzinger
     [not found] <3CE95190.75C52E2D@mvista.com>
2002-05-20 20:29 ` Andi Kleen
     [not found] ` <20020520222937.A1467@averell>
2002-05-20 21:18   ` george anzinger
2002-05-20 21:25 ` kuznet
2002-05-20 22:08 ` David S. Miller
     [not found] ` <200205202125.BAA03545@sex.inr.ac.ru>
2002-05-20 23:01   ` george anzinger
2002-05-20 23:54   ` Andi Kleen
2002-05-20 19:42 george anzinger

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='accom8$9i4$2@main.gmane.org' \
    --to=davem@redhat.com \
    --cc=ak@muc.de \
    --cc=ak@suse.de \
    --cc=george@mvista.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-net@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=niv@us.ibm.com \
    --cc=pekkas@netcore.fi \
    /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;
as well as URLs for NNTP newsgroup(s).