[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] xen/sched: fix sched_move_domain() for domain without vcpus


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Luca Fancellu <luca.fancellu@xxxxxxx>
  • Date: Wed, 15 Sep 2021 15:31:25 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=STGeZRz/sCVV+bj9yj0TBAhlmYRFaf/42Eo1Ncekw+o=; b=gyDHXRm5BPeyDM3Idi5RflS1NkRQE/4qBkqqXHRnd6LyGZw4YWcPA4GU6eh5uHvz57MLXelWKTbgT1TArHGUZCvA07xvnWUoloUoLTC+6Qe1dIngVtRHfu15h7Ziq9iif6n0e9QJSz9fVZu72M7OeOONI9kBNKad0KZ9C/QNH5mdx37PG9kBWuE/ss17RjXIaRv7RrBZZBkAS2Zh1At6z54dEhJN+wk98TZ6nkN8VSOGE5VtXndyREch+SFJ+LvaLJvc15TOrhsjUU5WGJlUPgD+DpHXuXt/19sU+axv8tj/rUPoOjzbvreCWDPtFFwDEd3jSuaCCnslrsEHp9f/4g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gelrlvjbyX4Ad6oIp/bQehT+SzmgMqpUxbz+Ro4QWdwHZXRS5Voq/LDEpV7WO+h8ibD6UAmO/cbJFQ4qGTYNE19KlZAyi6DDjkz8y7paa9lc2+xAkFLE1wA8Yy6X8FIwVJ5G1TR7wcQWG2VOtMCAXPP682DR+nMkk8lB4obQQEWNcAbIu5JK54tcwxeIhTKmQDCFjAyoT9pgusJwZVLj2djZQATTCZpHuQWrWn9/y05kcfQ1LVuBX81TVlcRO20L1/LNi0Z/vVheJhrWElARA0bTEu5qoabf+YB//4bqx/fDttf3XtHjcpCsQYf3OO2HNL5BqiZ929xhvRkRcB+udQ==
  • Authentication-results-original: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, George Dunlap <george.dunlap@xxxxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Wed, 15 Sep 2021 14:31:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=arm.com;


> On 8 Sep 2021, at 14:04, Juergen Gross <jgross@xxxxxxxx> wrote:
> 
> In case a domain is created with a cpupool other than Pool-0 specified
> it will be moved to that cpupool before any vcpus are allocated.
> 
> This will lead to a NULL pointer dereference in sched_move_domain().
> 
> Fix that by tolerating vcpus not being allocated yet.
> 
> Fixes: 70fadc41635b9b6 ("xen/cpupool: support moving domain between cpupools 
> with different granularity")
> Reported-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>

Reviewed-by: Luca Fancellu <Luca.fancellu@xxxxxxx>

> ---
> V2:
> - Only test for vcpu[0] not being present (Jan Beulich)
> ---
> xen/common/sched/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
> index 8d178baf3d..8f4b1ca10d 100644
> --- a/xen/common/sched/core.c
> +++ b/xen/common/sched/core.c
> @@ -651,7 +651,7 @@ int sched_move_domain(struct domain *d, struct cpupool *c)
>     struct scheduler *old_ops = dom_scheduler(d);
>     void *old_domdata;
>     unsigned int gran = cpupool_get_granularity(c);
> -    unsigned int n_units = DIV_ROUND_UP(d->max_vcpus, gran);
> +    unsigned int n_units = d->vcpu[0] ? DIV_ROUND_UP(d->max_vcpus, gran) : 0;
>     int ret = 0;
> 
>     for_each_vcpu ( d, v )
> -- 
> 2.26.2
> 
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.