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

Re: [PATCH 12/12] x86/boot: add cmdline to struct boot_domain


  • To: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Thu, 7 Nov 2024 16:12:46 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=apertussolutions.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=yOdhTX9d0VxfNaAqnwZk1tI+22gfz7+7+QWyZkVHbFE=; b=HY1wpCr2/VdlZcO7b/jJezwg332CEjgC/GaCpD0uRBU73FDnwM2+/dS7t9SWN+O+Oh9L3yZ3yKOI9Y2dUPQwNpwpLm/HND0Ubf0n6hzlmkWXzLsexxIk+pXSlYCEpmvxkvjkln83BWoKAdHKhOUVIqW7hVyfU108Bh0Pw8DFEgKBsYSRfmKhMezc7pP4ugga2YGOtdMumEuyF5wKzFfM8IIkz43BUnuCvU/W+0Q6lQw6x8sRi8Vk5ikyPvpbPFhJcDnhgF94BUxZJZBZ0uUYkpH6FR3RYSVgHYYHQuvJeWeYl9UARr1Po2CweFiO/oKdqt+cwRR0NyObZ8GO4aKUDQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nfbmXbcLZJVmYzoCP2WArZAYe6LSz1kuhcli+tayiXv43nIT3ciYvXapH/wD1jqAwbo5V4EDOja1QPYU008XuQ9K5fk+SduGEZtTL4dQ0p+KMWpn4QXFgdQDuc5L8xthf+zIeXFs93ohnlD0daJooF53yaT4fdV+hHCisyMr8CoPQvYxtkGQPgz+b5A/qEoW2O5QC8Jd+L65vxMarboOuBDhxEIqmDKMKC8NnU/jtdJ9wZTAC4A3AoFbP667hUSqCT9rixwomrM2JIrRDTJ8FQzQg1hLiK8NLe6AeXlHJ6hwPKcpzq+Jm6MwXd4oLamtkfpxdCnPzske5h7NmsPJqA==
  • Cc: <christopher.w.clark@xxxxxxxxx>, <stefano.stabellini@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 07 Nov 2024 21:13:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-11-02 13:25, Daniel P. Smith wrote:
Add a container for the "cooked" command line for a domain. This provides for
the backing memory to be directly associated with the domain being constructed.
This is done in anticipation that the domain construction path may need to be
invoked multiple times, thus ensuring each instance had a distinct memory
allocation.

Is the area only used at domain construction time? If that runs sequentially, then only a single cmdline buffer would be needed. cmdline_pa can keep pointing to individual cmdlines. Unless the multi-domain builder needs to keep multiple? But that could maybe keep cmdline_pa pointing into the device tree?

Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
Changes since v7:
- updated commit message to expand on intent and purpose
---
  xen/arch/x86/include/asm/bootdomain.h |  4 ++++
  xen/arch/x86/include/asm/dom0_build.h |  1 +
  xen/arch/x86/pv/dom0_build.c          |  4 ++--
  xen/arch/x86/setup.c                  | 18 ++++++++----------
  4 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootdomain.h 
b/xen/arch/x86/include/asm/bootdomain.h
index 3873f916f854..bc51f04a1df6 100644
--- a/xen/arch/x86/include/asm/bootdomain.h
+++ b/xen/arch/x86/include/asm/bootdomain.h
@@ -8,10 +8,14 @@
  #ifndef __XEN_X86_BOOTDOMAIN_H__
  #define __XEN_X86_BOOTDOMAIN_H__
+#include <public/xen.h>
+
  struct boot_module;
  struct domain;
struct boot_domain {
+    char cmdline[MAX_GUEST_CMDLINE];
+

You might want to put the 1024 byte chars at the end of the structure. Having the other pointers at the start is probably more useful.

      domid_t domid;
struct boot_module *kernel;

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 28257bf13127..2c84af52de3e 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -960,8 +960,8 @@ static int __init dom0_construct(struct boot_domain *bd)
      }
memset(si->cmd_line, 0, sizeof(si->cmd_line));
-    if ( cmdline != NULL )
-        strlcpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line));
+    if ( cmdline[0] != '\0' )

Shouldn't this check bd->cmdline[0] ? There is a const char *cmdline in this function that should probably be removed.

Regards,
Jason

+        strlcpy((char *)si->cmd_line, bd->cmdline, sizeof(si->cmd_line));
#ifdef CONFIG_VIDEO
      if ( !pv_shim && fill_console_start_info((void *)(si + 1



 


Rackspace

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