* [PATCH] domctl: don't truncate XEN_DOMCTL_max_mem requests
@ 2015-04-22 11:56 Jan Beulich
2015-04-22 12:03 ` Andrew Cooper
2015-05-04 7:49 ` Ping: " Jan Beulich
0 siblings, 2 replies; 5+ messages in thread
From: Jan Beulich @ 2015-04-22 11:56 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Campbell, Keir Fraser, Ian Jackson, Tim Deegan
[-- Attachment #1: Type: text/plain, Size: 947 bytes --]
Instead saturate the value if the input can't be represented in the
respective struct domain field.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -944,7 +944,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
case XEN_DOMCTL_max_mem:
{
- unsigned long new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10);
+ uint64_t new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10);
spin_lock(&d->page_alloc_lock);
/*
@@ -952,7 +952,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
* that the domain will now be allowed to "ratchet" down to new_max. In
* the meantime, while tot > max, all new allocations are disallowed.
*/
- d->max_pages = new_max;
+ d->max_pages = min(new_max, (uint64_t)(typeof(d->max_pages))-1);
spin_unlock(&d->page_alloc_lock);
break;
}
[-- Attachment #2: domctl-max-mem-saturation.patch --]
[-- Type: text/plain, Size: 995 bytes --]
domctl: don't truncate XEN_DOMCTL_max_mem requests
Instead saturate the value if the input can't be represented in the
respective struct domain field.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -944,7 +944,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
case XEN_DOMCTL_max_mem:
{
- unsigned long new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10);
+ uint64_t new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10);
spin_lock(&d->page_alloc_lock);
/*
@@ -952,7 +952,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
* that the domain will now be allowed to "ratchet" down to new_max. In
* the meantime, while tot > max, all new allocations are disallowed.
*/
- d->max_pages = new_max;
+ d->max_pages = min(new_max, (uint64_t)(typeof(d->max_pages))-1);
spin_unlock(&d->page_alloc_lock);
break;
}
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] domctl: don't truncate XEN_DOMCTL_max_mem requests
2015-04-22 11:56 [PATCH] domctl: don't truncate XEN_DOMCTL_max_mem requests Jan Beulich
@ 2015-04-22 12:03 ` Andrew Cooper
2015-04-22 12:08 ` Jan Beulich
2015-05-04 7:49 ` Ping: " Jan Beulich
1 sibling, 1 reply; 5+ messages in thread
From: Andrew Cooper @ 2015-04-22 12:03 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Ian Campbell, Ian Jackson, Keir Fraser, Tim Deegan
[-- Attachment #1.1: Type: text/plain, Size: 1249 bytes --]
On 22/04/15 12:56, Jan Beulich wrote:
> Instead saturate the value if the input can't be represented in the
> respective struct domain field.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Do I take it you have a 16TB guest to hand?
>
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -944,7 +944,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
>
> case XEN_DOMCTL_max_mem:
> {
> - unsigned long new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10);
> + uint64_t new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10);
>
> spin_lock(&d->page_alloc_lock);
> /*
> @@ -952,7 +952,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
> * that the domain will now be allowed to "ratchet" down to new_max. In
> * the meantime, while tot > max, all new allocations are disallowed.
> */
> - d->max_pages = new_max;
> + d->max_pages = min(new_max, (uint64_t)(typeof(d->max_pages))-1);
> spin_unlock(&d->page_alloc_lock);
> break;
> }
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 2185 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] domctl: don't truncate XEN_DOMCTL_max_mem requests
2015-04-22 12:03 ` Andrew Cooper
@ 2015-04-22 12:08 ` Jan Beulich
0 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2015-04-22 12:08 UTC (permalink / raw)
To: Andrew Cooper
Cc: Ian Campbell, xen-devel, Keir Fraser, Ian Jackson, Tim Deegan
>>> On 22.04.15 at 14:03, <andrew.cooper3@citrix.com> wrote:
> On 22/04/15 12:56, Jan Beulich wrote:
>> Instead saturate the value if the input can't be represented in the
>> respective struct domain field.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> Do I take it you have a 16TB guest to hand?
No, but see the subsequently sent libx{l,c} patch for why this is
needed anyway.
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Ping: [PATCH] domctl: don't truncate XEN_DOMCTL_max_mem requests
2015-04-22 11:56 [PATCH] domctl: don't truncate XEN_DOMCTL_max_mem requests Jan Beulich
2015-04-22 12:03 ` Andrew Cooper
@ 2015-05-04 7:49 ` Jan Beulich
2015-05-04 14:14 ` Tim Deegan
1 sibling, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2015-05-04 7:49 UTC (permalink / raw)
To: Ian Campbell, Ian Jackson, Keir Fraser, Tim Deegan; +Cc: xen-devel
While I got a review from Andrew, I'm still waiting for an ack (or nak).
Thanks, Jan
>>> On 22.04.15 at 13:56, <JBeulich@suse.com> wrote:
> Instead saturate the value if the input can't be represented in the
> respective struct domain field.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -944,7 +944,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
>
> case XEN_DOMCTL_max_mem:
> {
> - unsigned long new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10);
> + uint64_t new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10);
>
> spin_lock(&d->page_alloc_lock);
> /*
> @@ -952,7 +952,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
> * that the domain will now be allowed to "ratchet" down to new_max. In
> * the meantime, while tot > max, all new allocations are disallowed.
> */
> - d->max_pages = new_max;
> + d->max_pages = min(new_max, (uint64_t)(typeof(d->max_pages))-1);
> spin_unlock(&d->page_alloc_lock);
> break;
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Ping: [PATCH] domctl: don't truncate XEN_DOMCTL_max_mem requests
2015-05-04 7:49 ` Ping: " Jan Beulich
@ 2015-05-04 14:14 ` Tim Deegan
0 siblings, 0 replies; 5+ messages in thread
From: Tim Deegan @ 2015-05-04 14:14 UTC (permalink / raw)
To: Jan Beulich; +Cc: Ian Campbell, Keir Fraser, Ian Jackson, xen-devel
At 08:49 +0100 on 04 May (1430729386), Jan Beulich wrote:
> While I got a review from Andrew, I'm still waiting for an ack (or nak).
Acked-by: Tim Deegan <tim@xen.org>
I expect Coverity will complain on architectures where this isn't
necessary, but acked nonetheless.
Tim.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-05-04 14:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-22 11:56 [PATCH] domctl: don't truncate XEN_DOMCTL_max_mem requests Jan Beulich
2015-04-22 12:03 ` Andrew Cooper
2015-04-22 12:08 ` Jan Beulich
2015-05-04 7:49 ` Ping: " Jan Beulich
2015-05-04 14:14 ` Tim Deegan
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.