From: Waiman Long <longman@redhat.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Yang Shi <yang.shi@linux.alibaba.com>,
Arnd Bergmann <arnd@arndb.de>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Dmitry Safonov <dima@arista.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH v2] debugobjects: Move printk out of db lock critical sections
Date: Mon, 17 Dec 2018 13:33:07 -0500 [thread overview]
Message-ID: <e1e313d9-429d-fb9a-8ebe-74b43eda077e@redhat.com> (raw)
In-Reply-To: <20181217181712.GA5114@gmail.com>
On 12/17/2018 01:17 PM, Ingo Molnar wrote:
> * Waiman Long <longman@redhat.com> wrote:
>
>> The db->lock is a raw spinlock and so the lock hold time is supposed to
>> be short. This will not be the case when printk() is being involved in
>> some of the critical sections.
>>
>> In order to avoid the long hold time, in case some messages need to be
>> printed, all the debug_object_is_on_stack() and debug_print_object()
>> calls are now moved out of those critical sections in the following
>> functions.
>>
>> - __debug_object_init()
>> - debug_object_activate()
>> - debug_object_deactivate()
>> - debug_object_destroy()
>> - debug_object_free()
>> - debug_object_active_state()
>> - __debug_check_no_obj_freed()
>> - check_results()
>>
>> Holding the db->lock while calling printk() may lead to deadlock if
>> printk() somehow requires the allocation/freeing of debug object that
>> happens to be in the same hash bucket or a circular lock dependency
>> warning from lockdep as reported in
>>
>> https://lkml.kernel.org/r/20181211091154.GL23332@shao2-debian
> This makes me sad - whatever happened to the principle of keeping printk
> simple?
>
> We should rename printk() to syslog() or so, and rename early_printk() to
> printk(), and be done with this.
>
> Thanks,
>
> Ingo
The circular lock dependency actually happened because of the serial
console code that was called by printk() to display the message. We have
multiple console drivers that may be called depending on the hardware.
It can be hard to make sure that none of them will allocate or free
objects during the call.
Cheers,
Longman
next prev parent reply other threads:[~2018-12-17 18:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-13 21:59 Waiman Long
2018-12-17 18:17 ` Ingo Molnar
2018-12-17 18:33 ` Waiman Long [this message]
2018-12-17 19:31 ` Peter Zijlstra
2018-12-17 19:44 ` Linus Torvalds
2018-12-18 13:51 ` Ingo Molnar
2018-12-18 14:06 ` Thomas Gleixner
2018-12-18 2:23 ` Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e1e313d9-429d-fb9a-8ebe-74b43eda077e@redhat.com \
--to=longman@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=dima@arista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=yang.shi@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome