Re: [PATCH v7 4/7] xen/console: switch conring runtime allocation to xvmalloc

Jan Beulich <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <[email protected]>
On 13.07.2026 20:16, [email protected] wrote:
> @@ -474,20 +475,26 @@ void __init console_init_ring(void)
>  {
>      char *ring;
>      XENCONS_RING_IDX done, size, n;
> -    unsigned int order, memflags;
>      unsigned long flags;
>  
>      if ( !opt_conring_size )
>          return;
> -

Please can we keep this blank line and ...

> -    order = get_order_from_bytes(max(opt_conring_size, conring_size));
> -    memflags = MEMF_bits(crashinfo_maxaddr_bits);
> -    while ( (ring = alloc_xenheap_pages(order, memflags)) == NULL )
> +    else if ( opt_conring_size > GB(2) )

... have this be just "if ()"? (I'd also suggest to make the "positive" case
the "if()" part and have the out-of-range one in the "else" body.)

>      {
> -        BUG_ON(order == 0);
> -        order--;
> +        printk(XENLOG_WARNING "Limiting user-configured console ring size to 2 GiB\n");

Nit: Too long line. Yes, format strings shouldn't be split, but XENLOG_* can
every well live on a separate line.

> +        opt_conring_size = GB(2);
>      }
> -    opt_conring_size = PAGE_SIZE << order;
> +    else
> +    {
> +        unsigned int order = get_order_from_bytes(max(opt_conring_size,
> +                                                      conring_size));
> +        opt_conring_size = PAGE_SIZE << order;

Nit: Blank line please between declaration(s) and statement(s).

> +    }
> +
> +    ring = xvmalloc_array(char, opt_conring_size);
> +    if ( !ring )
> +        panic("Unable to allocate console ring of %u KiB\n",
> +              opt_conring_size >> 10);

Why do you lose the prior behavior of halving the size until allocation
succeeds (or we can't even allocate a single page)?

Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.