Skip to content

Commit

Permalink
Use helpers to obtain task pid in printks (arch code)
Browse files Browse the repository at this point in the history
One of the easiest things to isolate is the pid printed in kernel log.
There was a patch, that made this for arch-independent code, this one makes
so for arch/xxx files.

It took some time to cross-compile it, but hopefully these are all the
printks in arch code.

Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: Pavel Emelyanov <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and Linus Torvalds committed Oct 19, 2007
1 parent ba25f9d commit 19c5870
Show file tree
Hide file tree
Showing 37 changed files with 163 additions and 157 deletions.
16 changes: 8 additions & 8 deletions arch/alpha/kernel/semaphore.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ __down_failed(struct semaphore *sem)

#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down failed(%p)\n",
tsk->comm, tsk->pid, sem);
tsk->comm, task_pid_nr(tsk), sem);
#endif

tsk->state = TASK_UNINTERRUPTIBLE;
Expand Down Expand Up @@ -98,7 +98,7 @@ __down_failed(struct semaphore *sem)

#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down acquired(%p)\n",
tsk->comm, tsk->pid, sem);
tsk->comm, task_pid_nr(tsk), sem);
#endif
}

Expand All @@ -111,7 +111,7 @@ __down_failed_interruptible(struct semaphore *sem)

#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down failed(%p)\n",
tsk->comm, tsk->pid, sem);
tsk->comm, task_pid_nr(tsk), sem);
#endif

tsk->state = TASK_INTERRUPTIBLE;
Expand Down Expand Up @@ -139,7 +139,7 @@ __down_failed_interruptible(struct semaphore *sem)

#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down %s(%p)\n",
current->comm, current->pid,
current->comm, task_pid_nr(current),
(ret < 0 ? "interrupted" : "acquired"), sem);
#endif
return ret;
Expand Down Expand Up @@ -168,7 +168,7 @@ down(struct semaphore *sem)
#endif
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down(%p) <count=%d> from %p\n",
current->comm, current->pid, sem,
current->comm, task_pid_nr(current), sem,
atomic_read(&sem->count), __builtin_return_address(0));
#endif
__down(sem);
Expand All @@ -182,7 +182,7 @@ down_interruptible(struct semaphore *sem)
#endif
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down(%p) <count=%d> from %p\n",
current->comm, current->pid, sem,
current->comm, task_pid_nr(current), sem,
atomic_read(&sem->count), __builtin_return_address(0));
#endif
return __down_interruptible(sem);
Expand All @@ -201,7 +201,7 @@ down_trylock(struct semaphore *sem)

#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down_trylock %s from %p\n",
current->comm, current->pid,
current->comm, task_pid_nr(current),
ret ? "failed" : "acquired",
__builtin_return_address(0));
#endif
Expand All @@ -217,7 +217,7 @@ up(struct semaphore *sem)
#endif
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): up(%p) <count=%d> from %p\n",
current->comm, current->pid, sem,
current->comm, task_pid_nr(current), sem,
atomic_read(&sem->count), __builtin_return_address(0));
#endif
__up(sem);
Expand Down
6 changes: 3 additions & 3 deletions arch/alpha/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15)
#ifdef CONFIG_SMP
printk("CPU %d ", hard_smp_processor_id());
#endif
printk("%s(%d): %s %ld\n", current->comm, current->pid, str, err);
printk("%s(%d): %s %ld\n", current->comm, task_pid_nr(current), str, err);
dik_show_regs(regs, r9_15);
add_taint(TAINT_DIE);
dik_show_trace((unsigned long *)(regs+1));
Expand Down Expand Up @@ -646,7 +646,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
lock_kernel();

printk("%s(%d): unhandled unaligned exception\n",
current->comm, current->pid);
current->comm, task_pid_nr(current));

printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx\n",
pc, una_reg(26), regs->ps);
Expand Down Expand Up @@ -786,7 +786,7 @@ do_entUnaUser(void __user * va, unsigned long opcode,
}
if (++cnt < 5) {
printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n",
current->comm, current->pid,
current->comm, task_pid_nr(current),
regs->pc - 4, va, opcode, reg);
}
last_time = jiffies;
Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
goto survive;
}
printk(KERN_ALERT "VM: killing process %s(%d)\n",
current->comm, current->pid);
current->comm, task_pid_nr(current));
if (!user_mode(regs))
goto no_context;
do_group_exit(SIGKILL);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void __show_regs(struct pt_regs *regs)
void show_regs(struct pt_regs * regs)
{
printk("\n");
printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
__show_regs(regs);
__backtrace();
}
Expand Down
8 changes: 4 additions & 4 deletions arch/arm/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,16 +382,16 @@ static void clear_breakpoint(struct task_struct *task, struct debug_entry *bp)

