[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181107151900.gxmdvx42qeanpoah@pathway.suse.cz>
Date: Wed, 7 Nov 2018 16:19:00 +0100
From: Petr Mladek <pmladek@...e.com>
To: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Dmitriy Vyukov <dvyukov@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>,
Alexander Potapenko <glider@...gle.com>,
Fengguang Wu <fengguang.wu@...el.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will.deacon@....com>
Subject: Re: [PATCH 3/3] lockdep: Use line-buffered printk() for lockdep
messages.
On Fri 2018-11-02 22:31:57, Tetsuo Handa wrote:
> syzbot is sometimes getting mixed output like below due to concurrent
> printk(). Mitigate such output by using line-buffered printk() API.
>
> @@ -2421,18 +2458,20 @@ static void check_chain_key(struct task_struct *curr)
> print_usage_bug_scenario(struct held_lock *lock)
> {
> struct lock_class *class = hlock_class(lock);
> + struct printk_buffer *buf = get_printk_buffer();
>
> printk(" Possible unsafe locking scenario:\n\n");
> printk(" CPU0\n");
> printk(" ----\n");
> - printk(" lock(");
> - __print_lock_name(class);
> - printk(KERN_CONT ");\n");
> + printk_buffered(buf, " lock(");
> + __print_lock_name(class, buf);
> + printk_buffered(buf, ");\n");
> printk(" <Interrupt>\n");
> - printk(" lock(");
> - __print_lock_name(class);
> - printk(KERN_CONT ");\n");
> + printk_buffered(buf, " lock(");
> + __print_lock_name(class, buf);
> + printk_buffered(buf, ");\n");
> printk("\n *** DEADLOCK ***\n\n");
> + put_printk_buffer(buf);
> }
>
> static int
I really hope that the maze of pr_cont() calls in lockdep.c is the most
complicated one that we would meet.
Anyway, the following comes to my mind:
1. The mixing of normal and buffered printk calls is a bit confusing
and error prone. It would make sense to use the buffered printk
everywhere in the given section of code even when it is not
strictly needed.
2. I would replace "buf" with "pbuf" or "prbuf" to distinguish it a
bit from other eventual buffers.
Best Regards,
Petr
Powered by blists - more mailing lists