diff options
| author | Michael Ellerman <michael@ellerman.id.au> | 2012-10-09 00:20:36 -0400 |
|---|---|---|
| committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-11-14 20:59:59 -0500 |
| commit | 0104cd6839bd575f0aa1af4125eb865dc0391aae (patch) | |
| tree | b6bc759e85a2bd98c1f61c5f96235d64c4c111c5 | |
| parent | c4de38093ed9fe94fa35c3adb14afc40bf05e1da (diff) | |
powerpc/xmon: Fiddle xmon_depth_to_print logic in xmon_show_stack()
Currently xmon_depth_to_print is static and global, but it's only
ever used in xmon_show_stack().
At least with a modern compiler it's inlined, so there's no point
in it being static, we could #define it but it's only used in one
place.
By reworking the logic we can drop count and just decrement the
max value as a loop counter. Also switch to a while loop so we
actually print no more than 64 frames as you'd expect based on the
variable name.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| -rw-r--r-- | arch/powerpc/xmon/xmon.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index d940234b09ec..1f8d2f10a432 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
| @@ -1281,21 +1281,19 @@ static void get_function_bounds(unsigned long pc, unsigned long *startp, | |||
| 1281 | catch_memory_errors = 0; | 1281 | catch_memory_errors = 0; |
| 1282 | } | 1282 | } |
| 1283 | 1283 | ||
| 1284 | static int xmon_depth_to_print = 64; | ||
| 1285 | |||
| 1286 | #define LRSAVE_OFFSET (STACK_FRAME_LR_SAVE * sizeof(unsigned long)) | 1284 | #define LRSAVE_OFFSET (STACK_FRAME_LR_SAVE * sizeof(unsigned long)) |
| 1287 | #define MARKER_OFFSET (STACK_FRAME_MARKER * sizeof(unsigned long)) | 1285 | #define MARKER_OFFSET (STACK_FRAME_MARKER * sizeof(unsigned long)) |
| 1288 | 1286 | ||
| 1289 | static void xmon_show_stack(unsigned long sp, unsigned long lr, | 1287 | static void xmon_show_stack(unsigned long sp, unsigned long lr, |
| 1290 | unsigned long pc) | 1288 | unsigned long pc) |
| 1291 | { | 1289 | { |
| 1290 | int max_to_print = 64; | ||
| 1292 | unsigned long ip; | 1291 | unsigned long ip; |
| 1293 | unsigned long newsp; | 1292 | unsigned long newsp; |
| 1294 | unsigned long marker; | 1293 | unsigned long marker; |
| 1295 | int count = 0; | ||
| 1296 | struct pt_regs regs; | 1294 | struct pt_regs regs; |
| 1297 | 1295 | ||
| 1298 | do { | 1296 | while (max_to_print--) { |
| 1299 | if (sp < PAGE_OFFSET) { | 1297 | if (sp < PAGE_OFFSET) { |
| 1300 | if (sp != 0) | 1298 | if (sp != 0) |
| 1301 | printf("SP (%lx) is in userspace\n", sp); | 1299 | printf("SP (%lx) is in userspace\n", sp); |
| @@ -1366,7 +1364,7 @@ static void xmon_show_stack(unsigned long sp, unsigned long lr, | |||
| 1366 | break; | 1364 | break; |
| 1367 | 1365 | ||
| 1368 | sp = newsp; | 1366 | sp = newsp; |
| 1369 | } while (count++ < xmon_depth_to_print); | 1367 | } |
| 1370 | } | 1368 | } |
| 1371 | 1369 | ||
| 1372 | static void backtrace(struct pt_regs *excp) | 1370 | static void backtrace(struct pt_regs *excp) |
