mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Ian King <colin.i.king@gmail.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH][next] ACPI: OSL: ratelimit ACPICA kernel messages
Date: Thu, 13 Feb 2025 18:16:10 +0000	[thread overview]
Message-ID: <20250213181610.718343-1-colin.i.king@gmail.com> (raw)

In cases where the ACPI AML contains errors there can be quite a large
amount of ACPICA kernel log spamming. Reduce this by rate limiting
the messages.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/acpi/osl.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 5ff343096ece..d4ece68e0fd6 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -159,17 +159,21 @@ void __printf(1, 0) acpi_os_vprintf(const char *fmt, va_list args)
 	if (acpi_in_debugger) {
 		kdb_printf("%s", buffer);
 	} else {
-		if (printk_get_level(buffer))
-			printk("%s", buffer);
-		else
-			printk(KERN_CONT "%s", buffer);
+		if (printk_ratelimit()) {
+			if (printk_get_level(buffer))
+				printk("%s", buffer);
+			else
+				printk(KERN_CONT "%s", buffer);
+		}
 	}
 #else
 	if (acpi_debugger_write_log(buffer) < 0) {
-		if (printk_get_level(buffer))
-			printk("%s", buffer);
-		else
-			printk(KERN_CONT "%s", buffer);
+		if (printk_ratelimit()) {
+			if (printk_get_level(buffer))
+				printk("%s", buffer);
+			else
+				printk(KERN_CONT "%s", buffer);
+		}
 	}
 #endif
 }
-- 
2.47.2


             reply	other threads:[~2025-02-13 18:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13 18:16 Colin Ian King [this message]
2025-02-18 19:13 ` Rafael J. Wysocki
2025-02-18 19:19   ` Colin King (gmail)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250213181610.718343-1-colin.i.king@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®