From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Chris Wright <chrisw@sous-sol.org>
Cc: Matthew Wilcox <matthew@wil.cx>,
Chris Wright <chrisw@sous-sol.org>,
Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
Linus Torvalds <torvalds@linux-foundation.org>,
Yu Zhao <yu.zhao@intel.com>,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
stable@kernel.org
Subject: Re: [PATCH v2] SR-IOV: correct broken resource alignment calculations
Date: Sun, 30 Aug 2009 08:39:01 -0700 [thread overview]
Message-ID: <20090830083901.7d46e083@jbarnes-g45> (raw)
In-Reply-To: <20090828200006.GL10360@sequoia.sous-sol.org>
On Fri, 28 Aug 2009 13:00:06 -0700
Chris Wright <chrisw@sous-sol.org> wrote:
> * Matthew Wilcox (matthew@wil.cx) wrote:
> > On Fri, Aug 28, 2009 at 12:17:14PM -0700, Chris Wright wrote:
> > > This patch adds a support for a new resource alignment type,
> > > IORESOURCE_VSIZEALIGN, and allows struct resource to keep track
> > > of the size requirements of a VF BAR which are smaller than the
> > > full resource size. This could also be done all within the PCI
> > > layer w/out bloating struct resource or using the last available
> > > bit for alignment types.
> >
> > Yes, I think that would be preferable. We have a *LOT* of
> > resources in the kernel, and the embedded folks would not find it
> > funny if they all grew in size suddenly.
>
> An SR-IOV capable device includes an SR-IOV PCIe capability which
> describes the Virtual Function (VF) BAR requirements. A typical
> SR-IOV device can support multiple VFs whose BARs must be in a
> contiguous region, effectively an array of VF BARs. The BAR reports
> the size requirement for a single VF. We calculate the full range
> needed by simply multiplying the VF BAR size with the number of
> possible VFs and create a resource spanning the full range.
>
> This all seems sane enough except it artificially inflates the
> alignment requirement for the VF BAR. The VF BAR need only be
> aligned to the size of a single BAR not the contiguous range of VF
> BARs. This can cause us to fail to allocate resources for the BAR
> despite the fact that we actually have enough space.
>
> This patch adds a thin PCI specific layer over the generic
> resource_alignment() function which is aware of the special nature of
> VF BARs and does sorting and allocation based on the smaller alignment
> requirement.
>
> I recognize that while resource_alignment is generic, it's basically a
> PCI helper. An alternative to this patch is to add PCI VF BAR
> specific information to struct resource. I opted for the extra layer
> rather than adding such PCI specific information to struct resource.
> This does have the slight downside that we don't cache the BAR size
> and re-read for each alignment query (happens a small handful of
> times during boot for each VF BAR).
>
> Signed-off-by: Chris Wright <chrisw@sous-sol.org>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Matthew Wilcox <matthew@wil.cx>
> Cc: Yu Zhao <yu.zhao@intel.com>
> Cc: stable@kernel.org
Yeah, I like this one better. I've applied it to my for-linus branch;
would be nice to have a Tested-by for it before I send it to Linus...
Thanks,
--
Jesse Barnes, Intel Open Source Technology Center
prev parent reply other threads:[~2009-08-30 15:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-28 19:17 [PATCH] " Chris Wright
2009-08-28 19:43 ` Greg KH
2009-08-28 19:58 ` Chris Wright
2009-08-28 19:48 ` Matthew Wilcox
2009-08-28 19:59 ` Chris Wright
2009-08-28 20:00 ` [PATCH v2] " Chris Wright
2009-08-30 15:39 ` Jesse Barnes [this message]
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=20090830083901.7d46e083@jbarnes-g45 \
--to=jbarnes@virtuousgeek.org \
--cc=chrisw@sous-sol.org \
--cc=ink@jurassic.park.msu.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=yu.zhao@intel.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
all inboxes | Powered by JetHome®