From patchwork Mon Feb 17 19:44:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13978548 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E918EC021AB for ; Mon, 17 Feb 2025 19:44:43 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.890812.1299942 (Exim 4.92) (envelope-from ) id 1tk72c-0005XP-32; Mon, 17 Feb 2025 19:44:30 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 890812.1299942; Mon, 17 Feb 2025 19:44:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tk72b-0005XI-WD; Mon, 17 Feb 2025 19:44:30 +0000 Received: by outflank-mailman (input) for mailman id 890812; Mon, 17 Feb 2025 19:44:28 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tk72a-0005X7-M3 for xen-devel@lists.xenproject.org; Mon, 17 Feb 2025 19:44:28 +0000 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [2a00:1450:4864:20::336]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 985421e8-ed67-11ef-9896-31a8f345e629; Mon, 17 Feb 2025 20:44:26 +0100 (CET) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43962f7b0e4so28820075e9.3 for ; Mon, 17 Feb 2025 11:44:26 -0800 (PST) Received: from andrewcoop.. (host-92-26-98-202.as13285.net. [92.26.98.202]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4395a06d22csm161547025e9.22.2025.02.17.11.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2025 11:44:25 -0800 (PST) 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" X-Inumbo-ID: 985421e8-ed67-11ef-9896-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1739821466; x=1740426266; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9CN5/qCk+SO0dX8OyCK46+nuUpSM22Pu0EYMaFmXRRY=; b=fm1WlqaFl+htvDrjeFEYj7H8MRbVV6KzMtW/PuiVlIBRmwkEUbkIvn8fuIekNpoAvP Fbby+wS4ucAxXPSCtHz1exhPKkvaxaAnlhQ/WBx5MfZPljobKXwTI4lvOpwzy+1+Lyvo 12AwjcJtA0SzJ0OZen+uimGWp1SBZRz0UTVWw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739821466; x=1740426266; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9CN5/qCk+SO0dX8OyCK46+nuUpSM22Pu0EYMaFmXRRY=; b=Gp05G3nRALk+0npin39FrEHmSyMutrU7650LCtCr2O+Cg+crhuTSyV1MT40oGk9zY8 v8MSOqW0jdsuockRK6sEhdBg7Iv+ow1yj/22g37FyHaDtQK6sQLPUos8RnBEsVcNOAu1 6VT4/7+bh2xIDcup3QuAgdm9Gxo5s4abXVLyJIkjb1jjCh1PZ/0UxEXVYG8y0Mwml0t4 czB+TmOPOKuzXQzUo46cOurJx23SaOlyPp5X7LmQwr9jXb10GHhcEzMuF7vMWpoBCaqG WZjMpm7LgAMf4rYriKCIcuK3RekSwLaF8NWS4zTkAejr/thh2Q7lCJy70nyEgsNoITpz /o4A== X-Gm-Message-State: AOJu0YxZfhGu01jaPAIQ+wiUXQrDnh5mieSi3gnJpcv5/VLSJfCGDW55 Gd8S0toD3oA+kGiiTCfjkkSTgM1+RjeFDepYyAOJ8zIUgzfXl/7DMNDiVdxW3yzud7CLuZ6V4jp a X-Gm-Gg: ASbGnctPsVK8/AJKUCn1WbK4uW2Tv3ufdyZjyTcrIgvygxzsNqW93RU+uwys+NjU3sH 7ZCJkEHDxZ/WAbct5ltIqD5hpCDFbHQGjBf6hD/9QNIeJTU65WpetJCVCysq/+BFheO5lqAtqHY of9RVTTNEqBeMLfTR0XAwsLdR5iPe4BYoewC+EPkbg4l1RWmMmuA63jCxJLi0vnxmyHgvoOiCue whGXwYOqUn0PMIB1m1HU0WlvQaUwqp4GajW4qUTE1UYtYwI7+KlZbCmX/ho7QX6cOPpPyO58MTR N+aPcCvExuY/jcComnvIdNPuh3mW0lv7osyligqD1BYzmtkNUC0c X-Google-Smtp-Source: AGHT+IF8HqJOJt9V5Kn9NLXie7ZsAgvaU8cmCgSKkWj6WqzngR/dStu1tFuLNCDZWB5gTZIgLH0tFQ== X-Received: by 2002:a05:600c:5487:b0:439:8a8c:d3d8 with SMTP id 5b1f17b1804b1-4398a8cd568mr31235075e9.29.1739821465597; Mon, 17 Feb 2025 11:44:25 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Ayan Kumar Halder , Oleksii Kurochko Subject: [PATCH for-4.20(?) 1/3] xen/console: Fix truncation of panic() messages Date: Mon, 17 Feb 2025 19:44:19 +0000 Message-Id: <20250217194421.601813-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250217194421.601813-1-andrew.cooper3@citrix.com> References: <20250217194421.601813-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 The panic() function uses a static buffer to format its arguments into, simply to emit the result via printk("%s", buf). This buffer is not large enough for some existing users in Xen. e.g.: (XEN) **************************************** (XEN) Panic on CPU 0: (XEN) Invalid device tree blob at physical address 0x46a00000. (XEN) The DTB must be 8-byte aligned and must not exceed 2 MB in size. (XEN) (XEN) Plea**************************************** The remainder of this particular message is 'e check your bootloader.', but has been inherited by RISC-V from ARM. It is also pointless double buffering. Implement vprintk() beside printk(), and use it directly rather than rendering into a local buffer, removing it as one source of message limitation. This marginally simplifies panic(), and drops a global used-once buffer. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monné CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Ayan Kumar Halder CC: Oleksii Kurochko This taken from a security series (hence partially reviewed already), and thought it only applied to a forthcoming selftest, but then Ayan posted a truncated example to Matrix. Therefore this needs backporting, and might be wanted for 4.20 at this point. It's low risk and easy to test. --- xen/drivers/char/console.c | 21 +++++++++++++-------- xen/include/xen/lib.h | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 7da8c5296f3b..2926c97df9a4 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -962,11 +962,17 @@ static void vprintk_common(const char *prefix, const char *fmt, va_list args) local_irq_restore(flags); } +void vprintk(const char *fmt, va_list args) +{ + vprintk_common("(XEN) ", fmt, args); +} + void printk(const char *fmt, ...) { va_list args; + va_start(args, fmt); - vprintk_common("(XEN) ", fmt, args); + vprintk(fmt, args); va_end(args); } @@ -1268,23 +1274,22 @@ void panic(const char *fmt, ...) va_list args; unsigned long flags; static DEFINE_SPINLOCK(lock); - static char buf[128]; spin_debug_disable(); spinlock_profile_printall('\0'); debugtrace_dump(); - /* Protects buf[] and ensure multi-line message prints atomically. */ + /* Ensure multi-line message prints atomically. */ spin_lock_irqsave(&lock, flags); - va_start(args, fmt); - (void)vsnprintf(buf, sizeof(buf), fmt, args); - va_end(args); - console_start_sync(); printk("\n****************************************\n"); printk("Panic on CPU %d:\n", smp_processor_id()); - printk("%s", buf); + + va_start(args, fmt); + vprintk(fmt, args); + va_end(args); + printk("****************************************\n\n"); if ( opt_noreboot ) printk("Manual reset required ('noreboot' specified)\n"); diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index 81b722ea3e80..130f96791f75 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -60,6 +60,8 @@ debugtrace_printk(const char *fmt, ...) {} extern void printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2), cold)); +void vprintk(const char *fmt, va_list args) + __attribute__ ((format (printf, 1, 0), cold)); #define printk_once(fmt, args...) \ ({ \ From patchwork Mon Feb 17 19:44:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13978549 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70446C021A9 for ; Mon, 17 Feb 2025 19:44:46 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.890816.1299972 (Exim 4.92) (envelope-from ) id 1tk72k-0006Jt-R9; Mon, 17 Feb 2025 19:44:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 890816.1299972; Mon, 17 Feb 2025 19:44:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tk72k-0006Jg-O6; Mon, 17 Feb 2025 19:44:38 +0000 Received: by outflank-mailman (input) for mailman id 890816; Mon, 17 Feb 2025 19:44:37 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tk72j-0005w6-6w for xen-devel@lists.xenproject.org; Mon, 17 Feb 2025 19:44:37 +0000 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [2a00:1450:4864:20::32b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 98c73aec-ed67-11ef-9aa6-95dc52dad729; Mon, 17 Feb 2025 20:44:27 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4394345e4d5so32474485e9.0 for ; Mon, 17 Feb 2025 11:44:27 -0800 (PST) Received: from andrewcoop.. (host-92-26-98-202.as13285.net. [92.26.98.202]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4395a06d22csm161547025e9.22.2025.02.17.11.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2025 11:44:26 -0800 (PST) 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" X-Inumbo-ID: 98c73aec-ed67-11ef-9aa6-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1739821466; x=1740426266; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+nc2CIfoUyhnM2J8lcuiEwHkY+/RuqVIOqDK2tbwB/w=; b=iaV/oMwukuusawAueE+9avEkVHwDzGWzxsdqBiea7mEmhl0o19ynuDPyY4xQP0J/ww /uMXlxwr28q6RnNjZmfkXt/PtqdBbm0oHC1aGLRAEotCetlbzq1uae6YIuiPDi2deovw BL/CTAj2AQqkDY/Nmn6vMl58c29eE7g/kF6LY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739821466; x=1740426266; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+nc2CIfoUyhnM2J8lcuiEwHkY+/RuqVIOqDK2tbwB/w=; b=uDGrm8Ijifp4w78hvL+JwbzCSd9hmjL6PPUKtI16fmUu1WpaOfveVczP96JIuXS5VD FZRLDVLtyvTgM2JHSgJgBuH9hvCesf2zH9b4O93NqN8OPWY/+oV5NCr2ODqGm0WkrYxH yQmo5EtUDc1nJcI/tzlI0coOGeGnH4itBxPj1YdyuuQ1FKN+oSJeO/GeE95HFo0ZgdrK cQonNS6vkEkzBdiu0f3599gAggFwhi1xV04PATIuMtxiMCPcpbv9vZlHC2nH1wmI2lKG oNI5FDo4wLbQa2feJSlFAF/sP88BHIgljDk4AtC/iAIfFxuR3wFofBItjutmjgs170Hk L4/g== X-Gm-Message-State: AOJu0YxLzbLZ90G3UwSKRJgW9QfKaX05NEcKigh351dAlZ2eN4+A2vDe Nn5ams1y23V5SAoe0Ao8i6Dh/v5f+UCuEyS2uGGYkWiYd2IwtILQqiN/suNXTYQplyikSpao/i5 H X-Gm-Gg: ASbGncvY60I7UVhsYUdLjkX4vxUTmukcr3mD725zbMW5kHApZd6PtMswRfManeQYOQR MZHThI7hTkn49thCG3CF5lKNNnUSDf6fpFYPboas9i1gKP5KEuuxSdtSJW2jnvFA3qknkfww3gR sMyEKRiiu9TIjwehkPgEsssFHxP5oT9wOcIbLgsgN0Mnk9dShhH+eIcrIeJGTwC4+GcoSawrTAc +gebR0+WoNm2RIY7SH+mNBJLjlscBVS3E5cLYUeiSnIiitlQ7EINYLosVyCXSXzzN5WaV4VSmjA RjzIwndv2QgDfjEk1cRvGD11jrvPze0CB9PC86t2D1W+Urs5ccet X-Google-Smtp-Source: AGHT+IHPQrS6NoNQOy53+RfSFZIMq6lDhPKeOkmnJeQf8NByg3WieH1WtlLy2WfSZj8tH2r/SBfupw== X-Received: by 2002:a05:600c:3baa:b0:439:9274:8203 with SMTP id 5b1f17b1804b1-439927483d7mr5700375e9.6.1739821466643; Mon, 17 Feb 2025 11:44:26 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Ayan Kumar Halder , Oleksii Kurochko Subject: [PATCH for-4.21 2/3] xen/console: Optimise parameter order of vprintk_common() Date: Mon, 17 Feb 2025 19:44:20 +0000 Message-Id: <20250217194421.601813-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250217194421.601813-1-andrew.cooper3@citrix.com> References: <20250217194421.601813-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 For ABIs which pass parameters by register (all cases that we compile Xen for), inserting new arguments on the left hand side involves shuffling all other parameters along by one register whereas appending a new argument doesn't involve shuffling of existing registers. Reorder vprintk_common()'s prefix parameter to being last. This is a marginal improvement on all architectures: Function old new delta vprintk 18 12 -6 x86 vprintk 32 24 -8 arm32 vprintk 52 48 -4 arm64 vprintk 52 48 -4 riscv64 vprintk 80 72 -8 ppc64 Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monné CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Ayan Kumar Halder CC: Oleksii Kurochko This taken from a security series, hence partially reviewed already. --- xen/drivers/char/console.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 2926c97df9a4..f98142d9b9b9 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -910,7 +910,7 @@ static void printk_start_of_line(const char *prefix) __putstr(tstr); } -static void vprintk_common(const char *prefix, const char *fmt, va_list args) +static void vprintk_common(const char *fmt, va_list args, const char *prefix) { struct vps { bool continued, do_print; @@ -964,7 +964,7 @@ static void vprintk_common(const char *prefix, const char *fmt, va_list args) void vprintk(const char *fmt, va_list args) { - vprintk_common("(XEN) ", fmt, args); + vprintk_common(fmt, args, "(XEN) "); } void printk(const char *fmt, ...) @@ -984,7 +984,7 @@ void guest_printk(const struct domain *d, const char *fmt, ...) snprintf(prefix, sizeof(prefix), "(d%d) ", d->domain_id); va_start(args, fmt); - vprintk_common(prefix, fmt, args); + vprintk_common(fmt, args, prefix); va_end(args); } From patchwork Mon Feb 17 19:44:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 13978546 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19E3CC021AA for ; Mon, 17 Feb 2025 19:44:42 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.890813.1299952 (Exim 4.92) (envelope-from ) id 1tk72d-0005lS-C6; Mon, 17 Feb 2025 19:44:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 890813.1299952; Mon, 17 Feb 2025 19:44:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tk72d-0005lJ-9S; Mon, 17 Feb 2025 19:44:31 +0000 Received: by outflank-mailman (input) for mailman id 890813; Mon, 17 Feb 2025 19:44:29 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tk72b-0005X7-Nx for xen-devel@lists.xenproject.org; Mon, 17 Feb 2025 19:44:29 +0000 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [2a00:1450:4864:20::336]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 994766b6-ed67-11ef-9896-31a8f345e629; Mon, 17 Feb 2025 20:44:28 +0100 (CET) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43937cf2131so31539725e9.2 for ; Mon, 17 Feb 2025 11:44:28 -0800 (PST) Received: from andrewcoop.. (host-92-26-98-202.as13285.net. [92.26.98.202]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4395a06d22csm161547025e9.22.2025.02.17.11.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2025 11:44:27 -0800 (PST) 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" X-Inumbo-ID: 994766b6-ed67-11ef-9896-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1739821467; x=1740426267; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5YzESArRGDEbanW7NDpWp+57rIKx6rZ39D0RVCP0EuY=; b=cwJKryvjPFA1DszRqyUSOE8v0/SHb6sbz3/7ttoogZEfkXhxEpln/+efg3I+Mymzu7 sStIpW2JQA7zn6+ZdLvrb2l0s1rUKcyp37adwcUoakxArqbOng/odO9fPVrcbi5TI2SU KpjZXR2QZ4/rFf53dNoxwHX1Ns4z2EZG4dEPI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739821467; x=1740426267; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5YzESArRGDEbanW7NDpWp+57rIKx6rZ39D0RVCP0EuY=; b=fwIY4Pj5NPdkf2teiCliaa9SGTAc6cdAby/CPb3Y6Yhtb4M/pZnLJ0Q0YUB93cAmXO PciAyvYQeWNE0n8YU7p+EguTaDLHnoHcYouITLdbPJC5R+mQuOrysmtBAES4Rv/qVRe/ BhrY1bzwczcISLS7I2acS6g6LaoEGLWlX0gqxlakHOSoCGM+ybRBC+1pvCs/bTk4rdGK wZRfhdN8Ih/jlon18oCgoBVLcdo5EG5CDUGTDCO/iBe7iehnajeLGWPoxnZmowID8WZv BR4lDPtQ9Hat0ieK9J5QfL5q/gDLp9HNkMC+Fe/1fTthcGpiqQE3CYQqxDwir579ai3s /cww== X-Gm-Message-State: AOJu0Yw+xk/kQuu8bGfQZDXEnybPlOJeeBRs3rhkA5g3oGjPCsGQP2/6 ZfR37SR32QwMDU8TTIWmbBg1xRCJT/lK/xncrrKye+L83bNg1evqn0kZgv4IzTUPyw2/kcXF2rv X X-Gm-Gg: ASbGncvJEMPr+I5Nd8J4V7MeV3apVZxufxt8w+2RXhntZOk4Xxt2E8F/IIBX3bVBL44 KCMfeChPII4FJLcbqLmemwdkT6S7ikdgKduXwsPu5LVYZy19k15xpd5W0k/6Ul5HsQNo1lwdXPR llnGqoWgg1gXEf2ZQn0Ai/4uPDf2Tagx78Bcb8hcrEaQsPj1B6bBGFEIysz0XaRR34ww7aCX5bb bYOX0CTe3cZJHWWe4Zynws/bm02SpoK/T5Iqb3dqb5ed6qmv/pSLtGk6vooeBgBbaqEAbruRhod /1NcwuQoWHem+4JGgi15uC+36ujw8OoHb8C6vKeWAfAqcu/iESsl X-Google-Smtp-Source: AGHT+IE99dFPsW0YkAvMyNqRAy9mwU7uFHCF7uYyOWMGkzmRGb2OORq8+KprPLet8O8BIX+shANhqA== X-Received: by 2002:a05:600c:1c84:b0:439:8c80:6af4 with SMTP id 5b1f17b1804b1-4398c806deemr23873485e9.19.1739821467385; Mon, 17 Feb 2025 11:44:27 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Ayan Kumar Halder , Oleksii Kurochko Subject: [PATCH for-4.21 3/3] xen/ACPI: Drop local acpi_os_{v,}printf() and use plain {v,}printk() Date: Mon, 17 Feb 2025 19:44:21 +0000 Message-Id: <20250217194421.601813-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250217194421.601813-1-andrew.cooper3@citrix.com> References: <20250217194421.601813-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Now that Xen has a real vprintk(), there's no need to opencode it locally with vsnprintf(). Redirect the debug routines to the real {v,}printk() and drop the local acpi_os_{v,}printf() implementations. Amongst other things, this removes one arbitrary limit on message size, as well as removing a 512 byte static buffer that ought to have been in __initdata given that is private to an __init function. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monné CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Ayan Kumar Halder CC: Oleksii Kurochko --- xen/drivers/acpi/osl.c | 17 ----------------- xen/include/acpi/acpiosxf.h | 5 ++--- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index ab80d6b2a92a..7f233bab4269 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -45,23 +45,6 @@ ACPI_MODULE_NAME("osl") #include CONFIG_ACPI_CUSTOM_DSDT_FILE #endif -void __init acpi_os_printf(const char *fmt, ...) -{ - va_list args; - va_start(args, fmt); - acpi_os_vprintf(fmt, args); - va_end(args); -} - -void __init acpi_os_vprintf(const char *fmt, va_list args) -{ - static char buffer[512]; - - vsnprintf(buffer, sizeof(buffer), fmt, args); - - printk("%s", buffer); -} - acpi_physical_address __initdata rsdp_hint; acpi_physical_address __init acpi_os_get_root_pointer(void) diff --git a/xen/include/acpi/acpiosxf.h b/xen/include/acpi/acpiosxf.h index de83ea38c40f..2da318962f0d 100644 --- a/xen/include/acpi/acpiosxf.h +++ b/xen/include/acpi/acpiosxf.h @@ -82,8 +82,7 @@ acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width); /* * Debug print routines */ -void ACPI_INTERNAL_VAR_XFACE acpi_os_printf(const char *format, ...); - -void acpi_os_vprintf(const char *format, va_list args); +#define acpi_os_printf printk +#define acpi_os_vprintf vprintk #endif /* __ACPIOSXF_H__ */