Re: [PATCH] Use helpers to obtain task pid in printks (arch code)

2007-08-30 Thread Jan Engelhardt

On Aug 27 2007 11:01, Joe Perches wrote:
>On Mon, 2007-08-27 at 11:30 +0400, Pavel Emelyanov wrote:
>> From: Alexey Dobriyan <[EMAIL PROTECTED]>
>> 
>> 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.
>
>Perhaps it would be worthwhile to standardize the printk
>task information content? Maybe a format knob?
>
>Maybe TASK_FMT/TASK_ARG(task)
>
>#define TASK_FMT "%s"
>#define TASK_ARG(tsk) ({char __buf[MAX_TASK_INFO]; print_task(tsk, buf, 
>sizeof(__buf)); __buf})

Except that __buf goes out of scope before printk() is called...



Jan
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Use helpers to obtain task pid in printks (arch code)

2007-08-30 Thread Jan Engelhardt

On Aug 27 2007 11:01, Joe Perches wrote:
On Mon, 2007-08-27 at 11:30 +0400, Pavel Emelyanov wrote:
 From: Alexey Dobriyan [EMAIL PROTECTED]
 
 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.

Perhaps it would be worthwhile to standardize the printk
task information content? Maybe a format knob?

Maybe TASK_FMT/TASK_ARG(task)

#define TASK_FMT %s
#define TASK_ARG(tsk) ({char __buf[MAX_TASK_INFO]; print_task(tsk, buf, 
sizeof(__buf)); __buf})

Except that __buf goes out of scope before printk() is called...



Jan
-- 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Use helpers to obtain task pid in printks (arch code)

2007-08-27 Thread Joe Perches
On Mon, 2007-08-27 at 11:30 +0400, Pavel Emelyanov wrote:
> From: Alexey Dobriyan <[EMAIL PROTECTED]>
> 
> 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.

Perhaps it would be worthwhile to standardize the printk
task information content? Maybe a format knob?

Maybe TASK_FMT/TASK_ARG(task)

#define TASK_FMT "%s"
#define TASK_ARG(tsk) ({char __buf[MAX_TASK_INFO]; print_task(tsk, buf, 
sizeof(__buf)); __buf})

char* print_task(const struct task_struct* tsk, char* buf, size_t size)
{
char* p = buf;
int task_knob = get_task_knob();
*p++ = '[';
if (task_knob & feature)
p += snprintf(p, size - (p - buf), fmt, feature);
[...]
*p++ = ']';
return buf;
}
EXPORT_SYMBOL(print_task)


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2007-08-27 Thread Pavel Emelyanov

From: Alexey Dobriyan <[EMAIL PROTECTED]>

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]>

---

arch/alpha/kernel/semaphore.c   |   16 +--
arch/alpha/kernel/traps.c   |6 -
arch/alpha/mm/fault.c   |2 
arch/arm/kernel/process.c   |2 
arch/arm/kernel/ptrace.c|8 -

arch/arm/kernel/traps.c |   10 -
arch/arm/mm/alignment.c |2 
arch/i386/kernel/process.c  |2 
arch/i386/kernel/signal.c   |4 
arch/i386/kernel/traps.c|4 
arch/i386/mm/fault.c|4 
arch/ia64/ia32/sys_ia32.c   |6 -

arch/ia64/kernel/perfmon.c  |  161 
arch/ia64/kernel/perfmon_default_smpl.c |8 -
arch/ia64/kernel/process.c  |3 
arch/ia64/kernel/traps.c|6 -
arch/ia64/kernel/unaligned.c|5 
arch/m32r/kernel/traps.c|2 
arch/m68k/kernel/traps.c|4 
arch/mips/kernel/traps.c|2 
arch/parisc/kernel/traps.c  |   10 -
arch/parisc/kernel/unaligned.c  |2 
arch/parisc/mm/fault.c  |2 
arch/powerpc/kernel/process.c   |2 
arch/powerpc/kernel/traps.c |2 
arch/s390/kernel/process.c  |2 
arch/sh/kernel/process.c|2 
arch/sh/kernel/signal.c |4 
arch/sh/kernel/traps.c  |7 -
arch/sh64/kernel/traps.c|4 
arch/sh64/mm/fault.c|4 
arch/sparc/kernel/ptrace.c  |4 
arch/sparc/kernel/sys_sparc.c   |2 
arch/sparc/kernel/traps.c   |4 
arch/sparc64/kernel/traps.c |2 
arch/um/sys-x86_64/sysrq.c  |4 
arch/xtensa/kernel/traps.c  |6 -

37 files changed, 163 insertions(+), 157 deletions(-)

