Skip to contentSkip to conversation

x86: set dom0's default maximum reservation to the initial number of pages

PATCH In review David Vrabel 3 participants 6 messages Mar 20, 2012 – Mar 21, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: set dom0's default maximum reservation to the initial number of pages

From: David Vrabel <[email protected]>

If a maximum reservation for dom0 is not explictly given (i.e., no dom0_mem=max:MMM command line option), then set the maximum reservation to the initial number of pages. This is what most people seem to expect when they specify dom0_mem=512M (i.e., exactly 512 MB and no more).

This change means that with Linux 3.0.5 and later kernels, dom0_mem=512M has the same result as older, 'classic Xen' kernels. The older kernels used the initial number of pages to set the maximum number of pages and did not query the hypervisor for the maximum reservation.

It is still possible to have a larger reservation by explicitly specifying dom0_mem=max:MMM.

---
Keir,

Suggest waiting for an Ack from Konrad (I think it results in the behaviour we want but would prefer it if Konrad confirmed).

Also consider for 4.1.

Thanks.

David

 docs/misc/xen-command-line.markdown |    8 +++++++-
 xen/arch/x86/domain_build.c         |   10 ++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)
docs/misc/xen-command-line.markdown +7 -1
index beb8462..0798700 100644
@@ -221,12 +221,18 @@ Specify the total size for dom0.
 ### dom0\_mem (x86)
 > `= List of ( min:<value> | max: <value> | <value> )`
 
-each `<value>` is a size parameter.  If the size is positive, it represents an absolute value.  If the size is negative, the size specified is subtracted from the total available memory.
+Specify the amount of memory for the initial domain (dom0) and the maximum reservation (the maximum amount of memory that dom0 can be increased or ballooned to).
+
+Each `<value>` is a size parameter.  If the size is positive, it represents an absolute value.  If the size is negative, the size specified is subtracted from the total available memory.
 
 * `min:<value>` specifies the minimum amount of memory allocated to dom0.
 * `max:<value>` specifies the maximum amount of memory allocated to dom0.
 * `<value>` specified the exact amount of memory allocated to dom0.
 
+If `max:<value>` is specified then this sets the maximum reservation, otherwise the maximum reservation is set to the amount of memory allocated to dom0.
+
+For example, with `dom0_mem=512M`, dom0 starts with 512 MB and cannot balloon up any more. With `dom0_mem=512M,max:2G`, dom0 starts with 512 MB of memory and can balloon up to 2 GB.
+
 ### dom0\_shadow
 ### dom0\_vcpus\_pin
 > `= <boolean>`
xen/arch/x86/domain_build.c +10 -0
index b3c5d4c..0c09abc 100644
@@ -253,6 +253,16 @@ static unsigned long __init compute_dom0_nr_pages(
     }
 #endif
 
+    /*
+     * Set dom0's maximum reservation.
+     *
+     * If no maximum was set with dom0_mem=max:MMM, then the maximum
+     * is the same as the initial number of pages.  This is so
+     * dom0_mem=MMM gives the behaviour most people expect (i.e., this
+     * much RAM and no more).
+     */
+    if ( max_pages == LONG_MAX )
+        max_pages = nr_pages;
     d->max_pages = min_t(unsigned long, max_pages, UINT_MAX);
 
     return nr_pages;
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 17 lines · David Vrabel

From: David Vrabel <[email protected]>

If a maximum reservation for dom0 is not explictly given (i.e., no dom0_mem=max:MMM command line option), then set the maximum reservation to the initial number of pages. This is what most people seem to expect when they specify dom0_mem=512M (i.e., exactly 512 MB and no more).

This change means that with Linux 3.0.5 and later kernels, dom0_mem=512M has the same result as older, 'classic Xen' kernels. The older kernels used the initial number of pages to set the maximum number of pages and did not query the hypervisor for the maximum reservation.

It is still possible to have a larger reservation by explicitly specifying dom0_mem=max:MMM.

Quoted 6 lines

---
Keir,

Suggest waiting for an Ack from Konrad (I think it results in the behaviour we want but would prefer it if Konrad confirmed).

Acked! Thanks for doing this.

Quoted 58 lines

Also consider for 4.1.

