public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Roedel, Joerg" <Joerg.Roedel@amd.com>
To: "Xu, Andiry" <Andiry.Xu@amd.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	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 15:00:08 +0200	[thread overview]
Message-ID: <20110407130008.GX23633@amd.com> (raw)
In-Reply-To: <2DEEA3AB13739D45A22ADDB5086AEA0B01308475@sshaexmb1.amd.com>

On Thu, Apr 07, 2011 at 05:01:01AM -0400, Xu, Andiry wrote:
> > -----Original Message-----
> > From: Roedel, Joerg [mailto:Joerg.Roedel@amd.com]
> > Sent: Thursday, April 07, 2011 3:51 PM
> > To: Alan Stern
> > Cc: Greg Kroah-Hartman; Sarah Sharp; Xu, Andiry; linux-usb@vger.kernel.org;
> > linux-kernel@vger.kernel.org; stable@kernel.org
> > Subject: Re: [PATCH] USB host: Fix lockdep warning in AMD PLL quirk
> >
> > On Wed, Apr 06, 2011 at 11:16:07AM -0400, Alan Stern wrote:
> > > On Wed, 6 Apr 2011, Joerg Roedel wrote:
> >
> > > The counter really should be a bool: Has the chipset already been
> > > probed or not?  After all, nobody cares how many times this routine was
> > > called.
> > >
> > > > + spin_unlock_irqrestore(&amd_lock, flags);
> > >
> > > This code now contains a bug: You incremented the probe_count _before_
> > > doing the probe.  If another thread calls this routine right now, it
> > > will get an incorrect result.
> > >
> > > Fixing this up should be fairly easy.
> >
> > Hmm, we can get rid of the amd_lock completly if every thread uses the
> > following call-order:
> >
> >       usb_amd_find_chipset_info();
> >       usb_amd_quirk_pll_enable();
> >       usb_amd_quirk_pll_disable();
> >       usb_amd_dev_put();
> >
> 
> The correct order is:
> 
> usb_amd_find_chipset_info();
> usb_amd_quirk_pll_disable();
> usb_amd_quirk_pll_enable();
> usb_amd_dev_put();
> 
> The pair of pll disable and enable may be called for multiple times.

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?

Regards,

	Joerg

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632


  reply	other threads:[~2011-04-07 13:00 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 [this message]
2011-04-07 15:01         ` Alan Stern
2011-04-07 20:22           ` Joerg Roedel
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=20110407130008.GX23633@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=Andiry.Xu@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