From nobody Mon Feb 9 08:30:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1770255411; cv=none; d=zohomail.com; s=zohoarc; b=BAkt9dIqHAvo39qmgIzPqzijOAfU58u6jmnADaGVjNvY1CTK5CVMC3O7a+VyNhb1ynlgc2XhdUsadUC64Ji1l77RfyNzQW08yVJf8qZmet4kBUFdHpNcVeMTeHCB+HTaPRMfAqI6xXXwc6tIoX77kdiXIHLldmxl4Gu7pGkzChg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770255411; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BMutOBe+27MwLrOuLnd1uuC/N9cHX1rSjncNYS0rwBk=; b=dvRCDfEedXrDbUPqXKX6BDYOo0Xbwtxe+onnGx1sFbo7P65s62bDynRLiV6Hf+3qyHVFdL/LW5Fd+5GYxqTa+vt015et5+yDHwqubP2bPFhg1IdtWFU0rtjgMXLZ2DG0vmK/NDwvZUqx0CO4gQ0uRBaCRsGYSR88AnH3TiDslNM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 177025541117673.17861323859802; Wed, 4 Feb 2026 17:36:51 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1221355.1529654 (Exim 4.92) (envelope-from ) id 1vnoI9-0002g9-Ch; Thu, 05 Feb 2026 01:36:21 +0000 Received: by outflank-mailman (output) from mailman id 1221355.1529654; Thu, 05 Feb 2026 01:36:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vnoI9-0002fQ-6G; Thu, 05 Feb 2026 01:36:21 +0000 Received: by outflank-mailman (input) for mailman id 1221355; Thu, 05 Feb 2026 01:36:19 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vnoI7-0002TG-1r for xen-devel@lists.xenproject.org; Thu, 05 Feb 2026 01:36:19 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.96) (envelope-from ) id 1vnoI6-003wR7-3B; Thu, 05 Feb 2026 01:36:18 +0000 Received: from [140.209.201.102] (helo=localhost) by xenbits.xenproject.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vnoI6-00HVXX-1W; Thu, 05 Feb 2026 01:36:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From; bh=BMutOBe+27MwLrOuLnd1uuC/N9cHX1rSjncNYS0rwBk=; b=YfLCsDy85/YQXPUp+nhtR32ejQ sNRH1x0KloisX4lyHEJmPs0Te51ZWTdZWTWd4K7GeNECWxBny/uWMP4+bMudNtgCqPSJGJwuZ4ki6 8YIz55bbVEYQKEssoW8dLT1cAECE4ZzUyYzpn0AGeqgkwgIKtzS8L92YeDloOis1lc0Y=; From: dmukhin@xen.org To: xen-devel@lists.xenproject.org Cc: andrew.cooper3@citrix.com, anthony.perard@vates.tech, jbeulich@suse.com, julien@xen.org, michal.orzel@amd.com, roger.pau@citrix.com, sstabellini@kernel.org, dmukhin@ford.com Subject: [PATCH v5 5/6] xen/console: update conring memory allocation Date: Wed, 4 Feb 2026 17:36:05 -0800 Message-ID: <20260205013606.3384798-6-dmukhin@ford.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260205013606.3384798-1-dmukhin@ford.com> References: <20260205013606.3384798-1-dmukhin@ford.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1770255412296154100 Content-Type: text/plain; charset="utf-8" From: Denis Mukhin =20 conring buffer doesn't need to be aligned to it's size; it just needs to be contiguous. Use xmalloc_bytes() in console_init_preirq() for run-time conring buffer allocation. Warn user when the conring size is being changed behind the user's back during the console initialization. Also, limit the user-selectable conring buffer size to the maximum of 2GB and minimum of _CONRING_SIZE. Suggested-by: Andrew Cooper Signed-off-by: Denis Mukhin --- Changes since v4: - new patch --- xen/drivers/char/console.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 3ad86fd436e2..9394ab2a89eb 100644 --- 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; =20 if ( !opt_conring_size ) return; =20 - order =3D get_order_from_bytes(max(opt_conring_size, conring_size)); - memflags =3D MEMF_bits(crashinfo_maxaddr_bits); - while ( (ring =3D alloc_xenheap_pages(order, memflags)) =3D=3D NULL ) + opt_conring_size =3D max(opt_conring_size, conring_size); + size =3D ROUNDDOWN(opt_conring_size, PAGE_SIZE); + if ( size !=3D opt_conring_size ) { - BUG_ON(order =3D=3D 0); - order--; + opt_conring_size =3D size; + printk(XENLOG_WARNING "Rounding down console ring size to multiple= of %lu KiB.\n", + PAGE_SIZE >> 10); } - opt_conring_size =3D PAGE_SIZE << order; + if ( opt_conring_size >=3D GB(2) ) + { + opt_conring_size =3D GB(2); + printk(XENLOG_WARNING "Limiting user-configured console ring size.= \n"); + } + else if ( opt_conring_size < _CONRING_SIZE ) + { + opt_conring_size =3D _CONRING_SIZE; + printk(XENLOG_WARNING "Using compile-time console ring size.\n"); + } + + /* Contiguous buffer; does not need to be naturally aligned. */ + ring =3D xmalloc_bytes(opt_conring_size); + BUG_ON(ring =3D=3D NULL); =20 nrspin_lock_irqsave(&console_lock, flags); =20 --=20 2.52.0