diff options
| author | Douglas Anderson <dianders@chromium.org> | 2016-12-14 18:05:49 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-06 04:40:17 -0500 |
| commit | f726f4f411f9094a3901fb35985f070c0fdec5b2 (patch) | |
| tree | 6b52cf3c3e9e3ea6a54c6961a6f57a5d1ce6af7e /kernel/debug | |
| parent | 9b78d69054243a0d047ebccdd64cb8a2462e174e (diff) | |
kernel/debug/debug_core.c: more properly delay for secondary CPUs
commit 2d13bb6494c807bcf3f78af0e96c0b8615a94385 upstream.
We've got a delay loop waiting for secondary CPUs. That loop uses
loops_per_jiffy. However, loops_per_jiffy doesn't actually mean how
many tight loops make up a jiffy on all architectures. It is quite
common to see things like this in the boot log:
Calibrating delay loop (skipped), value calculated using timer
frequency.. 48.00 BogoMIPS (lpj=24000)
In my case I was seeing lots of cases where other CPUs timed out
entering the debugger only to print their stack crawls shortly after the
kdb> prompt was written.
Elsewhere in kgdb we already use udelay(), so that should be safe enough
to use to implement our timeout. We'll delay 1 ms for 1000 times, which
should give us a full second of delay (just like the old code wanted)
but allow us to notice that we're done every 1 ms.
[akpm@linux-foundation.org: simplifications, per Daniel]
Link: http://lkml.kernel.org/r/1477091361-2039-1-git-send-email-dianders@chromium.org
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Brian Norris <briannorris@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/debug')
| -rw-r--r-- | kernel/debug/debug_core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 0874e2edd275..79517e5549f1 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c | |||
| @@ -598,11 +598,11 @@ return_normal: | |||
| 598 | /* | 598 | /* |
| 599 | * Wait for the other CPUs to be notified and be waiting for us: | 599 | * Wait for the other CPUs to be notified and be waiting for us: |
| 600 | */ | 600 | */ |
| 601 | time_left = loops_per_jiffy * HZ; | 601 | time_left = MSEC_PER_SEC; |
| 602 | while (kgdb_do_roundup && --time_left && | 602 | while (kgdb_do_roundup && --time_left && |
| 603 | (atomic_read(&masters_in_kgdb) + atomic_read(&slaves_in_kgdb)) != | 603 | (atomic_read(&masters_in_kgdb) + atomic_read(&slaves_in_kgdb)) != |
| 604 | online_cpus) | 604 | online_cpus) |
| 605 | cpu_relax(); | 605 | udelay(1000); |
| 606 | if (!time_left) | 606 | if (!time_left) |
| 607 | pr_crit("Timed out waiting for secondary CPUs.\n"); | 607 | pr_crit("Timed out waiting for secondary CPUs.\n"); |
| 608 | 608 | ||
