From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Ram Pai <linuxram@us.ibm.com>,
Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH 1/5] PCI : Calculate right add_size
Date: Fri, 6 Jan 2012 13:14:36 -0800 [thread overview]
Message-ID: <20120106131436.17cf45e6@jbarnes-desktop> (raw)
In-Reply-To: <1323247984-15281-2-git-send-email-yinghai@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 2474 bytes --]
On Wed, 7 Dec 2011 00:53:00 -0800
Yinghai Lu <yinghai@kernel.org> wrote:
> During debug one SRIOV enabled hotplug, found add_size is not passed properly.
>
> the device have devices under two level bridges..
>
> +-[0000:80]-+-00.0-[81-8f]--
> | +-01.0-[90-9f]--
> | +-02.0-[a0-af]----00.0-[a1-a3]--+-02.0-[a2]--+-00.0 Oracle Corporation Device
> | | \-03.0-[a3]--+-00.0 Oracle Corporation Device
>
> so later parent bridge will not try to add big range.
> [ 557.455077] pci 0000:a0:00.0: BAR 14: assigned [mem 0xf9000000-0xf93fffff]
> [ 557.461974] pci 0000:a0:00.0: BAR 15: assigned [mem 0xf6000000-0xf61fffff pref]
> [ 557.469340] pci 0000:a1:02.0: BAR 14: assigned [mem 0xf9000000-0xf91fffff]
> [ 557.476231] pci 0000:a1:02.0: BAR 15: assigned [mem 0xf6000000-0xf60fffff pref]
> [ 557.483582] pci 0000:a1:03.0: BAR 14: assigned [mem 0xf9200000-0xf93fffff]
> [ 557.490468] pci 0000:a1:03.0: BAR 15: assigned [mem 0xf6100000-0xf61fffff pref]
> [ 557.497833] pci 0000:a1:03.0: BAR 14: can't assign mem (size 0x200000)
> [ 557.504378] pci 0000:a1:03.0: failed to add optional resources res=[mem 0xf9200000-0xf93fffff]
> [ 557.513026] pci 0000:a1:02.0: BAR 14: can't assign mem (size 0x200000)
> [ 557.519578] pci 0000:a1:02.0: failed to add optional resources res=[mem 0xf9000000-0xf91fffff]
>
> it turns out We did not calculate size1 properly.
>
> static resource_size_t calculate_memsize(resource_size_t size,
> resource_size_t min_size,
> resource_size_t size1,
> resource_size_t old_size,
> resource_size_t align)
> {
> if (size < min_size)
> size = min_size;
> if (old_size == 1 )
> old_size = 0;
> if (size < old_size)
> size = old_size;
> size = ALIGN(size + size1, align);
> return size;
> }
>
> We should not pass add_size with min_size in calculate_memsize.
> that will make add_size not contribute final add_size.
>
> Just pass add_size with size1 to calculate_memsize()
>
> With this change, We should have chance to remove extra addon in pci_reassign_resource...
This one looks like a fairly standalone bug fix; it doesn't require
subtle changes in behavior from the later patches to work right does it?
Thanks,
--
Jesse Barnes, Intel Open Source Technology Center
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-01-06 21:14 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 8:52 [PATCH 0/5] PCI: make pci hotplug/rescan path to handle add_size list Yinghai Lu
2011-12-07 8:53 ` [PATCH 1/5] PCI : Calculate right add_size Yinghai Lu
2012-01-06 21:14 ` Jesse Barnes [this message]
2012-01-07 1:21 ` Yinghai Lu
2011-12-07 8:53 ` [PATCH 2/5] PCI: Try to assign required+option size at first Yinghai Lu
2012-01-06 21:49 ` Jesse Barnes
2012-01-07 3:46 ` Yinghai Lu
2012-01-07 5:51 ` Yinghai Lu
2012-01-07 5:53 ` Yinghai Lu
2012-01-07 6:12 ` Yinghai Lu
2012-01-07 4:49 ` Linus Torvalds
2012-01-09 6:01 ` Yinghai Lu
2012-01-11 6:20 ` Linus Torvalds
2012-01-11 18:01 ` Yinghai Lu
2012-01-13 16:39 ` Ram Pai
2012-01-13 23:28 ` Yinghai Lu
2012-01-15 16:05 ` Ram Pai
2012-01-16 1:14 ` Yinghai Lu
2012-01-16 3:26 ` Ram Pai
2012-01-16 4:54 ` Yinghai Lu
2012-01-16 10:29 ` Ram Pai
2012-01-16 17:13 ` Yinghai Lu
2012-01-16 21:30 ` Yinghai Lu
2012-01-16 19:59 ` Peter Henriksson
2012-01-16 21:41 ` Yinghai Lu
2011-12-07 8:53 ` [PATCH 3/5] PCI: Using add_list in pcie hotplug path Yinghai Lu
2012-01-06 21:58 ` Jesse Barnes
2012-01-07 1:30 ` Yinghai Lu
2011-12-07 8:53 ` [PATCH 4/5] PCI: Make rescan bus could increase bridge resource size if needed Yinghai Lu
2011-12-07 8:53 ` [PATCH 5/5] PCI: Make pci_rescan_bus handle add_list Yinghai Lu
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=20120106131436.17cf45e6@jbarnes-desktop \
--to=jbarnes@virtuousgeek.org \
--cc=kaneshige.kenji@jp.fujitsu.com \
--cc=linux-pci@vger.kernel.org \
--cc=linuxram@us.ibm.com \
--cc=yinghai@kernel.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;
as well as URLs for NNTP newsgroup(s).