aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2014-06-17 02:15:36 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-06-24 00:05:50 -0400
commit072c4c018e547b4bd6cfa4086aae881140b62759 (patch)
tree4113ca3aee85e38657374cf719803d1dcafad740
parentd84e0d69c26b4d739214974d6ad6baf23f510580 (diff)
powerpc/ftrace: Use pr_fmt() to namespace error messages
The printks() in our ftrace code have no prefix, so they appear on the console with very little context, eg: Branch out of range Use pr_fmt() & pr_err() to add a prefix. While we're at it, collapse a few split lines that don't need to be, and add a missing newline to one message. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/kernel/ftrace.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index 96efc664b49d..d178834fe508 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -10,6 +10,8 @@
10 * 10 *
11 */ 11 */
12 12
13#define pr_fmt(fmt) "ftrace-powerpc: " fmt
14
13#include <linux/spinlock.h> 15#include <linux/spinlock.h>
14#include <linux/hardirq.h> 16#include <linux/hardirq.h>
15#include <linux/uaccess.h> 17#include <linux/uaccess.h>
@@ -115,7 +117,7 @@ __ftrace_make_nop(struct module *mod,
115 117
116 /* Make sure that that this is still a 24bit jump */ 118 /* Make sure that that this is still a 24bit jump */
117 if (!is_bl_op(op)) { 119 if (!is_bl_op(op)) {
118 printk(KERN_ERR "Not expected bl: opcode is %x\n", op); 120 pr_err("Not expected bl: opcode is %x\n", op);
119 return -EINVAL; 121 return -EINVAL;
120 } 122 }
121 123
@@ -125,12 +127,12 @@ __ftrace_make_nop(struct module *mod,
125 pr_devel("ip:%lx jumps to %p", ip, tramp); 127 pr_devel("ip:%lx jumps to %p", ip, tramp);
126 128
127 if (!is_module_trampoline(tramp)) { 129 if (!is_module_trampoline(tramp)) {
128 printk(KERN_ERR "Not a trampoline\n"); 130 pr_err("Not a trampoline\n");
129 return -EINVAL; 131 return -EINVAL;
130 } 132 }
131 133
132 if (module_trampoline_target(mod, tramp, &ptr)) { 134 if (module_trampoline_target(mod, tramp, &ptr)) {
133 printk(KERN_ERR "Failed to get trampoline target\n"); 135 pr_err("Failed to get trampoline target\n");
134 return -EFAULT; 136 return -EFAULT;
135 } 137 }
136 138
@@ -139,8 +141,7 @@ __ftrace_make_nop(struct module *mod,
139 entry = ppc_global_function_entry((void *)addr); 141 entry = ppc_global_function_entry((void *)addr);
140 /* This should match what was called */ 142 /* This should match what was called */
141 if (ptr != entry) { 143 if (ptr != entry) {
142 printk(KERN_ERR "addr %lx does not match expected %lx\n", 144 pr_err("addr %lx does not match expected %lx\n", ptr, entry);
143 ptr, entry);
144 return -EINVAL; 145 return -EINVAL;
145 } 146 }
146 147
@@ -180,7 +181,7 @@ __ftrace_make_nop(struct module *mod,
180 181
181 /* Make sure that that this is still a 24bit jump */ 182 /* Make sure that that this is still a 24bit jump */
182 if (!is_bl_op(op)) { 183 if (!is_bl_op(op)) {
183 printk(KERN_ERR "Not expected bl: opcode is %x\n", op); 184 pr_err("Not expected bl: opcode is %x\n", op);
184 return -EINVAL; 185 return -EINVAL;
185 } 186 }
186 187
@@ -199,7 +200,7 @@ __ftrace_make_nop(struct module *mod,
199 200
200 /* Find where the trampoline jumps to */ 201 /* Find where the trampoline jumps to */
201 if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) { 202 if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) {
202 printk(KERN_ERR "Failed to read %lx\n", tramp); 203 pr_err("Failed to read %lx\n", tramp);
203 return -EFAULT; 204 return -EFAULT;
204 } 205 }
205 206
@@ -210,7 +211,7 @@ __ftrace_make_nop(struct module *mod,
210 ((jmp[1] & 0xffff0000) != 0x398c0000) || 211 ((jmp[1] & 0xffff0000) != 0x398c0000) ||
211 (jmp[2] != 0x7d8903a6) || 212 (jmp[2] != 0x7d8903a6) ||
212 (jmp[3] != 0x4e800420)) { 213 (jmp[3] != 0x4e800420)) {
213 printk(KERN_ERR "Not a trampoline\n"); 214 pr_err("Not a trampoline\n");
214 return -EINVAL; 215 return -EINVAL;
215 } 216 }
216 217
@@ -222,8 +223,7 @@ __ftrace_make_nop(struct module *mod,
222 pr_devel(" %lx ", tramp); 223 pr_devel(" %lx ", tramp);
223 224
224 if (tramp != addr) { 225 if (tramp != addr) {
225 printk(KERN_ERR 226 pr_err("Trampoline location %08lx does not match addr\n",
226 "Trampoline location %08lx does not match addr\n",
227 tramp); 227 tramp);
228 return -EINVAL; 228 return -EINVAL;
229 } 229 }
@@ -264,15 +264,13 @@ int ftrace_make_nop(struct module *mod,
264 */ 264 */
265 if (!rec->arch.mod) { 265 if (!rec->arch.mod) {
266 if (!mod) { 266 if (!mod) {
267 printk(KERN_ERR "No module loaded addr=%lx\n", 267 pr_err("No module loaded addr=%lx\n", addr);
268 addr);
269 return -EFAULT; 268 return -EFAULT;
270 } 269 }
271 rec->arch.mod = mod; 270 rec->arch.mod = mod;
272 } else if (mod) { 271 } else if (mod) {
273 if (mod != rec->arch.mod) { 272 if (mod != rec->arch.mod) {
274 printk(KERN_ERR 273 pr_err("Record mod %p not equal to passed in mod %p\n",
275 "Record mod %p not equal to passed in mod %p\n",
276 rec->arch.mod, mod); 274 rec->arch.mod, mod);
277 return -EINVAL; 275 return -EINVAL;
278 } 276 }
@@ -309,25 +307,24 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
309 * just mask it out when doing the compare. 307 * just mask it out when doing the compare.
310 */ 308 */
311 if ((op[0] != 0x48000008) || ((op[1] & 0xffff0000) != 0xe8410000)) { 309 if ((op[0] != 0x48000008) || ((op[1] & 0xffff0000) != 0xe8410000)) {
312 printk(KERN_ERR "Unexpected call sequence: %x %x\n", 310 pr_err("Unexpected call sequence: %x %x\n", op[0], op[1]);
313 op[0], op[1]);
314 return -EINVAL; 311 return -EINVAL;
315 } 312 }
316 313
317 /* If we never set up a trampoline to ftrace_caller, then bail */ 314 /* If we never set up a trampoline to ftrace_caller, then bail */
318 if (!rec->arch.mod->arch.tramp) { 315 if (!rec->arch.mod->arch.tramp) {
319 printk(KERN_ERR "No ftrace trampoline\n"); 316 pr_err("No ftrace trampoline\n");
320 return -EINVAL; 317 return -EINVAL;
321 } 318 }
322 319
323 /* Ensure branch is within 24 bits */ 320 /* Ensure branch is within 24 bits */
324 if (!create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { 321 if (!create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) {
325 printk(KERN_ERR "Branch out of range"); 322 pr_err("Branch out of range\n");
326 return -EINVAL; 323 return -EINVAL;
327 } 324 }
328 325
329 if (patch_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { 326 if (patch_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) {
330 printk(KERN_ERR "REL24 out of range!\n"); 327 pr_err("REL24 out of range!\n");
331 return -EINVAL; 328 return -EINVAL;
332 } 329 }
333 330
@@ -346,13 +343,13 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
346 343
347 /* It should be pointing to a nop */ 344 /* It should be pointing to a nop */
348 if (op != PPC_INST_NOP) { 345 if (op != PPC_INST_NOP) {
349 printk(KERN_ERR "Expected NOP but have %x\n", op); 346 pr_err("Expected NOP but have %x\n", op);
350 return -EINVAL; 347 return -EINVAL;
351 } 348 }
352 349
353 /* If we never set up a trampoline to ftrace_caller, then bail */ 350 /* If we never set up a trampoline to ftrace_caller, then bail */
354 if (!rec->arch.mod->arch.tramp) { 351 if (!rec->arch.mod->arch.tramp) {
355 printk(KERN_ERR "No ftrace trampoline\n"); 352 pr_err("No ftrace trampoline\n");
356 return -EINVAL; 353 return -EINVAL;
357 } 354 }
358 355
@@ -360,7 +357,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
360 op = create_branch((unsigned int *)ip, 357 op = create_branch((unsigned int *)ip,
361 rec->arch.mod->arch.tramp, BRANCH_SET_LINK); 358 rec->arch.mod->arch.tramp, BRANCH_SET_LINK);
362 if (!op) { 359 if (!op) {
363 printk(KERN_ERR "REL24 out of range!\n"); 360 pr_err("REL24 out of range!\n");
364 return -EINVAL; 361 return -EINVAL;
365 } 362 }
366 363
@@ -398,7 +395,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
398 * already have a module defined. 395 * already have a module defined.
399 */ 396 */
400 if (!rec->arch.mod) { 397 if (!rec->arch.mod) {
401 printk(KERN_ERR "No module loaded\n"); 398 pr_err("No module loaded\n");
402 return -EINVAL; 399 return -EINVAL;
403 } 400 }
404 401