Messages in this thread | | | Subject | Re: [Kgdb-bugreport] [PATCH 4/5] kgdb: Use atomic operators whichuse barriers | From | Will Deacon <> | Date | Mon, 19 Apr 2010 16:21:56 +0100 |
| |
Hi Jason,
> Here is the revised patch, which is going into the kgdb-fixes branch. > > Thanks, > Jason. > > -- > From: Jason Wessel <jason.wessel@windriver.com> > Subject: [PATCH] kgdb: Use atomic operators which use barriers > > The cpu_relax() does not mandate that there is an smp memory barrier. > As a result on the arm smp architecture the kernel debugger can hang > on entry from time to time, as shown by the kgdb regression tests. > > The solution is simply to use the atomic operators which include a > proper smp memory barrier, instead of using atomic_set(). > > Tested-by: Will Deacon <will.deacon@arm.com> > Signed-off-by: Jason Wessel <jason.wessel@windriver.com> > --- > kernel/kgdb.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > --- a/kernel/kgdb.c > +++ b/kernel/kgdb.c > @@ -1379,8 +1379,7 @@ acquirelock: > * Make sure the above info reaches the primary CPU before > * our cpu_in_kgdb[] flag setting does: > */ > - smp_wmb(); > - atomic_set(&cpu_in_kgdb[cpu], 1); > + atomic_inc(&cpu_in_kgdb[cpu]);
As Dmitry pointed out here:
http://lkml.org/lkml/2010/4/8/214
This bit of code looks broken, especially since the comment has been left alone by the patch. I think commit ae6bf53e should be reverted because semantically all it does is remove the smp_wmb() above.
Please let me know what you think,
Will
| |