From: George Dunlap <george.dunlap@eu.citrix.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Keir Fraser <keir@xen.org>,
Ian Campbell <ian.campbell@citrix.com>,
Hanweidong <hanweidong@huawei.com>,
xen-devel@lists.xen.org,
Stefano Stabellini <stefano.stabellini@citrix.com>,
Ian Jackson <ian.jackson@citrix.com>
Subject: Re: [PATCH v3 2/8] hvmloader: Make the printfs more informative
Date: Fri, 21 Jun 2013 10:50:37 +0100 [thread overview]
Message-ID: <51C421ED.2010602@eu.citrix.com> (raw)
In-Reply-To: <51C41E4F.2050502@eu.citrix.com>
On 21/06/13 10:35, George Dunlap wrote:
> On 20/06/13 18:12, Stefano Stabellini wrote:
>> On Thu, 20 Jun 2013, George Dunlap wrote:
>>> * Warn that you're relocating some BARs to 64-bit
>>>
>>> * Warn that you're relocating guest pages, and how many
>>>
>>> * Include upper 32-bits of the base register when printing the bar
>>> placement info
>>>
>>> Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
>>> CC: Ian Campbell <ian.campbell@citrix.com>
>>> CC: Ian Jackson <ian.jackson@citrix.com>
>>> CC: Stefano Stabellini <stefano.stabellini@citrix.com>
>>> CC: Hanweidong <hanweidong@huawei.com>
>>> CC: Keir Fraser <keir@xen.org>
>>> ---
>>> tools/firmware/hvmloader/pci.c | 13 ++++++++++---
>>> 1 file changed, 10 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/tools/firmware/hvmloader/pci.c
>>> b/tools/firmware/hvmloader/pci.c
>>> index aa54bc1..d8592b0 100644
>>> --- a/tools/firmware/hvmloader/pci.c
>>> +++ b/tools/firmware/hvmloader/pci.c
>>> @@ -213,10 +213,17 @@ void pci_setup(void)
>>> ((pci_mem_start << 1) != 0) )
>>> pci_mem_start <<= 1;
>>> - if ( (pci_mem_start << 1) != 0 )
>>> + if ( (pci_mem_start << 1) != 0 ) {
>>> + printf("Low MMIO hole not large enough for all devices,"
>>> + " relocating some BARs to 64-bit\n");
>>> bar64_relocate = 1;
>>> + }
>>> /* Relocate RAM that overlaps PCI space (in 64k-page
>>> chunks). */
>>> + if ( (pci_mem_start >> PAGE_SHIFT) < hvm_info->low_mem_pgend )
>>> + printf("Relocating 0x%lx pages to highmem for lowmem MMIO
>>> hole\n",
>>> + hvm_info->low_mem_pgend - (pci_mem_start >>
>>> PAGE_SHIFT));
>> Shouldn't this be:
>>
>> min_t(unsigned int,
>> hvm_info->low_mem_pgend - (pci_mem_start >> PAGE_SHIFT),
>> (1u << 16) - 1);
>>
>> to match exactly what we do in the relocation code?
>
> No; the relocation is done in a loop which will run until the
> condition in the if above is satisfied.
>
> We could, I suppose, do the printf on each iteration of the loop; if
> I'm doing the math right*, the maximum iterations around the loop
> should be 8, and a typical number would be just 1 or 2.
>
> * Maximum MMIO size: 2GiB == 1<<31. In 4-k pages, that's 1<<(31-12)
> == 1<<19. This will do a batch of 1<<16 pages at a time, leaving 1<<3
> iterations maximum, or 8. (1<<16 pages is 1<<(16+12) or 1<<28 bytes,
> or 1<<8 == 256 megabytes moved at a time.)
>
>>
>> Regarding the message, what about:
>>
>> printf("Relocating 0x%lx pages from 0x%lx to 0x%lx%lx to make room
>> for a larger MMIO hole\n",
>> min_t(unsigned int,
>> hvm_info->low_mem_pgend - (pci_mem_start >> PAGE_SHIFT),
>> (1u << 16) - 1),
>> hvm_info->low_mem_pgend,
>> hvm_info->high_mem_pgend);
>
> Lemme see how it looks...
If you have a 2GiB MMIO hole, it looks like this:
(XEN) HVM42: Relocating 0xffff pages from 0e0001000 to 20f800000 for
lowmem MMIO hole
(XEN) HVM42: Relocating 0xffff pages from 0d0002000 to 21f7ff000 for
lowmem MMIO hole
(XEN) HVM42: Relocating 0xffff pages from 0c0003000 to 22f7fe000 for
lowmem MMIO hole
(XEN) HVM42: Relocating 0xffff pages from 0b0004000 to 23f7fd000 for
lowmem MMIO hole
(XEN) HVM42: Relocating 0xffff pages from 0a0005000 to 24f7fc000 for
lowmem MMIO hole
(XEN) HVM42: Relocating 0xffff pages from 090006000 to 25f7fb000 for
lowmem MMIO hole
(XEN) HVM42: Relocating 0xffff pages from 080007000 to 26f7fa000 for
lowmem MMIO hole
(XEN) HVM42: Relocating 0x7 pages from 080000000 to 27f7f9000 for lowmem
MMIO hole
Kind of ugly; I think I liked it better with just one printf.
-George
next prev parent reply other threads:[~2013-06-21 9:50 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-20 16:33 [PATCH 0/8] Relocate devices rather than memory for qemu-xen George Dunlap
2013-06-20 16:33 ` [PATCH v3 1/8] hvmloader: Remove all 64-bit print arguments George Dunlap
2013-06-20 17:06 ` Stefano Stabellini
2013-06-20 17:09 ` Ian Jackson
2013-06-21 8:37 ` George Dunlap
2013-06-21 8:34 ` George Dunlap
2013-06-21 9:22 ` George Dunlap
2013-06-21 10:22 ` [PATCH v3 1/8] hvmloader: Remove all 64-bit print arguments [and 1 more messages] Ian Jackson
2013-06-21 10:23 ` [PATCH v3 1/8] hvmloader: Remove all 64-bit print arguments Ian Jackson
2013-06-20 16:33 ` [PATCH v3 2/8] hvmloader: Make the printfs more informative George Dunlap
2013-06-20 17:12 ` Stefano Stabellini
2013-06-21 9:35 ` George Dunlap
2013-06-21 9:50 ` George Dunlap [this message]
2013-06-21 10:53 ` Stefano Stabellini
2013-06-21 10:53 ` Stefano Stabellini
2013-06-21 10:35 ` Ian Jackson
2013-06-20 16:33 ` [PATCH v3 3/8] hvmloader: Set up highmem resouce appropriately if there is no RAM above 4G George Dunlap
2013-06-20 17:16 ` Stefano Stabellini
2013-06-21 7:01 ` Jan Beulich
2013-06-21 9:06 ` George Dunlap
2013-06-21 10:38 ` Ian Jackson
2013-06-20 16:33 ` [PATCH v3 4/8] hvmloader: Fix check for needing a 64-bit bar George Dunlap
2013-06-20 16:33 ` [PATCH v3 5/8] hvmloader: Correct bug in low mmio region accounting George Dunlap
2013-06-20 17:20 ` Stefano Stabellini
2013-06-21 7:09 ` Jan Beulich
2013-06-20 16:33 ` [PATCH v3 6/8] hvmloader: Load large devices into high MMIO space as needed George Dunlap
2013-06-20 17:23 ` Stefano Stabellini
2013-06-21 7:12 ` Jan Beulich
2013-06-20 16:33 ` [PATCH v3 7/8] hvmloader: Remove minimum size for BARs to relocate to 64-bit space George Dunlap
2013-06-20 16:33 ` [PATCH v3 8/8] libxl, hvmloader: Don't relocate memory for MMIO hole George Dunlap
2013-06-20 17:38 ` Stefano Stabellini
2013-06-21 8:31 ` George Dunlap
2013-06-21 11:21 ` Stefano Stabellini
2013-06-21 11:31 ` Ian Jackson
2013-06-21 7:17 ` Jan Beulich
2013-06-21 8:32 ` George Dunlap
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=51C421ED.2010602@eu.citrix.com \
--to=george.dunlap@eu.citrix.com \
--cc=hanweidong@huawei.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@citrix.com \
--cc=keir@xen.org \
--cc=stefano.stabellini@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.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).