[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: Wed, 15 Jan 2025 14:50:50 -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=seD+oyU96rm9OHwuiSKSM0dOceEInH33mH+S6spoIzM=; b=uhv21AuooVyd6Rwehg1NCxIACETacphnC474EnyXpdtjHeIZuDA3UkZtT5FkjHk+pXBJg2zECcPVc+aFRrpYzukvcPGdsYdFUzt9oZaE6tv0jUvVnR+BEOp+mrF5sDnCI+LznRBhea3wo3WmgYC691m1KtEY6FONhWJHqbSjAL6rMAA0vpcWwvC/ewTK40Jk6PHsFqulJeYsPyw933kDIoyOnuoRcPhLrAw4x9kBp9mJ/dW+s+jaD/g2MXcOuYSd4hT0Q2d6NnmrHq7Kq/hSQmIB1riPmEFknWRjmhbIe/TpZlSllSRmnlwCCKqxPAy4b1FR6CMcAMwtb5AdZFGYDg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Wt3GjgMtIe5Cu4iSL79/8dEJyl26YEwHgofulbGVwdF08CDjKZlmAErlseHbmBs/e8tDg96PbMGgE0vgjKJl+2MBGxxu1zoLZK12c6yXOZb2+UXKiluNjz2b08XAS3Iccyg7teusAiH5RKmwybXG3V1lDvS+1yXrppg+pUJ47lh58HR+QkYLs9tkGAWcwh7YmbKgFb14+RFU2MuY1kXHoYGnioNr31ctepZA/w9yrH7tC484PiJzULWHaDTPEn7SuXU6NFWXyOk+3hee4+YbGfR3W7l/m3PGKgY3DQRWG4oanJwWYTDgKBMQVEKBliJ4d8xSgFYK5nGOqY1b+1MfBg==
- 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: Wed, 15 Jan 2025 19:51:09 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2025-01-15 12:22, Daniel P. Smith wrote:
On 1/10/25 14:52, Jason Andryuk wrote:
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.
But it is possible for there to be no command line, thus there is a
legitimate case where cmdline_size will be 0. If it is 0, there is no
reason to go through all of this logic.
Sure, but domain_cmdline_size() already handles an empty command line
and returns 0 for that. So I think this logic is still skipped in that
case.
Regards,
Jason
|