From: Linus Torvalds <torvalds@osdl.org>
To: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org
Subject: Re: [RFC&PATCH 1/2] PCI Error Recovery (readX_check)
Date: Mon, 23 Aug 2004 22:41:41 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.58.0408232231070.17766@ppc970.osdl.org> (raw)
In-Reply-To: <412AD123.8050605@jp.fujitsu.com>
On Tue, 24 Aug 2004, Hidetoshi Seto wrote:
>
> The basic design of new-found functions are:
>
> $1. clear_pci_errors(DEVICE)
> - find the highest(host or top PCI-to-PCI) bridge of DEVICE
> - check the status of the highest bridge, and if it indicates error(s):
> - write_lock
> - update each err_status of all devices registered to the working_device
> list of the highest bridge, by "|=" the value of the bridge status
> - clear the bridge status
> - write_unlock
> - clear the err_status of DEVICE
> - register DEVICE to the highest bridge
>
> $2. readX_check(DEVICE, ADDR)
> - read_lock
> - I/O (read)
> - read_unlock
>
> $3. read_pci_errors(DEVICE)
> - find the highest bridge of DEVICE
> - store the status of the highest bridge as STATUS
> - check ( STATUS | DEVICE->err_status )
> - return 1 if error (ex. Master/Target Abort, Party Error), else return 0
I'd suggest changing the locking a bit.
Just make "clear_pci_errors()" take a spinlock on the bridge, and
"read_pci_errors()" unlock it. We need to make sure that if multiple
devices on the same bridge try to be careful, they can do so without
seeing each others errors.
readX_check() itself would do no locking at all, since it is already
called with the assumption that the bridge has been locked.
I'd also suggest that you make "clear_pci_errors()" return a cookie for
read_pci_errors() to use.
Also, I assume that the thing would support (and please make the
documentation clear on it) multiple IO operations between a
"clear_pci_errors()" and it's ending "read_pci_errors()" pair. I can well
imagine that a driver might do
int get_data_buffer(struct pci_dev *dev, u32 *buf, int words)
{
int i;
pci_error_t cookie;
unsigned long offset = pci_resource_start(dev, 0) + DATA_OFFSET;
cookie = clear_pci_errors(dev);
/* Get the whole packet of data.. */
for (i = 0; i < words; i++)
*buf++ = readl_check(dev, offset);
/* Did we have any trouble? */
if (read_pci_errors(dev, cookie))
return -EIO;
/* All systems go.. */
return 0;
}
to read a "packet" of data from a device. Whatever.
Linus
next prev parent reply other threads:[~2004-08-24 5:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-24 5:24 [RFC&PATCH 1/2] PCI Error Recovery (readX_check) Hidetoshi Seto
2004-08-24 5:41 ` Linus Torvalds [this message]
2004-08-24 8:06 ` Hidetoshi Seto
2004-08-25 7:01 ` Benjamin Herrenschmidt
2004-08-25 7:20 ` Linus Torvalds
2004-08-25 15:52 ` Grant Grundler
2004-08-25 17:25 ` Linus Torvalds
2004-08-25 23:23 ` Benjamin Herrenschmidt
2004-08-25 23:35 ` Linus Torvalds
2004-08-25 15:42 ` Grant Grundler
2004-08-28 1:23 Hidetoshi Seto
2004-09-17 12:00 ` Hidetoshi Seto
2004-09-17 12:06 ` Hidetoshi Seto
2004-09-18 4:36 ` Grant Grundler
2004-09-21 8:32 ` Hidetoshi Seto
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=Pine.LNX.4.58.0408232231070.17766@ppc970.osdl.org \
--to=torvalds@osdl.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=seto.hidetoshi@jp.fujitsu.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;
as well as URLs for NNTP newsgroup(s).