public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: graff yang <graff.yang@gmail.com>
Cc: Mike Frysinger <vapier.adi@gmail.com>,
	gyang <graf.yang@analog.com>, Bryan Wu <cooloney@kernel.org>,
	alan@lxorguk.ukuu.org.uk, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 02/18] Blackfin Serial Driver: use barrier instead of  cpu_relax for Blackfin SMP like patch
Date: Wed, 11 Mar 2009 09:48:23 -0700	[thread overview]
Message-ID: <20090311094823.38ec1e17.akpm@linux-foundation.org> (raw)
In-Reply-To: <7d86d44a0903110250l9bcccd7led5558068f153522@mail.gmail.com>

On Wed, 11 Mar 2009 17:50:21 +0800 graff yang <graff.yang@gmail.com> wrote:

> On Wed, Mar 11, 2009 at 12:48 AM, Andrew Morton
> <akpm@linux-foundation.org> wrote:
> >
> > On Tue, 10 Mar 2009 06:25:08 -0400 Mike Frysinger <vapier.adi@gmail.com> wrote:
> >
> > > On Tue, Mar 10, 2009 at 06:07, gyang wrote:
> > > > On Fri, 2009-03-06 at 14:37 -0800, Andrew Morton wrote:
> > > >> On Fri, __6 Mar 2009 14:42:44 +0800
> > > >> Bryan Wu <cooloney@kernel.org> wrote:
> > > >>
> > > >> > From: Graf Yang <graf.yang@analog.com>
> > > >> >
> > > >> > We are making a SMP like patch to blackfin, cpu_relax() is replaced by a
> > > >> > data cache flush function which will count it to a per-cpu counter.
> > > >> > If this serial function is called too early, the per-cpu data area have
> > > >> > not been initialized, this call will cause crash.
> > > >>
> > > >> That's a bug in blackfin architecture support. __The kernel should be
> > > >> able to call cpu_relax() at any time, surely. __It's a very low-level
> > > >> and simple thing.
> > > >>
> > > >> > So we'd like to use barrier() instead of cpu_relax().
> > > >> >
> > > >>
> > > >> barrier() is purely a compiler concept. __We might as well just remove
> > > >> the cpu_relax() altogether.
> > > >
> > > > Do you mean remove cpu_relax(), and either not add barrier() here?
> > >
> > > afaik, early printk all runs before SMP is setup, so having it be a
> > > 100% busy wait is fine
> >
> > No, blackfin is busted, please fix this bug in blackfin core.
> >
> > What happens if core kernel code decides to run cpu_relax() prior to
> > initialising per-cpu data?
> 
> cpu_relax() will call smp_mb(), and it need to invalidate data-cache
> in blackfin smp-like kernel,
> the cache flush number is increased and recorded into a per-cpu data.
> 
> When cpu_relax() is called from early-printk functions, the per-cpu
> data areas have not
> been initialized.

Right.  And we've demonstrated here that this was a bad idea.

So I suggest that the blackfin maintainers delete that code.

If it's really valuable (which I doubt) then it could be reimplemented
via a statically-allocated array of longs and local_irq_save()
protection.  Or a statically allocated array of atomic_long_t's.


  reply	other threads:[~2009-03-11 16:52 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-06  6:42 [PATCH 00/18] Blackfin Serial Driver bug fixing and update Bryan Wu
2009-03-06  6:42 ` [PATCH 01/18] Blackfin Serial Driver: Add a debug function to serial driver Bryan Wu
2009-03-06 22:37   ` Andrew Morton
2009-03-06  6:42 ` [PATCH 02/18] Blackfin Serial Driver: use barrier instead of cpu_relax for Blackfin SMP like patch Bryan Wu
2009-03-06 22:37   ` Andrew Morton
2009-03-10 10:07     ` gyang
2009-03-10 10:25       ` Mike Frysinger
2009-03-10 16:48         ` Andrew Morton
2009-03-11  9:50           ` graff yang
2009-03-11 16:48             ` Andrew Morton [this message]
2009-03-06  6:42 ` [PATCH 03/18] Blackfin Serial Driver: fix a in dma circle rx buffer handling Bryan Wu
2009-03-06 22:38   ` Andrew Morton
2009-03-06  6:42 ` [PATCH 04/18] Blackfin Serial Driver: Change hardware flowcontrol from poll to interrupt driven Bryan Wu
2009-03-06 22:38   ` Andrew Morton
2009-03-06 22:49     ` Mike Frysinger
2009-03-06 23:00       ` Andrew Morton
2009-03-06  6:42 ` [PATCH 05/18] Blackfin Serial Driver: fix bug - serial port transfer big file from host to target would have more lines Bryan Wu
2009-03-06 22:38   ` Andrew Morton
2009-03-06  6:42 ` [PATCH 06/18] Blackfin Serial Driver: explain why we cannot cpu_relax() in early serial code Bryan Wu
2009-03-06 22:38   ` Andrew Morton
2009-03-06  6:42 ` [PATCH 07/18] Blackfin Serial Driver: BF538/9 Linux kernel Support Bryan Wu
2009-03-06  6:42 ` [PATCH 08/18] Blackfin Serial Driver: use "unsigned long" for flags with irq functions rather than "int" Bryan Wu
2009-03-06  6:42 ` [PATCH 09/18] Blackfin Serial Driver: irq funcs take an unsigned long for flags Bryan Wu
2009-03-06  6:42 ` [PATCH 10/18] Blackfin Serial Driver: fix compile error in PIO mode Bryan Wu
2009-03-06  6:42 ` [PATCH 11/18] Blackfin Serial Driver: update KGDB UART config name Bryan Wu
2009-03-06  6:42 ` [PATCH 12/18] Blackfin Serial Driver: fix building when debug is enabled but serial console is disabled Bryan Wu
2009-03-06  6:42 ` [PATCH 13/18] Blackfin Serial Driver: depend on KGDB_SERIAL_CONSOLE being set to N Bryan Wu
2009-03-06  6:42 ` [PATCH 14/18] Blackfin Serial Driver: use the DLAB macro to hide variant differences Bryan Wu
2009-03-06 22:38   ` Andrew Morton
2009-03-06 22:41     ` Mike Frysinger
2009-03-06  6:42 ` [PATCH 15/18] Blackfin Serial Driver: merge the upstream adeos/xenomai Bryan Wu
2009-03-06 22:38   ` Andrew Morton
2009-03-06 22:43     ` Mike Frysinger
2009-03-06  6:42 ` [PATCH 16/18] Blackfin Serial Driver: fix bug - up arrow key works abnormal for bf561 ezkit board Bryan Wu
2009-03-06  6:42 ` [PATCH 17/18] Blackfin Serial Driver: Fix bug - Enable hardware based CTS and RTS for bf548 Bryan Wu
2009-03-06 22:38   ` Andrew Morton
2009-03-06  6:43 ` [PATCH 18/18] Blackfin Serial Driver: update path to gpio header Bryan Wu

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=20090311094823.38ec1e17.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cooloney@kernel.org \
    --cc=graf.yang@analog.com \
    --cc=graff.yang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vapier.adi@gmail.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