From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Jan Kara <jack@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Jiri Kosina <jkosina@suse.cz>, Baoquan He <bhe@redhat.com>,
Prarit Bhargava <prarit@redhat.com>,
Xie XiuQi <xiexiuqi@huawei.com>,
Seth Jennings <sjenning@redhat.com>,
linux-kernel@vger.kernel.org,
"K. Y. Srinivasan" <kys@microsoft.com>
Subject: Re: [PATCH] panic: release stale console lock to always get the logbuf printed out
Date: Thu, 08 Oct 2015 12:03:25 +0200 [thread overview]
Message-ID: <87612hfziq.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20151008090153.GB13232@quack.suse.cz> (Jan Kara's message of "Thu, 8 Oct 2015 11:01:53 +0200")
Jan Kara <jack@suse.cz> writes:
>> --- a/kernel/panic.c~panic-release-stale-console-lock-to-always-get-the-logbuf-printed-out-fix
>> +++ a/kernel/panic.c
>> @@ -149,10 +149,10 @@ void panic(const char *fmt, ...)
>> bust_spinlocks(0);
>>
>> /*
>> - * We may have ended up killing the CPU holding the lock and still have
>> - * some valuable data in console buffer. Try to acquire the lock and
>> - * release it regardless of the result. The release will also print the
>> - * buffers out.
>> + * We may have ended up stopping the CPU holding the lock (in
>> + * smp_send_stop()) while still having some valuable data in the console
>> + * buffer. Try to acquire the lock then release it regardless of the
>> + * result. The release will also print the buffers out.
>> */
>> console_trylock();
>> console_unlock();
>> _
>>
>>
>> Does the console_trylock() guarantee that the console lock is now held?
>> If the console_lock-holding CPU is still running then there's a window
>> where the above code could enter console_unlock() when nobody's holding
>> console_lock. If smp_send_stop() always works (synchronously) then
>> that won't happen.
>
> We have this mechanism using zap_locks() in kernel/printk/printk.c when
> crash happens on the CPU holding console_sem. Can't we use the same
> mechanism for this case? Something like adding:
>
> zap_locks();
> console_lock();
> console_unlock();
>
> to panic?
I thought it doesn't really matter who holds the lock at this point --
all other cpus were already stopped with IPIs/NMIs.
> If we picked up patch "kernel: Avoid softlockups in
> stop_machine() during heavy printing" from my series (it's completely
> independent, I've attached the latest version), the result would look less
> hacky to me (attached). Thoughts?
Haven't tested it but should also work...
Thanks,
--
Vitaly
next prev parent reply other threads:[~2015-10-08 10:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-07 17:02 Vitaly Kuznetsov
2015-10-07 22:34 ` Andrew Morton
2015-10-08 9:01 ` Jan Kara
2015-10-08 10:03 ` Vitaly Kuznetsov [this message]
2015-10-08 20:56 ` Andrew Morton
2015-10-09 10:10 ` Vitaly Kuznetsov
2015-10-09 12:44 ` Vitaly Kuznetsov
2015-10-12 3:02 ` kbuild test robot
2015-10-08 9:51 ` Vitaly Kuznetsov
2015-10-08 20:54 ` Andrew Morton
2015-10-09 10:09 ` Vitaly Kuznetsov
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=87612hfziq.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=d.hatayama@jp.fujitsu.com \
--cc=jack@suse.cz \
--cc=jkosina@suse.cz \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=prarit@redhat.com \
--cc=sjenning@redhat.com \
--cc=xiexiuqi@huawei.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