Thanks.

David

 docs/misc/xen-command-line.markdown |    8 +++++++-
 xen/arch/x86/domain_build.c         |   10 ++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)
docs/misc/xen-command-line.markdown +7 -1
index beb8462..0798700 100644
@@ -221,12 +221,18 @@ Specify the total size for dom0.
 ### dom0\_mem (x86)
 > `= List of ( min:<value> | max: <value> | <value> )`
 
-each `<value>` is a size parameter.  If the size is positive, it represents an absolute value.  If the size is negative, the size specified is subtracted from the total available memory.
+Specify the amount of memory for the initial domain (dom0) and the maximum reservation (the maximum amount of memory that dom0 can be increased or ballooned to).
+
+Each `<value>` is a size parameter.  If the size is positive, it represents an absolute value.  If the size is negative, the size specified is subtracted from the total available memory.
 
 * `min:<value>` specifies the minimum amount of memory allocated to dom0.
 * `max:<value>` specifies the maximum amount of memory allocated to dom0.
 * `<value>` specified the exact amount of memory allocated to dom0.
 
+If `max:<value>` is specified then this sets the maximum reservation, otherwise the maximum reservation is set to the amount of memory allocated to dom0.
+
+For example, with `dom0_mem=512M`, dom0 starts with 512 MB and cannot balloon up any more. With `dom0_mem=512M,max:2G`, dom0 starts with 512 MB of memory and can balloon up to 2 GB.
+
 ### dom0\_shadow
 ### dom0\_vcpus\_pin
 > `= <boolean>`
xen/arch/x86/domain_build.c +10 -0
index b3c5d4c..0c09abc 100644
@@ -253,6 +253,16 @@ static unsigned long __init compute_dom0_nr_pages(
     }
 #endif
 
+    /*
+     * Set dom0's maximum reservation.
+     *
+     * If no maximum was set with dom0_mem=max:MMM, then the maximum
+     * is the same as the initial number of pages.  This is so
+     * dom0_mem=MMM gives the behaviour most people expect (i.e., this
+     * much RAM and no more).
+     */
+    if ( max_pages == LONG_MAX )
+        max_pages = nr_pages;
     d->max_pages = min_t(unsigned long, max_pages, UINT_MAX);
 
     return nr_pages;
Signature · 1 line
1.7.2.5
#2 lore raw
In reply to David Vrabel
Quoted 8 lines
Quoted 1 line
Quoted 1 line · David Vrabel

From: David Vrabel <[email protected]>

If a maximum reservation for dom0 is not explictly given (i.e., no dom0_mem=max:MMM command line option), then set the maximum reservation to the initial number of pages. This is what most people seem to expect when they specify dom0_mem=512M (i.e., exactly 512 MB and no more).

I think I had seen this before (not sure whether it came from you), and had already NAK-ed the idea back then. Please let's not play with the meaning of existing hypervisor options, unless the "most" in your description can validly be replaced by "all". In this case, _I_ am using the option in its current sense almost everywhere (expecting to be able to balloon up beyond the initial allocation), and it can also be useful in hotplug capable machines. If someone wants a particular maximum, (s)he should add the respective command line option.

Quoted 5 lines

This change means that with Linux 3.0.5 and later kernels, dom0_mem=512M has the same result as older, 'classic Xen' kernels. The older kernels used the initial number of pages to set the maximum number of pages and did not query the hypervisor for the maximum reservation.

If the pv-ops kernels behave differently in this aspect than the forward ported ones, then it should really be the newer one to get adjusted to the original behavior (if so intended), unless the old behavior was completely insane. Adjusting the hypervisor for a shortcoming(?) in a particular implementation of a Dom0 kernel doesn't seem to be the right route - please also consider non-Linux Dom0 kernels that might expect the current behavior.

Quoted 2 lines

It is still possible to have a larger reservation by explicitly specifying dom0_mem=max:MMM.

I am not intending to update dozens of command lines.

Jan

Quoted 81 lines

---
Keir,

Suggest waiting for an Ack from Konrad (I think it results in the behaviour we want but would prefer it if Konrad confirmed).

Also consider for 4.1.

Thanks.

