[Kgdb-bugreport] 2.6.23-rc3-mm1: kgdb build failure on powerpc
Andrew Morton
akpm at linux-foundation.org
Thu Aug 23 09:53:18 EST 2007
On Wed, 22 Aug 2007 17:44:12 -0500
Jason Wessel <jason.wessel at 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 at 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())
;
More information about the Linuxppc-dev
mailing list