if (ret != 2 || old_insn.thumb != BREAKINST_THUMB)
printk(KERN_ERR "%s:%d: corrupted Thumb breakpoint at "
"0x%08lx (0x%04x)\n", task->comm, task->pid,
addr, old_insn.thumb);
"0x%08lx (0x%04x)\n", task->comm,
task_pid_nr(task), addr, old_insn.thumb);
} else {
ret = swap_insn(task, addr & ~3, &old_insn.arm,
&bp->insn.arm, 4);

if (ret != 4 || old_insn.arm != BREAKINST_ARM)
printk(KERN_ERR "%s:%d: corrupted ARM breakpoint at "
"0x%08lx (0x%08x)\n", task->comm, task->pid,
addr, old_insn.arm);
"0x%08lx (0x%08x)\n", task->comm,
task_pid_nr(task), addr, old_insn.arm);
}
}

Expand Down
10 changes: 5 additions & 5 deletions arch/arm/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ static void __die(const char *str, int err, struct thread_info *thread, struct p
print_modules();
__show_regs(regs);
printk("Process %s (pid: %d, stack limit = 0x%p)\n",
tsk->comm, tsk->pid, thread + 1);
tsk->comm, task_pid_nr(tsk), thread + 1);

if (!user_mode(regs) || in_interrupt()) {
dump_mem("Stack: ", regs->ARM_sp,
Expand Down Expand Up @@ -337,7 +337,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
#ifdef CONFIG_DEBUG_USER
if (user_debug & UDBG_UNDEFINED) {
printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
current->comm, current->pid, pc);
current->comm, task_pid_nr(current), pc);
dump_instr(regs);
}
#endif
Expand Down Expand Up @@ -388,7 +388,7 @@ static int bad_syscall(int n, struct pt_regs *regs)
#ifdef CONFIG_DEBUG_USER
if (user_debug & UDBG_SYSCALL) {
printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n",
current->pid, current->comm, n);
task_pid_nr(current), current->comm, n);
dump_instr(regs);
}
#endif
Expand Down Expand Up @@ -565,7 +565,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
*/
if (user_debug & UDBG_SYSCALL) {
printk("[%d] %s: arm syscall %d\n",
current->pid, current->comm, no);
task_pid_nr(current), current->comm, no);
dump_instr(regs);
if (user_mode(regs)) {
__show_regs(regs);
Expand Down Expand Up @@ -642,7 +642,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
#ifdef CONFIG_DEBUG_USER
if (user_debug & UDBG_BADABORT) {
printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n",
current->pid, current->comm, code, instr);
task_pid_nr(current), current->comm, code, instr);
dump_instr(regs);
show_pte(current->mm, addr);
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mm/alignment.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
if (ai_usermode & 1)
printk("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%0*lx "
"Address=0x%08lx FSR 0x%03x\n", current->comm,
current->pid, instrptr,
task_pid_nr(current), instrptr,
thumb_mode(regs) ? 4 : 8,
thumb_mode(regs) ? tinstr : instr,
addr, fsr);
Expand Down
6 changes: 3 additions & 3 deletions arch/ia64/ia32/sys_ia32.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
if (flags & MAP_SHARED)
printk(KERN_INFO
"%s(%d): emulate_mmap() can't share head (addr=0x%lx)\n",
current->comm, current->pid, start);
current->comm, task_pid_nr(current), start);
ret = mmap_subpage(file, start, min(PAGE_ALIGN(start), end), prot, flags,
off);
if (IS_ERR((void *) ret))
Expand All @@ -786,7 +786,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
if (flags & MAP_SHARED)
printk(KERN_INFO
"%s(%d): emulate_mmap() can't share tail (end=0x%lx)\n",
current->comm, current->pid, end);
current->comm, task_pid_nr(current), end);
ret = mmap_subpage(file, max(start, PAGE_START(end)), end, prot, flags,
(off + len) - offset_in_page(end));
if (IS_ERR((void *) ret))
Expand Down Expand Up @@ -816,7 +816,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro

if ((flags & MAP_SHARED) && !is_congruent)
printk(KERN_INFO "%s(%d): emulate_mmap() can't share contents of incongruent mmap "
"(addr=0x%lx,off=0x%llx)\n", current->comm, current->pid, start, off);
"(addr=0x%lx,off=0x%llx)\n", current->comm, task_pid_nr(current), start, off);

DBG("mmap_body: mapping [0x%lx-0x%lx) %s with poff 0x%llx\n", pstart, pend,
is_congruent ? "congruent" : "not congruent", poff);
Expand Down
Loading

0 comments on commit 19c5870

Please sign in to comment.