mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: Andreas Noever <andreas.noever@gmail.com>,
	Michael Jamet <michael.jamet@intel.com>,
	Yehezkel Bernat <YehezkelShB@gmail.com>,
	Pengfei Xu <pengfei.xu@intel.com>, Lukas Wunner <lukas@wunner.de>
Subject: Re: [PATCH] thunderbolt: Make sure device runtime resume completes before taking domain lock
Date: Wed, 12 Jun 2019 13:38:01 +0300	[thread overview]
Message-ID: <20190612103801.GW2640@lahna.fi.intel.com> (raw)
In-Reply-To: <20190605140438.39000-1-mika.westerberg@linux.intel.com>

On Wed, Jun 05, 2019 at 05:04:38PM +0300, Mika Westerberg wrote:
> When a device is authorized from userspace by writing to authorized
> attribute we first take the domain lock and then runtime resume the
> device in question. There are two issues with this.
> 
> First is that the device connected notifications are blocked during this
> time which means we get them only after the authorization operation is
> complete. Because of this the authorization needed flag from the
> firmware notification is not reflecting the real authorization status
> anymore. So what happens is that the "authorized" keeps returning 0 even
> if the device was already authorized properly.
> 
> Second issue is that each time the controller is runtime resumed the
> connection_id field of device connected notification may be different
> than in the previous resume. We need to use the latest connection_id
> otherwise the firmware rejects the authorization command.
> 
> Fix these by moving runtime resume operations to happen before the
> domain lock is taken, and waiting for the updated device connected
> notification from the firmware before we allow runtime resume of a
> device to complete.
> 
> While there add missing locking to tb_switch_nvm_read().
> 
> Fixes: 09f11b6c99fe ("thunderbolt: Take domain lock in switch sysfs attribute callbacks")
> Reported-by: Pengfei Xu <pengfei.xu@intel.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Applied to thunderbolt.git/fixes.

      reply	other threads:[~2019-06-12 10:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-05 14:04 Mika Westerberg
2019-06-12 10:38 ` Mika Westerberg [this message]

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=20190612103801.GW2640@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=michael.jamet@intel.com \
    --cc=pengfei.xu@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

all inboxes | Powered by JetHome®