From: Joerg Roedel <joro@8bytes.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Roedel, Joerg" <Joerg.Roedel@amd.com>,
"Xu, Andiry" <Andiry.Xu@amd.com>,
Greg Kroah-Hartman <gregkh@suse.de>,
Sarah Sharp <sarah.a.sharp@linux.intel.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@kernel.org" <stable@kernel.org>
Subject: Re: [PATCH] USB host: Fix lockdep warning in AMD PLL quirk
Date: Thu, 7 Apr 2011 22:22:49 +0200 [thread overview]
Message-ID: <20110407202249.GD19819@8bytes.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1104071050270.2147-100000@iolanthe.rowland.org>
On Thu, Apr 07, 2011 at 11:01:02AM -0400, Alan Stern wrote:
> On Thu, 7 Apr 2011, Roedel, Joerg wrote:
>
> > So we could access the data structure without any locks if we want using
> > atomic_t for the probe_count and isoc_reqs members. But as I've seen
> > meanwhile the lock still needs to protect the access to the hardware in
> > the usb_amd_quirk_pll() function.
> > So its probably not worth the work, what do you think?
>
> You might as well use the spinlock.
Yes, since we need it anyway for protecting the hardware-access we can
leave everything as is (with the fix).
> However, is there a good reason to zero out the amd_chipset members in
> usb_amd_dev_put()? Can these things be added and removed dynamically?
> If they can't then the data should remain valid indefinitely once it
> has been probed, and you could call pci_dev_put() at the end of
> usb_amd_find_chipset_info().
Well, in a real system it is indeed very unlikely that the chipset is
hotplugged. But for formal correctness it is right to hold a reference
to the pci_dev struct as long as we rely on a pointer to it.
> And if they can, is it valid to call pci_dev_put() in usb_amd_dev_put()
> while holding a spinlock? You might want to move those calls to the
> end of the function.
I just had a look, pci_dev_put seems to be invalid in atomic context
too. If the reference count drops to 0 (which is very unlikely for the
chipset devices) the device and its kobject are released. This causes a
uevent to be sent to userspace which does GFP_KERNEL allocations and all
the stuff.
So for formal correctness the pci_dev_put calls need to be moved out of
the spinlock too.
Regards,
Joerg
next prev parent reply other threads:[~2011-04-07 20:30 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-06 11:21 [PATCH] USB host: Fix lockdep warning in AMD PLL quirk Joerg Roedel
2011-04-06 15:16 ` Alan Stern
2011-04-06 15:25 ` Roedel, Joerg
2011-04-07 2:21 ` Xu, Andiry
2011-04-07 7:50 ` Roedel, Joerg
2011-04-07 9:01 ` Xu, Andiry
2011-04-07 13:00 ` Roedel, Joerg
2011-04-07 15:01 ` Alan Stern
2011-04-07 20:22 ` Joerg Roedel [this message]
2011-04-08 14:26 ` [PATCH v4] " Joerg Roedel
2011-04-08 14:52 ` Alan Stern
2011-04-08 15:09 ` Roedel, Joerg
2011-04-08 16:30 ` Alan Stern
2011-04-07 8:26 ` [PATCH] " Joerg Roedel
2011-04-07 9:58 ` Xu, Andiry
2011-04-07 12:52 ` Roedel, Joerg
2011-04-07 13:14 ` Joerg Roedel
2011-04-11 6:26 ` Borislav Petkov
2011-04-11 6:43 ` Roedel, Joerg
2011-04-11 6:59 ` [PATCH v5] " Roedel, Joerg
2011-04-11 10:00 ` Sergei Shtylyov
2011-04-11 15:49 ` Alan Stern
2011-04-11 16:16 ` Roedel, Joerg
2011-04-11 16:25 ` Alan Stern
2011-04-11 16:37 ` Roedel, Joerg
2011-04-11 17:05 ` Alan Stern
2011-04-12 6:41 ` [PATCH v6] " Roedel, Joerg
2011-04-12 10:59 ` Sergei Shtylyov
2011-04-12 11:13 ` Roedel, Joerg
2011-04-13 6:38 ` [PATCH v7] " Roedel, Joerg
2011-04-13 14:44 ` Alan Stern
2011-04-07 14:35 ` [PATCH] " Alan Stern
2011-04-07 15:00 ` Roedel, Joerg
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=20110407202249.GD19819@8bytes.org \
--to=joro@8bytes.org \
--cc=Andiry.Xu@amd.com \
--cc=Joerg.Roedel@amd.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sarah.a.sharp@linux.intel.com \
--cc=stable@kernel.org \
--cc=stern@rowland.harvard.edu \
/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