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

Re: [PATCH v4 06/12] xen/common: add dom0 xen command line argument for Arm


  • To: Luca Fancellu <luca.fancellu@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 28 Mar 2023 11:44:34 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FS9VaI5T1Rqb9dw/YiPr/o6Wyx+B/vw5OBGvrEVxztM=; b=XKXwwRrSGENJoaKTyho6LKQOQH6+HxGUloQm/k9asKNBAO9ykQcrt8surOBbfLuYoSj9bdFAKMRhwmvHpPgWKSDiOPLBUN4IIKpn+WN0JJLU57IoC9DiQ32sSmXTx52ZB7PxTtk6hKDtI+hvOosUA/vSYZ5jm/VM+45DpoascXPTPapMudKMMUyWkJA1K7OeNhTU2w2BPS8axTyuNa6w8Pf7VxVzF7CC4sjut4E483w2GC9CujJdTwiNueyWogTfaHJ3+msGLjYerEQMPS/IjDRP4fz8XUjmrnZ6f6u+o9OEwP0swpUFeWHqjR1SGbwgQwgD7HnvIkCRetULde8kIQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AODR45f020lKj6zsFqIssa3mNYzeVcYuwYbJrfLp/Pi+FW6hXTVfaw4dMBVnFW0fgOM5tGF+k8XdehLwKM42BcY27I0aMZlK+IVSeqxvJDT872lU/45okQdGpemzK5JgfUq/SMpepjgyLngILi+gDLYbipS5bSmyhtL3O0XxQz9E0U/rRNJG8EZMSwI9LGTXApCaFyJ9ykdFlfu8TiANe+YMTdkaTBuVFHQWftRcoJaEgYYPMNjjEVswllt6dgIZI5HbaaaKda7CwThqvdFdUgGPEba3qjLejZNCSxY1JY/BJ0zy7z9ryUjD4P4ar9ec2vo4alcg2ssWB2VnewUPXA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: bertrand.marquis@xxxxxxx, wei.chen@xxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 28 Mar 2023 09:44:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.03.2023 12:59, Luca Fancellu wrote:
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -59,6 +59,11 @@ static int __init parse_dom0_mem(const char *s)
>  }
>  custom_param("dom0_mem", parse_dom0_mem);
>  
> +int __init parse_arch_dom0_param(const char *str_begin, const char *str_end)
> +{
> +    return -1;
> +}

Please also use -E... here, like x86 does.

> --- a/xen/arch/x86/dom0_build.c
> +++ b/xen/arch/x86/dom0_build.c
> @@ -266,42 +266,30 @@ bool __initdata opt_dom0_pvh = !IS_ENABLED(CONFIG_PV);
>  bool __initdata opt_dom0_verbose = IS_ENABLED(CONFIG_VERBOSE_DEBUG);
>  bool __initdata opt_dom0_msr_relaxed;
>  
> -static int __init cf_check parse_dom0_param(const char *s)
> +int __init parse_arch_dom0_param(const char *str_begin, const char *str_end)

Is there any reason you couldn't stick to the original variable names (s
and ss) or use other meaningful by shorter names like s and e or str and
end (my personal preference among the three in the order given)? That'll
help with line length and hence readability.

>  {
> -    const char *ss;
> -    int rc = 0;
> -
> -    do {
> -        int val;
> -
> -        ss = strchr(s, ',');
> -        if ( !ss )
> -            ss = strchr(s, '\0');
> +    int val, rc = 0;
>  
> -        if ( IS_ENABLED(CONFIG_PV) && !cmdline_strcmp(s, "pv") )
> -            opt_dom0_pvh = false;
> -        else if ( IS_ENABLED(CONFIG_HVM) && !cmdline_strcmp(s, "pvh") )
> -            opt_dom0_pvh = true;
> +    if ( IS_ENABLED(CONFIG_PV) && !cmdline_strcmp(str_begin, "pv") )
> +        opt_dom0_pvh = false;
> +    else if ( IS_ENABLED(CONFIG_HVM) && !cmdline_strcmp(str_begin, "pvh") )
> +        opt_dom0_pvh = true;
>  #ifdef CONFIG_SHADOW_PAGING
> -        else if ( (val = parse_boolean("shadow", s, ss)) >= 0 )
> -            opt_dom0_shadow = val;
> +    else if ( (val = parse_boolean("shadow", str_begin, str_end)) >= 0 )
> +        opt_dom0_shadow = val;
>  #endif
> -        else if ( (val = parse_boolean("verbose", s, ss)) >= 0 )
> -            opt_dom0_verbose = val;
> -        else if ( IS_ENABLED(CONFIG_PV) &&
> -                  (val = parse_boolean("cpuid-faulting", s, ss)) >= 0 )
> -            opt_dom0_cpuid_faulting = val;
> -        else if ( (val = parse_boolean("msr-relaxed", s, ss)) >= 0 )
> -            opt_dom0_msr_relaxed = val;
> -        else
> -            rc = -EINVAL;
> -
> -        s = ss + 1;
> -    } while ( *ss );
> +    else if ( (val = parse_boolean("verbose", str_begin, str_end)) >= 0 )
> +        opt_dom0_verbose = val;
> +    else if ( IS_ENABLED(CONFIG_PV) &&
> +              (val = parse_boolean("cpuid-faulting", str_begin, str_end)) >= 
> 0 )
> +        opt_dom0_cpuid_faulting = val;
> +    else if ( (val = parse_boolean("msr-relaxed", str_begin, str_end)) >= 0 )
> +        opt_dom0_msr_relaxed = val;
> +    else
> +        rc = -EINVAL;
>  
>      return rc;
>  }

While largely a style aspect (and hence I'm not going to insist), I don't
see the value of the "rc" local variable with the changed logic. With at
least the other aspects addressed
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan



 


Rackspace

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