All of lore.kernel.org
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: xen-devel@lists.xensource.com, Wei Liu <wei.liu2@citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	qemu-devel@nongnu.org, Don Slutz <dslutz@verizon.com>
Subject: Re: [Qemu-devel] [Xen-devel] [PATCH] increase maxmem before calling xc_domain_populate_physmap
Date: Wed, 03 Dec 2014 08:39:00 -0500	[thread overview]
Message-ID: <547F1274.6090607@terremark.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1412031218290.30971@kaball.uk.xensource.com>

On 12/03/14 07:20, Stefano Stabellini wrote:
> On Wed, 3 Dec 2014, Wei Liu wrote:
>> On Tue, Dec 02, 2014 at 03:23:29PM -0500, Don Slutz wrote:
>> [...]
>>>>>>>            hw_error("xc_domain_getinfo failed");
>>>>>>>        }
>>>>>>> -    if (xc_domain_setmaxmem(xen_xc, xen_domid, info.max_memkb +
>>>>>>> -                            (nr_pfn * XC_PAGE_SIZE / 1024)) < 0) {
>>>>>>> +    max_pages = info.max_memkb * 1024 / XC_PAGE_SIZE;
>>>>>>> +    free_pages = max_pages - info.nr_pages;
>>>>>>> +    real_free = free_pages;
>>>>>>> +    if (free_pages > VGA_HOLE_SIZE) {
>>>>>>> +        free_pages -= VGA_HOLE_SIZE;
>>>>>>> +    } else {
>>>>>>> +        free_pages = 0;
>>>>>>> +    }
>>>> I don't think we need to subtract VGA_HOLE_SIZE.
>>> If you do not use some slack (like 32 here), xen does report:
>>>
>>>
>>> (d5) [2014-11-29 17:07:21] Loaded SeaBIOS
>>> (d5) [2014-11-29 17:07:21] Creating MP tables ...
>>> (d5) [2014-11-29 17:07:21] Loading ACPI ...
>>> (XEN) [2014-11-29 17:07:21] page_alloc.c:1568:d5 Over-allocation for domain
>>> 5: 1057417 > 1057416
>>> (XEN) [2014-11-29 17:07:21] memory.c:158:d5 Could not allocate order=0
>> This message is a bit red herring.
>>
>> It's hvmloader trying to populate ram for firmware data. The actual
>> amount of extra pages needed depends on the firmware.
>>
>> In any case it's safe to disallow hvmloader from doing so, it will just
>> relocate some pages from ram (hence shrinking *mem_end).
> That looks like a better solution
>

I went with a "leave some slack" so that the error message above is not 
output.

When a change to hvmloader is done so that the message does not appear 
during
normal usage, the extra pages in QEMU can be dropped.


>>> extent: id=5 memflags=0 (0 of 1)
>>> (d5) [2014-11-29 17:07:21] vm86 TSS at 00098c00
>>> (d5) [2014-11-29 17:07:21] BIOS map:
>>>
>>>
>>> However while QEMU startup ends with 32 "free" pages (maxmem - curmem)
>>> this quickly changes to 23.  I.E. there are 7 more places that act like a
>>> call
>>> to xc_domain_populate_physmap_exact() but do not log errors if there is
>>> no free pages.  And just to make sure I do not fully understand what is
>>> happening here, after the message above, the domain appears to work
>>> fine and ends up with 8 "free" pages (code I do not know about ends up
>>> releasing populated pages).
>>>
>>> So my current thinking is to have QEMU leave a few (9 to 32 (64?)) pages
>>> "free".
>>>
>> Unless we know before hand how many pages hvmloader needs this number is
>> estimation at best.
>   
> Right. It would be nice to get rid of any estimations by:
> - making hvmloader use normal ram
> - making qemu increase maxmem
> - removing all the estimation from libxl

Sounds like a plan for 4.6

     -Don Slutz

WARNING: multiple messages have this Message-ID (diff)
From: Don Slutz <dslutz@verizon.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: xen-devel@lists.xensource.com, Wei Liu <wei.liu2@citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	qemu-devel@nongnu.org, Don Slutz <dslutz@verizon.com>
Subject: Re: [Qemu-devel] [PATCH] increase maxmem before calling xc_domain_populate_physmap
Date: Wed, 03 Dec 2014 08:39:00 -0500	[thread overview]
Message-ID: <547F1274.6090607@terremark.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1412031218290.30971@kaball.uk.xensource.com>

On 12/03/14 07:20, Stefano Stabellini wrote:
> On Wed, 3 Dec 2014, Wei Liu wrote:
>> On Tue, Dec 02, 2014 at 03:23:29PM -0500, Don Slutz wrote:
>> [...]
>>>>>>>            hw_error("xc_domain_getinfo failed");
>>>>>>>        }
>>>>>>> -    if (xc_domain_setmaxmem(xen_xc, xen_domid, info.max_memkb +
>>>>>>> -                            (nr_pfn * XC_PAGE_SIZE / 1024)) < 0) {
>>>>>>> +    max_pages = info.max_memkb * 1024 / XC_PAGE_SIZE;
>>>>>>> +    free_pages = max_pages - info.nr_pages;
>>>>>>> +    real_free = free_pages;
>>>>>>> +    if (free_pages > VGA_HOLE_SIZE) {
>>>>>>> +        free_pages -= VGA_HOLE_SIZE;
>>>>>>> +    } else {
>>>>>>> +        free_pages = 0;
>>>>>>> +    }
>>>> I don't think we need to subtract VGA_HOLE_SIZE.
>>> If you do not use some slack (like 32 here), xen does report:
>>>
>>>
>>> (d5) [2014-11-29 17:07:21] Loaded SeaBIOS
>>> (d5) [2014-11-29 17:07:21] Creating MP tables ...
>>> (d5) [2014-11-29 17:07:21] Loading ACPI ...
>>> (XEN) [2014-11-29 17:07:21] page_alloc.c:1568:d5 Over-allocation for domain
>>> 5: 1057417 > 1057416
>>> (XEN) [2014-11-29 17:07:21] memory.c:158:d5 Could not allocate order=0
>> This message is a bit red herring.
>>
>> It's hvmloader trying to populate ram for firmware data. The actual
>> amount of extra pages needed depends on the firmware.
>>
>> In any case it's safe to disallow hvmloader from doing so, it will just
>> relocate some pages from ram (hence shrinking *mem_end).
> That looks like a better solution
>

I went with a "leave some slack" so that the error message above is not 
output.

When a change to hvmloader is done so that the message does not appear 
during
normal usage, the extra pages in QEMU can be dropped.


>>> extent: id=5 memflags=0 (0 of 1)
>>> (d5) [2014-11-29 17:07:21] vm86 TSS at 00098c00
>>> (d5) [2014-11-29 17:07:21] BIOS map:
>>>
>>>
>>> However while QEMU startup ends with 32 "free" pages (maxmem - curmem)
>>> this quickly changes to 23.  I.E. there are 7 more places that act like a
>>> call
>>> to xc_domain_populate_physmap_exact() but do not log errors if there is
>>> no free pages.  And just to make sure I do not fully understand what is
>>> happening here, after the message above, the domain appears to work
>>> fine and ends up with 8 "free" pages (code I do not know about ends up
>>> releasing populated pages).
>>>
>>> So my current thinking is to have QEMU leave a few (9 to 32 (64?)) pages
>>> "free".
>>>
>> Unless we know before hand how many pages hvmloader needs this number is
>> estimation at best.
>   
> Right. It would be nice to get rid of any estimations by:
> - making hvmloader use normal ram
> - making qemu increase maxmem
> - removing all the estimation from libxl

Sounds like a plan for 4.6

     -Don Slutz

  reply	other threads:[~2014-12-03 13:39 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25 17:45 [Qemu-devel] [PATCH] increase maxmem before calling xc_domain_populate_physmap Stefano Stabellini
2014-11-25 17:45 ` Stefano Stabellini
2014-11-25 18:24 ` [Qemu-devel] [Xen-devel] " Andrew Cooper
2014-11-25 18:24   ` Andrew Cooper
2014-11-26 18:17   ` [Qemu-devel] " Stefano Stabellini
2014-11-26 18:17     ` Stefano Stabellini
2014-11-27  2:42     ` [Qemu-devel] " Don Slutz
2014-11-27  2:42       ` Don Slutz
2014-11-27 10:48       ` [Qemu-devel] " Stefano Stabellini
2014-11-27 10:48         ` Stefano Stabellini
2014-12-01 13:33         ` [Qemu-devel] " Don Slutz
2014-12-01 13:33           ` Don Slutz
2014-12-01 15:37           ` [Qemu-devel] " Stefano Stabellini
2014-12-01 15:37             ` Stefano Stabellini
2014-12-01 23:16             ` [Qemu-devel] " Don Slutz
2014-12-01 23:16               ` Don Slutz
2014-12-02 12:26               ` [Qemu-devel] " Stefano Stabellini
2014-12-02 12:26                 ` [Qemu-devel] " Stefano Stabellini
2014-12-02 20:23                 ` [Qemu-devel] [Xen-devel] " Don Slutz
2014-12-02 20:23                   ` Don Slutz
2014-12-03 10:54                   ` [Qemu-devel] " Wei Liu
2014-12-03 10:54                     ` Wei Liu
2014-12-03 12:20                     ` [Qemu-devel] " Stefano Stabellini
2014-12-03 12:20                       ` Stefano Stabellini
2014-12-03 13:39                       ` Don Slutz [this message]
2014-12-03 13:39                         ` [Qemu-devel] " Don Slutz
2014-12-03 14:50                         ` [Qemu-devel] [Xen-devel] " Stefano Stabellini
2014-12-03 14:50                           ` Stefano Stabellini
2014-12-04 16:26                           ` [Qemu-devel] " Don Slutz
2014-12-04 16:26                             ` Don Slutz
2014-12-04 16:38                             ` [Qemu-devel] " Wei Liu
2014-12-04 16:38                               ` Wei Liu

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=547F1274.6090607@terremark.com \
    --to=dslutz@verizon.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xensource.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.