David

 docs/misc/xen-command-line.markdown |    8 +++++++-
 xen/arch/x86/domain_build.c         |   10 ++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)
docs/misc/xen-command-line.markdown +0 -1
index beb8462..0798700 100644
@@ -221,12 +221,18 @@ Specify the total size for dom0.
 ### dom0\_mem (x86)
 > `= List of ( min:<value> | max: <value> | <value> )`
 
-each `<value>` is a size parameter.  If the size is positive, it represents an 

absolute value. If the size is negative, the size specified is subtracted from the total available memory.
+Specify the amount of memory for the initial domain (dom0) and the maximum reservation (the maximum amount of memory that dom0 can be increased or ballooned to).

docs/misc/xen-command-line.markdown +2 -0
+
+Each `<value>` is a size parameter.  If the size is positive, it represents 

an absolute value. If the size is negative, the size specified is subtracted from the total available memory.

* min:<value> specifies the minimum amount of memory allocated to dom0.
* max:<value> specifies the maximum amount of memory allocated to dom0.
* <value> specified the exact amount of memory allocated to dom0.

+If max:<value> is specified then this sets the maximum reservation, otherwise the maximum reservation is set to the amount of memory allocated to dom0.

docs/misc/xen-command-line.markdown +2 -0
+
+For example, with `dom0_mem=512M`, dom0 starts with 512 MB and cannot 

balloon up any more. With dom0_mem=512M,max:2G, dom0 starts with 512 MB of memory and can balloon up to 2 GB.

docs/misc/xen-command-line.markdown +1 -0
+
 ### dom0\_shadow
 ### dom0\_vcpus\_pin
 > `= <boolean>`
xen/arch/x86/domain_build.c +10 -0
index b3c5d4c..0c09abc 100644
@@ -253,6 +253,16 @@ static unsigned long __init compute_dom0_nr_pages(
     }
 #endif
 
+    /*
+     * Set dom0's maximum reservation.
+     *
+     * If no maximum was set with dom0_mem=max:MMM, then the maximum
+     * is the same as the initial number of pages.  This is so
+     * dom0_mem=MMM gives the behaviour most people expect (i.e., this
+     * much RAM and no more).
+     */
+    if ( max_pages == LONG_MAX )
+        max_pages = nr_pages;
     d->max_pages = min_t(unsigned long, max_pages, UINT_MAX);
 
     return nr_pages;
Signature · 7 lines
1.7.2.5


_______________________________________________
Xen-devel mailing list
[email protected] 
http://lists.xen.org/xen-devel 
#3 lore raw
Quoted 9 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · David Vrabel

From: David Vrabel <[email protected]>

If a maximum reservation for dom0 is not explictly given (i.e., no dom0_mem=max:MMM command line option), then set the maximum reservation to the initial number of pages. This is what most people seem to expect when they specify dom0_mem=512M (i.e., exactly 512 MB and no more).

Quoted 9 lines

I think I had seen this before (not sure whether it came from you), and had already NAK-ed the idea back then. Please let's not play with the meaning of existing hypervisor options, unless the "most" in your description can validly be replaced by "all". In this case, _I_ am using the option in its current sense almost everywhere (expecting to be able to balloon up beyond the initial allocation), and it can also be useful in hotplug capable machines. If someone wants a particular maximum, (s)he should add the respective command line option.

