[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070822165318.b82da13c.akpm@linux-foundation.org>
Date: Wed, 22 Aug 2007 16:53:18 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Jason Wessel <jason.wessel@...driver.com>
Cc: Mariusz Kozlowski <m.kozlowski@...land.pl>,
kgdb-bugreport@...ts.sourceforge.net, amitkale@...syssoft.com,
linux-kernel@...r.kernel.org, linuxppc-dev@...abs.org,
Paul Mackerras <paulus@...ba.org>
Subject: Re: [Kgdb-bugreport] 2.6.23-rc3-mm1: kgdb build failure on powerpc
On Wed, 22 Aug 2007 17:44:12 -0500
Jason Wessel <jason.wessel@...driver.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@...driver.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())
;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists