Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-07 Thread Grant Grundler
On Wed, Sep 07, 2005 at 10:05:30PM -0500, Brian King wrote: > I reverted the patch to use a spinlock and added a comment. > How does this look? Fine with me. Ball is in akpm/Paul's court. grant - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-07 Thread Brian King
Grant Grundler wrote: On Thu, Sep 08, 2005 at 08:39:15AM +1000, Paul Mackerras wrote: Grant Grundler writes: I would argue it more obvious. People looking at the code are immediately going to realize it was a deliberate choice to not use a spinlock. It achieves exactly the same effect as s

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-07 Thread Grant Grundler
On Thu, Sep 08, 2005 at 08:39:15AM +1000, Paul Mackerras wrote: > Grant Grundler writes: > > > I would argue it more obvious. People looking at the code > > are immediately going to realize it was a deliberate choice to > > not use a spinlock. > > It achieves exactly the same effect as spin_lock/

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-07 Thread Paul Mackerras
Grant Grundler writes: > I would argue it more obvious. People looking at the code > are immediately going to realize it was a deliberate choice to > not use a spinlock. It achieves exactly the same effect as spin_lock/spin_unlock, just more verbosely. :) > > and it precludes the sorts of optimi

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-07 Thread Grant Grundler
On Wed, Sep 07, 2005 at 03:49:37PM +1000, Paul Mackerras wrote: > Maybe, but it seems like a bad idea to me. It's longer, it's less > obvious what's happening, I would argue it more obvious. People looking at the code are immediately going to realize it was a deliberate choice to not use a spinlo

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-06 Thread Paul Mackerras
Grant Grundler writes: > Ok this is good example - I see what the problem is. > You could use the following sequence too then: > pci_block_user_cfg_access > pci_save_state > block_ucfg_access = 1 > mb() > while (spin_is_locked(&pci_lock

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-06 Thread Brian King
Grant Grundler wrote: > On Mon, Sep 05, 2005 at 01:31:20PM -0500, Brian King wrote: >>+void pci_block_user_cfg_access(struct pci_dev *dev) >>+{ >>+ pci_save_state(dev); >>+ dev->block_ucfg_access = 1; >>+ mb(); >>+ while (spin_is_locked(&pci_lock)) >>+ cpu_relax(); >>+}

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-05 Thread Grant Grundler
On Mon, Sep 05, 2005 at 01:31:20PM -0500, Brian King wrote: > That should work also. Here is an updated patch. ... The code looks good...but it got me thinking. ... > +void pci_block_user_cfg_access(struct pci_dev *dev) > +{ > + pci_save_state(dev); > + dev->block_ucfg_access = 1; > +

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-05 Thread Brian King
Grant Grundler wrote: On Sat, Sep 03, 2005 at 06:37:52PM -0500, Brian King wrote: ... Without the locking, we introduce a race condition. CPU 0 CPU 1 pci_block_user_cfg_access

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-03 Thread Grant Grundler
On Sat, Sep 03, 2005 at 06:37:52PM -0500, Brian King wrote: ... > Without the locking, we introduce a race condition. > > CPU 0 CPU 1 > > pci_block_user_cfg_access > pci_s

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-03 Thread Brian King
Grant Grundler wrote: On Sat, Sep 03, 2005 at 09:11:30AM +1000, Paul Mackerras wrote: Think about it. Taking the lock ensures that we don't do the assignment (dev->block_ucfg_access = 1) while any other cpu has the pci_lock. In other words, the reason for taking the lock is so that we wait un

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-02 Thread Grant Grundler
On Sat, Sep 03, 2005 at 09:11:30AM +1000, Paul Mackerras wrote: > Think about it. Taking the lock ensures that we don't do the > assignment (dev->block_ucfg_access = 1) while any other cpu has the > pci_lock. In other words, the reason for taking the lock is so that > we wait until nobody else is

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-02 Thread Paul Mackerras
Grant Grundler writes: > On Fri, Sep 02, 2005 at 06:56:35PM -0500, Brian King wrote: > > Andrew Morton wrote: > > >Brian King <[EMAIL PROTECTED]> wrote: > > > > > >>+void pci_block_user_cfg_access(struct pci_dev *dev) > > >>+{ > > >>+ unsigned long flags; > > >>+ > > >>+ pci_save_state(dev); > > >

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-02 Thread Grant Grundler
On Fri, Sep 02, 2005 at 06:56:35PM -0500, Brian King wrote: > Andrew Morton wrote: > >Brian King <[EMAIL PROTECTED]> wrote: > > > >>+void pci_block_user_cfg_access(struct pci_dev *dev) > >>+{ > >>+ unsigned long flags; > >>+ > >>+ pci_save_state(dev); > >>+ spin_lock_irqsave(&pci_lock, flags)

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-02 Thread Brian King
Andrew Morton wrote: Brian King <[EMAIL PROTECTED]> wrote: +void pci_block_user_cfg_access(struct pci_dev *dev) +{ + unsigned long flags; + + pci_save_state(dev); + spin_lock_irqsave(&pci_lock, flags); + dev->block_ucfg_access = 1; + spin_unlock_irqrestore(&pci_loc

Re: [PATCH 1/2] pci: Block config access during BIST (resend)

2005-09-01 Thread Andrew Morton
Brian King <[EMAIL PROTECTED]> wrote: > > +void pci_block_user_cfg_access(struct pci_dev *dev) > +{ > + unsigned long flags; > + > + pci_save_state(dev); > + spin_lock_irqsave(&pci_lock, flags); > + dev->block_ucfg_access = 1; > + spin_unlock_irqrestore(&pci_lock, flags); Are y