XenServer uses dom0_mem=752M and expects it to set the maximum reservation to 752M (if it doesn't it grinds to a halt rather spectacularly as it runs out of memory due to the extra memory used for page tables etc.). So whilst I appreciate your desire to not have to change any command lines, I don't want to either.

The dom0_mem option has been historically confusing. The min, and max options don't affect the initial number of pages in a useful way (min:MMM and max:MMM are no different to simply specifying MMM).

So I think we need to decide what behaviour is the best in the long term.

The two options are:

The current behaviour:

                      | Initial | Max       |
dom0_mem=III          | III     | Unlimited |
dom0_mem=III,max:MMM  | III     | MMM       |
dom0_mem=max:MMM      | MMM     | MMM       |

or this proposal:

                      | Initial | Max       |
dom0_mem=III          | III     | III       |
dom0_mem=III,max:MMM  | III     | MMM       |
dom0_mem=max:MMM      | MMM     | MMM       |

Hmm. Having enumerated the two options, the current behaviour looks more sensible to me now...

The docs still need updating and I think the min:MMM option should be deprecated.

Quoted 6 lines
Quoted 5 lines

This change means that with Linux 3.0.5 and later kernels, dom0_mem=512M has the same result as older, 'classic Xen' kernels. The older kernels used the initial number of pages to set the maximum number of pages and did not query the hypervisor for the maximum reservation.

Quoted 7 lines

If the pv-ops kernels behave differently in this aspect than the forward ported ones, then it should really be the newer one to get adjusted to the original behavior (if so intended), unless the old behavior was completely insane. Adjusting the hypervisor for a shortcoming(?) in a particular implementation of a Dom0 kernel doesn't seem to be the right route - please also consider non-Linux Dom0 kernels that might expect the current behavior.

The old behaviour did not allow dom0 to balloon up beyond the initial allocation so we don't what to go back to that.

Quoted 4 lines
Quoted 2 lines

It is still possible to have a larger reservation by explicitly specifying dom0_mem=max:MMM.

I am not intending to update dozens of command lines.

Looks like I will be though...

Quoted 71 lines
Quoted 71 lines

Keir,

Suggest waiting for an Ack from Konrad (I think it results in the behaviour we want but would prefer it if Konrad confirmed).

Also consider for 4.1.

Thanks.

David

 docs/misc/xen-command-line.markdown |    8 +++++++-
 xen/arch/x86/domain_build.c         |   10 ++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)
docs/misc/xen-command-line.markdown +0 -1
index beb8462..0798700 100644
@@ -221,12 +221,18 @@ Specify the total size for dom0.
 ### dom0\_mem (x86)
 > `= List of ( min:<value> | max: <value> | <value> )`
 
-each `<value>` is a size parameter.  If the size is positive, it represents an 

absolute value. If the size is negative, the size specified is subtracted from the total available memory.
+Specify the amount of memory for the initial domain (dom0) and the maximum reservation (the maximum amount of memory that dom0 can be increased or ballooned to).

docs/misc/xen-command-line.markdown +2 -0
+
+Each `<value>` is a size parameter.  If the size is positive, it represents 

an absolute value. If the size is negative, the size specified is subtracted from the total available memory.

* min:<value> specifies the minimum amount of memory allocated to dom0.
* max:<value> specifies the maximum amount of memory allocated to dom0.
* <value> specified the exact amount of memory allocated to dom0.

+If max:<value> is specified then this sets the maximum reservation, otherwise the maximum reservation is set to the amount of memory allocated to dom0.

docs/misc/xen-command-line.markdown +2 -0
+
+For example, with `dom0_mem=512M`, dom0 starts with 512 MB and cannot 

balloon up any more. With dom0_mem=512M,max:2G, dom0 starts with 512 MB of memory and can balloon up to 2 GB.

docs/misc/xen-command-line.markdown +1 -0
+
 ### dom0\_shadow
 ### dom0\_vcpus\_pin
 > `= <boolean>`
xen/arch/x86/domain_build.c +10 -0
index b3c5d4c..0c09abc 100644
@@ -253,6 +253,16 @@ static unsigned long __init compute_dom0_nr_pages(
     }
 #endif
 
+    /*
+     * Set dom0's maximum reservation.
+     *
+     * If no maximum was set with dom0_mem=max:MMM, then the maximum
+     * is the same as the initial number of pages.  This is so
+     * dom0_mem=MMM gives the behaviour most people expect (i.e., this
+     * much RAM and no more).
+     */
+    if ( max_pages == LONG_MAX )
+        max_pages = nr_pages;
     d->max_pages = min_t(unsigned long, max_pages, UINT_MAX);
 
     return nr_pages;
#4 lore raw
Quoted 43 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 9 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · David Vrabel

From: David Vrabel <[email protected]>

If a maximum reservation for dom0 is not explictly given (i.e., no dom0_mem=max:MMM command line option), then set the maximum reservation to the initial number of pages. This is what most people seem to expect when they specify dom0_mem=512M (i.e., exactly 512 MB and no more).

Quoted 9 lines

