linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jane Li <jiel@marvell.com>
To: Jan Kara <jack@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>, <joe@perches.com>,
	<tj@kernel.org>, <fweisbec@gmail.com>, <davem@davemloft.net>,
	<keescook@chromium.org>, <linux-kernel@vger.kernel.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	"jiel@marvell.com" <"Jane Li"@mx0b-0016f401.pphosted.com>
Subject: Re: [PATCH] printk: fix one circular lockdep warning about console_lock
Date: Thu, 20 Mar 2014 14:15:48 +0800	[thread overview]
Message-ID: <532A8794.40103@marvell.com> (raw)
In-Reply-To: <532A838D.8040209@marvell.com>

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<jiel@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 <jack@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 <jack@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



       reply	other threads:[~2014-03-20  6:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <23E65EE4544D484CBE73B588E192C6D620B93AC9EB@sc-vexch3.marvell.com>
     [not found] ` <532A838D.8040209@marvell.com>
2014-03-20  6:15   ` Jane Li [this message]
2014-02-11  6:50 [PATCH] printk: fix one circular lockdep warning about console_lock jiel
2014-02-11 18:29 ` Kees Cook
2014-02-11 21:19 ` Andrew Morton
2014-02-11 21:35   ` Daniel Vetter
2014-02-13 10:48   ` Jan Kara
2014-02-14  7:42   ` Jane Li
2014-03-19  3:08   ` Jane Li
2014-03-19 10:00     ` Jan Kara

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=532A8794.40103@marvell.com \
    --to=jiel@marvell.com \
    --cc="Jane Li"@mx0b-0016f401.pphosted.com \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=jack@suse.cz \
    --cc=joe@perches.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).