mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Jason Wessel <jason.wessel@windriver.com>
Cc: Will Deacon <will.deacon@arm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	kgdb-bugreport@lists.sourceforge.net, linux-arm@vger.kernel.org,
	Russell King - ARM Linux <linux@arm.linux.org.uk>
Subject: Re: [PATCH 4/5] kgdb: Use atomic operators which use barriers
Date: Fri, 2 Apr 2010 13:07:26 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.00.1004021250170.3634@i5.linux-foundation.org> (raw)
In-Reply-To: <alpine.LFD.2.00.1004021244140.3634@i5.linux-foundation.org>



On Fri, 2 Apr 2010, Linus Torvalds wrote:
> 
> But Linux does expect that if some other CPU modifies a memory location, 
> then we _will_ see that modification eventually. If the CPU needs help to 
> do so, then cpu_relax() needs to do that. Again - this has nothing to do 
> with memory barriers. It's just a basic requirement.

Btw, this is not necessarily just limited to cpu_relax() either. The 
assumption that we'll eventually see changes to memory is pretty common.

If some architecture doesn't see updates from other CPU's (or maybe DMA) 
without extra help, I suspect that it might be a good idea to not just 
have IO instructions but also things like 'udelay()' have that "extra 
helping sauce" in them.

For the exact same reason: we have drivers that depend on things like 
jiffies updates happening automatically, eg:

	drivers/scsi/u14-34f.c:   while ((jiffies - time) < (10 * HZ) && limit++ < 200000) udelay(100L);

or

	drivers/isdn/hisax/elsa_ser.c-  while(timeout-- && cs->hw.elsa.transcnt)
	drivers/isdn/hisax/elsa_ser.c:          udelay(1000);

or

	drivers/serial/68328serial.c:   while (!(uart->utx.w & UTX_TX_AVAIL)) udelay(5);

where those variables we read may be updated from another CPU taking an 
interrupt (or by DMA - I didn't look at how UTX_TX_AVAIL gets set, for 
example).

Now, in practice, I suspect the above kind of busy loop is _way_ less 
common. It's harder to grep for (I picked 'udelay()' to look for, but 
the result is full of noise that does IO etc that would presumably fix 
things anyway, so the above two are just random examples of some drivers 
basically reading variables in a busy loop).

And for something like ARM, random drivers probably don't much matter. So 
I doubt that this udelay() thing is at _all_ as important as cpu_relax() 
is, and ARM maintainers can probably happily just ignore it.

			Linus

  reply	other threads:[~2010-04-02 20:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-02 18:32 [GIT PULL] kgdb fixes for 2.6.34-rc3 Jason Wessel
2010-04-02 18:32 ` [PATCH 1/5] kgdb: have ebin2mem call probe_kernel_write once Jason Wessel
2010-04-02 18:32   ` [PATCH 2/5] kgdbts,sh: Add in breakpoint pc offset for superh Jason Wessel
2010-04-02 18:32     ` [PATCH 3/5] kgdb: eliminate kgdb_wait(), all cpus enter the same way Jason Wessel
2010-04-02 18:32       ` [PATCH 4/5] kgdb: Use atomic operators which use barriers Jason Wessel
2010-04-02 18:32         ` [PATCH 5/5] kgdb: Turn off tracing while in the debugger Jason Wessel
2010-04-02 19:12         ` [PATCH 4/5] kgdb: Use atomic operators which use barriers Linus Torvalds
2010-04-02 19:37           ` Jason Wessel
2010-04-02 19:43             ` Linus Torvalds
2010-04-02 19:46               ` Linus Torvalds
2010-04-02 20:07                 ` Linus Torvalds [this message]
2010-04-02 22:25               ` Russell King - ARM Linux
2010-04-02 23:24                 ` Linus Torvalds
2010-04-03 16:08                   ` Russell King - ARM Linux
2010-04-05  9:21               ` Pavel Machek
2010-04-05 14:56                 ` Linus Torvalds
2010-04-02 19:47             ` [Kgdb-bugreport] [PATCH 4/5] kgdb: Use atomic operators whichuse barriers Jason Wessel
2010-04-02 19:47               ` Linus Torvalds
2010-04-02 20:00                 ` Jason Wessel
2010-04-08 16:27                   ` Dmitry Adamushko
2010-04-19 15:21               ` Will Deacon
     [not found]           ` <000501cad70a$26ca7e10$745f7a30$@deacon@arm.com>
2010-04-08 14:55             ` [PATCH 4/5] kgdb: Use atomic operators which use barriers Linus Torvalds

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=alpine.LFD.2.00.1004021250170.3634@i5.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=jason.wessel@windriver.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-arm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=will.deacon@arm.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®