* [PATCH 1/8] powerpc/rtas-rtc: remove sideeffects of printk_ratelimit
[not found] <cover.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
@ 2011-06-04 15:35 ` Christian Dietrich
2011-06-04 15:35 ` [PATCH 2/8] drivers/octeon: use printk_ratelimited instead " Christian Dietrich
` (6 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Christian Dietrich @ 2011-06-04 15:35 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
linux-kernel, trivial
Don't use printk_ratelimit() as an additional condition for returning
on an error. Because when the ratelimit is reached, printk_ratelimit
will return 0 and e.g. in rtas_get_boot_time won't check for an error
condition.
Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
---
arch/powerpc/kernel/rtas-rtc.c | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/kernel/rtas-rtc.c b/arch/powerpc/kernel/rtas-rtc.c
index 77578c0..c57c193 100644
--- a/arch/powerpc/kernel/rtas-rtc.c
+++ b/arch/powerpc/kernel/rtas-rtc.c
@@ -4,6 +4,7 @@
#include <linux/init.h>
#include <linux/rtc.h>
#include <linux/delay.h>
+#include <linux/ratelimit.h>
#include <asm/prom.h>
#include <asm/rtas.h>
#include <asm/time.h>
@@ -29,9 +30,10 @@ unsigned long __init rtas_get_boot_time(void)
}
} while (wait_time && (get_tb() < max_wait_tb));
- if (error != 0 && printk_ratelimit()) {
- printk(KERN_WARNING "error: reading the clock failed (%d)\n",
- error);
+ if (error != 0) {
+ printk_ratelimited(KERN_WARNING
+ "error: reading the clock failed (%d)\n",
+ error);
return 0;
}
@@ -55,19 +57,21 @@ void rtas_get_rtc_time(struct rtc_time *rtc_tm)
wait_time = rtas_busy_delay_time(error);
if (wait_time) {
- if (in_interrupt() && printk_ratelimit()) {
+ if (in_interrupt()) {
memset(rtc_tm, 0, sizeof(struct rtc_time));
- printk(KERN_WARNING "error: reading clock"
- " would delay interrupt\n");
+ printk_ratelimited(KERN_WARNING
+ "error: reading clock "
+ "would delay interrupt\n");
return; /* delay not allowed */
}
msleep(wait_time);
}
} while (wait_time && (get_tb() < max_wait_tb));
- if (error != 0 && printk_ratelimit()) {
- printk(KERN_WARNING "error: reading the clock failed (%d)\n",
- error);
+ if (error != 0) {
+ printk_ratelimited(KERN_WARNING
+ "error: reading the clock failed (%d)\n",
+ error);
return;
}
@@ -99,9 +103,10 @@ int rtas_set_rtc_time(struct rtc_time *tm)
}
} while (wait_time && (get_tb() < max_wait_tb));
- if (error != 0 && printk_ratelimit())
- printk(KERN_WARNING "error: setting the clock failed (%d)\n",
- error);
+ if (error != 0)
+ printk_ratelimited(KERN_WARNING
+ "error: setting the clock failed (%d)\n",
+ error);
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/8] drivers/octeon: use printk_ratelimited instead of printk_ratelimit
[not found] <cover.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
2011-06-04 15:35 ` [PATCH 1/8] powerpc/rtas-rtc: remove sideeffects of printk_ratelimit Christian Dietrich
@ 2011-06-04 15:35 ` Christian Dietrich
2011-06-04 15:36 ` [PATCH 3/8] scsi/sg: " Christian Dietrich
` (5 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Christian Dietrich @ 2011-06-04 15:35 UTC (permalink / raw)
To: Greg Kroah-Hartman, David S. Miller, Richard Cochran,
MichaÅ MirosÅaw, Lucas De Marchi, devel,
linux-kernel, trivial
As per printk_ratelimit comment, it should not be used
Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
---
drivers/staging/octeon/ethernet-mdio.c | 27 +++++++++++++------------
drivers/staging/octeon/ethernet-rgmii.c | 33 ++++++++++++++++---------------
drivers/staging/octeon/ethernet-rx.c | 24 ++++++++++++----------
drivers/staging/octeon/ethernet-sgmii.c | 14 +++++++-----
drivers/staging/octeon/ethernet-tx.c | 11 +++++----
drivers/staging/octeon/ethernet-util.h | 4 ---
drivers/staging/octeon/ethernet-xaui.c | 22 +++++++++++---------
7 files changed, 70 insertions(+), 65 deletions(-)
diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index 8a11ffc..f18e3e1 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -27,6 +27,7 @@
#include <linux/kernel.h>
#include <linux/ethtool.h>
#include <linux/phy.h>
+#include <linux/ratelimit.h>
#include <net/dst.h>
@@ -129,22 +130,22 @@ static void cvm_oct_adjust_link(struct net_device *dev)
if (priv->last_link) {
netif_carrier_on(dev);
if (priv->queue != -1)
- DEBUGPRINT("%s: %u Mbps %s duplex, "
- "port %2d, queue %2d\n",
- dev->name, priv->phydev->speed,
- priv->phydev->duplex ?
- "Full" : "Half",
- priv->port, priv->queue);
+ printk_ratelimited("%s: %u Mbps %s duplex, "
+ "port %2d, queue %2d\n",
+ dev->name, priv->phydev->speed,
+ priv->phydev->duplex ?
+ "Full" : "Half",
+ priv->port, priv->queue);
else
- DEBUGPRINT("%s: %u Mbps %s duplex, "
- "port %2d, POW\n",
- dev->name, priv->phydev->speed,
- priv->phydev->duplex ?
- "Full" : "Half",
- priv->port);
+ printk_ratelimited("%s: %u Mbps %s duplex, "
+ "port %2d, POW\n",
+ dev->name, priv->phydev->speed,
+ priv->phydev->duplex ?
+ "Full" : "Half",
+ priv->port);
} else {
netif_carrier_off(dev);
- DEBUGPRINT("%s: Link down\n", dev->name);
+ printk_ratelimited("%s: Link down\n", dev->name);
}
}
}
diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c
index a0d4d4b..9c0d293 100644
--- a/drivers/staging/octeon/ethernet-rgmii.c
+++ b/drivers/staging/octeon/ethernet-rgmii.c
@@ -27,6 +27,7 @@
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
+#include <linux/ratelimit.h>
#include <net/dst.h>
#include <asm/octeon/octeon.h>
@@ -116,9 +117,9 @@ static void cvm_oct_rgmii_poll(struct net_device *dev)
cvmx_write_csr(CVMX_GMXX_RXX_INT_REG
(index, interface),
gmxx_rxx_int_reg.u64);
- DEBUGPRINT("%s: Using 10Mbps with software "
- "preamble removal\n",
- dev->name);
+ printk_ratelimited("%s: Using 10Mbps with software "
+ "preamble removal\n",
+ dev->name);
}
}
@@ -174,23 +175,23 @@ static void cvm_oct_rgmii_poll(struct net_device *dev)
if (!netif_carrier_ok(dev))
netif_carrier_on(dev);
if (priv->queue != -1)
- DEBUGPRINT("%s: %u Mbps %s duplex, "
- "port %2d, queue %2d\n",
- dev->name, link_info.s.speed,
- (link_info.s.full_duplex) ?
- "Full" : "Half",
- priv->port, priv->queue);
+ printk_ratelimited("%s: %u Mbps %s duplex, "
+ "port %2d, queue %2d\n",
+ dev->name, link_info.s.speed,
+ (link_info.s.full_duplex) ?
+ "Full" : "Half",
+ priv->port, priv->queue);
else
- DEBUGPRINT("%s: %u Mbps %s duplex, "
- "port %2d, POW\n",
- dev->name, link_info.s.speed,
- (link_info.s.full_duplex) ?
- "Full" : "Half",
- priv->port);
+ printk_ratelimited("%s: %u Mbps %s duplex, "
+ "port %2d, POW\n",
+ dev->name, link_info.s.speed,
+ (link_info.s.full_duplex) ?
+ "Full" : "Half",
+ priv->port);
} else {
if (netif_carrier_ok(dev))
netif_carrier_off(dev);
- DEBUGPRINT("%s: Link down\n", dev->name);
+ printk_ratelimited("%s: Link down\n", dev->name);
}
}
}
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
index cb38f9e..0f22f0f 100644
--- a/drivers/staging/octeon/ethernet-rx.c
+++ b/drivers/staging/octeon/ethernet-rx.c
@@ -34,6 +34,7 @@
#include <linux/ip.h>
#include <linux/string.h>
#include <linux/prefetch.h>
+#include <linux/ratelimit.h>
#include <linux/smp.h>
#include <net/dst.h>
#ifdef CONFIG_XFRM
@@ -186,13 +187,13 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
if (*ptr == 0xd5) {
/*
- DEBUGPRINT("Port %d received 0xd5 preamble\n", work->ipprt);
+ printk_ratelimited("Port %d received 0xd5 preamble\n", work->ipprt);
*/
work->packet_ptr.s.addr += i + 1;
work->len -= i + 5;
} else if ((*ptr & 0xf) == 0xd) {
/*
- DEBUGPRINT("Port %d received 0x?d preamble\n", work->ipprt);
+ printk_ratelimited("Port %d received 0x?d preamble\n", work->ipprt);
*/
work->packet_ptr.s.addr += i;
work->len -= i + 4;
@@ -203,9 +204,9 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
ptr++;
}
} else {
- DEBUGPRINT("Port %d unknown preamble, packet "
- "dropped\n",
- work->ipprt);
+ printk_ratelimited("Port %d unknown preamble, packet "
+ "dropped\n",
+ work->ipprt);
/*
cvmx_helper_dump_packet(work);
*/
@@ -214,8 +215,8 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
}
}
} else {
- DEBUGPRINT("Port %d receive error code %d, packet dropped\n",
- work->ipprt, work->word2.snoip.err_code);
+ printk_ratelimited("Port %d receive error code %d, packet dropped\n",
+ work->ipprt, work->word2.snoip.err_code);
cvm_oct_free_work(work);
return 1;
}
@@ -334,8 +335,9 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
*/
skb = dev_alloc_skb(work->len);
if (!skb) {
- DEBUGPRINT("Port %d failed to allocate skbuff, packet dropped\n",
- work->ipprt);
+ printk_ratelimited("Port %d failed to allocate "
+ "skbuff, packet dropped\n",
+ work->ipprt);
cvm_oct_free_work(work);
continue;
}
@@ -429,7 +431,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
} else {
/* Drop any packet received for a device that isn't up */
/*
- DEBUGPRINT("%s: Device not up, packet dropped\n",
+ printk_ratelimited("%s: Device not up, packet dropped\n",
dev->name);
*/
#ifdef CONFIG_64BIT
@@ -444,7 +446,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
* Drop any packet received for a device that
* doesn't exist.
*/
- DEBUGPRINT("Port %d not controlled by Linux, packet dropped\n",
+ printk_ratelimited("Port %d not controlled by Linux, packet dropped\n",
work->ipprt);
dev_kfree_skb_irq(skb);
}
diff --git a/drivers/staging/octeon/ethernet-sgmii.c b/drivers/staging/octeon/ethernet-sgmii.c
index 2d8589e..5e148b5 100644
--- a/drivers/staging/octeon/ethernet-sgmii.c
+++ b/drivers/staging/octeon/ethernet-sgmii.c
@@ -26,6 +26,7 @@
**********************************************************************/
#include <linux/kernel.h>
#include <linux/netdevice.h>
+#include <linux/ratelimit.h>
#include <net/dst.h>
#include <asm/octeon/octeon.h>
@@ -90,20 +91,21 @@ static void cvm_oct_sgmii_poll(struct net_device *dev)
if (!netif_carrier_ok(dev))
netif_carrier_on(dev);
if (priv->queue != -1)
- DEBUGPRINT
+ printk_ratelimited
("%s: %u Mbps %s duplex, port %2d, queue %2d\n",
dev->name, link_info.s.speed,
(link_info.s.full_duplex) ? "Full" : "Half",
priv->port, priv->queue);
else
- DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, POW\n",
- dev->name, link_info.s.speed,
- (link_info.s.full_duplex) ? "Full" : "Half",
- priv->port);
+ printk_ratelimited
+ ("%s: %u Mbps %s duplex, port %2d, POW\n",
+ dev->name, link_info.s.speed,
+ (link_info.s.full_duplex) ? "Full" : "Half",
+ priv->port);
} else {
if (netif_carrier_ok(dev))
netif_carrier_off(dev);
- DEBUGPRINT("%s: Link down\n", dev->name);
+ printk_ratelimited("%s: Link down\n", dev->name);
}
}
diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
index afc2b73..6227571 100644
--- a/drivers/staging/octeon/ethernet-tx.c
+++ b/drivers/staging/octeon/ethernet-tx.c
@@ -30,6 +30,7 @@
#include <linux/init.h>
#include <linux/etherdevice.h>
#include <linux/ip.h>
+#include <linux/ratelimit.h>
#include <linux/string.h>
#include <net/dst.h>
#ifdef CONFIG_XFRM
@@ -446,7 +447,7 @@ dont_put_skbuff_in_hw:
priv->queue + qos,
pko_command, hw_buffer,
CVMX_PKO_LOCK_NONE))) {
- DEBUGPRINT("%s: Failed to send the packet\n", dev->name);
+ printk_ratelimited("%s: Failed to send the packet\n", dev->name);
queue_type = QUEUE_DROP;
}
skip_xmit:
@@ -525,8 +526,8 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
/* Get a work queue entry */
cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
if (unlikely(work == NULL)) {
- DEBUGPRINT("%s: Failed to allocate a work queue entry\n",
- dev->name);
+ printk_ratelimited("%s: Failed to allocate a work "
+ "queue entry\n", dev->name);
priv->stats.tx_dropped++;
dev_kfree_skb(skb);
return 0;
@@ -535,8 +536,8 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
/* Get a packet buffer */
packet_buffer = cvmx_fpa_alloc(CVMX_FPA_PACKET_POOL);
if (unlikely(packet_buffer == NULL)) {
- DEBUGPRINT("%s: Failed to allocate a packet buffer\n",
- dev->name);
+ printk_ratelimited("%s: Failed to allocate a packet buffer\n",
+ dev->name);
cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1));
priv->stats.tx_dropped++;
dev_kfree_skb(skb);
diff --git a/drivers/staging/octeon/ethernet-util.h b/drivers/staging/octeon/ethernet-util.h
index c745a72..144fb99 100644
--- a/drivers/staging/octeon/ethernet-util.h
+++ b/drivers/staging/octeon/ethernet-util.h
@@ -25,10 +25,6 @@
* Contact Cavium Networks for more information
*********************************************************************/
-#define DEBUGPRINT(format, ...) do { if (printk_ratelimit()) \
- printk(format, ##__VA_ARGS__); \
- } while (0)
-
/**
* cvm_oct_get_buffer_ptr - convert packet data address to pointer
* @packet_ptr: Packet data hardware address
diff --git a/drivers/staging/octeon/ethernet-xaui.c b/drivers/staging/octeon/ethernet-xaui.c
index 3fca1cc..861a4b3 100644
--- a/drivers/staging/octeon/ethernet-xaui.c
+++ b/drivers/staging/octeon/ethernet-xaui.c
@@ -26,6 +26,7 @@
**********************************************************************/
#include <linux/kernel.h>
#include <linux/netdevice.h>
+#include <linux/ratelimit.h>
#include <net/dst.h>
#include <asm/octeon/octeon.h>
@@ -89,20 +90,21 @@ static void cvm_oct_xaui_poll(struct net_device *dev)
if (!netif_carrier_ok(dev))
netif_carrier_on(dev);
if (priv->queue != -1)
- DEBUGPRINT
- ("%s: %u Mbps %s duplex, port %2d, queue %2d\n",
- dev->name, link_info.s.speed,
- (link_info.s.full_duplex) ? "Full" : "Half",
- priv->port, priv->queue);
+ printk_ratelimited
+ ("%s: %u Mbps %s duplex, port %2d, queue %2d\n",
+ dev->name, link_info.s.speed,
+ (link_info.s.full_duplex) ? "Full" : "Half",
+ priv->port, priv->queue);
else
- DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, POW\n",
- dev->name, link_info.s.speed,
- (link_info.s.full_duplex) ? "Full" : "Half",
- priv->port);
+ printk_ratelimited
+ ("%s: %u Mbps %s duplex, port %2d, POW\n",
+ dev->name, link_info.s.speed,
+ (link_info.s.full_duplex) ? "Full" : "Half",
+ priv->port);
} else {
if (netif_carrier_ok(dev))
netif_carrier_off(dev);
- DEBUGPRINT("%s: Link down\n", dev->name);
+ printk_ratelimited("%s: Link down\n", dev->name);
}
}
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/8] scsi/sg: use printk_ratelimited instead of printk_ratelimit
[not found] <cover.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
2011-06-04 15:35 ` [PATCH 1/8] powerpc/rtas-rtc: remove sideeffects of printk_ratelimit Christian Dietrich
2011-06-04 15:35 ` [PATCH 2/8] drivers/octeon: use printk_ratelimited instead " Christian Dietrich
@ 2011-06-04 15:36 ` Christian Dietrich
2011-06-04 15:36 ` [PATCH 4/8] md/raid: " Christian Dietrich
` (4 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Christian Dietrich @ 2011-06-04 15:36 UTC (permalink / raw)
To: Doug Gilbert, James E.J. Bottomley, linux-scsi, linux-kernel, trivial
Since printk_ratelimit() shouldn't be used anymore (see comment in
include/linux/printk.h), replace it with printk_ratelimited.
Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
---
drivers/scsi/sg.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 909ed9e..441a1c5 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -50,6 +50,7 @@ static int sg_version_num = 30534; /* 2 digits for each component */
#include <linux/delay.h>
#include <linux/blktrace_api.h>
#include <linux/mutex.h>
+#include <linux/ratelimit.h>
#include "scsi.h"
#include <scsi/scsi_dbg.h>
@@ -626,14 +627,15 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
*/
if (hp->dxfer_direction == SG_DXFER_TO_FROM_DEV) {
static char cmd[TASK_COMM_LEN];
- if (strcmp(current->comm, cmd) && printk_ratelimit()) {
- printk(KERN_WARNING
- "sg_write: data in/out %d/%d bytes for SCSI command 0x%x--"
- "guessing data in;\n "
- "program %s not setting count and/or reply_len properly\n",
- old_hdr.reply_len - (int)SZ_SG_HEADER,
- input_size, (unsigned int) cmnd[0],
- current->comm);
+ if (strcmp(current->comm, cmd)) {
+ printk_ratelimited(KERN_WARNING
+ "sg_write: data in/out %d/%d bytes "
+ "for SCSI command 0x%x-- guessing "
+ "data in;\n program %s not setting "
+ "count and/or reply_len properly\n",
+ old_hdr.reply_len - (int)SZ_SG_HEADER,
+ input_size, (unsigned int) cmnd[0],
+ current->comm);
strcpy(cmd, current->comm);
}
}
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/8] md/raid: use printk_ratelimited instead of printk_ratelimit
[not found] <cover.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
` (2 preceding siblings ...)
2011-06-04 15:36 ` [PATCH 3/8] scsi/sg: " Christian Dietrich
@ 2011-06-04 15:36 ` Christian Dietrich
2011-06-28 6:45 ` NeilBrown
2011-06-04 15:36 ` [PATCH 5/8] drivers/char/rtc: " Christian Dietrich
` (3 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Christian Dietrich @ 2011-06-04 15:36 UTC (permalink / raw)
To: Neil Brown, linux-raid, linux-kernel, trivial
As per printk_ratelimit comment, it should not be used.
Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
---
drivers/md/raid1.c | 22 ++++++++++++----------
drivers/md/raid10.c | 22 ++++++++++++----------
drivers/md/raid5.c | 39 +++++++++++++++++++--------------------
3 files changed, 43 insertions(+), 40 deletions(-)
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 5d09609..30af10e 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -35,6 +35,7 @@
#include <linux/delay.h>
#include <linux/blkdev.h>
#include <linux/seq_file.h>
+#include <linux/ratelimit.h>
#include "md.h"
#include "raid1.h"
#include "bitmap.h"
@@ -287,10 +288,11 @@ static void raid1_end_read_request(struct bio *bio, int error)
* oops, read error:
*/
char b[BDEVNAME_SIZE];
- if (printk_ratelimit())
- printk(KERN_ERR "md/raid1:%s: %s: rescheduling sector %llu\n",
- mdname(conf->mddev),
- bdevname(conf->mirrors[mirror].rdev->bdev,b), (unsigned long long)r1_bio->sector);
+ printk_ratelimited(KERN_ERR "md/raid1:%s: %s: "
+ "rescheduling sector %llu\n",
+ mdname(conf->mddev),
+ bdevname(conf->mirrors[mirror].rdev->bdev, b),
+ (unsigned long long)r1_bio->sector);
reschedule_retry(r1_bio);
}
@@ -1574,12 +1576,12 @@ static void raid1d(mddev_t *mddev)
GFP_NOIO, mddev);
r1_bio->bios[r1_bio->read_disk] = bio;
rdev = conf->mirrors[disk].rdev;
- if (printk_ratelimit())
- printk(KERN_ERR "md/raid1:%s: redirecting sector %llu to"
- " other mirror: %s\n",
- mdname(mddev),
- (unsigned long long)r1_bio->sector,
- bdevname(rdev->bdev,b));
+ printk_ratelimited(KERN_ERR
+ "md/raid1:%s: redirecting sector %llu to"
+ " other mirror: %s\n",
+ mdname(mddev),
+ (unsigned long long)r1_bio->sector,
+ bdevname(rdev->bdev, b));
bio->bi_sector = r1_bio->sector + rdev->data_offset;
bio->bi_bdev = rdev->bdev;
bio->bi_end_io = raid1_end_read_request;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 6e84668..e80475a 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -22,6 +22,7 @@
#include <linux/delay.h>
#include <linux/blkdev.h>
#include <linux/seq_file.h>
+#include <linux/ratelimit.h>
#include "md.h"
#include "raid10.h"
#include "raid0.h"
@@ -277,10 +278,11 @@ static void raid10_end_read_request(struct bio *bio, int error)
* oops, read error - keep the refcount on the rdev
*/
char b[BDEVNAME_SIZE];
- if (printk_ratelimit())
- printk(KERN_ERR "md/raid10:%s: %s: rescheduling sector %llu\n",
- mdname(conf->mddev),
- bdevname(conf->mirrors[dev].rdev->bdev,b), (unsigned long long)r10_bio->sector);
+ printk_ratelimited(KERN_ERR
+ "md/raid10:%s: %s: rescheduling sector %llu\n",
+ mdname(conf->mddev),
+ bdevname(conf->mirrors[dev].rdev->bdev, b),
+ (unsigned long long)r10_bio->sector);
reschedule_retry(r10_bio);
}
}
@@ -1667,12 +1669,12 @@ static void raid10d(mddev_t *mddev)
bio_put(bio);
slot = r10_bio->read_slot;
rdev = conf->mirrors[mirror].rdev;
- if (printk_ratelimit())
- printk(KERN_ERR "md/raid10:%s: %s: redirecting sector %llu to"
- " another mirror\n",
- mdname(mddev),
- bdevname(rdev->bdev,b),
- (unsigned long long)r10_bio->sector);
+ printk_ratelimited(KERN_ERR
+ "md/raid10:%s: %s: redirecting"
+ "sector %llu to another mirror\n",
+ mdname(mddev),
+ bdevname(rdev->bdev, b),
+ (unsigned long long)r10_bio->sector);
bio = bio_clone_mddev(r10_bio->master_bio,
GFP_NOIO, mddev);
r10_bio->devs[slot].bio = bio;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 346e69b..8927c26 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -51,6 +51,7 @@
#include <linux/seq_file.h>
#include <linux/cpu.h>
#include <linux/slab.h>
+#include <linux/ratelimit.h>
#include "md.h"
#include "raid5.h"
#include "raid0.h"
@@ -96,8 +97,6 @@
#define __inline__
#endif
-#define printk_rl(args...) ((void) (printk_ratelimit() && printk(args)))
-
/*
* We maintain a biased count of active stripes in the bottom 16 bits of
* bi_phys_segments, and a count of processed stripes in the upper 16 bits
@@ -1587,12 +1586,12 @@ static void raid5_end_read_request(struct bio * bi, int error)
set_bit(R5_UPTODATE, &sh->dev[i].flags);
if (test_bit(R5_ReadError, &sh->dev[i].flags)) {
rdev = conf->disks[i].rdev;
- printk_rl(KERN_INFO "md/raid:%s: read error corrected"
- " (%lu sectors at %llu on %s)\n",
- mdname(conf->mddev), STRIPE_SECTORS,
- (unsigned long long)(sh->sector
- + rdev->data_offset),
- bdevname(rdev->bdev, b));
+ printk_ratelimited(KERN_INFO "md/raid:%s: read error corrected"
+ " (%lu sectors at %llu on %s)\n",
+ mdname(conf->mddev), STRIPE_SECTORS,
+ (unsigned long long)(sh->sector
+ + rdev->data_offset),
+ bdevname(rdev->bdev, b));
clear_bit(R5_ReadError, &sh->dev[i].flags);
clear_bit(R5_ReWrite, &sh->dev[i].flags);
}
@@ -1606,21 +1605,21 @@ static void raid5_end_read_request(struct bio * bi, int error)
clear_bit(R5_UPTODATE, &sh->dev[i].flags);
atomic_inc(&rdev->read_errors);
if (conf->mddev->degraded >= conf->max_degraded)
- printk_rl(KERN_WARNING
- "md/raid:%s: read error not correctable "
- "(sector %llu on %s).\n",
- mdname(conf->mddev),
- (unsigned long long)(sh->sector
- + rdev->data_offset),
+ printk_ratelimited(KERN_WARNING
+ "md/raid:%s: read error not correctable "
+ "(sector %llu on %s).\n",
+ mdname(conf->mddev),
+ (unsigned long long)(sh->sector
+ + rdev->data_offset),
bdn);
else if (test_bit(R5_ReWrite, &sh->dev[i].flags))
/* Oh, no!!! */
- printk_rl(KERN_WARNING
- "md/raid:%s: read error NOT corrected!! "
- "(sector %llu on %s).\n",
- mdname(conf->mddev),
- (unsigned long long)(sh->sector
- + rdev->data_offset),
+ printk_ratelimited(KERN_WARNING
+ "md/raid:%s: read error NOT corrected!! "
+ "(sector %llu on %s).\n",
+ mdname(conf->mddev),
+ (unsigned long long)(sh->sector
+ + rdev->data_offset),
bdn);
else if (atomic_read(&rdev->read_errors)
> conf->max_nr_stripes)
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/8] drivers/char/rtc: use printk_ratelimited instead of printk_ratelimit
[not found] <cover.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
` (3 preceding siblings ...)
2011-06-04 15:36 ` [PATCH 4/8] md/raid: " Christian Dietrich
@ 2011-06-04 15:36 ` Christian Dietrich
2011-06-04 15:36 ` [PATCH 6/8] drivers/gpu/drm: " Christian Dietrich
` (2 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Christian Dietrich @ 2011-06-04 15:36 UTC (permalink / raw)
To: David S. Miller, Grant Likely, linux-kernel, trivial
Since printk_ratelimit() shouldn't be used anymore (see comment in
include/linux/printk.h), replace it with printk_ratelimited.
Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
---
drivers/char/rtc.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index dfa8b30..ccd124a 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -80,6 +80,7 @@
#include <linux/bcd.h>
#include <linux/delay.h>
#include <linux/uaccess.h>
+#include <linux/ratelimit.h>
#include <asm/current.h>
#include <asm/system.h>
@@ -1195,10 +1196,8 @@ static void rtc_dropped_irq(unsigned long data)
spin_unlock_irq(&rtc_lock);
- if (printk_ratelimit()) {
- printk(KERN_WARNING "rtc: lost some interrupts at %ldHz.\n",
- freq);
- }
+ printk_ratelimited(KERN_WARNING "rtc: lost some interrupts at %ldHz.\n",
+ freq);
/* Now we have new data */
wake_up_interruptible(&rtc_wait);
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/8] drivers/gpu/drm: use printk_ratelimited instead of printk_ratelimit
[not found] <cover.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
` (4 preceding siblings ...)
2011-06-04 15:36 ` [PATCH 5/8] drivers/char/rtc: " Christian Dietrich
@ 2011-06-04 15:36 ` Christian Dietrich
2011-06-04 15:36 ` [PATCH 7/8] arch/powerpc: " Christian Dietrich
2011-06-04 15:37 ` [PATCH 8/8] arch/x86: " Christian Dietrich
7 siblings, 0 replies; 13+ messages in thread
From: Christian Dietrich @ 2011-06-04 15:36 UTC (permalink / raw)
To: David Airlie, dri-devel, linux-kernel, trivial
Since printk_ratelimit() shouldn't be used anymore (see comment in
include/linux/printk.h), replace it with printk_ratelimited.
Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
---
drivers/gpu/drm/drm_ioc32.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
index d61d185..4a058c7 100644
--- a/drivers/gpu/drm/drm_ioc32.c
+++ b/drivers/gpu/drm/drm_ioc32.c
@@ -28,6 +28,7 @@
* IN THE SOFTWARE.
*/
#include <linux/compat.h>
+#include <linux/ratelimit.h>
#include "drmP.h"
#include "drm_core.h"
@@ -253,10 +254,10 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
return -EFAULT;
m32.handle = (unsigned long)handle;
- if (m32.handle != (unsigned long)handle && printk_ratelimit())
- printk(KERN_ERR "compat_drm_addmap truncated handle"
- " %p for type %d offset %x\n",
- handle, m32.type, m32.offset);
+ if (m32.handle != (unsigned long)handle)
+ printk_ratelimited(KERN_ERR "compat_drm_addmap truncated handle"
+ " %p for type %d offset %x\n",
+ handle, m32.type, m32.offset);
if (copy_to_user(argp, &m32, sizeof(m32)))
return -EFAULT;
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 7/8] arch/powerpc: use printk_ratelimited instead of printk_ratelimit
[not found] <cover.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
` (5 preceding siblings ...)
2011-06-04 15:36 ` [PATCH 6/8] drivers/gpu/drm: " Christian Dietrich
@ 2011-06-04 15:36 ` Christian Dietrich
2011-06-04 15:37 ` [PATCH 8/8] arch/x86: " Christian Dietrich
7 siblings, 0 replies; 13+ messages in thread
From: Christian Dietrich @ 2011-06-04 15:36 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Al Viro,
Michael Ellerman, Anton Blanchard, Kumar Gala,
Alexey Kardashevskiy, Phil Carmody, Milton Miller, Scott Wood,
Meador Inge, linuxppc-dev, linux-kernel, trivial
Since printk_ratelimit() shouldn't be used anymore (see comment in
include/linux/printk.h), replace it with printk_ratelimited.
Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
---
arch/powerpc/kernel/signal_32.c | 57 +++++++++++++++++++++-----------------
arch/powerpc/kernel/signal_64.c | 17 ++++++-----
arch/powerpc/kernel/traps.c | 22 +++++++--------
arch/powerpc/mm/fault.c | 10 +++---
arch/powerpc/sysdev/mpic.c | 11 +++----
5 files changed, 60 insertions(+), 57 deletions(-)
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index b96a3a0..78b76dc 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -25,6 +25,7 @@
#include <linux/errno.h>
#include <linux/elf.h>
#include <linux/ptrace.h>
+#include <linux/ratelimit.h>
#ifdef CONFIG_PPC64
#include <linux/syscalls.h>
#include <linux/compat.h>
@@ -892,11 +893,12 @@ badframe:
printk("badframe in handle_rt_signal, regs=%p frame=%p newsp=%lx\n",
regs, frame, newsp);
#endif
- if (show_unhandled_signals && printk_ratelimit())
- printk(KERN_INFO "%s[%d]: bad frame in handle_rt_signal32: "
- "%p nip %08lx lr %08lx\n",
- current->comm, current->pid,
- addr, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(KERN_INFO
+ "%s[%d]: bad frame in handle_rt_signal32: "
+ "%p nip %08lx lr %08lx\n",
+ current->comm, current->pid,
+ addr, regs->nip, regs->link);
force_sigsegv(sig, current);
return 0;
@@ -1058,11 +1060,12 @@ long sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
return 0;
bad:
- if (show_unhandled_signals && printk_ratelimit())
- printk(KERN_INFO "%s[%d]: bad frame in sys_rt_sigreturn: "
- "%p nip %08lx lr %08lx\n",
- current->comm, current->pid,
- rt_sf, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(KERN_INFO
+ "%s[%d]: bad frame in sys_rt_sigreturn: "
+ "%p nip %08lx lr %08lx\n",
+ current->comm, current->pid,
+ rt_sf, regs->nip, regs->link);
force_sig(SIGSEGV, current);
return 0;
@@ -1149,12 +1152,12 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
* We kill the task with a SIGSEGV in this situation.
*/
if (do_setcontext(ctx, regs, 1)) {
- if (show_unhandled_signals && printk_ratelimit())
- printk(KERN_INFO "%s[%d]: bad frame in "
- "sys_debug_setcontext: %p nip %08lx "
- "lr %08lx\n",
- current->comm, current->pid,
- ctx, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(KERN_INFO "%s[%d]: bad frame in "
+ "sys_debug_setcontext: %p nip %08lx "
+ "lr %08lx\n",
+ current->comm, current->pid,
+ ctx, regs->nip, regs->link);
force_sig(SIGSEGV, current);
goto out;
@@ -1236,11 +1239,12 @@ badframe:
printk("badframe in handle_signal, regs=%p frame=%p newsp=%lx\n",
regs, frame, newsp);
#endif
- if (show_unhandled_signals && printk_ratelimit())
- printk(KERN_INFO "%s[%d]: bad frame in handle_signal32: "
- "%p nip %08lx lr %08lx\n",
- current->comm, current->pid,
- frame, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(KERN_INFO
+ "%s[%d]: bad frame in handle_signal32: "
+ "%p nip %08lx lr %08lx\n",
+ current->comm, current->pid,
+ frame, regs->nip, regs->link);
force_sigsegv(sig, current);
return 0;
@@ -1288,11 +1292,12 @@ long sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
return 0;
badframe:
- if (show_unhandled_signals && printk_ratelimit())
- printk(KERN_INFO "%s[%d]: bad frame in sys_sigreturn: "
- "%p nip %08lx lr %08lx\n",
- current->comm, current->pid,
- addr, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(KERN_INFO
+ "%s[%d]: bad frame in sys_sigreturn: "
+ "%p nip %08lx lr %08lx\n",
+ current->comm, current->pid,
+ addr, regs->nip, regs->link);
force_sig(SIGSEGV, current);
return 0;
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index da989ff..e91c736 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -24,6 +24,7 @@
#include <linux/elf.h>
#include <linux/ptrace.h>
#include <linux/module.h>
+#include <linux/ratelimit.h>
#include <asm/sigcontext.h>
#include <asm/ucontext.h>
@@ -380,10 +381,10 @@ badframe:
printk("badframe in sys_rt_sigreturn, regs=%p uc=%p &uc->uc_mcontext=%p\n",
regs, uc, &uc->uc_mcontext);
#endif
- if (show_unhandled_signals && printk_ratelimit())
- printk(regs->msr & MSR_64BIT ? fmt64 : fmt32,
- current->comm, current->pid, "rt_sigreturn",
- (long)uc, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
+ current->comm, current->pid, "rt_sigreturn",
+ (long)uc, regs->nip, regs->link);
force_sig(SIGSEGV, current);
return 0;
@@ -468,10 +469,10 @@ badframe:
printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n",
regs, frame, newsp);
#endif
- if (show_unhandled_signals && printk_ratelimit())
- printk(regs->msr & MSR_64BIT ? fmt64 : fmt32,
- current->comm, current->pid, "setup_rt_frame",
- (long)frame, regs->nip, regs->link);
+ if (show_unhandled_signals)
+ printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
+ current->comm, current->pid, "setup_rt_frame",
+ (long)frame, regs->nip, regs->link);
force_sigsegv(signr, current);
return 0;
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 0ff4ab9..7929aef 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -34,6 +34,7 @@
#include <linux/bug.h>
#include <linux/kdebug.h>
#include <linux/debugfs.h>
+#include <linux/ratelimit.h>
#include <asm/emulated_ops.h>
#include <asm/pgtable.h>
@@ -197,12 +198,11 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
if (die("Exception in kernel mode", regs, signr))
return;
} else if (show_unhandled_signals &&
- unhandled_signal(current, signr) &&
- printk_ratelimit()) {
- printk(regs->msr & MSR_64BIT ? fmt64 : fmt32,
- current->comm, current->pid, signr,
- addr, regs->nip, regs->link, code);
- }
+ unhandled_signal(current, signr)) {
+ printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
+ current->comm, current->pid, signr,
+ addr, regs->nip, regs->link, code);
+ }
memset(&info, 0, sizeof(info));
info.si_signo = signr;
@@ -1342,9 +1342,8 @@ void altivec_assist_exception(struct pt_regs *regs)
} else {
/* didn't recognize the instruction */
/* XXX quick hack for now: set the non-Java bit in the VSCR */
- if (printk_ratelimit())
- printk(KERN_ERR "Unrecognized altivec instruction "
- "in %s at %lx\n", current->comm, regs->nip);
+ printk_ratelimited(KERN_ERR "Unrecognized altivec instruction "
+ "in %s at %lx\n", current->comm, regs->nip);
current->thread.vscr.u[3] |= 0x10000;
}
}
@@ -1548,9 +1547,8 @@ u32 ppc_warn_emulated;
void ppc_warn_emulated_print(const char *type)
{
- if (printk_ratelimit())
- pr_warning("%s used emulated %s instruction\n", current->comm,
- type);
+ pr_warn_ratelimited("%s used emulated %s instruction\n", current->comm,
+ type);
}
static int __init ppc_warn_emulated_init(void)
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 54f4fb9..ad35f66 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -31,6 +31,7 @@
#include <linux/kdebug.h>
#include <linux/perf_event.h>
#include <linux/magic.h>
+#include <linux/ratelimit.h>
#include <asm/firmware.h>
#include <asm/page.h>
@@ -346,11 +347,10 @@ bad_area_nosemaphore:
return 0;
}
- if (is_exec && (error_code & DSISR_PROTFAULT)
- && printk_ratelimit())
- printk(KERN_CRIT "kernel tried to execute NX-protected"
- " page (%lx) - exploit attempt? (uid: %d)\n",
- address, current_uid());
+ if (is_exec && (error_code & DSISR_PROTFAULT))
+ printk_ratelimited(KERN_CRIT "kernel tried to execute NX-protected"
+ " page (%lx) - exploit attempt? (uid: %d)\n",
+ address, current_uid());
return SIGSEGV;
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 3a8de5b..58d7a53 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -29,6 +29,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/syscore_ops.h>
+#include <linux/ratelimit.h>
#include <asm/ptrace.h>
#include <asm/signal.h>
@@ -1648,9 +1649,8 @@ static unsigned int _mpic_get_one_irq(struct mpic *mpic, int reg)
return NO_IRQ;
}
if (unlikely(mpic->protected && test_bit(src, mpic->protected))) {
- if (printk_ratelimit())
- printk(KERN_WARNING "%s: Got protected source %d !\n",
- mpic->name, (int)src);
+ printk_ratelimited(KERN_WARNING "%s: Got protected source %d !\n",
+ mpic->name, (int)src);
mpic_eoi(mpic);
return NO_IRQ;
}
@@ -1688,9 +1688,8 @@ unsigned int mpic_get_coreint_irq(void)
return NO_IRQ;
}
if (unlikely(mpic->protected && test_bit(src, mpic->protected))) {
- if (printk_ratelimit())
- printk(KERN_WARNING "%s: Got protected source %d !\n",
- mpic->name, (int)src);
+ printk_ratelimited(KERN_WARNING "%s: Got protected source %d !\n",
+ mpic->name, (int)src);
return NO_IRQ;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 8/8] arch/x86: use printk_ratelimited instead of printk_ratelimit
[not found] <cover.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
` (6 preceding siblings ...)
2011-06-04 15:36 ` [PATCH 7/8] arch/powerpc: " Christian Dietrich
@ 2011-06-04 15:37 ` Christian Dietrich
2011-06-06 6:35 ` Rusty Russell
7 siblings, 1 reply; 13+ messages in thread
From: Christian Dietrich @ 2011-06-04 15:37 UTC (permalink / raw)
To: Venkatesh Pallipadi (Venki),
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Avi Kivity,
Marcelo Tosatti, Rusty Russell, Kevin Tian, Fengzhe Zhang,
John Stultz, Lucas De Marchi, linux-kernel, kvm, lguest, trivial
Since printk_ratelimit() shouldn't be used anymore (see comment in
include/linux/printk.h), replace it with printk_ratelimited.
Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
---
arch/x86/kernel/hpet.c | 6 +++---
arch/x86/kernel/irq.c | 9 ++++-----
arch/x86/kvm/i8259.c | 7 +++----
arch/x86/lguest/boot.c | 6 +++---
4 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 6781765..800d01b 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -10,6 +10,7 @@
#include <linux/cpu.h>
#include <linux/pm.h>
#include <linux/io.h>
+#include <linux/ratelimit.h>
#include <asm/fixmap.h>
#include <asm/i8253.h>
@@ -1158,9 +1159,8 @@ static void hpet_rtc_timer_reinit(void)
if (lost_ints) {
if (hpet_rtc_flags & RTC_PIE)
hpet_pie_count += lost_ints;
- if (printk_ratelimit())
- printk(KERN_WARNING "hpet1: lost %d rtc interrupts\n",
- lost_ints);
+ printk_ratelimited("hpet1: lost %d rtc interrupts\n",
+ lost_ints);
}
}
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 6c0802e..435bf12 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -9,6 +9,7 @@
#include <linux/smp.h>
#include <linux/ftrace.h>
#include <linux/delay.h>
+#include <linux/ratelimit.h>
#include <asm/apic.h>
#include <asm/io_apic.h>
@@ -28,8 +29,7 @@ void (*x86_platform_ipi_callback)(void) = NULL;
*/
void ack_bad_irq(unsigned int irq)
{
- if (printk_ratelimit())
- pr_err("unexpected IRQ trap at vector %02x\n", irq);
+ pr_err_ratelimited("unexpected IRQ trap at vector %02x\n", irq);
/*
* Currently unexpected vectors happen only on SMP and APIC.
@@ -188,9 +188,8 @@ unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
if (!handle_irq(irq, regs)) {
ack_APIC_irq();
- if (printk_ratelimit())
- pr_emerg("%s: %d.%d No irq handler for vector (irq %d)\n",
- __func__, smp_processor_id(), vector, irq);
+ pr_emerg_ratelimited("%s: %d.%d No irq handler for vector (irq %d)\n",
+ __func__, smp_processor_id(), vector, irq);
}
irq_exit();
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 19fe855..8e26193 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -29,6 +29,7 @@
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/bitops.h>
+#include <linux/ratelimit.h>
#include "irq.h"
#include <linux/kvm_host.h>
@@ -473,8 +474,7 @@ static int picdev_write(struct kvm_io_device *this,
return -EOPNOTSUPP;
if (len != 1) {
- if (printk_ratelimit())
- printk(KERN_ERR "PIC: non byte write\n");
+ printk_ratelimited(KERN_ERR "PIC: non byte write\n");
return 0;
}
pic_lock(s);
@@ -503,8 +503,7 @@ static int picdev_read(struct kvm_io_device *this,
return -EOPNOTSUPP;
if (len != 1) {
- if (printk_ratelimit())
- printk(KERN_ERR "PIC: non byte read\n");
+ printk_ratelimited(KERN_ERR "PIC: non byte read\n");
return 0;
}
pic_lock(s);
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index db832fd..23a6eff 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -56,6 +56,7 @@
#include <linux/lguest_launcher.h>
#include <linux/virtio_console.h>
#include <linux/pm.h>
+#include <linux/ratelimit.h>
#include <asm/apic.h>
#include <asm/lguest.h>
#include <asm/paravirt.h>
@@ -927,9 +928,8 @@ static int lguest_clockevent_set_next_event(unsigned long delta,
/* FIXME: I don't think this can ever happen, but James tells me he had
* to put this code in. Maybe we should remove it now. Anyone? */
if (delta < LG_CLOCK_MIN_DELTA) {
- if (printk_ratelimit())
- printk(KERN_DEBUG "%s: small delta %lu ns\n",
- __func__, delta);
+ printk_ratelimited(KERN_DEBUG "%s: small delta %lu ns\n",
+ __func__, delta);
return -ETIME;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 8/8] arch/x86: use printk_ratelimited instead of printk_ratelimit
2011-06-04 15:37 ` [PATCH 8/8] arch/x86: " Christian Dietrich
@ 2011-06-06 6:35 ` Rusty Russell
2011-06-06 8:11 ` richard -rw- weinberger
0 siblings, 1 reply; 13+ messages in thread
From: Rusty Russell @ 2011-06-06 6:35 UTC (permalink / raw)
To: Christian Dietrich, Venkatesh Pallipadi (Venki),
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Avi Kivity,
Marcelo Tosatti, Kevin Tian, Fengzhe Zhang, John Stultz,
Lucas De Marchi, linux-kernel, kvm, lguest, trivial
On Sat, 4 Jun 2011 17:37:04 +0200, Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de> wrote:
> Since printk_ratelimit() shouldn't be used anymore (see comment in
> include/linux/printk.h), replace it with printk_ratelimited.
Acked-by: Rusty Russell <rusty@rustcorp.com.au> (lguest part)
> diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
> index db832fd..23a6eff 100644
> --- a/arch/x86/lguest/boot.c
> +++ b/arch/x86/lguest/boot.c
> @@ -56,6 +56,7 @@
> #include <linux/lguest_launcher.h>
> #include <linux/virtio_console.h>
> #include <linux/pm.h>
> +#include <linux/ratelimit.h>
> #include <asm/apic.h>
> #include <asm/lguest.h>
> #include <asm/paravirt.h>
Is this new include really needed? The printk_ratelimited() definition
is in printk.h...
Thanks,
Rusty.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 8/8] arch/x86: use printk_ratelimited instead of printk_ratelimit
2011-06-06 6:35 ` Rusty Russell
@ 2011-06-06 8:11 ` richard -rw- weinberger
2011-06-07 3:11 ` Rusty Russell
0 siblings, 1 reply; 13+ messages in thread
From: richard -rw- weinberger @ 2011-06-06 8:11 UTC (permalink / raw)
To: Rusty Russell
Cc: Christian Dietrich, Venkatesh Pallipadi (Venki),
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Avi Kivity,
Marcelo Tosatti, Kevin Tian, Fengzhe Zhang, John Stultz,
Lucas De Marchi, linux-kernel, kvm, lguest, trivial
On Mon, Jun 6, 2011 at 8:35 AM, Rusty Russell <rusty@rustcorp.com.au> wrote:
> On Sat, 4 Jun 2011 17:37:04 +0200, Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de> wrote:
>> Since printk_ratelimit() shouldn't be used anymore (see comment in
>> include/linux/printk.h), replace it with printk_ratelimited.
>
> Acked-by: Rusty Russell <rusty@rustcorp.com.au> (lguest part)
>
>> diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
>> index db832fd..23a6eff 100644
>> --- a/arch/x86/lguest/boot.c
>> +++ b/arch/x86/lguest/boot.c
>> @@ -56,6 +56,7 @@
>> #include <linux/lguest_launcher.h>
>> #include <linux/virtio_console.h>
>> #include <linux/pm.h>
>> +#include <linux/ratelimit.h>
>> #include <asm/apic.h>
>> #include <asm/lguest.h>
>> #include <asm/paravirt.h>
>
> Is this new include really needed? The printk_ratelimited() definition
> is in printk.h...
Yes.
printk_ratelimited() needs DEFINE_RATELIMIT_STATE() which is defined
in ratelimit.h.
--
Thanks,
//richard
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 8/8] arch/x86: use printk_ratelimited instead of printk_ratelimit
2011-06-06 8:11 ` richard -rw- weinberger
@ 2011-06-07 3:11 ` Rusty Russell
2011-06-07 3:37 ` Joe Perches
0 siblings, 1 reply; 13+ messages in thread
From: Rusty Russell @ 2011-06-07 3:11 UTC (permalink / raw)
To: richard -rw- weinberger
Cc: Christian Dietrich, Venkatesh Pallipadi (Venki),
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Avi Kivity,
Marcelo Tosatti, Kevin Tian, Fengzhe Zhang, John Stultz,
Lucas De Marchi, linux-kernel, kvm, lguest, trivial
On Mon, 6 Jun 2011 10:11:53 +0200, richard -rw- weinberger <richard.weinberger@gmail.com> wrote:
> On Mon, Jun 6, 2011 at 8:35 AM, Rusty Russell <rusty@rustcorp.com.au> wrote:
> > On Sat, 4 Jun 2011 17:37:04 +0200, Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de> wrote:
> >> Since printk_ratelimit() shouldn't be used anymore (see comment in
> >> include/linux/printk.h), replace it with printk_ratelimited.
> >
> > Acked-by: Rusty Russell <rusty@rustcorp.com.au> (lguest part)
> >
> >> diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
> >> index db832fd..23a6eff 100644
> >> --- a/arch/x86/lguest/boot.c
> >> +++ b/arch/x86/lguest/boot.c
> >> @@ -56,6 +56,7 @@
> >> #include <linux/lguest_launcher.h>
> >> #include <linux/virtio_console.h>
> >> #include <linux/pm.h>
> >> +#include <linux/ratelimit.h>
> >> #include <asm/apic.h>
> >> #include <asm/lguest.h>
> >> #include <asm/paravirt.h>
> >
> > Is this new include really needed? The printk_ratelimited() definition
> > is in printk.h...
>
> Yes.
> printk_ratelimited() needs DEFINE_RATELIMIT_STATE() which is defined
> in ratelimit.h.
Yech. I'm assuming that making printk.h include ratelimit.h makes a
nasty mess?
Thanks,
Rusty.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 8/8] arch/x86: use printk_ratelimited instead of printk_ratelimit
2011-06-07 3:11 ` Rusty Russell
@ 2011-06-07 3:37 ` Joe Perches
0 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2011-06-07 3:37 UTC (permalink / raw)
To: Rusty Russell
Cc: richard -rw- weinberger, Christian Dietrich,
Venkatesh Pallipadi (Venki),
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Avi Kivity,
Marcelo Tosatti, Kevin Tian, Fengzhe Zhang, John Stultz,
Lucas De Marchi, linux-kernel, kvm, lguest, trivial
On Tue, 2011-06-07 at 12:41 +0930, Rusty Russell wrote:
> On Mon, 6 Jun 2011 10:11:53 +0200, richard -rw- weinberger <richard.weinberger@gmail.com> wrote:
> > printk_ratelimited() needs DEFINE_RATELIMIT_STATE() which is defined
> > in ratelimit.h.
> Yech. I'm assuming that making printk.h include ratelimit.h makes a
> nasty mess?
Yup.
I proposed moving the <foo>_ratelimited dclarations to
ratelimited.h without any comment.
http://lkml.org/lkml/2010/2/18/377
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/8] md/raid: use printk_ratelimited instead of printk_ratelimit
2011-06-04 15:36 ` [PATCH 4/8] md/raid: " Christian Dietrich
@ 2011-06-28 6:45 ` NeilBrown
0 siblings, 0 replies; 13+ messages in thread
From: NeilBrown @ 2011-06-28 6:45 UTC (permalink / raw)
To: Christian Dietrich; +Cc: linux-raid, linux-kernel, trivial
On Sat, 4 Jun 2011 17:36:21 +0200 Christian Dietrich
<christian.dietrich@informatik.uni-erlangen.de> wrote:
> As per printk_ratelimit comment, it should not be used
>
> Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
> ---
> drivers/md/raid1.c | 22 ++++++++++++----------
> drivers/md/raid10.c | 22 ++++++++++++----------
> drivers/md/raid5.c | 39 +++++++++++++++++++--------------------
> 3 files changed, 43 insertions(+), 40 deletions(-)
Thanks. I've applied this one to my 'md' tree.
NeilBrown
>
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 5d09609..30af10e 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -35,6 +35,7 @@
> #include <linux/delay.h>
> #include <linux/blkdev.h>
> #include <linux/seq_file.h>
> +#include <linux/ratelimit.h>
> #include "md.h"
> #include "raid1.h"
> #include "bitmap.h"
> @@ -287,10 +288,11 @@ static void raid1_end_read_request(struct bio *bio, int error)
> * oops, read error:
> */
> char b[BDEVNAME_SIZE];
> - if (printk_ratelimit())
> - printk(KERN_ERR "md/raid1:%s: %s: rescheduling sector %llu\n",
> - mdname(conf->mddev),
> - bdevname(conf->mirrors[mirror].rdev->bdev,b), (unsigned long long)r1_bio->sector);
> + printk_ratelimited(KERN_ERR "md/raid1:%s: %s: "
> + "rescheduling sector %llu\n",
> + mdname(conf->mddev),
> + bdevname(conf->mirrors[mirror].rdev->bdev, b),
> + (unsigned long long)r1_bio->sector);
> reschedule_retry(r1_bio);
> }
>
> @@ -1574,12 +1576,12 @@ static void raid1d(mddev_t *mddev)
> GFP_NOIO, mddev);
> r1_bio->bios[r1_bio->read_disk] = bio;
> rdev = conf->mirrors[disk].rdev;
> - if (printk_ratelimit())
> - printk(KERN_ERR "md/raid1:%s: redirecting sector %llu to"
> - " other mirror: %s\n",
> - mdname(mddev),
> - (unsigned long long)r1_bio->sector,
> - bdevname(rdev->bdev,b));
> + printk_ratelimited(KERN_ERR
> + "md/raid1:%s: redirecting sector %llu to"
> + " other mirror: %s\n",
> + mdname(mddev),
> + (unsigned long long)r1_bio->sector,
> + bdevname(rdev->bdev, b));
> bio->bi_sector = r1_bio->sector + rdev->data_offset;
> bio->bi_bdev = rdev->bdev;
> bio->bi_end_io = raid1_end_read_request;
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 6e84668..e80475a 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -22,6 +22,7 @@
> #include <linux/delay.h>
> #include <linux/blkdev.h>
> #include <linux/seq_file.h>
> +#include <linux/ratelimit.h>
> #include "md.h"
> #include "raid10.h"
> #include "raid0.h"
> @@ -277,10 +278,11 @@ static void raid10_end_read_request(struct bio *bio, int error)
> * oops, read error - keep the refcount on the rdev
> */
> char b[BDEVNAME_SIZE];
> - if (printk_ratelimit())
> - printk(KERN_ERR "md/raid10:%s: %s: rescheduling sector %llu\n",
> - mdname(conf->mddev),
> - bdevname(conf->mirrors[dev].rdev->bdev,b), (unsigned long long)r10_bio->sector);
> + printk_ratelimited(KERN_ERR
> + "md/raid10:%s: %s: rescheduling sector %llu\n",
> + mdname(conf->mddev),
> + bdevname(conf->mirrors[dev].rdev->bdev, b),
> + (unsigned long long)r10_bio->sector);
> reschedule_retry(r10_bio);
> }
> }
> @@ -1667,12 +1669,12 @@ static void raid10d(mddev_t *mddev)
> bio_put(bio);
> slot = r10_bio->read_slot;
> rdev = conf->mirrors[mirror].rdev;
> - if (printk_ratelimit())
> - printk(KERN_ERR "md/raid10:%s: %s: redirecting sector %llu to"
> - " another mirror\n",
> - mdname(mddev),
> - bdevname(rdev->bdev,b),
> - (unsigned long long)r10_bio->sector);
> + printk_ratelimited(KERN_ERR
> + "md/raid10:%s: %s: redirecting"
> + "sector %llu to another mirror\n",
> + mdname(mddev),
> + bdevname(rdev->bdev, b),
> + (unsigned long long)r10_bio->sector);
> bio = bio_clone_mddev(r10_bio->master_bio,
> GFP_NOIO, mddev);
> r10_bio->devs[slot].bio = bio;
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 346e69b..8927c26 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -51,6 +51,7 @@
> #include <linux/seq_file.h>
> #include <linux/cpu.h>
> #include <linux/slab.h>
> +#include <linux/ratelimit.h>
> #include "md.h"
> #include "raid5.h"
> #include "raid0.h"
> @@ -96,8 +97,6 @@
> #define __inline__
> #endif
>
> -#define printk_rl(args...) ((void) (printk_ratelimit() && printk(args)))
> -
> /*
> * We maintain a biased count of active stripes in the bottom 16 bits of
> * bi_phys_segments, and a count of processed stripes in the upper 16 bits
> @@ -1587,12 +1586,12 @@ static void raid5_end_read_request(struct bio * bi, int error)
> set_bit(R5_UPTODATE, &sh->dev[i].flags);
> if (test_bit(R5_ReadError, &sh->dev[i].flags)) {
> rdev = conf->disks[i].rdev;
> - printk_rl(KERN_INFO "md/raid:%s: read error corrected"
> - " (%lu sectors at %llu on %s)\n",
> - mdname(conf->mddev), STRIPE_SECTORS,
> - (unsigned long long)(sh->sector
> - + rdev->data_offset),
> - bdevname(rdev->bdev, b));
> + printk_ratelimited(KERN_INFO "md/raid:%s: read error corrected"
> + " (%lu sectors at %llu on %s)\n",
> + mdname(conf->mddev), STRIPE_SECTORS,
> + (unsigned long long)(sh->sector
> + + rdev->data_offset),
> + bdevname(rdev->bdev, b));
> clear_bit(R5_ReadError, &sh->dev[i].flags);
> clear_bit(R5_ReWrite, &sh->dev[i].flags);
> }
> @@ -1606,21 +1605,21 @@ static void raid5_end_read_request(struct bio * bi, int error)
> clear_bit(R5_UPTODATE, &sh->dev[i].flags);
> atomic_inc(&rdev->read_errors);
> if (conf->mddev->degraded >= conf->max_degraded)
> - printk_rl(KERN_WARNING
> - "md/raid:%s: read error not correctable "
> - "(sector %llu on %s).\n",
> - mdname(conf->mddev),
> - (unsigned long long)(sh->sector
> - + rdev->data_offset),
> + printk_ratelimited(KERN_WARNING
> + "md/raid:%s: read error not correctable "
> + "(sector %llu on %s).\n",
> + mdname(conf->mddev),
> + (unsigned long long)(sh->sector
> + + rdev->data_offset),
> bdn);
> else if (test_bit(R5_ReWrite, &sh->dev[i].flags))
> /* Oh, no!!! */
> - printk_rl(KERN_WARNING
> - "md/raid:%s: read error NOT corrected!! "
> - "(sector %llu on %s).\n",
> - mdname(conf->mddev),
> - (unsigned long long)(sh->sector
> - + rdev->data_offset),
> + printk_ratelimited(KERN_WARNING
> + "md/raid:%s: read error NOT corrected!! "
> + "(sector %llu on %s).\n",
> + mdname(conf->mddev),
> + (unsigned long long)(sh->sector
> + + rdev->data_offset),
> bdn);
> else if (atomic_read(&rdev->read_errors)
> > conf->max_nr_stripes)
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-06-28 6:47 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <cover.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
2011-06-04 15:35 ` [PATCH 1/8] powerpc/rtas-rtc: remove sideeffects of printk_ratelimit Christian Dietrich
2011-06-04 15:35 ` [PATCH 2/8] drivers/octeon: use printk_ratelimited instead " Christian Dietrich
2011-06-04 15:36 ` [PATCH 3/8] scsi/sg: " Christian Dietrich
2011-06-04 15:36 ` [PATCH 4/8] md/raid: " Christian Dietrich
2011-06-28 6:45 ` NeilBrown
2011-06-04 15:36 ` [PATCH 5/8] drivers/char/rtc: " Christian Dietrich
2011-06-04 15:36 ` [PATCH 6/8] drivers/gpu/drm: " Christian Dietrich
2011-06-04 15:36 ` [PATCH 7/8] arch/powerpc: " Christian Dietrich
2011-06-04 15:37 ` [PATCH 8/8] arch/x86: " Christian Dietrich
2011-06-06 6:35 ` Rusty Russell
2011-06-06 8:11 ` richard -rw- weinberger
2011-06-07 3:11 ` Rusty Russell
2011-06-07 3:37 ` Joe Perches
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).