linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [kGDB]Cannot compile KGDB on ARM SMP
Date: Thu, 4 Mar 2010 18:28:43 -0000	[thread overview]
Message-ID: <001f01cabbc8$85680300$90380900$@deacon@arm.com> (raw)
In-Reply-To: <1267724191.6526.501.camel@e102109-lin.cambridge.arm.com>

Hi Catalin,

> On Thu, 2010-03-04 at 17:28 +0000, Will Deacon wrote:
> > I took a quick look at the code in kernel/kgdb.c and adding the following
> > memory barrier appears to resolve the issue:
> >
> > diff --git a/kernel/kgdb.c b/kernel/kgdb.c
> > index 761fdd2..1308381 100644
> > --- a/kernel/kgdb.c
> > +++ b/kernel/kgdb.c
> > @@ -1537,6 +1537,7 @@ acquirelock:
> >                  * Wait till all the CPUs have quit
> >                  * from the debugger.
> >                  */
> > +               smp_wmb();
> >                 for_each_online_cpu(i) {
> >                         while (atomic_read(&cpu_in_kgdb[i]))
> >                                 cpu_relax();
> 
> Shouldn't this be smp_rmb()?

Actually, I think that we need an smp_mb() because there is
another variable involved (passive_cpu_wait[i]) as well as
cpu_in_kgdb[i], both of which are being read from and written
to.

I think deadlock occurs because the store buffers don't drain
on the 11MPCore, so the CPUs happily cpu_relax() while polling
on variables that they will never see change. Perhaps cpu_relax()
should be defined to be something stronger than a compiler memory
barrier for ARM?

Will

      reply	other threads:[~2010-03-04 18:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02  9:07 [kGDB]Cannot compile KGDB on ARM SMP Jean-Michel Hautbois
2010-03-03 23:36 ` Jason Wessel
2010-03-04 17:28   ` Will Deacon
2010-03-04 17:36     ` Catalin Marinas
2010-03-04 18:28       ` Will Deacon [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='001f01cabbc8$85680300$90380900$@deacon@arm.com' \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).