linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Coelho, Luciano" <luciano.coelho@intel.com>
To: "jikos@kernel.org" <jikos@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linuxwifi <linuxwifi@intel.com>,
	"Zhang, Rui" <rui.zhang@intel.com>,
	"edubezval@gmail.com" <edubezval@gmail.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"Weinehall, David" <david.weinehall@intel.com>,
	"Berg, Johannes" <johannes.berg@intel.com>,
	"kvalo@codeaurora.org" <kvalo@codeaurora.org>,
	"Sharon, Sara" <sara.sharon@intel.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"Grumbach, Emmanuel" <emmanuel.grumbach@intel.com>
Subject: Re: [linuxwifi] x86/thermal: AB-BA dependency between mvm->mutex and tz->lock
Date: Thu, 3 Aug 2017 11:28:45 +0000	[thread overview]
Message-ID: <1501759724.15969.49.camel@intel.com> (raw)
In-Reply-To: <87vam5nf4w.fsf@kamboji.qca.qualcomm.com>

On Thu, 2017-08-03 at 13:02 +0300, Kalle Valo wrote:
> "Coelho, Luciano" <luciano.coelho@intel.com> writes:
> 
> > On Thu, 2017-08-03 at 11:10 +0200, Jiri Kosina wrote:
> > > On Mon, 31 Jul 2017, Jiri Kosina wrote:
> > > 
> > > > Hi,
> > > > 
> > > > booting current Linus' tree, I'm seeing lockdep splat (see the end of this 
> > > > mail).
> > > > 
> > > > Apparently, there is AB-BA between tz->lock and mvm->mutex through the CPU 
> > > > hotplug lock.
> > > > 
> > > > The obivous depency is: thermal_zone_get_temp() acquires tz->lock, and 
> > > > then calls iwl_mvm_tzone_get_temp() (through tz->ops->get_temp() 
> > > > callback), which acquires mvm->mutex
> > > > 
> > > > The less obvious dependency is primarily caused by iwl_op_mode_mvm_start() 
> > > > allocating workqueue (#2 stacktrace) while holding mvm->mutex (which is 
> > > > broken, because that mutex is being taken also from CPU hotplug callback 
> > > > path, hence the AB-BA).
> > > 
> > > As the "central" part of the dependency is being added by iwlwifi driver 
> > > (_iwl_pcie_rx_init() allocating workqueue while holding 
> > > trans_pcie->mutex), I'm adding iwlwifi folks as well to CC.

[...]

> > > >  -> #2 (cpu_hotplug_lock.rw_sem){++++++}:
> > > >         lock_acquire+0xbd/0x220
> > > >         cpus_read_lock+0x46/0x90
> > > >         apply_workqueue_attrs+0x17/0x50
> > > >         __alloc_workqueue_key+0x195/0x4d0
> > > >         _iwl_pcie_rx_init+0x384/0x390 [iwlwifi]
> > > >         iwl_pcie_rx_init+0x1e/0x380 [iwlwifi]
> > > >         iwl_trans_pcie_start_fw+0x295/0x6f0 [iwlwifi]
> > > >         iwl_mvm_load_ucode_wait_alive+0xe7/0x390 [iwlmvm]
> > > >         iwl_run_init_mvm_ucode+0x84/0x320 [iwlmvm]
> > > >         iwl_op_mode_mvm_start+0x964/0xd30 [iwlmvm]
> > > >         _iwl_op_mode_start.isra.9+0x47/0xa0 [iwlwifi]
> > > >         iwl_opmode_register+0xaa/0xd0 [iwlwifi]
> > > >         iwl_mvm_init+0x37/0x1000 [iwlmvm]
> > > >         do_one_initcall+0x51/0x1a9
> > > >         do_init_module+0x60/0x20e
> > > >         load_module+0x203f/0x2b50
> > > >         SYSC_finit_module+0x96/0xd0
> > > >         SyS_finit_module+0xe/0x10
> > > >         entry_SYSCALL_64_fastpath+0x23/0xc2

Okay, so as I understand it the problem has been there for a long time,
but the splat is only coming up now because of Thomas' patch that adds
the lockdep map[1], right?

I see the workqueue allocation you mentioned.  I'll try to move this
allocation out of the mutex and see how it goes.

[1] http://lkml.kernel.org/r/20170524081549.709375845@linutronix.de

--
Cheers,
Luca.

  reply	other threads:[~2017-08-03 11:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-31 11:18 x86/thermal: AB-BA dependency between mvm->mutex and tz->lock Jiri Kosina
2017-08-03  9:10 ` Jiri Kosina
2017-08-03  9:43   ` [linuxwifi] " Coelho, Luciano
2017-08-03 10:02     ` Kalle Valo
2017-08-03 11:28       ` Coelho, Luciano [this message]
2017-08-03 11:34         ` Jiri Kosina
2017-08-03 13:09           ` Jiri Kosina
2017-08-17 13:38             ` Jiri Kosina
2017-08-17 14:02               ` Coelho, Luciano
2017-08-22  7:32               ` [PATCH] iwlwifi: pcie: move rx workqueue initialization to iwl_trans_pcie_alloc() Luca Coelho
2017-08-22  7:37               ` [PATCH v2] " Luca Coelho
2017-08-24  6:00                 ` Luca Coelho
2017-08-24 19:56                   ` Jiri Kosina
2017-08-24 20:00                     ` Luca Coelho
2017-08-29  8:19                       ` Kalle Valo
2017-09-04 11:43                       ` Jiri Kosina
2017-09-04 11:44                         ` Luca Coelho
2017-08-24 13:50                 ` [v2] " Kalle Valo
2017-08-30 14:57                 ` [PATCH v2] " David Weinehall
2017-08-31  6:11                   ` Luca Coelho

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=1501759724.15969.49.camel@intel.com \
    --to=luciano.coelho@intel.com \
    --cc=david.weinehall@intel.com \
    --cc=edubezval@gmail.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=jikos@kernel.org \
    --cc=johannes.berg@intel.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linuxwifi@intel.com \
    --cc=rui.zhang@intel.com \
    --cc=sara.sharon@intel.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;
as well as URLs for NNTP newsgroup(s).