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

Re: [PATCH] tools/init-dom0less: Fix cpus > 1 and xenstore entries


  • To: Jason Andryuk <jason.andryuk@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Thu, 6 Mar 2025 11:29:53 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SXqfIDlKKtSbL6kyYsF97WaIRlFv2XaNGtqSIfIVvto=; b=EiyObHTJEJBueVeLTNtXIozaB7gUdlmS32n3YniOSRuyw44r3PFOqWYl+vb5QAob6T0uFLLKWoRWoyHtT9OSygC+lzy+hLjr2D/cGQspYSMHg+o9fSgg1SPviLlVSYt93s1zcU0g7ZOaNaE0wrSvPIEEwk5I4B1OhFcjuwyz9lx4ucgeHpnXOyzh9G0qBadL6AXLenYfLSSRe03QsK6hqABPt/AF4ZSWu0JlpQf+UvF/0bYxUpmUYhY4+5FZfUtwxuc4LtjYOqGU0aimjOaE7YKr/Fengxv+65qtjx06PL105RSrtyOrWSrmCAKvwaVuigDsYOVTg7p6FgkPvSZOug==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P5y8DrVOR637UK1TdOYjL6YTUvoKURgChGwoS/0IUqasp+DGM+Xuc4npc7LNcBhMVu1mI+y9gAHLKsiorCoeVlaSBkwAUZNMbSjAOjWxqsZjfKUT4mIl9pnwK0AHQ8oqe5RByf6pHBqKm4gL2JxR8Fre/L5yQjIcvJwLU1Z0dnbOkjmJFL7/C8+bQJyLbxqGG+6B2Uhn3i0XqLu2I3jChrag5Pmfhz7D9mFShaQBSWflXBrXu1TzsVXStKp5H2t3993QIgDHP/GGitj0o5laWBZpLoYiATRVawh4Xixg6zemL5KuuIhIedJIFxqrephmRokYMaJnWD3ffl3w+11oNw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Thu, 06 Mar 2025 10:30:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 05/03/2025 22:58, Jason Andryuk wrote:
> 
> 
> The trailing / in the path is incorrect and generates an error when
> writing to xenstore:
> Checking domid: 1
> Init dom0less domain: 1
> init-dom0less: writing to xenstore: No error information
> 
> init-dom0less exits without finishing initialization.
> 
> vcpu_max_id is an inclusive value, so it should be included in the
> loop's range to include all vcpus.  Without this, no xenstore entries
> are created for a 1 vcpu domain.
> 
> Finally, use vcpu_online, the count of online vcpus, to determine online
> vs. offline.  info->cpupool is a cpupool id and not a bitmask.
> 
> Fixes: ec53e0c4ea ("tools: add example application to initialize dom0less PV 
> drivers")
> Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
> ---
>  tools/helpers/init-dom0less.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c
> index 17579fe2e8..c569a890a0 100644
> --- a/tools/helpers/init-dom0less.c
> +++ b/tools/helpers/init-dom0less.c
> @@ -182,13 +182,13 @@ retry_transaction:
>      if (!do_xs_write_dom(xsh, t, domid, "vm", vm_val_str)) goto err;
>      if (!do_xs_write_dom(xsh, t, domid, "name", dom_name_str)) goto err;
>      if (!do_xs_write_dom(xsh, t, domid, "cpu", "")) goto err;
> -    for (i = 0; i < info->vcpu_max_id; i++) {
> -        rc = snprintf(cpu_str, STR_MAX_LENGTH, "cpu/%u/availability/", i);
> +    for (i = 0; i <= info->vcpu_max_id; i++) {
> +        rc = snprintf(cpu_str, STR_MAX_LENGTH, "cpu/%u/availability", i);
Up until this point:
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

That said...

>          if (rc < 0 || rc >= STR_MAX_LENGTH)
>              goto err;
>          rc = -EIO;
>          if (!do_xs_write_dom(xsh, t, domid, cpu_str,
> -                             (info->cpupool & (1 << i)) ? "online" : 
> "offline"))
> +                             i < info->vcpu_online ? "online" : "offline"))
I struggle with this one. Let's say that a dom0less domU starts with 4 vCPUs and
later on (before executing init-dom0less from dom0), decides to kill it's 2nd
vCPU. So domU is running vCPU{0,2,3}. With your patch, after executing the
script, the 4th vCPU will have its availability set to offline and domU will get
notified to kill its 4th vCPU. That does not sound right...

~Michal




 


Rackspace

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