From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Gary Hade <garyhade@us.ibm.com>, Ingo Molnar <mingo@elte.hu>,
Thomas Meyer <thomas@m3y3r.de>,
Stefan Richter <stefanr@s5r6.in-berlin.de>,
Thomas Gleixner <tglx@linutronix.de>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
LKML <linux-kernel@vger.kernel.org>,
Adrian Bunk <bunk@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Natalie Protasevich <protasnb@gmail.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
pm@debian.org
Subject: Re: [patch] pci: revert "PCI: remove transparent bridge sizing"
Date: Thu, 27 Mar 2008 02:29:22 +0300 [thread overview]
Message-ID: <20080326232922.GA15784@jurassic.park.msu.ru> (raw)
In-Reply-To: <alpine.LFD.1.00.0803261416390.2775@woody.linux-foundation.org>
On Wed, Mar 26, 2008 at 02:41:44PM -0700, Linus Torvalds wrote:
> In fact, I think the old code was buggy too, because we actually *do* have
> single-byte resources where start == end, as showb by google:
>
> PCI: Ignore bogus resource 1 [3f6:3f6] of Symphony Labs SL82c105
> PCI: Ignore bogus resource 3 [376:376] of Symphony Labs SL82c105
>
> where that resource actually looks valid, and should have a single byte
> alignment! Admittedly I think it was created with a quirk (can you get
> that kind of resource from actually _probing_ a PCI device?) but I do
> think that a single-byte resource is valid.
Good point - even though 1-byte size/alignment is invalid for a regular BAR
(minimum is 8 bytes for IO and 16 bytes for MEM, IIRC), nothing prevents
us from using this code for non-standard stuff, including single-byte
resources.
> So I wonder if we shouldn't just make this a bit more readable and also a
> bit more explicit with something like the appended..
Agreed, this looks better...
> NOTE! This will also consider a bridge resource at 0 to be an invalid
> resource (since now the alignment will be zero), which is a bit odd and
> makes me worry a bit. I wouldn't be surprised if some non-PC architectures
> have PCI bridges at zero. But maybe they should be (or already are?)
> marked IORESOURCE_PCI_FIXED?
Well, at this point (pdev_sort_resources call) bridge resource->start
has nothing to do with a bus address, it just a temporary storage for
required alignment, filled by sizing routines (and 0 is definitely invalid
here). I know, this is quite confusing, but I didn't want to add extra
fields to existing structures or create temporary per-bus trees...
But after pci_assign_resource() that resource can certainly be at 0,
depending on PCIBIOS_MIN_{IO,MEM} and free slots in the resource tree.
> +static inline resource_size_t get_resource_alignment(int resno, struct resource *r)
> +{
> + resource_size_t start = r->start, end = r->end;
> + resource_size_t alignment = 0;
> +
> + /* End == start == 0 - invalid resource */
> + if (end && start <= end) {
> + alignment = end - start - 1;
Must be end - start + 1
> Also, the reason I *think* this issue is ok is that I think the only PCI
> bus resources we can see in the whole pdev_sort_resources() mess is the
> ones that are behind the bus that we're not sizing for, and they've been
> set up by pbus_size_mem().
>
> And pbus_size_mem() has this special magic setup where it calculates the
> size and the alignment of the bus resource, and then makes
>
> r->start = alignment;
> r->end = r->start + size - 1;
>
> so using "r->start" *should* be ok in this case because it really means
> "alignment" in this one case.
Yes, absolutely.
> I also wonder if we maybe should just add a separate "alignment" field to
> the resources. Rather than playing games like these (and having to compare
> the resource number to decide whether it is a bus resource or a normal PCI
> device resource), just adding the dang field would be a whole lot saner.
Extra 4 or 8 bytes per resource? Well, if you think that people won't start
complain too much about that, I'll be absolutely happy with that.
It'd vastly improve readability.
> I dunno. I'm not going to do anything in this area before 2.6.25 is out
> because this *does* make me a bit nervous, but if somebody wants to think
> about this and perhaps write patches for testing, that would be good.
If the new "align" field (and then, maybe, "size" instead of "end"?)
is OK, then I'm definitely willing to give it a try.
Ivan.
next prev parent reply other threads:[~2008-03-26 23:29 UTC|newest]
Thread overview: 97+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-22 1:59 2.6.25-rc6-git6: Reported regressions from 2.6.24 Rafael J. Wysocki
2008-03-22 2:52 ` Jeff Garzik
2008-03-22 11:11 ` Ingo Molnar
2008-03-22 5:33 ` Andrew Morton
2008-03-22 11:15 ` Ingo Molnar
2008-03-22 17:53 ` Rafael J. Wysocki
2008-03-22 16:32 ` Heiko Carstens
2008-03-22 17:56 ` Rafael J. Wysocki
2008-03-22 16:34 ` ohci1394 problem (MMIO broken) (was 2.6.25-rc6-git6: Reported regressions from 2.6.24) Stefan Richter
2008-03-22 17:24 ` Thomas Meyer
2008-03-22 17:58 ` Rafael J. Wysocki
2008-03-22 18:27 ` Stefan Richter
2008-03-22 19:02 ` Stefan Richter
2008-03-22 21:33 ` Linus Torvalds
2008-03-22 21:58 ` Thomas Gleixner
2008-03-22 21:59 ` H. Peter Anvin
2008-03-22 22:27 ` ohci1394 problem (MMIO broken) (was 2.6.25-rc6-git6: Reported regressions from 2.6.24) [Bug 10080] Stefan Richter
2008-03-22 23:28 ` ohci1394 problem (MMIO broken) (was 2.6.25-rc6-git6: Reported regressions from 2.6.24) Yinghai Lu
2008-03-22 23:31 ` H. Peter Anvin
2008-03-23 2:00 ` Yinghai Lu
2008-03-23 2:39 ` H. Peter Anvin
2008-03-23 3:30 ` Yinghai Lu
2008-03-22 23:01 ` Linus Torvalds
2008-03-22 23:50 ` Stefan Richter
2008-03-23 6:35 ` Ingo Molnar
2008-03-24 19:34 ` Thomas Meyer
2008-03-24 19:47 ` Ingo Molnar
2008-03-24 20:17 ` Thomas Meyer
2008-03-24 20:47 ` Linus Torvalds
2008-03-26 3:39 ` Benjamin Herrenschmidt
2008-03-26 23:25 ` Benjamin Herrenschmidt
2008-03-24 19:58 ` Thomas Meyer
2008-03-24 20:50 ` Linus Torvalds
2008-03-24 21:24 ` Stefan Richter
2008-03-24 21:47 ` Stefan Richter
2008-03-25 7:31 ` Ingo Molnar
2008-03-25 16:50 ` Ingo Molnar
2008-03-25 17:06 ` Stefan Richter
2008-03-25 18:32 ` Thomas Meyer
2008-03-25 20:11 ` Ingo Molnar
2008-03-25 20:29 ` Ingo Molnar
2008-03-25 21:08 ` Thomas Meyer
2008-03-25 21:47 ` Linus Torvalds
2008-03-25 22:02 ` Thomas Meyer
2008-03-26 10:14 ` Ivan Kokshaysky
2008-03-26 12:17 ` Benjamin Herrenschmidt
2008-03-26 13:54 ` [patch] pci: revert "PCI: remove transparent bridge sizing" Ingo Molnar
2008-03-26 17:45 ` Thomas Meyer
2008-03-26 18:07 ` Gary Hade
2008-03-26 18:33 ` Linus Torvalds
2008-03-26 20:30 ` Gary Hade
2008-03-26 20:46 ` Linus Torvalds
2008-03-26 20:58 ` Ivan Kokshaysky
2008-03-26 21:41 ` Linus Torvalds
2008-03-26 21:57 ` Benjamin Herrenschmidt
2008-03-26 22:07 ` Alan Cox
2008-03-26 22:27 ` Benjamin Herrenschmidt
2008-03-26 22:10 ` Ingo Molnar
2008-03-26 22:29 ` Benjamin Herrenschmidt
2008-03-26 22:47 ` Linus Torvalds
2008-03-26 22:54 ` Benjamin Herrenschmidt
2008-03-26 23:18 ` Benjamin Herrenschmidt
2008-03-26 22:30 ` Ingo Molnar
2008-03-26 22:31 ` Linus Torvalds
2008-03-26 22:47 ` Alan Cox
2008-03-26 23:17 ` Benjamin Herrenschmidt
2008-03-26 23:29 ` Ivan Kokshaysky [this message]
2008-03-26 23:43 ` Linus Torvalds
2008-03-27 17:12 ` Linus Torvalds
2008-03-27 22:18 ` Ivan Kokshaysky
2008-03-27 22:34 ` Linus Torvalds
2008-03-28 19:24 ` Gary Hade
2008-03-28 20:46 ` Gary Hade
2008-03-30 15:44 ` Ivan Kokshaysky
2008-03-26 23:45 ` Benjamin Herrenschmidt
2008-03-26 21:29 ` Ingo Molnar
2008-03-26 11:12 ` ohci1394 problem (MMIO broken) (was 2.6.25-rc6-git6: Reported regressions from 2.6.24) Ivan Kokshaysky
2008-03-25 21:02 ` Thomas Meyer
2008-03-25 23:33 ` Benjamin Herrenschmidt
2008-03-26 0:03 ` Yinghai Lu
2008-03-26 0:12 ` Benjamin Herrenschmidt
2008-03-23 12:57 ` 2.6.25-rc6-git6: Reported regressions from 2.6.24 Alan Cox
2008-03-26 16:30 ` Ray Lee
2008-03-26 17:02 ` Adrian Bunk
2008-03-26 22:11 ` Rafael J. Wysocki
2008-03-27 10:18 ` Romano Giannetti
2008-03-27 14:43 ` Ray Lee
2008-03-31 18:21 ` Linus Torvalds
2008-03-31 19:29 ` Mark Lord
2008-03-31 21:04 ` Tino Keitel
2008-03-31 21:26 ` Tino Keitel
2008-04-03 19:06 ` 2.6.25-rc7/8: Another resume regression Mark Lord
2008-04-05 2:27 ` Mark Lord
2008-04-07 10:51 ` Rafael J. Wysocki
2008-04-07 15:51 ` Mark Lord
2008-04-07 17:40 ` Rafael J. Wysocki
2008-04-08 15:35 ` Mark Lord
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=20080326232922.GA15784@jurassic.park.msu.ru \
--to=ink@jurassic.park.msu.ru \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=bunk@kernel.org \
--cc=garyhade@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=pm@debian.org \
--cc=protasnb@gmail.com \
--cc=rjw@sisk.pl \
--cc=stefanr@s5r6.in-berlin.de \
--cc=tglx@linutronix.de \
--cc=thomas@m3y3r.de \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®