* (unknown),
@ 2010-12-15 10:18 Chen Gong
2010-12-15 10:18 ` [PATCH] eliminate the usage of printk_ratelimit Chen Gong
0 siblings, 1 reply; 4+ messages in thread
From: Chen Gong @ 2010-12-15 10:18 UTC (permalink / raw)
To: linux-acpi
[PATCH] eliminate the usage of printk_ratelimit
It is a simple printk limit patch based on latest acpi-test tree
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] eliminate the usage of printk_ratelimit
2010-12-15 10:18 (unknown), Chen Gong
@ 2010-12-15 10:18 ` Chen Gong
2010-12-17 6:27 ` Len Brown
0 siblings, 1 reply; 4+ messages in thread
From: Chen Gong @ 2010-12-15 10:18 UTC (permalink / raw)
To: linux-acpi; +Cc: Chen Gong
To avoid messages to be suppressed, use __ratelimit to
substitute printk_ratelimit.
Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
---
drivers/acpi/apei/ghes.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 51905d0..29d38ad 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -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);
--
1.7.3.1.120.g38a18
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] eliminate the usage of printk_ratelimit
2010-12-15 10:18 ` [PATCH] eliminate the usage of printk_ratelimit Chen Gong
@ 2010-12-17 6:27 ` Len Brown
2010-12-20 1:38 ` Chen Gong
0 siblings, 1 reply; 4+ messages in thread
From: Len Brown @ 2010-12-17 6:27 UTC (permalink / raw)
To: Chen Gong; +Cc: linux-acpi
On Wed, 15 Dec 2010, Chen Gong wrote:
> To avoid messages to be suppressed, use __ratelimit to
> substitute printk_ratelimit.
>
> Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
> ---
> drivers/acpi/apei/ghes.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index 51905d0..29d38ad 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -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))
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
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] eliminate the usage of printk_ratelimit
2010-12-17 6:27 ` Len Brown
@ 2010-12-20 1:38 ` Chen Gong
0 siblings, 0 replies; 4+ messages in thread
From: Chen Gong @ 2010-12-20 1:38 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi
于 12/17/2010 2:27 PM, Len Brown 写道:
> On Wed, 15 Dec 2010, Chen Gong wrote:
>
>> To avoid messages to be suppressed, use __ratelimit to
>> substitute printk_ratelimit.
>>
>> Signed-off-by: Chen Gong<gong.chen@linux.intel.com>
>> ---
>> drivers/acpi/apei/ghes.c | 4 +++-
>> 1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
>> index 51905d0..29d38ad 100644
>> --- a/drivers/acpi/apei/ghes.c
>> +++ b/drivers/acpi/apei/ghes.c
>> @@ -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))
>
> 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.
>
> Is using ratelimit better than using printk_once()?
>
> -Len
>
>> 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-12-20 1:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-15 10:18 (unknown), Chen Gong
2010-12-15 10:18 ` [PATCH] eliminate the usage of printk_ratelimit Chen Gong
2010-12-17 6:27 ` Len Brown
2010-12-20 1:38 ` Chen Gong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).