From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: brking@us.ibm.com
Cc: greg@kroah.com, paulus@samba.org, benh@kernel.crashing.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] pci: Block config access during BIST
Date: Sat, 20 Nov 2004 02:27:16 +0000 [thread overview]
Message-ID: <1100917635.9398.12.camel@localhost.localdomain> (raw)
In-Reply-To: <200411192023.iAJKNNSt004374@d03av02.boulder.ibm.com>
On Gwe, 2004-11-19 at 20:23, brking@us.ibm.com wrote:
> +#define PCI_READ_CONFIG(size,type) \
> +int pci_read_config_##size \
> + (struct pci_dev *dev, int pos, type *val) \
> +{ \
> + unsigned long flags; \
> + int ret = 0; \
> + if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
> + spin_lock_irqsave(&access_lock, flags); \
> + if (!dev->block_cfg_access) \
> + ret = pci_bus_read_config_##size(dev->bus, dev->devfn, pos, val); \
> + else if (pos < sizeof(dev->saved_config_space)) \
> + *val = (type)dev->saved_config_space[pos/sizeof(dev->saved_config_space[0])]; \
> + else \
> + *val = -1; \
> + spin_unlock_irqrestore(&access_lock, flags); \
> + return ret; \
> +}
Several vendors (for good or for bad) require configuration space is
touched from interrupts on fast paths. This change will _really_ hurt
random PC class machines so please make it more sensible in its
condition handling.
To start with you can do something like
if(unlikely(dev->designed_badly)) {
slow_spinlock_path
}
/* Designed less badly 8) */
existing code path
Even better, put that code in your private debug tree. Replace the
locked cases with BUG() and fix the driver to get its internal locking
right in this situation.
It seems wrong to put expensive checks in core code paths when you could
just as easily provide
my_device_is_stupid_pci_read_config_byte()
and equivalent lock taking functions that wrap the existing ones and are
locked against the reset path without hurting sane computing devices
(and PC's).
Alan
next prev parent reply other threads:[~2004-11-20 3:33 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-19 20:23 [PATCH 1/2] pci: Block config access during BIST brking
2004-11-19 21:32 ` Greg KH
2004-11-19 22:25 ` Brian King
2004-11-19 22:46 ` Benjamin Herrenschmidt
2004-11-19 23:22 ` Brian King
2004-11-20 0:23 ` Benjamin Herrenschmidt
2004-11-19 22:45 ` Benjamin Herrenschmidt
2004-11-20 2:27 ` Alan Cox [this message]
2004-11-20 7:09 ` Benjamin Herrenschmidt
2004-11-20 12:42 ` Alan Cox
2004-11-20 22:32 ` Benjamin Herrenschmidt
2004-11-20 23:38 ` Brian King
2004-11-21 0:06 ` Benjamin Herrenschmidt
2004-11-21 1:55 ` Brian King
2004-11-21 7:03 ` Benjamin Herrenschmidt
2004-11-21 17:22 ` Brian King
2004-12-03 15:26 ` Brian King
2004-11-24 11:49 ` Alan Cox
2004-11-25 22:00 ` Paul Mackerras
2004-11-25 21:11 ` Alan Cox
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=1100917635.9398.12.camel@localhost.localdomain \
--to=alan@lxorguk.ukuu.org.uk \
--cc=benh@kernel.crashing.org \
--cc=brking@us.ibm.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
/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