I think I had seen this before (not sure whether it came from you), and had already NAK-ed the idea back then. Please let's not play with the meaning of existing hypervisor options, unless the "most" in your description can validly be replaced by "all". In this case, _I_ am using the option in its current sense almost everywhere (expecting to be able to balloon up beyond the initial allocation), and it can also be useful in hotplug capable machines. If someone wants a particular maximum, (s)he should add the respective command line option.

XenServer uses dom0_mem=752M and expects it to set the maximum reservation to 752M (if it doesn't it grinds to a halt rather spectacularly as it runs out of memory due to the extra memory used for page tables etc.). So whilst I appreciate your desire to not have to change any command lines, I don't want to either.

The dom0_mem option has been historically confusing. The min, and max options don't affect the initial number of pages in a useful way (min:MMM and max:MMM are no different to simply specifying MMM).

So I think we need to decide what behaviour is the best in the long term.

The two options are:

The current behaviour:

                      | Initial | Max       |
dom0_mem=III          | III     | Unlimited |
dom0_mem=III,max:MMM  | III     | MMM       |
dom0_mem=max:MMM      | MMM     | MMM       |

or this proposal:

Quoted 7 lines
                      | Initial | Max       |
dom0_mem=III          | III     | III       |
dom0_mem=III,max:MMM  | III     | MMM       |
dom0_mem=max:MMM      | MMM     | MMM       |

Hmm. Having enumerated the two options, the current behaviour looks more sensible to me now...

Great.

Quoted 2 lines

The docs still need updating and I think the min:MMM option should be deprecated.

Why should we deprecate min:? It can be useful when combined with other sub-options, can't it?

Quoted 14 lines
Quoted 6 lines
Quoted 5 lines

This change means that with Linux 3.0.5 and later kernels, dom0_mem=512M has the same result as older, 'classic Xen' kernels. The older kernels used the initial number of pages to set the maximum number of pages and did not query the hypervisor for the maximum reservation.

Quoted 7 lines

If the pv-ops kernels behave differently in this aspect than the forward ported ones, then it should really be the newer one to get adjusted to the original behavior (if so intended), unless the old behavior was completely insane. Adjusting the hypervisor for a shortcoming(?) in a particular implementation of a Dom0 kernel doesn't seem to be the right route - please also consider non-Linux Dom0 kernels that might expect the current behavior.

Quoted 2 lines

The old behaviour did not allow dom0 to balloon up beyond the initial allocation so we don't what to go back to that.

In pv-ops Linux Dom0 you mean? While I can't speak of non-Linux, ballooning up beyond the initial allocation works fine in the legacy and forward ported kernels.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

It is still possible to have a larger reservation by explicitly specifying dom0_mem=max:MMM.

I am not intending to update dozens of command lines.

Looks like I will be though...

Sorry, but yes, you're going to have to use the originally intended option if XenServer's expectation indeed is an enforced maximum.

Jan

#5 lore raw
Quoted 6 lines · Jan Beulich
Quoted 2 lines · David Vrabel

The docs still need updating and I think the min:MMM option should be deprecated.

Why should we deprecate min:? It can be useful when combined with other sub-options, can't it?

Not convinced of its utility but it does do something, so yes, it should be kept.

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 5 lines

This change means that with Linux 3.0.5 and later kernels, dom0_mem=512M has the same result as older, 'classic Xen' kernels. The older kernels used the initial number of pages to set the maximum number of pages and did not query the hypervisor for the maximum reservation.

If the pv-ops kernels behave differently in this aspect than the forward ported ones, then it should really be the newer one to get adjusted to the original behavior (if so intended), unless the old behavior was completely insane. Adjusting the hypervisor for a shortcoming(?) in a particular implementation of a Dom0 kernel doesn't seem to be the right route - please also consider non-Linux Dom0 kernels that might expect the current behavior.

Quoted 6 lines
Quoted 2 lines

The old behaviour did not allow dom0 to balloon up beyond the initial allocation so we don't what to go back to that.

In pv-ops Linux Dom0 you mean? While I can't speak of non-Linux, ballooning up beyond the initial allocation works fine in the legacy and forward ported kernels.

Perhaps I'm looking at a XenServer specific limitation.

David