WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 1/5] xen: use maximum reservation to limit amount

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 1/5] xen: use maximum reservation to limit amount of usable RAM
From: David Vrabel <david.vrabel@xxxxxxxxxx>
Date: Thu, 1 Sep 2011 13:12:10 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 01 Sep 2011 05:11:12 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20110831204057.GA641@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1313765840-22084-1-git-send-email-david.vrabel@xxxxxxxxxx> <1313765840-22084-2-git-send-email-david.vrabel@xxxxxxxxxx> <20110831204057.GA641@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110818 Icedove/3.0.11
On 31/08/11 21:40, Konrad Rzeszutek Wilk wrote:
>> Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
>> ---
>>  arch/x86/xen/setup.c |   19 +++++++++++++++++++
>>  1 files changed, 19 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
>> index df118a8..c3b8d44 100644
>> --- a/arch/x86/xen/setup.c
>> +++ b/arch/x86/xen/setup.c
>> @@ -184,6 +184,19 @@ static unsigned long __init xen_set_identity(const 
>> struct e820entry *list,
>>                                      PFN_UP(start_pci), PFN_DOWN(last));
>>      return identity;
>>  }
>> +
>> +static unsigned long __init xen_get_max_pages(void)
>> +{
>> +    unsigned long max_pages = MAX_DOMAIN_PAGES;
>> +    domid_t domid = DOMID_SELF;
>> +    int ret;
>> +
>> +    ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
>> +    if (ret > 0)
>> +            max_pages = ret;
>> +    return min(max_pages, MAX_DOMAIN_PAGES);
>> +}
>> +
>>  /**
>>   * machine_specific_memory_setup - Hook for machine specific memory setup.
>>   **/
>> @@ -292,6 +305,12 @@ char * __init xen_memory_setup(void)
>>  
>>      sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
>>  
>> +    extra_limit = xen_get_max_pages();
>> +    if (extra_limit >= max_pfn)
>> +            extra_pages = extra_limit - max_pfn;
>> +    else
>> +            extra_pages = 0;
>> +
>>      extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, 
>> &e820);
> 
> I ran this on three setups:
> 
> 1) PV (domU)
> 2) PV+PCI (dom0)
> 3) PV+PCI+e820_hole=1 (domU)
> 
> and then the same without this patch.
> 
> Both the 2) and 3) worked correctly - the E820 had the same non-RAM regions 
> and
> gaps - and the last RAM E820 entry was properly truncated. However, when it
> came to pure PV it was truncated more than it should:
> 
> domU:                                                         domU:
> 0000000000000000 - 00000000000a0000 (usable)          0000000000000000 - 
> 00000000000a0000 (usable)
> 00000000000a0000 - 0000000000100000 (reserved)        00000000000a0000 - 
> 0000000000100000 (reserved)
> 0000000000100000 - 0000000040800000 (usable)        | 0000000000100000 - 
> 0000000040100000 (usable)
> 
> (left has the old PV - without your patch). Which makes me think that there 
> is something
> amiss in the toolstack? I used 'xl' (latest xen-unstable from today).

What were you expecting? It looks like xl is either: specifying a memory
map that is larger than it should be or b) setting the maximum
reservation as too low.  And if you asked for 1 GiB neither looks right.

David

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>