On 03/19/2014 06:00 PM, Jan Kara wrote: > On Wed 19-03-14 11:08:08, Jane Li wrote: >> On 02/12/2014 05:19 AM, Andrew Morton wrote: >>> On Tue, 11 Feb 2014 14:50:00 +0800<j...@marvell.com> wrote: > Umm, I disagree with the patch. What I proposed in my answer to your patch > is something like the patch below. Does it fix your problem? > > Honza > > From 91497a88c403a7f22e78fee2f69d7413c6e8209f Mon Sep 17 00:00:00 2001 > From: Jan Kara <j...@suse.cz> > Date: Wed, 19 Mar 2014 10:56:12 +0100 > Subject: [PATCH] printk: Fixup lockdep annotation in console_suspend() > > Although console_suspend() releases console_sem, it doesn't tell lockdep > about it. That results in the lockdep warning about circular locking when > doing the following: > enter suspend -> resume -> plug-out CPUx (echo 0 > cpux/online) > > Fix the problem by telling lockdep we actually released the semaphore in > console_suspend() and acquired it again in console_resume(). > > Signed-off-by: Jan Kara <j...@suse.cz> > --- > kernel/printk/printk.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index > 4dae9cbe9259..e6ada322782b 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -1880,6 +1880,7 @@ void suspend_console(void) > console_lock(); > console_suspended = 1; > up(&console_sem); > + mutex_release(&console_lock_dep_map, 1, _RET_IP_); > } > > void resume_console(void) > @@ -1887,6 +1888,7 @@ void resume_console(void) > if (!console_suspend_enabled) > return; > down(&console_sem); > + mutex_acquire(&console_lock_dep_map, 0, 0, _RET_IP_); > console_suspended = 0; > console_unlock(); > } > -- > 1.8.1.4
Oh, yes, this new solution works well. If run same test, no circular lockdep warning occurs now. I will update patch v2. Sorry for misunderstanding your answer before. Thanks! Best Regards, Jane -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/