diff --git a/arch/alpha/kernel/semaphore.c b/arch/alpha/kernel/semaphore.c
--- a/arch/alpha/kernel/semaphore.c
+++ b/arch/alpha/kernel/semaphore.c
@@ -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;
@@ -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
}

@@ -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;
@@ -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;
@@ -168,7 +168,7 @@ down(struct semaphore *sem)
#endif
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down(%p)  from %p\n",
-  current->comm, current->pid, sem,
+  current->comm, task_pid_nr(current), sem,
   atomic_read(>count), __builtin_return_address(0));
#endif
__down(sem);
@@ -182,7 +182,7 @@ down_interruptible(struct semaphore *sem)
#endif
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): down(%p)  from %p\n",
-  current->comm, current->pid, sem,
+  current->comm, task_pid_nr(current), sem,
   atomic_read(>count), __builtin_return_address(0));
#endif
return __down_interruptible(sem);
@@ -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
@@ -217,7 +217,7 @@ up(struct semaphore *sem)
#endif
#ifdef CONFIG_DEBUG_SEMAPHORE
printk("%s(%d): up(%p)  from %p\n",
-  current->comm, current->pid, sem,
+  current->comm, task_pid_nr(current), sem,
   atomic_read(>count), __builtin_return_address(0));
#endif
__up(sem);
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
--- 

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

2007-08-27 Thread Pavel Emelyanov

From: Alexey Dobriyan [EMAIL PROTECTED]

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]

---

arch/alpha/kernel/semaphore.c   |   16 +--
arch/alpha/kernel/traps.c   |6 -
arch/alpha/mm/fault.c   |2 
arch/arm/kernel/process.c   |2 
arch/arm/kernel/ptrace.c|8 -

arch/arm/kernel/traps.c |   10 -
arch/arm/mm/alignment.c |2 
arch/i386/kernel/process.c  |2 
arch/i386/kernel/signal.c   |4 
arch/i386/kernel/traps.c|4 
arch/i386/mm/fault.c|4 
arch/ia64/ia32/sys_ia32.c   |6 -

arch/ia64/kernel/perfmon.c  |  161 
arch/ia64/kernel/perfmon_default_smpl.c |8 -
arch/ia64/kernel/process.c  |3 
arch/ia64/kernel/traps.c|6 -
arch/ia64/kernel/unaligned.c|5 
arch/m32r/kernel/traps.c|2 
arch/m68k/kernel/traps.c|4 
arch/mips/kernel/traps.c|2 
arch/parisc/kernel/traps.c  |   10 -
arch/parisc/kernel/unaligned.c  |2 
arch/parisc/mm/fault.c  |2 
arch/powerpc/kernel/process.c   |2 
arch/powerpc/kernel/traps.c |2 
arch/s390/kernel/process.c  |2 
arch/sh/kernel/process.c|2 
arch/sh/kernel/signal.c |4 
arch/sh/kernel/traps.c  |7 -
arch/sh64/kernel/traps.c|4 
arch/sh64/mm/fault.c|4 
arch/sparc/kernel/ptrace.c  |4 
arch/sparc/kernel/sys_sparc.c   |2 
arch/sparc/kernel/traps.c   |4 
arch/sparc64/kernel/traps.c |2 
arch/um/sys-x86_64/sysrq.c  |4 
arch/xtensa/kernel/traps.c  |6 -

37 files changed, 163 insertions(+), 157 deletions(-)

diff --git a/arch/alpha/kernel/semaphore.c b/arch/alpha/kernel/semaphore.c
--- a/arch/alpha/kernel/semaphore.c
+++ b/arch/alpha/kernel/semaphore.c
@@ -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;
@@ -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
}

@@ -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;
@@ -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;
@@ -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);
@@ -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);
@@ -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
@@ -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);
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
--- a/arch/alpha/kernel/traps.c
+++ 

Re: [PATCH] Use helpers to obtain task pid in printks (arch code)

2007-08-27 Thread Joe Perches
On Mon, 2007-08-27 at 11:30 +0400, Pavel Emelyanov wrote:
 From: Alexey Dobriyan [EMAIL PROTECTED]
 
 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.

Perhaps it would be worthwhile to standardize the printk
task information content? Maybe a format knob?

Maybe TASK_FMT/TASK_ARG(task)

#define TASK_FMT %s
#define TASK_ARG(tsk) ({char __buf[MAX_TASK_INFO]; print_task(tsk, buf, 
sizeof(__buf)); __buf})

char* print_task(const struct task_struct* tsk, char* buf, size_t size)
{
char* p = buf;
int task_knob = get_task_knob();
*p++ = '[';
if (task_knob  feature)
p += snprintf(p, size - (p - buf), fmt, feature);
[...]
*p++ = ']';
return buf;
}
EXPORT_SYMBOL(print_task)


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/