xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 1/3] xen: allow balloon driver to use more than one memory region
Date: Tue, 16 Aug 2011 15:21:03 +0100	[thread overview]
Message-ID: <4E4A7CCF.4070209@citrix.com> (raw)
In-Reply-To: <20110816133854.GB30261@dumpdata.com>

On 16/08/11 14:38, Konrad Rzeszutek Wilk wrote:
> On Tue, Aug 16, 2011 at 11:00:36AM +0100, David Vrabel wrote:
>> Allow the xen balloon driver to populate its list of extra pages from
>> more than one region of memory.  This will allow platforms to provide
>> (for example) a region of low memory and a region of high memory.
> 
> What does this solve? Is this a requirement for another patch? If so
> please specify the name of it.
>>
>> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
>> ---
>> Is there a better way of passing the memory information to the balloon
>> driver?
> 
> I think the way you have it is OK.
> 
>> ---
>>  arch/x86/xen/setup.c  |   20 ++++++++++----------
>>  drivers/xen/balloon.c |   48 ++++++++++++++++++++++++++++--------------------
>>  include/xen/page.h    |    9 ++++++++-
>>  3 files changed, 46 insertions(+), 31 deletions(-)
>>
>> diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
>> index df118a8..30d0015 100644
>> --- a/arch/x86/xen/setup.c
>> +++ b/arch/x86/xen/setup.c
>> @@ -37,7 +37,7 @@ extern void xen_syscall_target(void);
>>  extern void xen_syscall32_target(void);
>>  
>>  /* Amount of extra memory space we add to the e820 ranges */
>> -phys_addr_t xen_extra_mem_start, xen_extra_mem_size;
>> +struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS];
>>  
>>  /* 
>>   * The maximum amount of extra memory compared to the base size.  The
>> @@ -56,7 +56,7 @@ static void __init xen_add_extra_mem(unsigned long pages)
>>  	unsigned long pfn;
>>  
>>  	u64 size = (u64)pages * PAGE_SIZE;
>> -	u64 extra_start = xen_extra_mem_start + xen_extra_mem_size;
>> +	u64 extra_start = xen_extra_mem[0].start + xen_extra_mem[0].size;
> 
> Wouldn't this be for [1]?

No. I probably should have made it clear in the description but this
patch doesn't change the number of regions.  It only changes the pair of
variables to a single element array of a structure.

See XEN_EXTRA_MEM_MAX_REGIONS in include/xen/page.h:

--- a/include/xen/page.h
+++ b/include/xen/page.h
@@ -3,6 +3,13 @@

 #include <asm/xen/page.h>

-extern phys_addr_t xen_extra_mem_start, xen_extra_mem_size;
+struct xen_memory_region {
+	phys_addr_t start;
+	phys_addr_t size;
+};
+
+#define XEN_EXTRA_MEM_MAX_REGIONS 1
+
+extern struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS];

 #endif	/* _XEN_PAGE_H */

>> @@ -263,10 +263,10 @@ char * __init xen_memory_setup(void)
>>  	}
>>  	/* Align the balloon area so that max_low_pfn does not get set
>>  	 * to be at the _end_ of the PCI gap at the far end (fee01000).
>> -	 * Note that xen_extra_mem_start gets set in the loop above to be
>> -	 * past the last E820 region. */
>> -	if (xen_initial_domain() && (xen_extra_mem_start < (1ULL<<32)))
>> -		xen_extra_mem_start = (1ULL<<32);
>> +	 * Note that the start of balloon area gets set in the loop above
>> +         * to be past the last E820 region. */
>> +	if (xen_initial_domain() && (xen_extra_mem[0].start < (1ULL<<32)))
>> +		xen_extra_mem[0].start = (1ULL<<32);
> 
> So what about the highmem memory? Should there a be a check to move
> the lowmem to highmem count?

Again, the patch isn't adding any additional regions.


>> +	for (r = 0; r < XEN_EXTRA_MEM_MAX_REGIONS; r++)
> 
> You probably should also check to make sure that the values are actually valid.
> Like
>         if (!xedn_extra_mem[r].start)
>             continue;

balloon_add_memory_region() is a nop if size == 0.  But I can an
explicit check (of size) here if that is preferred.

>> + 		balloon_add_memory_region(PFN_UP(xen_extra_mem[r].start),
>> +					  PFN_DOWN(xen_extra_mem[r].size));
>>  
>>  	return 0;
>>  }

David

  reply	other threads:[~2011-08-16 14:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-16 10:00 [RFC] limit dom0 memory using Xen's dom0_mem command line option David Vrabel
2011-08-16 10:00 ` [PATCH 1/3] xen: allow balloon driver to use more than one memory region David Vrabel
2011-08-16 13:38   ` Konrad Rzeszutek Wilk
2011-08-16 14:21     ` David Vrabel [this message]
2011-08-16 14:48       ` Konrad Rzeszutek Wilk
2011-08-16 15:03         ` David Vrabel
2011-08-16 10:00 ` [PATCH 2/3] xen: allow extra memory to be two regions David Vrabel
2011-08-16 13:48   ` Konrad Rzeszutek Wilk
2011-08-16 14:33     ` David Vrabel
2011-08-16 14:48       ` Konrad Rzeszutek Wilk
2011-08-16 15:03         ` David Vrabel
2011-08-16 15:36           ` Konrad Rzeszutek Wilk
2011-08-22 13:55             ` Konrad Rzeszutek Wilk
2011-08-22 14:01               ` David Vrabel
2011-08-16 10:00 ` [PATCH 3/3] xen: use maximum reservation to limit dom0 memory David Vrabel
2011-08-16 13:53   ` Konrad Rzeszutek Wilk
2011-08-16 14:41     ` David Vrabel
2011-08-16 14:54       ` Konrad Rzeszutek Wilk
2011-08-16 14:50     ` Konrad Rzeszutek Wilk
2011-08-16 13:33 ` [RFC] limit dom0 memory using Xen's dom0_mem command line option Konrad Rzeszutek Wilk

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=4E4A7CCF.4070209@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=konrad.wilk@oracle.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 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).