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

Re: [PATCH v5 5/6] xen/console: update conring memory allocation


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: dmukhin@xxxxxxxx
  • Date: Fri, 8 May 2026 14:45:52 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 205.220.161.53) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=ford.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ford.com; dkim=pass (signature was verified) header.d=saarlouis.ford.com; dkim=pass (signature was verified) header.d=ford.com; 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=AzW29ifmTy2q85zPQ5kqe9FGXxfBzpBT4chc1Y/NQOg=; b=fJzAbt6i9uV3VsSgHxAiU9OTqjs6iDbVsfpqBRmHr/scIrLS25JUzdnv1gXrXmwioLm7Sh59kIypuO+IdpCorVMlOk9Rc2AKSU6XDbfcmFspprH0yHRLqFnZKfC4QCEcZQQAy7Eqw4Atl7jUadzJL+4BAUbmTTZvUw/2CctZjic/LrD2wea4FwZ2BZbbWCzh7BjFGKZ1QAWXOPagus6cW8VWCeOuKEMzsCvw3B4jSXXFiF2uQciDKXDiXvWnWGvCEMuMIam9xrRnC2/Fn6wydsrc0VQCKO70t/+Ll6tn/IXAuCqTM5Ew/GzpTw0J0tIrd3UO9cccyMONKCyK9vCrKQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kHiI5ee8jrBdRCjaLv7m8oc3NFYc+CDvdcD/+KKtHnQ9nQd0lHxxQRbXys+ftTSt0ip3sbyWN4wqPJaMr2K+FX12ckEoyxx0gkZ+unx21h+4XVoCdf1KjpW4aSamMf3EyR82bDP9zl5Aenn/TFtLSbcoTprFWTZ6wOedraaj3/rd2VmsWUpf/qOMgFsQNM+kJaSA07ilg5o68cbcu+pwsm6+a2r/mTkUlxLzNdxjFPYTFPNcXMKJzQe8nSUnJng8uUzfmTbj/XI6PxtnPMtX616yHkX2PV8AcY/NDpR6ZdiUtXGMFS64yaCP4m0fBg5auAZjyF5ieuF0CjfRE4/xjA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=ppford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=selector2-azureford-onmicrosoft-com header.d=azureford.onmicrosoft.com header.i="@azureford.onmicrosoft.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=ppserprodsaar header.d=saarlouis.ford.com header.i="@saarlouis.ford.com" header.h="Cc:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=ppfserpocford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"
  • Cc: andrew.cooper3@xxxxxxxxxx, anthony.perard@xxxxxxxxxx, julien@xxxxxxx, michal.orzel@xxxxxxx, roger.pau@xxxxxxxxxx, sstabellini@xxxxxxxxxx, dmukhin@xxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 08 May 2026 21:46:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Pser-m365-app: SER-APP

On Mon, Feb 09, 2026 at 06:02:52PM +0100, Jan Beulich wrote:
> On 05.02.2026 02:36, dmukhin@xxxxxxx wrote:
> > --- a/xen/drivers/char/console.c
> > +++ b/xen/drivers/char/console.c
> > @@ -463,20 +463,34 @@ static void cf_check conring_dump_keyhandler(unsigned 
> > char key)
> >  void __init console_init_ring(void)
> >  {
> >      char *ring;
> > -    unsigned int start, size, chunk, order, memflags;
> > +    unsigned int start, size, chunk;
> >      unsigned long flags;
> >  
> >      if ( !opt_conring_size )
> >          return;
> >  
> > -    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 )
> > +    opt_conring_size = max(opt_conring_size, conring_size);
> > +    size = ROUNDDOWN(opt_conring_size, PAGE_SIZE);
> > +    if ( size != opt_conring_size )
> >      {
> > -        BUG_ON(order == 0);
> > -        order--;
> > +        opt_conring_size = size;
> > +        printk(XENLOG_WARNING "Rounding down console ring size to multiple 
> > of %lu KiB.\n",
> > +               PAGE_SIZE >> 10);
> >      }
> > -    opt_conring_size = PAGE_SIZE << order;
> > +    if ( opt_conring_size >= GB(2) )
> > +    {
> > +        opt_conring_size = GB(2);
> > +        printk(XENLOG_WARNING "Limiting user-configured console ring 
> > size.\n");
> > +    }
> > +    else if ( opt_conring_size < _CONRING_SIZE )
> > +    {
> > +        opt_conring_size = _CONRING_SIZE;
> > +        printk(XENLOG_WARNING "Using compile-time console ring size.\n");
> > +    }
> > +
> > +    /* Contiguous buffer; does not need to be naturally aligned. */
> > +    ring = xmalloc_bytes(opt_conring_size);
> 
> I'm sorry, but I'm going to veto any new uses of xmalloc_bytes(). As per the
> comment at the top of xvmalloc.h, the family of functions there should be used
> in new code. That family deliberately doesn't include a counterpart of
> xmalloc_bytes(). You're wanting a multiple of page size anyway, so perhaps it
> is warranted here to actually use vmalloc() directly.

Thanks for taking a look at the series!

Sorry it's been a while, I am getting back to the series only now :-/

Turns out that vmalloc() is not available on MPU systems (*-mpu jobs in CI):
CONFIG_HAS_VMAP is disabled.

I will switch to xvmalloc-backed allocation, if that's OK.

--
Denis



 


Rackspace

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