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

Re: [Xen-devel] [PATCH RFC v1 59/74] xen/pvshim: add shim_mem cmdline parameter



>>> On 04.01.18 at 14:06, <wei.liu2@xxxxxxxxxx> wrote:
> @@ -284,7 +291,16 @@ unsigned long __init dom0_compute_nr_pages(
>           * maximum of 128MB.
>           */
>          if ( nr_pages == 0 )
> -            nr_pages = -min(avail / 16, 128UL << (20 - PAGE_SHIFT));
> +        {
> +            uint64_t rsvd = min(avail / 16, 128UL << (20 - PAGE_SHIFT));

"unsigned long" and blank line following it.

> --- a/xen/arch/x86/pv/shim.c
> +++ b/xen/arch/x86/pv/shim.c
> @@ -40,6 +40,52 @@ bool pv_shim;
>  boolean_param("pv-shim", pv_shim);
>  #endif
>  
> +/*
> + * By default, 1/16th of total HVM container's memory is reserved for 
> xen-shim
> + * with minimum amount being 10MB and maximum amount 128MB. Some users may 
> wish
> + * to tune this constants for better memory utilization. This can be achieved
> + * using the following xen-shim's command line option:
> + *
> + * shim_mem=[min:<min_amt>,][max:<max_amt>,][<amt>]
> + *
> + * <min_amt>: The minimum amount of memory that should be allocated for 
> xen-shim
> + *            (ignored if greater than max)
> + * <max_amt>: The maximum amount of memory that should be allocated for 
> xen-shim
> + * <amt>:     The precise amount of memory to allocate for xen-shim
> + *            (overrides both min and max)
> + */
> +static uint64_t __initdata shim_nrpages;
> +static uint64_t __initdata shim_min_nrpages = 10UL << (20 - PAGE_SHIFT);
> +static uint64_t __initdata shim_max_nrpages = 128UL << (20 - PAGE_SHIFT);

"unsigned long" at the very least. The Dom0 variant of the code
also allows for negative values (and hence uses "long"), but it
looks like you don't mean to support such here.

> +static int __init parse_shim_mem(const char *s)
> +{
> +    do {
> +        if ( !strncmp(s, "min:", 4) )
> +            shim_min_nrpages = parse_size_and_unit(s+4, &s) >> PAGE_SHIFT;
> +        else if ( !strncmp(s, "max:", 4) )
> +            shim_max_nrpages = parse_size_and_unit(s+4, &s) >> PAGE_SHIFT;

Blanks around + (twice) please.

> +        else
> +            shim_nrpages = parse_size_and_unit(s, &s) >> PAGE_SHIFT;
> +    } while ( *s++ == ',' );
> +
> +    return s[-1] ? -EINVAL : 0;
> +}
> +custom_param("shim_mem", parse_shim_mem);
> +
> +uint64_t pv_shim_mem(uint64_t avail)

unsigned long (twice) and __init.

With that (or the promise to clean it up after initial commit)
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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