From: "Chen, Tiejun" <tiejun.chen@intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "tim@xen.org" <tim@xen.org>, Kevin Tian <kevin.tian@intel.com>,
"wei.liu2@citrix.com" <wei.liu2@citrix.com>,
"ian.campbell@citrix.com" <ian.campbell@citrix.com>,
"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
"Ian.Jackson@eu.citrix.com" <Ian.Jackson@eu.citrix.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
"stefano.stabellini@citrix.com" <stefano.stabellini@citrix.com>,
Yang Z Zhang <yang.z.zhang@intel.com>
Subject: Re: [v3][PATCH 07/16] hvmloader/pci: skip reserved ranges
Date: Wed, 17 Jun 2015 16:26:21 +0800 [thread overview]
Message-ID: <55812F2D.2030504@intel.com> (raw)
In-Reply-To: <5581466C0200007800085DEC@mail.emea.novell.com>
On 2015/6/17 16:05, Jan Beulich wrote:
>>>> On 17.06.15 at 09:54, <tiejun.chen@intel.com> wrote:
>> On 2015/6/17 15:19, Jan Beulich wrote:
>>>>>> On 17.06.15 at 09:10, <tiejun.chen@intel.com> wrote:
>>>> Yeah, this may waste some spaces in this worst case but I this think
>>>> this can guarantee our change don't impact on the original expectation,
>>>> right?
>>>
>>> "Some space" may be multiple Gb (e.g. the frame buffer of a graphics
>>
>> Sure.
>>
>>> card), which is totally unacceptable.
>>>
>>
>> But then I don't understand what's your way. How can we fit all pci
>> devices just with "the smallest power-of-2 region enclosing the reserved
>> device memory"?
>>
>> For example, the whole pci memory is sitting at
>> [0xa0000000, 0xa2000000]. And there are two PCI devices, A and B. Note
>> each device needs to be allocated with 0x1000000. So if without
>> concerning RMRR,
>>
>> A. [0xa0000000,0xa1000000]
>> B. [0xa1000000,0xa2000000]
>>
>> But if one RMRR resides at [0xa0f00000, 0xa1f00000] which obviously
>> generate its own alignment with 0x1000000. So the pci memory is expended
>> as [0xa0000000, 0xa3000000], right?
>>
>> Then actually the whole pci memory can be separated three segments like,
>>
>> #1. [0xa0000000, 0xa0f00000]
>> #2. [0xa0f00000, 0xa1f00000] -> RMRR would occupy
>> #3. [0xa1f00000, 0xa3000000]
>>
>> So just #3 can suffice to allocate but just for one device, right?
>
> Right, i.e. this isn't even sufficient - you need [a0000000,a3ffffff]
> to fit everything (but of course you can put smaller BARs into the
> unused ranges [a0000000,a0efffff] and [a1f00000,a1ffffff]).
Yes, I knew there's this sort of hole that we should use efficiently as
you said. And I also thought about this way previously but current pci
allocation framework isn't friend to implement this easily,
/* Assign iomem and ioport resources in descending order of size. */
for ( i = 0; i < nr_bars; i++ )
{
I mean it isn't easy to calculate what's the most sufficient size in
advance, and its also difficult to find to fit a appropriate pci device
into those "holes", so see below,
> That's why I said it's not going to be tricky to get all corner cases
> right _and_ not use up more space than needed.
>
>>>>> ought to work out the smallest power-of-2 region enclosing the
>>>>
>>>> Okay. I remember the smallest size of a given PCI I/O space is 8 bytes,
>>>> and the smallest size of a PCI memory space is 16 bytes. So
>>>>
>>>> /* At least 16 bytes to align a PCI BAR size. */
>>>> uint64_t align = 16;
>>>>
>>>> reserved_start = memory_map.map[j].addr;
>>>> reserved_size = memory_map.map[j].size;
>>>>
>>>> reserved_start = (reserved_star + align) & ~(align - 1);
>>>> reserved_size = (reserved_size + align) & ~(align - 1);
>>>>
>>>> Is this correct?
>>>
>>> Simply aligning the region doesn't help afaict. You need to fit it
>>> with the other MMIO allocations.
>>
>> I guess you're saying just those mmio allocations conflicting with RMRR?
>> But we don't know these exact addresses until we finalize to allocate
>> them, right?
>
> That's the point - you need to allocate them _around_ the reserved
> regions.
>
Something hits me to generate another idea,
#1. Still allocate all devices as before.
#2. Lookup all actual bars to check if they're conflicting RMRR
We can skip these bars to keep zero. Then later it would make lookup easily.
#3. Need to reallocate these conflicting bars.
#3.1 Trying to reallocate them with the remaining resources
#3.2 If the remaining resources aren't enough, we need to allocate them
from high_mem_resource.
I just feel this way may be easy and better. And even, this way also can
help terminate the preexisting allocation failures, right?
Thanks
Tiejun
next prev parent reply other threads:[~2015-06-17 8:26 UTC|newest]
Thread overview: 114+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-11 1:15 [v3][PATCH 00/16] Fix RMRR Tiejun Chen
2015-06-11 1:15 ` [v3][PATCH 01/16] xen: introduce XENMEM_reserved_device_memory_map Tiejun Chen
2015-06-11 8:56 ` Tian, Kevin
2015-06-11 1:15 ` [v3][PATCH 02/16] xen/x86/p2m: introduce set_identity_p2m_entry Tiejun Chen
2015-06-11 7:33 ` Jan Beulich
2015-06-11 8:23 ` Chen, Tiejun
2015-06-11 9:23 ` Jan Beulich
2015-06-11 9:25 ` Chen, Tiejun
2015-06-11 9:00 ` Tian, Kevin
2015-06-11 9:18 ` Chen, Tiejun
2015-06-11 1:15 ` [v3][PATCH 03/16] xen/vtd: create RMRR mapping Tiejun Chen
2015-06-11 9:14 ` Tian, Kevin
2015-06-11 9:31 ` Chen, Tiejun
2015-06-11 14:07 ` Tim Deegan
2015-06-12 2:43 ` Chen, Tiejun
2015-06-12 5:58 ` Chen, Tiejun
2015-06-12 5:59 ` Tian, Kevin
2015-06-12 6:13 ` Chen, Tiejun
2015-06-18 10:07 ` Tim Deegan
2015-06-19 0:37 ` Chen, Tiejun
2015-06-17 10:03 ` Jan Beulich
2015-06-18 6:23 ` Chen, Tiejun
2015-06-11 1:15 ` [v3][PATCH 04/16] xen/passthrough: extend hypercall to support rdm reservation policy Tiejun Chen
2015-06-11 9:28 ` Tian, Kevin
2015-06-12 6:31 ` Chen, Tiejun
2015-06-12 8:45 ` Jan Beulich
2015-06-12 9:20 ` Chen, Tiejun
2015-06-12 9:26 ` Jan Beulich
2015-06-15 7:39 ` Chen, Tiejun
2015-06-16 2:30 ` Tian, Kevin
2015-06-17 10:11 ` Jan Beulich
2015-06-18 7:14 ` Chen, Tiejun
2015-06-18 7:53 ` Jan Beulich
2015-06-18 8:48 ` Chen, Tiejun
2015-06-18 9:13 ` Jan Beulich
2015-06-18 9:31 ` Chen, Tiejun
2015-06-11 1:15 ` [v3][PATCH 05/16] xen: enable XENMEM_memory_map in hvm Tiejun Chen
2015-06-11 9:29 ` Tian, Kevin
2015-06-17 10:14 ` Jan Beulich
2015-06-18 8:53 ` Chen, Tiejun
2015-06-11 1:15 ` [v3][PATCH 06/16] hvmloader: get guest memory map into memory_map[] Tiejun Chen
2015-06-11 9:38 ` Tian, Kevin
2015-06-12 7:33 ` Chen, Tiejun
2015-06-17 10:22 ` Jan Beulich
2015-06-18 9:13 ` Chen, Tiejun
2015-06-11 1:15 ` [v3][PATCH 07/16] hvmloader/pci: skip reserved ranges Tiejun Chen
2015-06-11 9:51 ` Tian, Kevin
2015-06-12 7:53 ` Chen, Tiejun
2015-06-16 5:47 ` Tian, Kevin
2015-06-16 9:29 ` Chen, Tiejun
2015-06-16 9:40 ` Jan Beulich
2015-06-17 7:10 ` Chen, Tiejun
2015-06-17 7:19 ` Jan Beulich
2015-06-17 7:54 ` Chen, Tiejun
2015-06-17 8:05 ` Jan Beulich
2015-06-17 8:26 ` Chen, Tiejun [this message]
2015-06-17 8:47 ` Chen, Tiejun
2015-06-17 9:02 ` Jan Beulich
2015-06-17 9:18 ` Chen, Tiejun
2015-06-17 9:24 ` Jan Beulich
2015-06-18 6:17 ` Chen, Tiejun
2015-06-18 6:29 ` Jan Beulich
2015-06-18 7:01 ` Chen, Tiejun
2015-06-18 8:05 ` Jan Beulich
2015-06-19 2:02 ` Chen, Tiejun
2015-06-23 9:46 ` Chen, Tiejun
2015-06-11 1:15 ` [v3][PATCH 08/16] hvmloader/e820: construct guest e820 table Tiejun Chen
2015-06-11 9:59 ` Tian, Kevin
2015-06-12 8:19 ` Chen, Tiejun
2015-06-16 5:54 ` Tian, Kevin
2015-06-11 1:15 ` [v3][PATCH 09/16] tools/libxc: Expose new hypercall xc_reserved_device_memory_map Tiejun Chen
2015-06-11 10:00 ` Tian, Kevin
2015-06-11 1:15 ` [v3][PATCH 10/16] tools: extend xc_assign_device() to support rdm reservation policy Tiejun Chen
2015-06-11 10:02 ` Tian, Kevin
2015-06-12 8:25 ` Chen, Tiejun
2015-06-16 2:28 ` Tian, Kevin
2015-06-12 15:43 ` Wei Liu
2015-06-15 1:12 ` Chen, Tiejun
2015-06-15 14:58 ` Wei Liu
2015-06-16 2:31 ` Chen, Tiejun
2015-06-11 1:15 ` [v3][PATCH 11/16] tools: introduce some new parameters to set rdm policy Tiejun Chen
2015-06-12 16:02 ` Wei Liu
2015-06-15 1:19 ` Chen, Tiejun
2015-06-11 1:15 ` [v3][PATCH 12/16] tools/libxl: passes rdm reservation policy Tiejun Chen
2015-06-12 16:17 ` Wei Liu
2015-06-15 1:26 ` Chen, Tiejun
2015-06-15 15:00 ` Wei Liu
2015-06-11 1:15 ` [v3][PATCH 13/16] tools/libxl: detect and avoid conflicts with RDM Tiejun Chen
2015-06-11 10:19 ` Tian, Kevin
2015-06-12 8:30 ` Chen, Tiejun
2015-06-12 16:39 ` Wei Liu
2015-06-15 1:50 ` Chen, Tiejun
2015-06-15 15:01 ` Wei Liu
2015-06-16 1:44 ` Chen, Tiejun
2015-06-11 1:15 ` [v3][PATCH 14/16] tools/libxl: extend XENMEM_set_memory_map Tiejun Chen
2015-06-12 16:43 ` Wei Liu
2015-06-15 2:15 ` Chen, Tiejun
2015-06-11 1:15 ` [v3][PATCH 15/16] xen/vtd: enable USB device assignment Tiejun Chen
2015-06-11 10:22 ` Tian, Kevin
2015-06-12 8:59 ` Chen, Tiejun
2015-06-16 5:58 ` Tian, Kevin
2015-06-16 6:09 ` Chen, Tiejun
2015-06-11 1:15 ` [v3][PATCH 16/16] xen/vtd: prevent from assign the device with shared rmrr Tiejun Chen
2015-06-11 10:25 ` Tian, Kevin
2015-06-12 8:44 ` Chen, Tiejun
2015-06-17 10:28 ` Jan Beulich
2015-06-18 9:23 ` Chen, Tiejun
2015-06-11 7:27 ` [v3][PATCH 00/16] Fix RMRR Jan Beulich
2015-06-11 8:42 ` Tian, Kevin
2015-06-11 9:06 ` Chen, Tiejun
2015-06-11 12:52 ` Tim Deegan
2015-06-12 2:10 ` Chen, Tiejun
2015-06-12 8:04 ` Jan Beulich
2015-06-12 8:20 ` Chen, Tiejun
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=55812F2D.2030504@intel.com \
--to=tiejun.chen@intel.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=kevin.tian@intel.com \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
--cc=yang.z.zhang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.