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

Re: [PATCH v2 03/15] x86/boot: add cmdline to struct boot_domain


  • To: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Fri, 10 Jan 2025 14:52:57 -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=02oETOlBsWxI1frBbQ+Ht8ybGSP54hNsPPtunB8DhLU=; b=VCVsT0kfMGc2QvkuY/pvwkusn351h4Lelg7T0ymdLw7381xN2xWsx3e06TcMKCkhZM2p2/iZmbpcx4ou/QbVdUVjogQ8YDwkxac+LQP6T8DWRt2+OkMrSxljRdtHVtCI2Ai6doRRzP0F+Pi9uIiyfiQeq3IoPWZlzg1mFK1l7EnwBcf9XGF/WsSurOulaOf0n7NHDXRj5aE7iFb2/famk5oOwBXLi5mceYhmNm0eEa9/OYjdUIYn9HrOvT0AWv3EvASmRPuw5Ij6DLV2GQcH+rXY/t+FvN32v7MWmEBezwcc1hGw2hPCW6JZpes9r72LCmd76D204oTZn1O8xPLZbg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=X872xgXHGfsGM237LvtrTMRk9/0f5dx62JzHSvW5ak+01K8CnFNg7uBcxw7C0pJW8TW3D+EhLRgh/KlzwdiShSkewM7P7/55XGkdHmW1PL54nSrHuwt/Jfe2yghu6yGFP4u9CApHM4twNfD3cjnmDWeNwgEuql6g8QbKsS1Sqmd5R9Wlkhag1SGNdKBUVMmZCYr85/nZB2+ajP2WLIcVSok0DPJl03bTKP+p6FHJO+BJVBvfQv/pGplVZJdouu/2wG0r+smh2S1W7JgDfYxD7jSefWuRS1ubu7Idea07Ve8Ft7+n1F9lGRsTc+FKjgPgvZa+3Tv4Hnaa3NeUrMNVGw==
  • 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: Fri, 10 Jan 2025 19:54:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-12-26 11:57, 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.

Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>


@@ -1018,39 +1037,52 @@ static struct domain *__init create_dom0(struct 
boot_info *bi)
          panic("Error creating d%uv0\n", bd->domid);
/* Grab the DOM0 command line. */
-    if ( bd->kernel->cmdline_pa || bi->kextra )
+    if ( (bd->kernel->cmdline_pa &&
+          ((char *)__va(bd->kernel->cmdline_pa))[0]) ||
+         bi->kextra )
      {
-        if ( bd->kernel->cmdline_pa )
-            safe_strcpy(cmdline,
-                        cmdline_cook(__va(bd->kernel->cmdline_pa), 
bi->loader));
+        size_t cmdline_size = domain_cmdline_size(bi, bd);
+
+        if ( cmdline_size )
+        {
+            if ( !(cmdline = xzalloc_array(char, cmdline_size)) )
+                panic("Error allocating cmdline buffer for %pd\n", d);

I guess I wasn't clear last time. Instead of two levels of indent, I was thinking at the top level:

    /* Grab the DOM0 command line. */
    cmdline_size = domain_cmdline_size(bi, bd);
    if ( cmdline_size )
    {

domain_cmdline_size() checks all the pointers, so this removes duplication and indent.

The rest looks good.

Regards,
Jason



 


Rackspace

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