Skip to contentSkip to conversation

(unknown)

PATCH In review Chen Gong 2 participants 4 messages Dec 15, 2010 – Dec 20, 2010

Subsystems (2)
lore
Share & tools
lore

Chen Gong

author
#0 lore raw

[PATCH] eliminate the usage of printk_ratelimit

It is a simple printk limit patch based on latest acpi-test tree

author
#1 lore raw

PATCH 1/1 eliminate the usage of printk_ratelimit

To avoid messages to be suppressed, use __ratelimit to substitute printk_ratelimit.

---
 drivers/acpi/apei/ghes.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/acpi/apei/ghes.c +3 -1
index 51905d0..29d38ad 100644
@@ -180,13 +180,15 @@ static int ghes_copy_tofrom_phys(void *buffer, u64 paddr, u32 len,
 static int ghes_read_estatus(struct ghes *ghes, int silent)
 {
 	struct acpi_hest_generic *g = ghes->generic;
+	/* Not more than 2 messages every 5 seconds */
+	static DEFINE_RATELIMIT_STATE(ratelimit, 5*HZ, 2);
 	u64 buf_paddr;
 	u32 len;
 	int rc;
 
 	rc = acpi_atomic_read(&buf_paddr, &g->error_status_address);
 	if (rc) {
-		if (!silent && printk_ratelimit())
+		if (!silent && __ratelimit(&ratelimit))
 			pr_warning(FW_WARN GHES_PFX
 "Failed to read error status block address for hardware error source: %d.\n",
 				   g->header.source_id);
Signature · 1 line
1.7.3.1.120.g38a18
reviewer
#2 lore raw

Re: [PATCH] eliminate the usage of printk_ratelimit

Quoted 16 lines · Chen Gong

To avoid messages to be suppressed, use __ratelimit to substitute printk_ratelimit.

---
 drivers/acpi/apei/ghes.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/acpi/apei/ghes.c +0 -0
index 51905d0..29d38ad 100644
@@ -180,13 +180,15 @@ static int ghes_copy_tofrom_phys(void *buffer, u64 paddr, u32 len,
 static int ghes_read_estatus(struct ghes *ghes, int silent)
 {
 	struct acpi_hest_generic *g = ghes->generic;

drivers/acpi/apei/ghes.c static int ghes_copy_tofrom_phys(void *buffer, u64 paddr, u32 len, · line 191

Quoted 10 lines
drivers/acpi/apei/ghes.c +3 -1
+	/* Not more than 2 messages every 5 seconds */
+	static DEFINE_RATELIMIT_STATE(ratelimit, 5*HZ, 2);
 	u64 buf_paddr;
 	u32 len;
 	int rc;
 
 	rc = acpi_atomic_read(&buf_paddr, &g->error_status_address);
 	if (rc) {
-		if (!silent && printk_ratelimit())
+		if (!silent && __ratelimit(&ratelimit))

So you want to change 10 messages/5s into 2 messages/5s?

That isn't a very big change.

Is using ratelimit better than using printk_once()?

-Len

Quoted 5 lines
drivers/acpi/apei/ghes.c +0 -0
 			pr_warning(FW_WARN GHES_PFX
 "Failed to read error status block address for hardware error source: %d.\n",
 				   g->header.source_id);
Signature · 1 line
1.7.3.1.120.g38a18
author
#3 lore raw

Re: [PATCH] eliminate the usage of printk_ratelimit

Quoted 24 lines · Len Brown
Quoted 22 lines · Chen Gong

To avoid messages to be suppressed, use __ratelimit to substitute printk_ratelimit.

---
  drivers/acpi/apei/ghes.c |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)
drivers/acpi/apei/ghes.c +2 -0
index 51905d0..29d38ad 100644
@@ -180,13 +180,15 @@ static int ghes_copy_tofrom_phys(void *buffer, u64 paddr, u32 len,
  static int ghes_read_estatus(struct ghes *ghes, int silent)
  {
  	struct acpi_hest_generic *g = ghes->generic;
+	/* Not more than 2 messages every 5 seconds */
+	static DEFINE_RATELIMIT_STATE(ratelimit, 5*HZ, 2);
  	u64 buf_paddr;
  	u32 len;
  	int rc;
 
Quoted 8 lines

drivers/acpi/apei/ghes.c static int ghes_copy_tofrom_phys(void *buffer, u64 paddr, u32 len, · line 191

Quoted 4 lines
drivers/acpi/apei/ghes.c +1 -1
  	rc = acpi_atomic_read(&buf_paddr,&g->error_status_address);
  	if (rc) {
-		if (!silent&&  printk_ratelimit())
+		if (!silent&&  __ratelimit(&ratelimit))

So you want to change 10 messages/5s into 2 messages/5s?

That isn't a very big change.

No, it is because printk_ratelimit shares ratelimiting state with all other *unrelated* printk_ratelimit() callsites.

Quoted 12 lines

Is using ratelimit better than using printk_once()?

-Len

Quoted 5 lines
drivers/acpi/apei/ghes.c +0 -1
  			pr_warning(FW_WARN GHES_PFX
  "Failed to read error status block address for hardware error source: %d.\n",
  				   g->header.source_id);
--

1.7.3.1.120.g38a18

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html