From: "Jan Beulich" Subject: Re: [v3][PATCH 07/16] hvmloader/pci: skip reserved ranges Date: Thu, 18 Jun 2015 07:29:13 +0100 Message-ID: <558281590200007800086672@mail.emea.novell.com> References: <1433985325-16676-1-git-send-email-tiejun.chen@intel.com> <1433985325-16676-8-git-send-email-tiejun.chen@intel.com> <557A9000.600@intel.com> <557FEC6A.1080003@intel.com> <55800B21020000780008561E@mail.emea.novell.com> <55811D50.2070002@intel.com> <55813BA60200007800085D93@mail.emea.novell.com> <558127B7.5060800@intel.com> <5581466C0200007800085DEC@mail.emea.novell.com> <55812F2D.2030504@intel.com> <558153D30200007800085E77@mail.emea.novell.com> <55813B61.6020206@intel.com> <558158D30200007800085EEB@mail.emea.novell.com> <5582627E.3010909@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5582627E.3010909@intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tiejun Chen Cc: "tim@xen.org" , Kevin Tian , "wei.liu2@citrix.com" , "ian.campbell@citrix.com" , "andrew.cooper3@citrix.com" , "Ian.Jackson@eu.citrix.com" , "xen-devel@lists.xen.org" , "stefano.stabellini@citrix.com" , Yang Z Zhang List-Id: xen-devel@lists.xenproject.org >>> On 18.06.15 at 08:17, wrote: > On 2015/6/17 17:24, Jan Beulich wrote: >>>>> On 17.06.15 at 11:18, wrote: >>> On 2015/6/17 17:02, Jan Beulich wrote: >>>>>>> On 17.06.15 at 10:26, wrote: >>>>> 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. >>>> >>>> That's possible onyl for 64-bit BARs. >>> >>> You're right so this means its not proper to adjust mmio_total to >>> include conflicting reserved ranges and finally moved all conflicting >>> bars to high_mem_resource as Kevin suggested previously, so i high >>> level, we still need to decrease pci_mem_start to populate more RAM to >>> compensate them as I did, right? >> >> You probably should do both: Prefer moving things beyond 4Gb, >> but if not possible increase the MMIO hole. >> > > I'm trying to figure out a better solution. Perhaps we can allocate > 32-bit bars and 64-bit bars orderly. This may help us bypass those > complicated corner cases. Dealing with 32- and 64-bit BARs separately won't help at all, as there may only be 32-bit ones, or the set of 32-bit ones may already require you to do re-arrangements. Plus, for compatibility reasons (just like physical machines' BIOSes do) avoiding to place MMIO above 4Gb where possible is still a goal. > #1. We don't calculate how much memory should be compensated to add them > to expand something like we though previously. > > #2. Instead, before allocating bars, we just check if reserved device > memory is really conflicting this default region [pci_mem_start, > pci_mem_end] > > #2.1 If not, obviously nothing is changed. > #2.2 If yes, we introduce a new local bool, bar32_allocating, which > indicates if we want to allocate 32-bit bars and 64-bit bars separately. > > So here we should set as true, and we also need to set 'bar64_relocate' > to relocate bars to 64-bit. Doesn't look like the right approach to me. As said before, I think you should allocate BARs _around_ reserved regions (perhaps filling non-aligned areas first, again utilizing that BARs are always a power of 2 in size). Jan