Commit 19c5870c authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds

Use helpers to obtain task pid in printks (arch code)

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: default avatarAlexey Dobriyan <adobriyan@openvz.org>
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ba25f9dc
...@@ -69,7 +69,7 @@ __down_failed(struct semaphore *sem) ...@@ -69,7 +69,7 @@ __down_failed(struct semaphore *sem)
#ifdef CONFIG_DEBUG_SEMAPHORE #ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down failed(%p)\n", printk("%s(%d): down failed(%p)\n",
tsk->comm, tsk->pid, sem); tsk->comm, task_pid_nr(tsk), sem);
#endif #endif
tsk->state = TASK_UNINTERRUPTIBLE; tsk->state = TASK_UNINTERRUPTIBLE;
...@@ -98,7 +98,7 @@ __down_failed(struct semaphore *sem) ...@@ -98,7 +98,7 @@ __down_failed(struct semaphore *sem)
#ifdef CONFIG_DEBUG_SEMAPHORE #ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down acquired(%p)\n", printk("%s(%d): down acquired(%p)\n",
tsk->comm, tsk->pid, sem); tsk->comm, task_pid_nr(tsk), sem);
#endif #endif
} }
...@@ -111,7 +111,7 @@ __down_failed_interruptible(struct semaphore *sem) ...@@ -111,7 +111,7 @@ __down_failed_interruptible(struct semaphore *sem)
#ifdef CONFIG_DEBUG_SEMAPHORE #ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down failed(%p)\n", printk("%s(%d): down failed(%p)\n",
tsk->comm, tsk->pid, sem); tsk->comm, task_pid_nr(tsk), sem);
#endif #endif
tsk->state = TASK_INTERRUPTIBLE; tsk->state = TASK_INTERRUPTIBLE;
...@@ -139,7 +139,7 @@ __down_failed_interruptible(struct semaphore *sem) ...@@ -139,7 +139,7 @@ __down_failed_interruptible(struct semaphore *sem)
#ifdef CONFIG_DEBUG_SEMAPHORE #ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down %s(%p)\n", printk("%s(%d): down %s(%p)\n",
current->comm, current->pid, current->comm, task_pid_nr(current),
(ret < 0 ? "interrupted" : "acquired"), sem); (ret < 0 ? "interrupted" : "acquired"), sem);
#endif #endif
return ret; return ret;
...@@ -168,7 +168,7 @@ down(struct semaphore *sem) ...@@ -168,7 +168,7 @@ down(struct semaphore *sem)
#endif #endif
#ifdef CONFIG_DEBUG_SEMAPHORE #ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down(%p) <count=%d> from %p\n", 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)); atomic_read(&sem->count), __builtin_return_address(0));
#endif #endif
__down(sem); __down(sem);
...@@ -182,7 +182,7 @@ down_interruptible(struct semaphore *sem) ...@@ -182,7 +182,7 @@ down_interruptible(struct semaphore *sem)
#endif #endif
#ifdef CONFIG_DEBUG_SEMAPHORE #ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down(%p) <count=%d> from %p\n", 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)); atomic_read(&sem->count), __builtin_return_address(0));
#endif #endif
return __down_interruptible(sem); return __down_interruptible(sem);
...@@ -201,7 +201,7 @@ down_trylock(struct semaphore *sem) ...@@ -201,7 +201,7 @@ down_trylock(struct semaphore *sem)
#ifdef CONFIG_DEBUG_SEMAPHORE #ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down_trylock %s from %p\n", printk("%s(%d): down_trylock %s from %p\n",
current->comm, current->pid, current->comm, task_pid_nr(current),
ret ? "failed" : "acquired", ret ? "failed" : "acquired",
__builtin_return_address(0)); __builtin_return_address(0));
#endif #endif
...@@ -217,7 +217,7 @@ up(struct semaphore *sem) ...@@ -217,7 +217,7 @@ up(struct semaphore *sem)
#endif #endif
#ifdef CONFIG_DEBUG_SEMAPHORE #ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): up(%p) <count=%d> from %p\n", 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)); atomic_read(&sem->count), __builtin_return_address(0));
#endif #endif
__up(sem); __up(sem);
......
...@@ -182,7 +182,7 @@ die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15) ...@@ -182,7 +182,7 @@ die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
printk("CPU %d ", hard_smp_processor_id()); printk("CPU %d ", hard_smp_processor_id());
#endif #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); dik_show_regs(regs, r9_15);
add_taint(TAINT_DIE); add_taint(TAINT_DIE);
dik_show_trace((unsigned long *)(regs+1)); dik_show_trace((unsigned long *)(regs+1));
...@@ -646,7 +646,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg, ...@@ -646,7 +646,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
lock_kernel(); lock_kernel();
printk("%s(%d): unhandled unaligned exception\n", 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", printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx\n",
pc, una_reg(26), regs->ps); pc, una_reg(26), regs->ps);
...@@ -786,7 +786,7 @@ do_entUnaUser(void __user * va, unsigned long opcode, ...@@ -786,7 +786,7 @@ do_entUnaUser(void __user * va, unsigned long opcode,
} }
if (++cnt < 5) { if (++cnt < 5) {
printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n", 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); regs->pc - 4, va, opcode, reg);
} }
last_time = jiffies; last_time = jiffies;
......
...@@ -194,7 +194,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr, ...@@ -194,7 +194,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
goto survive; goto survive;
} }
printk(KERN_ALERT "VM: killing process %s(%d)\n", printk(KERN_ALERT "VM: killing process %s(%d)\n",
current->comm, current->pid); current->comm, task_pid_nr(current));
if (!user_mode(regs)) if (!user_mode(regs))
goto no_context; goto no_context;
do_group_exit(SIGKILL); do_group_exit(SIGKILL);
......
...@@ -265,7 +265,7 @@ void __show_regs(struct pt_regs *regs) ...@@ -265,7 +265,7 @@ void __show_regs(struct pt_regs *regs)
void show_regs(struct pt_regs * regs) void show_regs(struct pt_regs * regs)
{ {
printk("\n"); 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); __show_regs(regs);
__backtrace(); __backtrace();
} }
......
...@@ -382,16 +382,16 @@ static void clear_breakpoint(struct task_struct *task, struct debug_entry *bp) ...@@ -382,16 +382,16 @@ static void clear_breakpoint(struct task_struct *task, struct debug_entry *bp)
if (ret != 2 || old_insn.thumb != BREAKINST_THUMB) if (ret != 2 || old_insn.thumb != BREAKINST_THUMB)
printk(KERN_ERR "%s:%d: corrupted Thumb breakpoint at " printk(KERN_ERR "%s:%d: corrupted Thumb breakpoint at "
"0x%08lx (0x%04x)\n", task->comm, task->pid, "0x%08lx (0x%04x)\n", task->comm,
addr, old_insn.thumb); task_pid_nr(task), addr, old_insn.thumb);
} else { } else {
ret = swap_insn(task, addr & ~3, &old_insn.arm, ret = swap_insn(task, addr & ~3, &old_insn.arm,
&bp->insn.arm, 4); &bp->insn.arm, 4);
if (ret != 4 || old_insn.arm != BREAKINST_ARM) if (ret != 4 || old_insn.arm != BREAKINST_ARM)
printk(KERN_ERR "%s:%d: corrupted ARM breakpoint at " printk(KERN_ERR "%s:%d: corrupted ARM breakpoint at "
"0x%08lx (0x%08x)\n", task->comm, task->pid, "0x%08lx (0x%08x)\n", task->comm,
addr, old_insn.arm); task_pid_nr(task), addr, old_insn.arm);
} }
} }
......
...@@ -223,7 +223,7 @@ static void __die(const char *str, int err, struct thread_info *thread, struct p ...@@ -223,7 +223,7 @@ static void __die(const char *str, int err, struct thread_info *thread, struct p
print_modules(); print_modules();
__show_regs(regs); __show_regs(regs);
printk("Process %s (pid: %d, stack limit = 0x%p)\n", 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()) { if (!user_mode(regs) || in_interrupt()) {
dump_mem("Stack: ", regs->ARM_sp, dump_mem("Stack: ", regs->ARM_sp,
...@@ -337,7 +337,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs) ...@@ -337,7 +337,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
#ifdef CONFIG_DEBUG_USER #ifdef CONFIG_DEBUG_USER
if (user_debug & UDBG_UNDEFINED) { if (user_debug & UDBG_UNDEFINED) {
printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n", 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); dump_instr(regs);
} }
#endif #endif
...@@ -388,7 +388,7 @@ static int bad_syscall(int n, struct pt_regs *regs) ...@@ -388,7 +388,7 @@ static int bad_syscall(int n, struct pt_regs *regs)
#ifdef CONFIG_DEBUG_USER #ifdef CONFIG_DEBUG_USER
if (user_debug & UDBG_SYSCALL) { if (user_debug & UDBG_SYSCALL) {
printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n", 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); dump_instr(regs);
} }
#endif #endif
...@@ -565,7 +565,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) ...@@ -565,7 +565,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
*/ */
if (user_debug & UDBG_SYSCALL) { if (user_debug & UDBG_SYSCALL) {
printk("[%d] %s: arm syscall %d\n", printk("[%d] %s: arm syscall %d\n",
current->pid, current->comm, no); task_pid_nr(current), current->comm, no);
dump_instr(regs); dump_instr(regs);
if (user_mode(regs)) { if (user_mode(regs)) {
__show_regs(regs); __show_regs(regs);
...@@ -642,7 +642,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs) ...@@ -642,7 +642,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
#ifdef CONFIG_DEBUG_USER #ifdef CONFIG_DEBUG_USER
if (user_debug & UDBG_BADABORT) { if (user_debug & UDBG_BADABORT) {
printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n", 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); dump_instr(regs);
show_pte(current->mm, addr); show_pte(current->mm, addr);
} }
......
...@@ -757,7 +757,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) ...@@ -757,7 +757,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
if (ai_usermode & 1) if (ai_usermode & 1)
printk("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%0*lx " printk("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%0*lx "
"Address=0x%08lx FSR 0x%03x\n", current->comm, "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) ? 4 : 8,
thumb_mode(regs) ? tinstr : instr, thumb_mode(regs) ? tinstr : instr,
addr, fsr); addr, fsr);
......
...@@ -773,7 +773,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro ...@@ -773,7 +773,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
if (flags & MAP_SHARED) if (flags & MAP_SHARED)
printk(KERN_INFO printk(KERN_INFO
"%s(%d): emulate_mmap() can't share head (addr=0x%lx)\n", "%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, ret = mmap_subpage(file, start, min(PAGE_ALIGN(start), end), prot, flags,
off); off);
if (IS_ERR((void *) ret)) if (IS_ERR((void *) ret))
...@@ -786,7 +786,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro ...@@ -786,7 +786,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
if (flags & MAP_SHARED) if (flags & MAP_SHARED)
printk(KERN_INFO printk(KERN_INFO
"%s(%d): emulate_mmap() can't share tail (end=0x%lx)\n", "%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, ret = mmap_subpage(file, max(start, PAGE_START(end)), end, prot, flags,
(off + len) - offset_in_page(end)); (off + len) - offset_in_page(end));
if (IS_ERR((void *) ret)) if (IS_ERR((void *) ret))
...@@ -816,7 +816,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro ...@@ -816,7 +816,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
if ((flags & MAP_SHARED) && !is_congruent) if ((flags & MAP_SHARED) && !is_congruent)
printk(KERN_INFO "%s(%d): emulate_mmap() can't share contents of incongruent mmap " 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, DBG("mmap_body: mapping [0x%lx-0x%lx) %s with poff 0x%llx\n", pstart, pend,
is_congruent ? "congruent" : "not congruent", poff); is_congruent ? "congruent" : "not congruent", poff);
......
...@@ -158,14 +158,14 @@ ...@@ -158,14 +158,14 @@
*/ */
#define PROTECT_CTX(c, f) \ #define PROTECT_CTX(c, f) \
do { \ do { \
DPRINT(("spinlock_irq_save ctx %p by [%d]\n", c, current->pid)); \ DPRINT(("spinlock_irq_save ctx %p by [%d]\n", c, task_pid_nr(current))); \
spin_lock_irqsave(&(c)->ctx_lock, f); \ spin_lock_irqsave(&(c)->ctx_lock, f); \
DPRINT(("spinlocked ctx %p by [%d]\n", c, current->pid)); \ DPRINT(("spinlocked ctx %p by [%d]\n", c, task_pid_nr(current))); \
} while(0) } while(0)
#define UNPROTECT_CTX(c, f) \ #define UNPROTECT_CTX(c, f) \
do { \ do { \
DPRINT(("spinlock_irq_restore ctx %p by [%d]\n", c, current->pid)); \ DPRINT(("spinlock_irq_restore ctx %p by [%d]\n", c, task_pid_nr(current))); \
spin_unlock_irqrestore(&(c)->ctx_lock, f); \ spin_unlock_irqrestore(&(c)->ctx_lock, f); \
} while(0) } while(0)
...@@ -227,12 +227,12 @@ ...@@ -227,12 +227,12 @@
#ifdef PFM_DEBUGGING #ifdef PFM_DEBUGGING
#define DPRINT(a) \ #define DPRINT(a) \
do { \ do { \
if (unlikely(pfm_sysctl.debug >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), current->pid); printk a; } \ if (unlikely(pfm_sysctl.debug >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), task_pid_nr(current)); printk a; } \
} while (0) } while (0)
#define DPRINT_ovfl(a) \ #define DPRINT_ovfl(a) \
do { \ do { \
if (unlikely(pfm_sysctl.debug > 0 && pfm_sysctl.debug_ovfl >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), current->pid); printk a; } \ if (unlikely(pfm_sysctl.debug > 0 && pfm_sysctl.debug_ovfl >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), task_pid_nr(current)); printk a; } \
} while (0) } while (0)
#endif #endif
...@@ -913,7 +913,7 @@ pfm_mask_monitoring(struct task_struct *task) ...@@ -913,7 +913,7 @@ pfm_mask_monitoring(struct task_struct *task)
unsigned long mask, val, ovfl_mask; unsigned long mask, val, ovfl_mask;
int i; int i;
DPRINT_ovfl(("masking monitoring for [%d]\n", task->pid)); DPRINT_ovfl(("masking monitoring for [%d]\n", task_pid_nr(task)));
ovfl_mask = pmu_conf->ovfl_val; ovfl_mask = pmu_conf->ovfl_val;
/* /*
...@@ -992,12 +992,12 @@ pfm_restore_monitoring(struct task_struct *task) ...@@ -992,12 +992,12 @@ pfm_restore_monitoring(struct task_struct *task)
ovfl_mask = pmu_conf->ovfl_val; ovfl_mask = pmu_conf->ovfl_val;
if (task != current) { if (task != current) {
printk(KERN_ERR "perfmon.%d: invalid task[%d] current[%d]\n", __LINE__, task->pid, current->pid); printk(KERN_ERR "perfmon.%d: invalid task[%d] current[%d]\n", __LINE__, task_pid_nr(task), task_pid_nr(current));
return; return;
} }
if (ctx->ctx_state != PFM_CTX_MASKED) { if (ctx->ctx_state != PFM_CTX_MASKED) {
printk(KERN_ERR "perfmon.%d: task[%d] current[%d] invalid state=%d\n", __LINE__, printk(KERN_ERR "perfmon.%d: task[%d] current[%d] invalid state=%d\n", __LINE__,
task->pid, current->pid, ctx->ctx_state); task_pid_nr(task), task_pid_nr(current), ctx->ctx_state);
return; return;
} }
psr = pfm_get_psr(); psr = pfm_get_psr();
...@@ -1051,7 +1051,8 @@ pfm_restore_monitoring(struct task_struct *task) ...@@ -1051,7 +1051,8 @@ pfm_restore_monitoring(struct task_struct *task)
if ((mask & 0x1) == 0UL) continue; if ((mask & 0x1) == 0UL) continue;
ctx->th_pmcs[i] = ctx->ctx_pmcs[i]; ctx->th_pmcs[i] = ctx->ctx_pmcs[i];
ia64_set_pmc(i, ctx->th_pmcs[i]); ia64_set_pmc(i, ctx->th_pmcs[i]);
DPRINT(("[%d] pmc[%d]=0x%lx\n", task->pid, i, ctx->th_pmcs[i])); DPRINT(("[%d] pmc[%d]=0x%lx\n",
task_pid_nr(task), i, ctx->th_pmcs[i]));
} }
ia64_srlz_d(); ia64_srlz_d();
...@@ -1370,7 +1371,7 @@ pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu) ...@@ -1370,7 +1371,7 @@ pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)
error_conflict: error_conflict:
DPRINT(("system wide not possible, conflicting session [%d] on CPU%d\n", DPRINT(("system wide not possible, conflicting session [%d] on CPU%d\n",
pfm_sessions.pfs_sys_session[cpu]->pid, task_pid_nr(pfm_sessions.pfs_sys_session[cpu]),
cpu)); cpu));
abort: abort:
UNLOCK_PFS(flags); UNLOCK_PFS(flags);
...@@ -1442,7 +1443,7 @@ pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long siz ...@@ -1442,7 +1443,7 @@ pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long siz
/* sanity checks */ /* sanity checks */
if (task->mm == NULL || size == 0UL || vaddr == NULL) { if (task->mm == NULL || size == 0UL || vaddr == NULL) {
printk(KERN_ERR "perfmon: pfm_remove_smpl_mapping [%d] invalid context mm=%p\n", task->pid, task->mm); printk(KERN_ERR "perfmon: pfm_remove_smpl_mapping [%d] invalid context mm=%p\n", task_pid_nr(task), task->mm);
return -EINVAL; return -EINVAL;
} }
...@@ -1459,7 +1460,7 @@ pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long siz ...@@ -1459,7 +1460,7 @@ pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long siz
up_write(&task->mm->mmap_sem); up_write(&task->mm->mmap_sem);
if (r !=0) { if (r !=0) {
printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task->pid, vaddr, size); printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size);
} }
DPRINT(("do_unmap(%p, %lu)=%d\n", vaddr, size, r)); DPRINT(("do_unmap(%p, %lu)=%d\n", vaddr, size, r));
...@@ -1501,7 +1502,7 @@ pfm_free_smpl_buffer(pfm_context_t *ctx) ...@@ -1501,7 +1502,7 @@ pfm_free_smpl_buffer(pfm_context_t *ctx)
return 0; return 0;
invalid_free: invalid_free:
printk(KERN_ERR "perfmon: pfm_free_smpl_buffer [%d] no buffer\n", current->pid); printk(KERN_ERR "perfmon: pfm_free_smpl_buffer [%d] no buffer\n", task_pid_nr(current));
return -EINVAL; return -EINVAL;
} }
#endif #endif
...@@ -1547,13 +1548,13 @@ pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos) ...@@ -1547,13 +1548,13 @@ pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos)
unsigned long flags; unsigned long flags;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
if (PFM_IS_FILE(filp) == 0) { if (PFM_IS_FILE(filp) == 0) {
printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", current->pid); printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", task_pid_nr(current));
return -EINVAL; return -EINVAL;
} }
ctx = (pfm_context_t *)filp->private_data; ctx = (pfm_context_t *)filp->private_data;
if (ctx == NULL) { if (ctx == NULL) {
printk(KERN_ERR "perfmon: pfm_read: NULL ctx [%d]\n", current->pid); printk(KERN_ERR "perfmon: pfm_read: NULL ctx [%d]\n", task_pid_nr(current));
return -EINVAL; return -EINVAL;
} }
...@@ -1607,7 +1608,7 @@ pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos) ...@@ -1607,7 +1608,7 @@ pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos)
PROTECT_CTX(ctx, flags); PROTECT_CTX(ctx, flags);
} }
DPRINT(("[%d] back to running ret=%ld\n", current->pid, ret)); DPRINT(("[%d] back to running ret=%ld\n", task_pid_nr(current), ret));
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&ctx->ctx_msgq_wait, &wait); remove_wait_queue(&ctx->ctx_msgq_wait, &wait);
...@@ -1616,7 +1617,7 @@ pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos) ...@@ -1616,7 +1617,7 @@ pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos)
ret = -EINVAL; ret = -EINVAL;
msg = pfm_get_next_msg(ctx); msg = pfm_get_next_msg(ctx);
if (msg == NULL) { if (msg == NULL) {
printk(KERN_ERR "perfmon: pfm_read no msg for ctx=%p [%d]\n", ctx, current->pid); printk(KERN_ERR "perfmon: pfm_read no msg for ctx=%p [%d]\n", ctx, task_pid_nr(current));
goto abort_locked; goto abort_locked;
} }
...@@ -1647,13 +1648,13 @@ pfm_poll(struct file *filp, poll_table * wait) ...@@ -1647,13 +1648,13 @@ pfm_poll(struct file *filp, poll_table * wait)
unsigned int mask = 0; unsigned int mask = 0;
if (PFM_IS_FILE(filp) == 0) { if (PFM_IS_FILE(filp) == 0) {
printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", current->pid); printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", task_pid_nr(current));
return 0; return 0;
} }
ctx = (pfm_context_t *)filp->private_data; ctx = (pfm_context_t *)filp->private_data;
if (ctx == NULL) { if (ctx == NULL) {
printk(KERN_ERR "perfmon: pfm_poll: NULL ctx [%d]\n", current->pid); printk(KERN_ERR "perfmon: pfm_poll: NULL ctx [%d]\n", task_pid_nr(current));
return 0; return 0;
} }
...@@ -1692,7 +1693,7 @@ pfm_do_fasync(int fd, struct file *filp, pfm_context_t *ctx, int on) ...@@ -1692,7 +1693,7 @@ pfm_do_fasync(int fd, struct file *filp, pfm_context_t *ctx, int on)
ret = fasync_helper (fd, filp, on, &ctx->ctx_async_queue); ret = fasync_helper (fd, filp, on, &ctx->ctx_async_queue);
DPRINT(("pfm_fasync called by [%d] on ctx_fd=%d on=%d async_queue=%p ret=%d\n", DPRINT(("pfm_fasync called by [%d] on ctx_fd=%d on=%d async_queue=%p ret=%d\n",
current->pid, task_pid_nr(current),
fd, fd,
on, on,
ctx->ctx_async_queue, ret)); ctx->ctx_async_queue, ret));
...@@ -1707,13 +1708,13 @@ pfm_fasync(int fd, struct file *filp, int on) ...@@ -1707,13 +1708,13 @@ pfm_fasync(int fd, struct file *filp, int on)
int ret; int ret;
if (PFM_IS_FILE(filp) == 0) { if (PFM_IS_FILE(filp) == 0) {
printk(KERN_ERR "perfmon: pfm_fasync bad magic [%d]\n", current->pid); printk(KERN_ERR "perfmon: pfm_fasync bad magic [%d]\n", task_pid_nr(current));
return -EBADF; return -EBADF;
} }
ctx = (pfm_context_t *)filp->private_data; ctx = (pfm_context_t *)filp->private_data;
if (ctx == NULL) { if (ctx == NULL) {
printk(KERN_ERR "perfmon: pfm_fasync NULL ctx [%d]\n", current->pid); printk(KERN_ERR "perfmon: pfm_fasync NULL ctx [%d]\n", task_pid_nr(current));
return -EBADF; return -EBADF;
} }
/* /*
...@@ -1759,7 +1760,7 @@ pfm_syswide_force_stop(void *info) ...@@ -1759,7 +1760,7 @@ pfm_syswide_force_stop(void *info)
if (owner != ctx->ctx_task) { if (owner != ctx->ctx_task) {
printk(KERN_ERR "perfmon: pfm_syswide_force_stop CPU%d unexpected owner [%d] instead of [%d]\n", printk(KERN_ERR "perfmon: pfm_syswide_force_stop CPU%d unexpected owner [%d] instead of [%d]\n",
smp_processor_id(), smp_processor_id(),
owner->pid, ctx->ctx_task->pid); task_pid_nr(owner), task_pid_nr(ctx->ctx_task));
return; return;
} }
if (GET_PMU_CTX() != ctx) { if (GET_PMU_CTX() != ctx) {
...@@ -1769,7 +1770,7 @@ pfm_syswide_force_stop(void *info) ...@@ -1769,7 +1770,7 @@ pfm_syswide_force_stop(void *info)
return; return;
} }
DPRINT(("on CPU%d forcing system wide stop for [%d]\n", smp_processor_id(), ctx->ctx_task->pid)); DPRINT(("on CPU%d forcing system wide stop for [%d]\n", smp_processor_id(), task_pid_nr(ctx->ctx_task)));
/* /*
* the context is already protected in pfm_close(), we simply * the context is already protected in pfm_close(), we simply
* need to mask interrupts to avoid a PMU interrupt race on * need to mask interrupts to avoid a PMU interrupt race on
...@@ -1821,7 +1822,7 @@ pfm_flush(struct file *filp, fl_owner_t id) ...@@ -1821,7 +1822,7 @@ pfm_flush(struct file *filp, fl_owner_t id)
ctx = (pfm_context_t *)filp->private_data; ctx = (pfm_context_t *)filp->private_data;
if (ctx == NULL) { if (ctx == NULL) {
printk(KERN_ERR "perfmon: pfm_flush: NULL ctx [%d]\n", current->pid); printk(KERN_ERR "perfmon: pfm_flush: NULL ctx [%d]\n", task_pid_nr(current));
return -EBADF; return -EBADF;
} }
...@@ -1969,7 +1970,7 @@ pfm_close(struct inode *inode, struct file *filp) ...@@ -1969,7 +1970,7 @@ pfm_close(struct inode *inode, struct file *filp)
ctx = (pfm_context_t *)filp->private_data; ctx = (pfm_context_t *)filp->private_data;
if (ctx == NULL) { if (ctx == NULL) {
printk(KERN_ERR "perfmon: pfm_close: NULL ctx [%d]\n", current->pid); printk(KERN_ERR "perfmon: pfm_close: NULL ctx [%d]\n", task_pid_nr(current));
return -EBADF; return -EBADF;
} }
...@@ -2066,7 +2067,7 @@ pfm_close(struct inode *inode, struct file *filp) ...@@ -2066,7 +2067,7 @@ pfm_close(struct inode *inode, struct file *filp)
*/ */
ctx->ctx_state = PFM_CTX_ZOMBIE; ctx->ctx_state = PFM_CTX_ZOMBIE;
DPRINT(("zombie ctx for [%d]\n", task->pid)); DPRINT(("zombie ctx for [%d]\n", task_pid_nr(task)));
/* /*
* cannot free the context on the spot. deferred until * cannot free the context on the spot. deferred until
* the task notices the ZOMBIE state * the task notices the ZOMBIE state
...@@ -2472,7 +2473,7 @@ pfm_setup_buffer_fmt(struct task_struct *task, struct file *filp, pfm_context_t ...@@ -2472,7 +2473,7 @@ pfm_setup_buffer_fmt(struct task_struct *task, struct file *filp, pfm_context_t
/* invoke and lock buffer format, if found */ /* invoke and lock buffer format, if found */
fmt = pfm_find_buffer_fmt(arg->ctx_smpl_buf_id); fmt = pfm_find_buffer_fmt(arg->ctx_smpl_buf_id);
if (fmt == NULL) { if (fmt == NULL) {
DPRINT(("[%d] cannot find buffer format\n", task->pid)); DPRINT(("[%d] cannot find buffer format\n", task_pid_nr(task)));
return -EINVAL; return -EINVAL;
} }
...@@ -2483,7 +2484,7 @@ pfm_setup_buffer_fmt(struct task_struct *task, struct file *filp, pfm_context_t ...@@ -2483,7 +2484,7 @@ pfm_setup_buffer_fmt(struct task_struct *task, struct file *filp, pfm_context_t
ret = pfm_buf_fmt_validate(fmt, task, ctx_flags, cpu, fmt_arg); ret = pfm_buf_fmt_validate(fmt, task, ctx_flags, cpu, fmt_arg);
DPRINT(("[%d] after validate(0x%x,%d,%p)=%d\n", task->pid, ctx_flags, cpu, fmt_arg, ret)); DPRINT(("[%d] after validate(0x%x,%d,%p)=%d\n", task_pid_nr(task), ctx_flags, cpu, fmt_arg, ret));
if (ret) goto error; if (ret) goto error;
...@@ -2605,23 +2606,23 @@ pfm_task_incompatible(pfm_context_t *ctx, struct task_struct *task) ...@@ -2605,23 +2606,23 @@ pfm_task_incompatible(pfm_context_t *ctx, struct task_struct *task)
* no kernel task or task not owner by caller * no kernel task or task not owner by caller
*/ */
if (task->mm == NULL) { if (task->mm == NULL) {
DPRINT(("task [%d] has not memory context (kernel thread)\n", task->pid)); DPRINT(("task [%d] has not memory context (kernel thread)\n", task_pid_nr(task)));
return -EPERM; return -EPERM;
} }
if (pfm_bad_permissions(task)) { if (pfm_bad_permissions(task)) {
DPRINT(("no permission to attach to [%d]\n", task->pid)); DPRINT(("no permission to attach to [%d]\n", task_pid_nr(task)));
return -EPERM; return -EPERM;
} }
/* /*
* cannot block in self-monitoring mode * cannot block in self-monitoring mode
*/ */
if (CTX_OVFL_NOBLOCK(ctx) == 0 && task == current) { if (CTX_OVFL_NOBLOCK(ctx) == 0 && task == current) {
DPRINT(("cannot load a blocking context on self for [%d]\n", task->pid)); DPRINT(("cannot load a blocking context on self for [%d]\n", task_pid_nr(task)));
return -EINVAL; return -EINVAL;
} }
if (task->exit_state == EXIT_ZOMBIE) { if (task->exit_state == EXIT_ZOMBIE) {
DPRINT(("cannot attach to zombie task [%d]\n", task->pid)); DPRINT(("cannot attach to zombie task [%d]\n", task_pid_nr(task)));
return -EBUSY; return -EBUSY;
} }
...@@ -2631,7 +2632,7 @@ pfm_task_incompatible(pfm_context_t *ctx, struct task_struct *task) ...@@ -2631,7 +2632,7 @@ pfm_task_incompatible(pfm_context_t *ctx, struct task_struct *task)
if (task == current) return 0; if (task == current) return 0;
if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) { if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) {
DPRINT(("cannot attach to non-stopped task [%d] state=%ld\n", task->pid, task->state)); DPRINT(("cannot attach to non-stopped task [%d] state=%ld\n", task_pid_nr(task), task->state));
return -EBUSY; return -EBUSY;
} }
/* /*
...@@ -3512,7 +3513,7 @@ pfm_use_debug_registers(struct task_struct *task) ...@@ -3512,7 +3513,7 @@ pfm_use_debug_registers(struct task_struct *task)
if (pmu_conf->use_rr_dbregs == 0) return 0; if (pmu_conf->use_rr_dbregs == 0) return 0;
DPRINT(("called for [%d]\n", task->pid)); DPRINT(("called for [%d]\n", task_pid_nr(task)));
/* /*
* do it only once * do it only once
...@@ -3543,7 +3544,7 @@ pfm_use_debug_registers(struct task_struct *task) ...@@ -3543,7 +3544,7 @@ pfm_use_debug_registers(struct task_struct *task)
DPRINT(("ptrace_use_dbregs=%u sys_use_dbregs=%u by [%d] ret = %d\n", DPRINT(("ptrace_use_dbregs=%u sys_use_dbregs=%u by [%d] ret = %d\n",
pfm_sessions.pfs_ptrace_use_dbregs, pfm_sessions.pfs_ptrace_use_dbregs,
pfm_sessions.pfs_sys_use_dbregs, pfm_sessions.pfs_sys_use_dbregs,
task->pid, ret)); task_pid_nr(task), ret));
UNLOCK_PFS(flags); UNLOCK_PFS(flags);
...@@ -3568,7 +3569,7 @@ pfm_release_debug_registers(struct task_struct *task) ...@@ -3568,7 +3569,7 @@ pfm_release_debug_registers(struct task_struct *task)
LOCK_PFS(flags); LOCK_PFS(flags);
if (pfm_sessions.pfs_ptrace_use_dbregs == 0) { if (pfm_sessions.pfs_ptrace_use_dbregs == 0) {
printk(KERN_ERR "perfmon: invalid release for [%d] ptrace_use_dbregs=0\n", task->pid); printk(KERN_ERR "perfmon: invalid release for [%d] ptrace_use_dbregs=0\n", task_pid_nr(task));
ret = -1; ret = -1;
} else { } else {
pfm_sessions.pfs_ptrace_use_dbregs--; pfm_sessions.pfs_ptrace_use_dbregs--;
...@@ -3620,7 +3621,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs) ...@@ -3620,7 +3621,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
/* sanity check */ /* sanity check */
if (unlikely(task == NULL)) { if (unlikely(task == NULL)) {
printk(KERN_ERR "perfmon: [%d] pfm_restart no task\n", current->pid); printk(KERN_ERR "perfmon: [%d] pfm_restart no task\n", task_pid_nr(current));
return -EINVAL; return -EINVAL;
} }
...@@ -3629,7 +3630,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs) ...@@ -3629,7 +3630,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
fmt = ctx->ctx_buf_fmt; fmt = ctx->ctx_buf_fmt;
DPRINT(("restarting self %d ovfl=0x%lx\n", DPRINT(("restarting self %d ovfl=0x%lx\n",
task->pid, task_pid_nr(task),
ctx->ctx_ovfl_regs[0])); ctx->ctx_ovfl_regs[0]));
if (CTX_HAS_SMPL(ctx)) { if (CTX_HAS_SMPL(ctx)) {
...@@ -3653,11 +3654,11 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs) ...@@ -3653,11 +3654,11 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
pfm_reset_regs(ctx, ctx->ctx_ovfl_regs, PFM_PMD_LONG_RESET); pfm_reset_regs(ctx, ctx->ctx_ovfl_regs, PFM_PMD_LONG_RESET);
if (rst_ctrl.bits.mask_monitoring == 0) { if (rst_ctrl.bits.mask_monitoring == 0) {
DPRINT(("resuming monitoring for [%d]\n", task->pid)); DPRINT(("resuming monitoring for [%d]\n", task_pid_nr(task)));
if (state == PFM_CTX_MASKED) pfm_restore_monitoring(task); if (state == PFM_CTX_MASKED) pfm_restore_monitoring(task);
} else { } else {
DPRINT(("keeping monitoring stopped for [%d]\n", task->pid)); DPRINT(("keeping monitoring stopped for [%d]\n", task_pid_nr(task)));
// cannot use pfm_stop_monitoring(task, regs); // cannot use pfm_stop_monitoring(task, regs);
} }
...@@ -3714,10 +3715,10 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs) ...@@ -3714,10 +3715,10 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
* "self-monitoring". * "self-monitoring".
*/ */
if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) { if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) {
DPRINT(("unblocking [%d] \n", task->pid)); DPRINT(("unblocking [%d] \n", task_pid_nr(task)));
complete(&ctx->ctx_restart_done); complete(&ctx->ctx_restart_done);
} else { } else {
DPRINT(("[%d] armed exit trap\n", task->pid)); DPRINT(("[%d] armed exit trap\n", task_pid_nr(task)));
ctx->ctx_fl_trap_reason = PFM_TRAP_REASON_RESET; ctx->ctx_fl_trap_reason = PFM_TRAP_REASON_RESET;
...@@ -3805,7 +3806,7 @@ pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_ ...@@ -3805,7 +3806,7 @@ pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_
* don't bother if we are loaded and task is being debugged * don't bother if we are loaded and task is being debugged
*/ */
if (is_loaded && (thread->flags & IA64_THREAD_DBG_VALID) != 0) { if (is_loaded && (thread->flags & IA64_THREAD_DBG_VALID) != 0) {
DPRINT(("debug registers already in use for [%d]\n", task->pid)); DPRINT(("debug registers already in use for [%d]\n", task_pid_nr(task)));
return -EBUSY; return -EBUSY;
} }
...@@ -3846,7 +3847,7 @@ pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_ ...@@ -3846,7 +3847,7 @@ pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_
* is shared by all processes running on it * is shared by all processes running on it
*/ */
if (first_time && can_access_pmu) { if (first_time && can_access_pmu) {
DPRINT(("[%d] clearing ibrs, dbrs\n", task->pid)); DPRINT(("[%d] clearing ibrs, dbrs\n", task_pid_nr(task)));
for (i=0; i < pmu_conf->num_ibrs; i++) { for (i=0; i < pmu_conf->num_ibrs; i++) {
ia64_set_ibr(i, 0UL); ia64_set_ibr(i, 0UL);
ia64_dv_serialize_instruction(); ia64_dv_serialize_instruction();
...@@ -4035,7 +4036,7 @@ pfm_stop(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs) ...@@ -4035,7 +4036,7 @@ pfm_stop(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
return -EBUSY; return -EBUSY;
} }
DPRINT(("task [%d] ctx_state=%d is_system=%d\n", DPRINT(("task [%d] ctx_state=%d is_system=%d\n",
PFM_CTX_TASK(ctx)->pid, task_pid_nr(PFM_CTX_TASK(ctx)),
state, state,
is_system)); is_system));
/* /*
...@@ -4093,7 +4094,7 @@ pfm_stop(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs) ...@@ -4093,7 +4094,7 @@ pfm_stop(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
* monitoring disabled in kernel at next reschedule * monitoring disabled in kernel at next reschedule
*/ */
ctx->ctx_saved_psr_up = 0; ctx->ctx_saved_psr_up = 0;
DPRINT(("task=[%d]\n", task->pid)); DPRINT(("task=[%d]\n", task_pid_nr(task)));
} }
return 0; return 0;
} }
...@@ -4298,11 +4299,12 @@ pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs) ...@@ -4298,11 +4299,12 @@ pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
if (is_system) { if (is_system) {
if (pfm_sessions.pfs_ptrace_use_dbregs) { if (pfm_sessions.pfs_ptrace_use_dbregs) {
DPRINT(("cannot load [%d] dbregs in use\n", task->pid)); DPRINT(("cannot load [%d] dbregs in use\n",
task_pid_nr(task)));
ret = -EBUSY; ret = -EBUSY;
} else { } else {
pfm_sessions.pfs_sys_use_dbregs++; pfm_sessions.pfs_sys_use_dbregs++;
DPRINT(("load [%d] increased sys_use_dbreg=%u\n", task->pid, pfm_sessions.pfs_sys_use_dbregs)); DPRINT(("load [%d] increased sys_use_dbreg=%u\n", task_pid_nr(task), pfm_sessions.pfs_sys_use_dbregs));
set_dbregs = 1; set_dbregs = 1;
} }
} }
...@@ -4394,7 +4396,7 @@ pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs) ...@@ -4394,7 +4396,7 @@ pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
/* allow user level control */ /* allow user level control */
ia64_psr(regs)->sp = 0; ia64_psr(regs)->sp = 0;
DPRINT(("clearing psr.sp for [%d]\n", task->pid)); DPRINT(("clearing psr.sp for [%d]\n", task_pid_nr(task)));
SET_LAST_CPU(ctx, smp_processor_id()); SET_LAST_CPU(ctx, smp_processor_id());
INC_ACTIVATION(); INC_ACTIVATION();
...@@ -4429,7 +4431,7 @@ pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs) ...@@ -4429,7 +4431,7 @@ pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
*/ */
SET_PMU_OWNER(task, ctx); SET_PMU_OWNER(task, ctx);
DPRINT(("context loaded on PMU for [%d]\n", task->pid)); DPRINT(("context loaded on PMU for [%d]\n", task_pid_nr(task)));
} else { } else {
/* /*
* when not current, task MUST be stopped, so this is safe * when not current, task MUST be stopped, so this is safe
...@@ -4493,7 +4495,7 @@ pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg ...@@ -4493,7 +4495,7 @@ pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
int prev_state, is_system; int prev_state, is_system;
int ret; int ret;
DPRINT(("ctx_state=%d task [%d]\n", ctx->ctx_state, task ? task->pid : -1)); DPRINT(("ctx_state=%d task [%d]\n", ctx->ctx_state, task ? task_pid_nr(task) : -1));
prev_state = ctx->ctx_state; prev_state = ctx->ctx_state;
is_system = ctx->ctx_fl_system; is_system = ctx->ctx_fl_system;
...@@ -4568,7 +4570,7 @@ pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg ...@@ -4568,7 +4570,7 @@ pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
*/ */
ia64_psr(regs)->sp = 1; ia64_psr(regs)->sp = 1;
DPRINT(("setting psr.sp for [%d]\n", task->pid)); DPRINT(("setting psr.sp for [%d]\n", task_pid_nr(task)));
} }
/* /*
* save PMDs to context * save PMDs to context
...@@ -4608,7 +4610,7 @@ pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg ...@@ -4608,7 +4610,7 @@ pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
ctx->ctx_fl_can_restart = 0; ctx->ctx_fl_can_restart = 0;
ctx->ctx_fl_going_zombie = 0; ctx->ctx_fl_going_zombie = 0;
DPRINT(("disconnected [%d] from context\n", task->pid)); DPRINT(("disconnected [%d] from context\n", task_pid_nr(task)));
return 0; return 0;
} }
...@@ -4631,7 +4633,7 @@ pfm_exit_thread(struct task_struct *task) ...@@ -4631,7 +4633,7 @@ pfm_exit_thread(struct task_struct *task)
PROTECT_CTX(ctx, flags); PROTECT_CTX(ctx, flags);
DPRINT(("state=%d task [%d]\n", ctx->ctx_state, task->pid)); DPRINT(("state=%d task [%d]\n", ctx->ctx_state, task_pid_nr(task)));
state = ctx->ctx_state; state = ctx->ctx_state;
switch(state) { switch(state) {
...@@ -4640,13 +4642,13 @@ pfm_exit_thread(struct task_struct *task) ...@@ -4640,13 +4642,13 @@ pfm_exit_thread(struct task_struct *task)
* only comes to this function if pfm_context is not NULL, i.e., cannot * only comes to this function if pfm_context is not NULL, i.e., cannot
* be in unloaded state * be in unloaded state
*/ */
printk(KERN_ERR "perfmon: pfm_exit_thread [%d] ctx unloaded\n", task->pid); printk(KERN_ERR "perfmon: pfm_exit_thread [%d] ctx unloaded\n", task_pid_nr(task));
break; break;
case PFM_CTX_LOADED: case PFM_CTX_LOADED:
case PFM_CTX_MASKED: case PFM_CTX_MASKED:
ret = pfm_context_unload(ctx, NULL, 0, regs); ret = pfm_context_unload(ctx, NULL, 0, regs);
if (ret) { if (ret) {
printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task->pid, state, ret); printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task_pid_nr(task), state, ret);
} }
DPRINT(("ctx unloaded for current state was %d\n", state)); DPRINT(("ctx unloaded for current state was %d\n", state));
...@@ -4655,12 +4657,12 @@ pfm_exit_thread(struct task_struct *task) ...@@ -4655,12 +4657,12 @@ pfm_exit_thread(struct task_struct *task)
case PFM_CTX_ZOMBIE: case PFM_CTX_ZOMBIE:
ret = pfm_context_unload(ctx, NULL, 0, regs); ret = pfm_context_unload(ctx, NULL, 0, regs);
if (ret) { if (ret) {
printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task->pid, state, ret); printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task_pid_nr(task), state, ret);
} }
free_ok = 1; free_ok = 1;
break; break;
default: default:
printk(KERN_ERR "perfmon: pfm_exit_thread [%d] unexpected state=%d\n", task->pid, state); printk(KERN_ERR "perfmon: pfm_exit_thread [%d] unexpected state=%d\n", task_pid_nr(task), state);
break; break;
} }
UNPROTECT_CTX(ctx, flags); UNPROTECT_CTX(ctx, flags);
...@@ -4744,7 +4746,7 @@ pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags) ...@@ -4744,7 +4746,7 @@ pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags)
DPRINT(("context %d state=%d [%d] task_state=%ld must_stop=%d\n", DPRINT(("context %d state=%d [%d] task_state=%ld must_stop=%d\n",
ctx->ctx_fd, ctx->ctx_fd,
state, state,
task->pid, task_pid_nr(task),
task->state, PFM_CMD_STOPPED(cmd))); task->state, PFM_CMD_STOPPED(cmd)));
/* /*
...@@ -4791,7 +4793,7 @@ pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags) ...@@ -4791,7 +4793,7 @@ pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags)
*/ */
if (PFM_CMD_STOPPED(cmd)) { if (PFM_CMD_STOPPED(cmd)) {
if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) { if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) {
DPRINT(("[%d] task not in stopped state\n", task->pid)); DPRINT(("[%d] task not in stopped state\n", task_pid_nr(task)));
return -EBUSY; return -EBUSY;
} }
/* /*
...@@ -4884,7 +4886,7 @@ sys_perfmonctl (int fd, int cmd, void __user *arg, int count) ...@@ -4884,7 +4886,7 @@ sys_perfmonctl (int fd, int cmd, void __user *arg, int count)
* limit abuse to min page size * limit abuse to min page size
*/ */
if (unlikely(sz > PFM_MAX_ARGSIZE)) { if (unlikely(sz > PFM_MAX_ARGSIZE)) {
printk(KERN_ERR "perfmon: [%d] argument too big %lu\n", current->pid, sz); printk(KERN_ERR "perfmon: [%d] argument too big %lu\n", task_pid_nr(current), sz);
return -E2BIG; return -E2BIG;
} }
...@@ -5031,11 +5033,11 @@ pfm_context_force_terminate(pfm_context_t *ctx, struct pt_regs *regs) ...@@ -5031,11 +5033,11 @@ pfm_context_force_terminate(pfm_context_t *ctx, struct pt_regs *regs)
{ {
int ret; int ret;
DPRINT(("entering for [%d]\n", current->pid)); DPRINT(("entering for [%d]\n", task_pid_nr(current)));
ret = pfm_context_unload(ctx, NULL, 0, regs); ret = pfm_context_unload(ctx, NULL, 0, regs);
if (ret) { if (ret) {
printk(KERN_ERR "pfm_context_force_terminate: [%d] unloaded failed with %d\n", current->pid, ret); printk(KERN_ERR "pfm_context_force_terminate: [%d] unloaded failed with %d\n", task_pid_nr(current), ret);
} }
/* /*
...@@ -5072,7 +5074,7 @@ pfm_handle_work(void) ...@@ -5072,7 +5074,7 @@ pfm_handle_work(void)
ctx = PFM_GET_CTX(current); ctx = PFM_GET_CTX(current);
if (ctx == NULL) { if (ctx == NULL) {
printk(KERN_ERR "perfmon: [%d] has no PFM context\n", current->pid); printk(KERN_ERR "perfmon: [%d] has no PFM context\n", task_pid_nr(current));
return; return;
} }
...@@ -5269,7 +5271,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str ...@@ -5269,7 +5271,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str
DPRINT_ovfl(("pmc0=0x%lx pid=%d iip=0x%lx, %s " DPRINT_ovfl(("pmc0=0x%lx pid=%d iip=0x%lx, %s "
"used_pmds=0x%lx\n", "used_pmds=0x%lx\n",
pmc0, pmc0,
task ? task->pid: -1, task ? task_pid_nr(task): -1,
(regs ? regs->cr_iip : 0), (regs ? regs->cr_iip : 0),
CTX_OVFL_NOBLOCK(ctx) ? "nonblocking" : "blocking", CTX_OVFL_NOBLOCK(ctx) ? "nonblocking" : "blocking",
ctx->ctx_used_pmds[0])); ctx->ctx_used_pmds[0]));
...@@ -5458,7 +5460,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str ...@@ -5458,7 +5460,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str
} }
DPRINT_ovfl(("owner [%d] pending=%ld reason=%u ovfl_pmds=0x%lx ovfl_notify=0x%lx masked=%d\n", DPRINT_ovfl(("owner [%d] pending=%ld reason=%u ovfl_pmds=0x%lx ovfl_notify=0x%lx masked=%d\n",
GET_PMU_OWNER() ? GET_PMU_OWNER()->pid : -1, GET_PMU_OWNER() ? task_pid_nr(GET_PMU_OWNER()) : -1,
PFM_GET_WORK_PENDING(task), PFM_GET_WORK_PENDING(task),
ctx->ctx_fl_trap_reason, ctx->ctx_fl_trap_reason,
ovfl_pmds, ovfl_pmds,
...@@ -5483,7 +5485,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str ...@@ -5483,7 +5485,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str
sanity_check: sanity_check:
printk(KERN_ERR "perfmon: CPU%d overflow handler [%d] pmc0=0x%lx\n", printk(KERN_ERR "perfmon: CPU%d overflow handler [%d] pmc0=0x%lx\n",
smp_processor_id(), smp_processor_id(),
task ? task->pid : -1, task ? task_pid_nr(task) : -1,
pmc0); pmc0);
return; return;
...@@ -5516,7 +5518,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str ...@@ -5516,7 +5518,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str
* *
* Overall pretty hairy stuff.... * Overall pretty hairy stuff....
*/ */
DPRINT(("ctx is zombie for [%d], converted to spurious\n", task ? task->pid: -1)); DPRINT(("ctx is zombie for [%d], converted to spurious\n", task ? task_pid_nr(task): -1));
pfm_clear_psr_up(); pfm_clear_psr_up();
ia64_psr(regs)->up = 0; ia64_psr(regs)->up = 0;
ia64_psr(regs)->sp = 1; ia64_psr(regs)->sp = 1;
...@@ -5577,13 +5579,13 @@ pfm_do_interrupt_handler(int irq, void *arg, struct pt_regs *regs) ...@@ -5577,13 +5579,13 @@ pfm_do_interrupt_handler(int irq, void *arg, struct pt_regs *regs)
report_spurious1: report_spurious1:
printk(KERN_INFO "perfmon: spurious overflow interrupt on CPU%d: process %d has no PFM context\n", printk(KERN_INFO "perfmon: spurious overflow interrupt on CPU%d: process %d has no PFM context\n",
this_cpu, task->pid); this_cpu, task_pid_nr(task));
pfm_unfreeze_pmu(); pfm_unfreeze_pmu();
return -1; return -1;
report_spurious2: report_spurious2:
printk(KERN_INFO "perfmon: spurious overflow interrupt on CPU%d: process %d, invalid flag\n", printk(KERN_INFO "perfmon: spurious overflow interrupt on CPU%d: process %d, invalid flag\n",
this_cpu, this_cpu,
task->pid); task_pid_nr(task));
pfm_unfreeze_pmu(); pfm_unfreeze_pmu();
return -1; return -1;
} }
...@@ -5870,7 +5872,8 @@ pfm_force_cleanup(pfm_context_t *ctx, struct pt_regs *regs) ...@@ -5870,7 +5872,8 @@ pfm_force_cleanup(pfm_context_t *ctx, struct pt_regs *regs)
ia64_psr(regs)->sp = 1; ia64_psr(regs)->sp = 1;
if (GET_PMU_OWNER() == task) { if (GET_PMU_OWNER() == task) {
DPRINT(("cleared ownership for [%d]\n", ctx->ctx_task->pid)); DPRINT(("cleared ownership for [%d]\n",
task_pid_nr(ctx->ctx_task)));
SET_PMU_OWNER(NULL, NULL); SET_PMU_OWNER(NULL, NULL);
} }
...@@ -5882,7 +5885,7 @@ pfm_force_cleanup(pfm_context_t *ctx, struct pt_regs *regs) ...@@ -5882,7 +5885,7 @@ pfm_force_cleanup(pfm_context_t *ctx, struct pt_regs *regs)
task->thread.pfm_context = NULL; task->thread.pfm_context = NULL;
task->thread.flags &= ~IA64_THREAD_PM_VALID; task->thread.flags &= ~IA64_THREAD_PM_VALID;
DPRINT(("force cleanup for [%d]\n", task->pid)); DPRINT(("force cleanup for [%d]\n", task_pid_nr(task)));
} }
...@@ -6426,7 +6429,7 @@ pfm_flush_pmds(struct task_struct *task, pfm_context_t *ctx) ...@@ -6426,7 +6429,7 @@ pfm_flush_pmds(struct task_struct *task, pfm_context_t *ctx)
if (PMD_IS_COUNTING(i)) { if (PMD_IS_COUNTING(i)) {
DPRINT(("[%d] pmd[%d] ctx_pmd=0x%lx hw_pmd=0x%lx\n", DPRINT(("[%d] pmd[%d] ctx_pmd=0x%lx hw_pmd=0x%lx\n",
task->pid, task_pid_nr(task),
i, i,
ctx->ctx_pmds[i].val, ctx->ctx_pmds[i].val,
val & ovfl_val)); val & ovfl_val));
...@@ -6448,11 +6451,11 @@ pfm_flush_pmds(struct task_struct *task, pfm_context_t *ctx) ...@@ -6448,11 +6451,11 @@ pfm_flush_pmds(struct task_struct *task, pfm_context_t *ctx)
*/ */
if (pmc0 & (1UL << i)) { if (pmc0 & (1UL << i)) {
val += 1 + ovfl_val; val += 1 + ovfl_val;
DPRINT(("[%d] pmd[%d] overflowed\n", task->pid, i)); DPRINT(("[%d] pmd[%d] overflowed\n", task_pid_nr(task), i));
} }
} }
DPRINT(("[%d] ctx_pmd[%d]=0x%lx pmd_val=0x%lx\n", task->pid, i, val, pmd_val)); DPRINT(("[%d] ctx_pmd[%d]=0x%lx pmd_val=0x%lx\n", task_pid_nr(task), i, val, pmd_val));
if (is_self) ctx->th_pmds[i] = pmd_val; if (is_self) ctx->th_pmds[i] = pmd_val;
...@@ -6793,14 +6796,14 @@ dump_pmu_state(const char *from) ...@@ -6793,14 +6796,14 @@ dump_pmu_state(const char *from)
printk("CPU%d from %s() current [%d] iip=0x%lx %s\n", printk("CPU%d from %s() current [%d] iip=0x%lx %s\n",
this_cpu, this_cpu,
from, from,
current->pid, task_pid_nr(current),
regs->cr_iip, regs->cr_iip,
current->comm); current->comm);
task = GET_PMU_OWNER(); task = GET_PMU_OWNER();
ctx = GET_PMU_CTX(); ctx = GET_PMU_CTX();
printk("->CPU%d owner [%d] ctx=%p\n", this_cpu, task ? task->pid : -1, ctx); printk("->CPU%d owner [%d] ctx=%p\n", this_cpu, task ? task_pid_nr(task) : -1, ctx);
psr = pfm_get_psr(); psr = pfm_get_psr();
...@@ -6848,7 +6851,7 @@ pfm_inherit(struct task_struct *task, struct pt_regs *regs) ...@@ -6848,7 +6851,7 @@ pfm_inherit(struct task_struct *task, struct pt_regs *regs)
{ {
struct thread_struct *thread; struct thread_struct *thread;
DPRINT(("perfmon: pfm_inherit clearing state for [%d]\n", task->pid)); DPRINT(("perfmon: pfm_inherit clearing state for [%d]\n", task_pid_nr(task)));
thread = &task->thread; thread = &task->thread;
......
...@@ -44,11 +44,11 @@ default_validate(struct task_struct *task, unsigned int flags, int cpu, void *da ...@@ -44,11 +44,11 @@ default_validate(struct task_struct *task, unsigned int flags, int cpu, void *da
int ret = 0; int ret = 0;
if (data == NULL) { if (data == NULL) {
DPRINT(("[%d] no argument passed\n", task->pid)); DPRINT(("[%d] no argument passed\n", task_pid_nr(task)));
return -EINVAL; return -EINVAL;
} }
DPRINT(("[%d] validate flags=0x%x CPU%d\n", task->pid, flags, cpu)); DPRINT(("[%d] validate flags=0x%x CPU%d\n", task_pid_nr(task), flags, cpu));
/* /*
* must hold at least the buffer header + one minimally sized entry * must hold at least the buffer header + one minimally sized entry
...@@ -88,7 +88,7 @@ default_init(struct task_struct *task, void *buf, unsigned int flags, int cpu, v ...@@ -88,7 +88,7 @@ default_init(struct task_struct *task, void *buf, unsigned int flags, int cpu, v
hdr->hdr_count = 0UL; hdr->hdr_count = 0UL;
DPRINT(("[%d] buffer=%p buf_size=%lu hdr_size=%lu hdr_version=%u cur_offs=%lu\n", DPRINT(("[%d] buffer=%p buf_size=%lu hdr_size=%lu hdr_version=%u cur_offs=%lu\n",
task->pid, task_pid_nr(task),
buf, buf,
hdr->hdr_buf_size, hdr->hdr_buf_size,
sizeof(*hdr), sizeof(*hdr),
...@@ -245,7 +245,7 @@ default_restart(struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, stru ...@@ -245,7 +245,7 @@ default_restart(struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, stru
static int static int
default_exit(struct task_struct *task, void *buf, struct pt_regs *regs) default_exit(struct task_struct *task, void *buf, struct pt_regs *regs)
{ {
DPRINT(("[%d] exit(%p)\n", task->pid, buf)); DPRINT(("[%d] exit(%p)\n", task_pid_nr(task), buf));
return 0; return 0;
} }
......
...@@ -105,7 +105,8 @@ show_regs (struct pt_regs *regs) ...@@ -105,7 +105,8 @@ show_regs (struct pt_regs *regs)
unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri; unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
print_modules(); print_modules();
printk("\nPid: %d, CPU %d, comm: %20s\n", current->pid, smp_processor_id(), current->comm); printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current),
smp_processor_id(), current->comm);
printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s\n", printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s\n",
regs->cr_ipsr, regs->cr_ifs, ip, print_tainted()); regs->cr_ipsr, regs->cr_ifs, ip, print_tainted());
print_symbol("ip is at %s\n", ip); print_symbol("ip is at %s\n", ip);
......
...@@ -61,7 +61,7 @@ die (const char *str, struct pt_regs *regs, long err) ...@@ -61,7 +61,7 @@ die (const char *str, struct pt_regs *regs, long err)
if (++die.lock_owner_depth < 3) { if (++die.lock_owner_depth < 3) {
printk("%s[%d]: %s %ld [%d]\n", printk("%s[%d]: %s %ld [%d]\n",
current->comm, current->pid, str, err, ++die_counter); current->comm, task_pid_nr(current), str, err, ++die_counter);
(void) notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); (void) notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
show_regs(regs); show_regs(regs);
} else } else
...@@ -315,7 +315,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr) ...@@ -315,7 +315,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
last.time = current_jiffies + 5 * HZ; last.time = current_jiffies + 5 * HZ;
printk(KERN_WARNING printk(KERN_WARNING
"%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n", "%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n",
current->comm, current->pid, regs->cr_iip + ia64_psr(regs)->ri, isr); current->comm, task_pid_nr(current), regs->cr_iip + ia64_psr(regs)->ri, isr);
} }
} }
} }
...@@ -453,7 +453,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa, ...@@ -453,7 +453,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
if (code == 8) { if (code == 8) {
# ifdef CONFIG_IA64_PRINT_HAZARDS # ifdef CONFIG_IA64_PRINT_HAZARDS
printk("%s[%d]: possible hazard @ ip=%016lx (pr = %016lx)\n", printk("%s[%d]: possible hazard @ ip=%016lx (pr = %016lx)\n",
current->comm, current->pid, current->comm, task_pid_nr(current),
regs.cr_iip + ia64_psr(&regs)->ri, regs.pr); regs.cr_iip + ia64_psr(&regs)->ri, regs.pr);
# endif # endif
return; return;
......
...@@ -1340,7 +1340,8 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs) ...@@ -1340,7 +1340,8 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
size_t len; size_t len;
len = sprintf(buf, "%s(%d): unaligned access to 0x%016lx, " len = sprintf(buf, "%s(%d): unaligned access to 0x%016lx, "
"ip=0x%016lx\n\r", current->comm, current->pid, "ip=0x%016lx\n\r", current->comm,
task_pid_nr(current),
ifa, regs->cr_iip + ipsr->ri); ifa, regs->cr_iip + ipsr->ri);
/* /*
* Don't call tty_write_message() if we're in the kernel; we might * Don't call tty_write_message() if we're in the kernel; we might
...@@ -1363,7 +1364,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs) ...@@ -1363,7 +1364,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
"administrator\n" "administrator\n"
"echo 0 > /proc/sys/kernel/ignore-" "echo 0 > /proc/sys/kernel/ignore-"
"unaligned-usertrap to re-enable\n", "unaligned-usertrap to re-enable\n",
current->comm, current->pid); current->comm, task_pid_nr(current));
} }
} }
} else { } else {
......
...@@ -196,7 +196,7 @@ static void show_registers(struct pt_regs *regs) ...@@ -196,7 +196,7 @@ static void show_registers(struct pt_regs *regs)
printk("SPI: %08lx\n", sp); printk("SPI: %08lx\n", sp);
} }
printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)", printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)",
current->comm, current->pid, 0xffff & i, 4096+(unsigned long)current); current->comm, task_pid_nr(current), 0xffff & i, 4096+(unsigned long)current);
/* /*
* When in-kernel, we also print out the stack and code at the * When in-kernel, we also print out the stack and code at the
......
...@@ -900,7 +900,7 @@ void show_registers(struct pt_regs *regs) ...@@ -900,7 +900,7 @@ void show_registers(struct pt_regs *regs)
regs->d4, regs->d5, regs->a0, regs->a1); regs->d4, regs->d5, regs->a0, regs->a1);
printk("Process %s (pid: %d, task=%p)\n", printk("Process %s (pid: %d, task=%p)\n",
current->comm, current->pid, current); current->comm, task_pid_nr(current), current);
addr = (unsigned long)&fp->un; addr = (unsigned long)&fp->un;
printk("Frame format=%X ", regs->format); printk("Frame format=%X ", regs->format);
switch (regs->format) { switch (regs->format) {
...@@ -1038,7 +1038,7 @@ void bad_super_trap (struct frame *fp) ...@@ -1038,7 +1038,7 @@ void bad_super_trap (struct frame *fp)
fp->un.fmtb.daddr, space_names[ssw & DFC], fp->un.fmtb.daddr, space_names[ssw & DFC],
fp->ptregs.pc); fp->ptregs.pc);
} }
printk ("Current process id is %d\n", current->pid); printk ("Current process id is %d\n", task_pid_nr(current));
die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0); die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
} }
......
...@@ -314,7 +314,7 @@ void show_registers(const struct pt_regs *regs) ...@@ -314,7 +314,7 @@ void show_registers(const struct pt_regs *regs)
__show_regs(regs); __show_regs(regs);
print_modules(); print_modules();
printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n", printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n",
current->comm, current->pid, current_thread_info(), current); current->comm, task_pid_nr(current), current_thread_info(), current);
show_stacktrace(current, regs); show_stacktrace(current, regs);
show_code((unsigned int __user *) regs->cp0_epc); show_code((unsigned int __user *) regs->cp0_epc);
printk("\n"); printk("\n");
......
...@@ -219,7 +219,7 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err) ...@@ -219,7 +219,7 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
return; /* STFU */ return; /* STFU */
printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n", printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n",
current->comm, current->pid, str, err, regs->iaoq[0]); current->comm, task_pid_nr(current), str, err, regs->iaoq[0]);
#ifdef PRINT_USER_FAULTS #ifdef PRINT_USER_FAULTS
/* XXX for debugging only */ /* XXX for debugging only */
show_regs(regs); show_regs(regs);
...@@ -252,7 +252,7 @@ KERN_CRIT " || ||\n"); ...@@ -252,7 +252,7 @@ KERN_CRIT " || ||\n");
if (err) if (err)
printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n", printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n",
current->comm, current->pid, str, err); current->comm, task_pid_nr(current), str, err);
/* Wot's wrong wif bein' racy? */ /* Wot's wrong wif bein' racy? */
if (current->thread.flags & PARISC_KERNEL_DEATH) { if (current->thread.flags & PARISC_KERNEL_DEATH) {
...@@ -317,7 +317,7 @@ static void handle_break(struct pt_regs *regs) ...@@ -317,7 +317,7 @@ static void handle_break(struct pt_regs *regs)
if (unlikely(iir != GDB_BREAK_INSN)) { if (unlikely(iir != GDB_BREAK_INSN)) {
printk(KERN_DEBUG "break %d,%d: pid=%d command='%s'\n", printk(KERN_DEBUG "break %d,%d: pid=%d command='%s'\n",
iir & 31, (iir>>13) & ((1<<13)-1), iir & 31, (iir>>13) & ((1<<13)-1),
current->pid, current->comm); task_pid_nr(current), current->comm);
show_regs(regs); show_regs(regs);
} }
#endif #endif
...@@ -747,7 +747,7 @@ void handle_interruption(int code, struct pt_regs *regs) ...@@ -747,7 +747,7 @@ void handle_interruption(int code, struct pt_regs *regs)
if (user_mode(regs)) { if (user_mode(regs)) {
#ifdef PRINT_USER_FAULTS #ifdef PRINT_USER_FAULTS
printk(KERN_DEBUG "\nhandle_interruption() pid=%d command='%s'\n", printk(KERN_DEBUG "\nhandle_interruption() pid=%d command='%s'\n",
current->pid, current->comm); task_pid_nr(current), current->comm);
show_regs(regs); show_regs(regs);
#endif #endif
/* SIGBUS, for lack of a better one. */ /* SIGBUS, for lack of a better one. */
...@@ -772,7 +772,7 @@ void handle_interruption(int code, struct pt_regs *regs) ...@@ -772,7 +772,7 @@ void handle_interruption(int code, struct pt_regs *regs)
else else
printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ", printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ",
code); code);
printk("pid=%d command='%s'\n", current->pid, current->comm); printk("pid=%d command='%s'\n", task_pid_nr(current), current->comm);
show_regs(regs); show_regs(regs);
#endif #endif
si.si_signo = SIGSEGV; si.si_signo = SIGSEGV;
......
...@@ -469,7 +469,7 @@ void handle_unaligned(struct pt_regs *regs) ...@@ -469,7 +469,7 @@ void handle_unaligned(struct pt_regs *regs)
&& ++unaligned_count < 5) { && ++unaligned_count < 5) {
char buf[256]; char buf[256];
sprintf(buf, "%s(%d): unaligned access to 0x" RFMT " at ip=0x" RFMT "\n", sprintf(buf, "%s(%d): unaligned access to 0x" RFMT " at ip=0x" RFMT "\n",
current->comm, current->pid, regs->ior, regs->iaoq[0]); current->comm, task_pid_nr(current), regs->ior, regs->iaoq[0]);
printk(KERN_WARNING "%s", buf); printk(KERN_WARNING "%s", buf);
#ifdef DEBUG_UNALIGNED #ifdef DEBUG_UNALIGNED
show_regs(regs); show_regs(regs);
......
...@@ -211,7 +211,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, ...@@ -211,7 +211,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
#ifdef PRINT_USER_FAULTS #ifdef PRINT_USER_FAULTS
printk(KERN_DEBUG "\n"); printk(KERN_DEBUG "\n");
printk(KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n", printk(KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n",
tsk->pid, tsk->comm, code, address); task_pid_nr(tsk), tsk->comm, code, address);
if (vma) { if (vma) {
printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n", printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n",
vma->vm_start, vma->vm_end); vma->vm_start, vma->vm_end);
......
...@@ -459,7 +459,7 @@ void show_regs(struct pt_regs * regs) ...@@ -459,7 +459,7 @@ void show_regs(struct pt_regs * regs)
printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr); printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
#endif #endif
printk("TASK = %p[%d] '%s' THREAD: %p", printk("TASK = %p[%d] '%s' THREAD: %p",
current, current->pid, current->comm, task_thread_info(current)); current, task_pid_nr(current), current->comm, task_thread_info(current));
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
printk(" CPU: %d", smp_processor_id()); printk(" CPU: %d", smp_processor_id());
......
...@@ -881,7 +881,7 @@ void nonrecoverable_exception(struct pt_regs *regs) ...@@ -881,7 +881,7 @@ void nonrecoverable_exception(struct pt_regs *regs)
void trace_syscall(struct pt_regs *regs) void trace_syscall(struct pt_regs *regs)
{ {
printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n", printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
current, current->pid, regs->nip, regs->link, regs->gpr[0], current, task_pid_nr(current), regs->nip, regs->link, regs->gpr[0],
regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted()); regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted());
} }
......
...@@ -166,7 +166,7 @@ void show_regs(struct pt_regs *regs) ...@@ -166,7 +166,7 @@ void show_regs(struct pt_regs *regs)
printk("CPU: %d %s\n", task_thread_info(tsk)->cpu, print_tainted()); printk("CPU: %d %s\n", task_thread_info(tsk)->cpu, print_tainted());
printk("Process %s (pid: %d, task: %p, ksp: %p)\n", printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
current->comm, current->pid, (void *) tsk, current->comm, task_pid_nr(current), (void *) tsk,
(void *) tsk->thread.ksp); (void *) tsk->thread.ksp);
show_registers(regs); show_registers(regs);
......
...@@ -121,7 +121,7 @@ void machine_power_off(void) ...@@ -121,7 +121,7 @@ void machine_power_off(void)
void show_regs(struct pt_regs * regs) void show_regs(struct pt_regs * regs)
{ {
printk("\n"); printk("\n");
printk("Pid : %d, Comm: %20s\n", current->pid, current->comm); printk("Pid : %d, Comm: %20s\n", task_pid_nr(current), current->comm);
print_symbol("PC is at %s\n", instruction_pointer(regs)); print_symbol("PC is at %s\n", instruction_pointer(regs));
printk("PC : %08lx SP : %08lx SR : %08lx ", printk("PC : %08lx SP : %08lx SR : %08lx ",
regs->pc, regs->regs[15], regs->sr); regs->pc, regs->regs[15], regs->sr);
......
...@@ -382,7 +382,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, ...@@ -382,7 +382,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
set_fs(USER_DS); set_fs(USER_DS);
pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n", pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
current->comm, current->pid, frame, regs->pc, regs->pr); current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);
flush_cache_sigtramp(regs->pr); flush_cache_sigtramp(regs->pr);
...@@ -462,7 +462,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -462,7 +462,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
set_fs(USER_DS); set_fs(USER_DS);
pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n", pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
current->comm, current->pid, frame, regs->pc, regs->pr); current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);
flush_cache_sigtramp(regs->pr); flush_cache_sigtramp(regs->pr);
......
...@@ -95,8 +95,8 @@ void die(const char * str, struct pt_regs * regs, long err) ...@@ -95,8 +95,8 @@ void die(const char * str, struct pt_regs * regs, long err)
print_modules(); print_modules();
show_regs(regs); show_regs(regs);
printk("Process: %s (pid: %d, stack limit = %p)\n", printk("Process: %s (pid: %d, stack limit = %p)\n", current->comm,
current->comm, current->pid, task_stack_page(current) + 1); task_pid_nr(current), task_stack_page(current) + 1);
if (!user_mode(regs) || in_interrupt()) if (!user_mode(regs) || in_interrupt())
dump_mem("Stack: ", regs->regs[15], THREAD_SIZE + dump_mem("Stack: ", regs->regs[15], THREAD_SIZE +
...@@ -386,7 +386,8 @@ static int handle_unaligned_access(u16 instruction, struct pt_regs *regs) ...@@ -386,7 +386,8 @@ static int handle_unaligned_access(u16 instruction, struct pt_regs *regs)
printk(KERN_NOTICE "Fixing up unaligned userspace access " printk(KERN_NOTICE "Fixing up unaligned userspace access "
"in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
current->comm,current->pid,(u16*)regs->pc,instruction); current->comm, task_pid_nr(current),
(u16 *)regs->pc, instruction);
} }
ret = -EFAULT; ret = -EFAULT;
......
...@@ -764,7 +764,7 @@ static int misaligned_fixup(struct pt_regs *regs) ...@@ -764,7 +764,7 @@ static int misaligned_fixup(struct pt_regs *regs)
--user_mode_unaligned_fixup_count; --user_mode_unaligned_fixup_count;
/* Only do 'count' worth of these reports, to remove a potential DoS against syslog */ /* Only do 'count' worth of these reports, to remove a potential DoS against syslog */
printk("Fixing up unaligned userspace access in \"%s\" pid=%d pc=0x%08x ins=0x%08lx\n", printk("Fixing up unaligned userspace access in \"%s\" pid=%d pc=0x%08x ins=0x%08lx\n",
current->comm, current->pid, (__u32)regs->pc, opcode); current->comm, task_pid_nr(current), (__u32)regs->pc, opcode);
} else } else
#endif #endif
if (!user_mode(regs) && (kernel_mode_unaligned_fixup_count > 0)) { if (!user_mode(regs) && (kernel_mode_unaligned_fixup_count > 0)) {
...@@ -774,7 +774,7 @@ static int misaligned_fixup(struct pt_regs *regs) ...@@ -774,7 +774,7 @@ static int misaligned_fixup(struct pt_regs *regs)
(__u32)regs->pc, opcode); (__u32)regs->pc, opcode);
} else { } else {
printk("Fixing up unaligned kernelspace access in \"%s\" pid=%d pc=0x%08x ins=0x%08lx\n", printk("Fixing up unaligned kernelspace access in \"%s\" pid=%d pc=0x%08x ins=0x%08lx\n",
current->comm, current->pid, (__u32)regs->pc, opcode); current->comm, task_pid_nr(current), (__u32)regs->pc, opcode);
} }
} }
......
...@@ -81,7 +81,7 @@ static inline void print_vma(struct vm_area_struct *vma) ...@@ -81,7 +81,7 @@ static inline void print_vma(struct vm_area_struct *vma)
static inline void print_task(struct task_struct *tsk) static inline void print_task(struct task_struct *tsk)
{ {
printk("Task pid %d\n", tsk->pid); printk("Task pid %d\n", task_pid_nr(tsk));
} }
static pte_t *lookup_pte(struct mm_struct *mm, unsigned long address) static pte_t *lookup_pte(struct mm_struct *mm, unsigned long address)
...@@ -272,7 +272,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess, ...@@ -272,7 +272,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
* usermode, so only need a few */ * usermode, so only need a few */
count++; count++;
printk("user mode bad_area address=%08lx pid=%d (%s) pc=%08lx\n", printk("user mode bad_area address=%08lx pid=%d (%s) pc=%08lx\n",
address, current->pid, current->comm, address, task_pid_nr(current), current->comm,
(unsigned long) regs->pc); (unsigned long) regs->pc);
#if 0 #if 0
show_regs(regs); show_regs(regs);
......
...@@ -155,7 +155,7 @@ static inline void read_sunos_user(struct pt_regs *regs, unsigned long offset, ...@@ -155,7 +155,7 @@ static inline void read_sunos_user(struct pt_regs *regs, unsigned long offset,
/* Rest of them are completely unsupported. */ /* Rest of them are completely unsupported. */
default: default:
printk("%s [%d]: Wants to read user offset %ld\n", printk("%s [%d]: Wants to read user offset %ld\n",
current->comm, current->pid, offset); current->comm, task_pid_nr(current), offset);
pt_error_return(regs, EIO); pt_error_return(regs, EIO);
return; return;
} }
...@@ -222,7 +222,7 @@ static inline void write_sunos_user(struct pt_regs *regs, unsigned long offset, ...@@ -222,7 +222,7 @@ static inline void write_sunos_user(struct pt_regs *regs, unsigned long offset,
/* Rest of them are completely unsupported or "no-touch". */ /* Rest of them are completely unsupported or "no-touch". */
default: default:
printk("%s [%d]: Wants to write user offset %ld\n", printk("%s [%d]: Wants to write user offset %ld\n",
current->comm, current->pid, offset); current->comm, task_pid_nr(current), offset);
goto failure; goto failure;
} }
success: success:
......
...@@ -357,7 +357,7 @@ c_sys_nis_syscall (struct pt_regs *regs) ...@@ -357,7 +357,7 @@ c_sys_nis_syscall (struct pt_regs *regs)
if (count++ > 5) if (count++ > 5)
return -ENOSYS; return -ENOSYS;
printk ("%s[%d]: Unimplemented SPARC system call %d\n", printk ("%s[%d]: Unimplemented SPARC system call %d\n",
current->comm, current->pid, (int)regs->u_regs[1]); current->comm, task_pid_nr(current), (int)regs->u_regs[1]);
#ifdef DEBUG_UNIMP_SYSCALL #ifdef DEBUG_UNIMP_SYSCALL
show_regs (regs); show_regs (regs);
#endif #endif
......
...@@ -38,7 +38,7 @@ struct trap_trace_entry trapbuf[1024]; ...@@ -38,7 +38,7 @@ struct trap_trace_entry trapbuf[1024];
void syscall_trace_entry(struct pt_regs *regs) void syscall_trace_entry(struct pt_regs *regs)
{ {
printk("%s[%d]: ", current->comm, current->pid); printk("%s[%d]: ", current->comm, task_pid_nr(current));
printk("scall<%d> (could be %d)\n", (int) regs->u_regs[UREG_G1], printk("scall<%d> (could be %d)\n", (int) regs->u_regs[UREG_G1],
(int) regs->u_regs[UREG_I0]); (int) regs->u_regs[UREG_I0]);
} }
...@@ -99,7 +99,7 @@ void die_if_kernel(char *str, struct pt_regs *regs) ...@@ -99,7 +99,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
" /_| \\__/ |_\\\n" " /_| \\__/ |_\\\n"
" \\__U_/\n"); " \\__U_/\n");
printk("%s(%d): %s [#%d]\n", current->comm, current->pid, str, ++die_counter); printk("%s(%d): %s [#%d]\n", current->comm, task_pid_nr(current), str, ++die_counter);
show_regs(regs); show_regs(regs);
add_taint(TAINT_DIE); add_taint(TAINT_DIE);
......
...@@ -2225,7 +2225,7 @@ void die_if_kernel(char *str, struct pt_regs *regs) ...@@ -2225,7 +2225,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
" /_| \\__/ |_\\\n" " /_| \\__/ |_\\\n"
" \\__U_/\n"); " \\__U_/\n");
printk("%s(%d): %s [#%d]\n", current->comm, current->pid, str, ++die_counter); printk("%s(%d): %s [#%d]\n", current->comm, task_pid_nr(current), str, ++die_counter);
notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV); notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV);
__asm__ __volatile__("flushw"); __asm__ __volatile__("flushw");
__show_regs(regs); __show_regs(regs);
......
...@@ -15,8 +15,8 @@ void __show_regs(struct pt_regs * regs) ...@@ -15,8 +15,8 @@ void __show_regs(struct pt_regs * regs)
{ {
printk("\n"); printk("\n");
print_modules(); print_modules();
printk("Pid: %d, comm: %.20s %s %s\n", printk("Pid: %d, comm: %.20s %s %s\n", task_pid_nr(current),
current->pid, current->comm, print_tainted(), init_utsname()->release); current->comm, print_tainted(), init_utsname()->release);
printk("RIP: %04lx:[<%016lx>] ", PT_REGS_CS(regs) & 0xffff, printk("RIP: %04lx:[<%016lx>] ", PT_REGS_CS(regs) & 0xffff,
PT_REGS_RIP(regs)); PT_REGS_RIP(regs));
printk("\nRSP: %016lx EFLAGS: %08lx\n", PT_REGS_RSP(regs), printk("\nRSP: %016lx EFLAGS: %08lx\n", PT_REGS_RSP(regs),
......
...@@ -301,7 +301,7 @@ void show_regs(struct pt_regs * regs) ...@@ -301,7 +301,7 @@ void show_regs(struct pt_regs * regs)
unsigned long d0, d1, d2, d3, d6, d7; unsigned long d0, d1, d2, d3, d6, d7;
printk("\n"); printk("\n");
printk("Pid: %d, comm: %20s\n", current->pid, current->comm); printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id()); printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id());
print_symbol("EIP is at %s\n", regs->eip); print_symbol("EIP is at %s\n", regs->eip);
......
...@@ -200,8 +200,8 @@ asmlinkage int sys_sigreturn(unsigned long __unused) ...@@ -200,8 +200,8 @@ asmlinkage int sys_sigreturn(unsigned long __unused)
if (show_unhandled_signals && printk_ratelimit()) if (show_unhandled_signals && printk_ratelimit())
printk("%s%s[%d] bad frame in sigreturn frame:%p eip:%lx" printk("%s%s[%d] bad frame in sigreturn frame:%p eip:%lx"
" esp:%lx oeax:%lx\n", " esp:%lx oeax:%lx\n",
current->pid > 1 ? KERN_INFO : KERN_EMERG, task_pid_nr(current) > 1 ? KERN_INFO : KERN_EMERG,
current->comm, current->pid, frame, regs->eip, current->comm, task_pid_nr(current), frame, regs->eip,
regs->esp, regs->orig_eax); regs->esp, regs->orig_eax);
force_sig(SIGSEGV, current); force_sig(SIGSEGV, current);
......
...@@ -316,7 +316,7 @@ void show_registers(struct pt_regs *regs) ...@@ -316,7 +316,7 @@ void show_registers(struct pt_regs *regs)
printk(KERN_EMERG "ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n", printk(KERN_EMERG "ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n",
regs->xds & 0xffff, regs->xes & 0xffff, regs->xfs & 0xffff, gs, ss); regs->xds & 0xffff, regs->xes & 0xffff, regs->xfs & 0xffff, gs, ss);
printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)", printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)",
TASK_COMM_LEN, current->comm, current->pid, TASK_COMM_LEN, current->comm, task_pid_nr(current),
current_thread_info(), current, task_thread_info(current)); current_thread_info(), current, task_thread_info(current));
/* /*
* When in-kernel, we also print out the stack and code at the * When in-kernel, we also print out the stack and code at the
...@@ -622,7 +622,7 @@ fastcall void __kprobes do_general_protection(struct pt_regs * regs, ...@@ -622,7 +622,7 @@ fastcall void __kprobes do_general_protection(struct pt_regs * regs,
printk_ratelimit()) printk_ratelimit())
printk(KERN_INFO printk(KERN_INFO
"%s[%d] general protection eip:%lx esp:%lx error:%lx\n", "%s[%d] general protection eip:%lx esp:%lx error:%lx\n",
current->comm, current->pid, current->comm, task_pid_nr(current),
regs->eip, regs->esp, error_code); regs->eip, regs->esp, error_code);
force_sig(SIGSEGV, current); force_sig(SIGSEGV, current);
......
...@@ -471,8 +471,8 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs, ...@@ -471,8 +471,8 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
printk_ratelimit()) { printk_ratelimit()) {
printk("%s%s[%d]: segfault at %08lx eip %08lx " printk("%s%s[%d]: segfault at %08lx eip %08lx "
"esp %08lx error %lx\n", "esp %08lx error %lx\n",
tsk->pid > 1 ? KERN_INFO : KERN_EMERG, task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG,
tsk->comm, tsk->pid, address, regs->eip, tsk->comm, task_pid_nr(tsk), address, regs->eip,
regs->esp, error_code); regs->esp, error_code);
} }
tsk->thread.cr2 = address; tsk->thread.cr2 = address;
......
...@@ -176,7 +176,7 @@ void do_unhandled(struct pt_regs *regs, unsigned long exccause) ...@@ -176,7 +176,7 @@ void do_unhandled(struct pt_regs *regs, unsigned long exccause)
printk("Caught unhandled exception in '%s' " printk("Caught unhandled exception in '%s' "
"(pid = %d, pc = %#010lx) - should not happen\n" "(pid = %d, pc = %#010lx) - should not happen\n"
"\tEXCCAUSE is %ld\n", "\tEXCCAUSE is %ld\n",
current->comm, current->pid, regs->pc, exccause); current->comm, task_pid_nr(current), regs->pc, exccause);
force_sig(SIGILL, current); force_sig(SIGILL, current);
} }
...@@ -228,7 +228,7 @@ do_illegal_instruction(struct pt_regs *regs) ...@@ -228,7 +228,7 @@ do_illegal_instruction(struct pt_regs *regs)
/* If in user mode, send SIGILL signal to current process. */ /* If in user mode, send SIGILL signal to current process. */
printk("Illegal Instruction in '%s' (pid = %d, pc = %#010lx)\n", printk("Illegal Instruction in '%s' (pid = %d, pc = %#010lx)\n",
current->comm, current->pid, regs->pc); current->comm, task_pid_nr(current), regs->pc);
force_sig(SIGILL, current); force_sig(SIGILL, current);
} }
...@@ -254,7 +254,7 @@ do_unaligned_user (struct pt_regs *regs) ...@@ -254,7 +254,7 @@ do_unaligned_user (struct pt_regs *regs)
current->thread.error_code = -3; current->thread.error_code = -3;
printk("Unaligned memory access to %08lx in '%s' " printk("Unaligned memory access to %08lx in '%s' "
"(pid = %d, pc = %#010lx)\n", "(pid = %d, pc = %#010lx)\n",
regs->excvaddr, current->comm, current->pid, regs->pc); regs->excvaddr, current->comm, task_pid_nr(current), regs->pc);
info.si_signo = SIGBUS; info.si_signo = SIGBUS;
info.si_errno = 0; info.si_errno = 0;
info.si_code = BUS_ADRALN; info.si_code = BUS_ADRALN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment