linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jason Wessel <jason.wessel@windriver.com>
Cc: kgdb-bugreport@lists.sourceforge.net, amitkale@linsyssoft.com,
	linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org,
	Mariusz Kozlowski <m.kozlowski@tuxland.pl>,
	Paul Mackerras <paulus@samba.org>
Subject: Re: [Kgdb-bugreport] 2.6.23-rc3-mm1: kgdb build failure on powerpc
Date: Wed, 22 Aug 2007 16:53:18 -0700	[thread overview]
Message-ID: <20070822165318.b82da13c.akpm@linux-foundation.org> (raw)
In-Reply-To: <46CCBC3C.7010307@windriver.com>

On Wed, 22 Aug 2007 17:44:12 -0500
Jason Wessel <jason.wessel@windriver.com> wrote:

> Perhaps there is a cleaner way to do the same thing and avoid the 
> cmpxchg all together.  I used the attached patch to eliminate the 
> cmpxchg operation.
> 
> 
> Jason.
> 
> 
> [kgdb_enter_atomic.patch  text/plain (2.0KB)]
> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
> 
> ---
>  kernel/kgdb.c |   18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> --- a/kernel/kgdb.c
> +++ b/kernel/kgdb.c
> @@ -121,6 +121,7 @@ struct task_struct *kgdb_usethread, *kgd
>  
>  int debugger_step;
>  atomic_t debugger_active;
> +static atomic_t kgdb_sync = ATOMIC_INIT(-1);
>  
>  /* Our I/O buffers. */
>  static char remcom_in_buffer[BUFMAX];
> @@ -638,8 +639,14 @@ static void kgdb_wait(struct pt_regs *re
>  	kgdb_info[processor].task = current;
>  	atomic_set(&procindebug[processor], 1);
>  
> +	/* The master processor must be active to enter here, but this is
> +	 * gaurd in case the master processor had not been selected if
> +	 * this was an entry via nmi.
> +	 */
> +	while (!atomic_read(&debugger_active));

eek.  We're in the process of hunting down and eliminating exactly this
construct.  There have been cases where the compiler cached the
atomic_read() result in a register, turning the above into an infinite
loop.

Plus we should never add power-burners like that into the kernel anyway. 
That loop should have a cpu_relax() in it.  Which will also fix the
compiler problem described above.

Thirdly, please always add a newline when coding statements like that:

	while (expr())
		;

  reply	other threads:[~2007-08-22 23:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070822020648.5ea3a612.akpm@linux-foundation.org>
2007-08-22 19:04 ` 2.6.23-rc3-mm1: kgdb build failure on powerpc Mariusz Kozlowski
2007-08-22 19:47   ` Andrew Morton
2007-08-22 22:44     ` [Kgdb-bugreport] " Jason Wessel
2007-08-22 23:53       ` Andrew Morton [this message]
2007-08-23  3:25         ` Jason Wessel
2007-08-29 23:43           ` Pete/Piet Delaney
2007-08-30  0:05             ` Pete/Piet Delaney
2007-08-30  1:19             ` Pete/Piet Delaney
2007-08-30  1:38               ` Randy Dunlap
2007-08-30  2:07               ` Jason Wessel
2007-08-30  2:13               ` Jason Wessel

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=20070822165318.b82da13c.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=amitkale@linsyssoft.com \
    --cc=jason.wessel@windriver.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=m.kozlowski@tuxland.pl \
    --cc=paulus@samba.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).