* [PATCH 1/2] printk delay for each line break instead of callback
@ 2010-02-06 13:34 Dave Young
2010-02-08 22:06 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Dave Young @ 2010-02-06 13:34 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Ingo Molnar
printk delay for every callback does not make sense, change to delay every line
Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
---
kernel/printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-2.6.orig/kernel/printk.c 2010-02-02 13:38:47.646659531 +0800
+++ linux-2.6/kernel/printk.c 2010-02-02 13:39:19.446657319 +0800
@@ -678,7 +678,6 @@ asmlinkage int vprintk(const char *fmt,
char *p;
boot_delay_msec();
- printk_delay();
preempt_disable();
/* This stops the holder of console_sem just where we want him */
@@ -746,6 +745,7 @@ asmlinkage int vprintk(const char *fmt,
*/
for ( ; *p; p++) {
if (new_text_line) {
+ printk_delay();
/* Always output the token */
emit_log_char('<');
emit_log_char(current_log_level + '0');
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] printk delay for each line break instead of callback
2010-02-06 13:34 [PATCH 1/2] printk delay for each line break instead of callback Dave Young
@ 2010-02-08 22:06 ` Andrew Morton
2010-02-09 2:44 ` Dave Young
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2010-02-08 22:06 UTC (permalink / raw)
To: Dave Young; +Cc: linux-kernel, Ingo Molnar
On Sat, 6 Feb 2010 21:34:25 +0800
Dave Young <hidave.darkstar@gmail.com> wrote:
> printk delay for every callback does not make sense, change to delay every line
>
> Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
> ---
>
> kernel/printk.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- linux-2.6.orig/kernel/printk.c 2010-02-02 13:38:47.646659531 +0800
> +++ linux-2.6/kernel/printk.c 2010-02-02 13:39:19.446657319 +0800
> @@ -678,7 +678,6 @@ asmlinkage int vprintk(const char *fmt,
> char *p;
>
> boot_delay_msec();
> - printk_delay();
>
> preempt_disable();
> /* This stops the holder of console_sem just where we want him */
> @@ -746,6 +745,7 @@ asmlinkage int vprintk(const char *fmt,
> */
> for ( ; *p; p++) {
> if (new_text_line) {
> + printk_delay();
> /* Always output the token */
> emit_log_char('<');
> emit_log_char(current_log_level + '0');
This moves the printk_delay() so that it is now inside
spin_lock_irqsave(logbuf_lock).
This fixes the race I mentioned in the previous email, but it seems a
bad idea. If the delay is long enough, it could even cause other CPUs
to get hit by the NMI watchdog when trying to acquire logbuf_lock.
A better approach would be to perform the calculation of "how long must
I delay" at this site, but perform the actual delay later, after the
raw_local_irq_restore(). This means that if the printk contains
"a\nb\nc\n" then we won't delay until the final \n, but that seems a
fairly small problem.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] printk delay for each line break instead of callback
2010-02-08 22:06 ` Andrew Morton
@ 2010-02-09 2:44 ` Dave Young
0 siblings, 0 replies; 3+ messages in thread
From: Dave Young @ 2010-02-09 2:44 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Ingo Molnar
On Tue, Feb 9, 2010 at 6:06 AM, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Sat, 6 Feb 2010 21:34:25 +0800
> Dave Young <hidave.darkstar@gmail.com> wrote:
>
>> printk delay for every callback does not make sense, change to delay every line
>>
>> Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
>> ---
>>
>> kernel/printk.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> --- linux-2.6.orig/kernel/printk.c 2010-02-02 13:38:47.646659531 +0800
>> +++ linux-2.6/kernel/printk.c 2010-02-02 13:39:19.446657319 +0800
>> @@ -678,7 +678,6 @@ asmlinkage int vprintk(const char *fmt,
>> char *p;
>>
>> boot_delay_msec();
>> - printk_delay();
>>
>> preempt_disable();
>> /* This stops the holder of console_sem just where we want him */
>> @@ -746,6 +745,7 @@ asmlinkage int vprintk(const char *fmt,
>> */
>> for ( ; *p; p++) {
>> if (new_text_line) {
>> + printk_delay();
>> /* Always output the token */
>> emit_log_char('<');
>> emit_log_char(current_log_level + '0');
>
> This moves the printk_delay() so that it is now inside
> spin_lock_irqsave(logbuf_lock).
>
> This fixes the race I mentioned in the previous email, but it seems a
> bad idea. If the delay is long enough, it could even cause other CPUs
> to get hit by the NMI watchdog when trying to acquire logbuf_lock.
>
> A better approach would be to perform the calculation of "how long must
> I delay" at this site, but perform the actual delay later, after the
> raw_local_irq_restore(). This means that if the printk contains
> "a\nb\nc\n" then we won't delay until the final \n, but that seems a
> fairly small problem.
>
Ok, agree. But need another variable to track '\n', if there's no line
break then
it will not delay at the end of printk.
--
Regards
dave
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-09 2:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-06 13:34 [PATCH 1/2] printk delay for each line break instead of callback Dave Young
2010-02-08 22:06 ` Andrew Morton
2010-02-09 2:44 ` Dave Young
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox