public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] ACPI: OSL: ratelimit ACPICA kernel messages
@ 2025-02-13 18:16 Colin Ian King
  2025-02-18 19:13 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Ian King @ 2025-02-13 18:16 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown, linux-acpi; +Cc: linux-kernel

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] ACPI: OSL: ratelimit ACPICA kernel messages
  2025-02-13 18:16 [PATCH][next] ACPI: OSL: ratelimit ACPICA kernel messages Colin Ian King
@ 2025-02-18 19:13 ` Rafael J. Wysocki
  2025-02-18 19:19   ` Colin King (gmail)
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2025-02-18 19:13 UTC (permalink / raw)
  To: Colin Ian King, Saket Dumbre; +Cc: Len Brown, linux-acpi, linux-kernel

+Saket Dumbre

On Thu, Feb 13, 2025 at 7:16 PM Colin Ian King <colin.i.king@gmail.com> wrote:
>
> In cases where the ACPI AML contains errors there can be quite a large
> amount of ACPICA kernel log spamming.

Except when someone wants to see them all which also happens.

And wouldn't this also rate limit debug messages from ACPICA
specifically enabled via the kernel command line?

If so, I'd rather find a way to tell ACPICA to be less verbose.

> 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
>  }
> --

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] ACPI: OSL: ratelimit ACPICA kernel messages
  2025-02-18 19:13 ` Rafael J. Wysocki
@ 2025-02-18 19:19   ` Colin King (gmail)
  0 siblings, 0 replies; 3+ messages in thread
From: Colin King (gmail) @ 2025-02-18 19:19 UTC (permalink / raw)
  To: Rafael J. Wysocki, Saket Dumbre; +Cc: Len Brown, linux-acpi, linux-kernel


[-- Attachment #1.1.1: Type: text/plain, Size: 2414 bytes --]

On 18/02/2025 19:13, Rafael J. Wysocki wrote:
> +Saket Dumbre
> 
> On Thu, Feb 13, 2025 at 7:16 PM Colin Ian King <colin.i.king@gmail.com> wrote:
>>
>> In cases where the ACPI AML contains errors there can be quite a large
>> amount of ACPICA kernel log spamming.
> 
> Except when someone wants to see them all which also happens.
> 
> And wouldn't this also rate limit debug messages from ACPICA
> specifically enabled via the kernel command line?
> 
> If so, I'd rather find a way to tell ACPICA to be less verbose.

Yep, makes sense Rafael. The crux of the matter is that there should be 
some way to reduce repeated identical "ACPI BIOS Error" messages, 
especially when the AML is triggering this 10+ times a second :-)

Colin

> 
>> 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
>>   }
>> --


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 4901 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-18 19:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13 18:16 [PATCH][next] ACPI: OSL: ratelimit ACPICA kernel messages Colin Ian King
2025-02-18 19:13 ` Rafael J. Wysocki
2025-02-18 19:19   ` Colin King (gmail)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox