public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 8/8] arch/x86: use printk_ratelimited instead of printk_ratelimit
       [not found] <cover.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
@ 2011-06-04 15:37 ` Christian Dietrich
       [not found] ` <fce87f1efab55e15e91b21f1b73f0e86016a27d9.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
  1 sibling, 0 replies; 5+ 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 <

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] 5+ messages in thread

* Re: [PATCH 8/8] arch/x86: use printk_ratelimited instead of printk_ratelimit
       [not found] ` <fce87f1efab55e15e91b21f1b73f0e86016a27d9.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
@ 2011-06-06  6:35   ` Rusty Russell
       [not found]   ` <874o43ii1m.fsf@rustcorp.com.au>
  1 sibling, 0 replies; 5+ messages in thread
From: Rusty Russell @ 2011-06-06  6:35 UTC (permalink / raw)
  To: Christian Dietrich, Venkatesh Pallipadi (Venki), Thomas Gleixner,
	Ingo Molnar

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] 5+ messages in thread

* Re: [PATCH 8/8] arch/x86: use printk_ratelimited instead of printk_ratelimit
       [not found]   ` <874o43ii1m.fsf@rustcorp.com.au>
@ 2011-06-06  8:11     ` richard -rw- weinberger
       [not found]       ` <BANLkTinS67qH-pm2=Z9G1UXk4OOuZNsN9g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ 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] 5+ messages in thread

* Re: [PATCH 8/8] arch/x86: use printk_ratelimited instead of printk_ratelimit
       [not found]       ` <BANLkTinS67qH-pm2=Z9G1UXk4OOuZNsN9g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-06-07  3:11         ` Rusty Russell
  2011-06-07  3:37           ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Rusty Russell @ 2011-06-07  3:11 UTC (permalink / raw)
  To: richard -rw- weinberger
  Cc: lguest-uLR06cmDAlY/bJ5BZ2RsiQ, Venkatesh Pallipadi (Venki),
	Kevin Tian, Marcelo Tosatti, trivial-DgEjT+Ai2ygdnm+yROfE0A,
	kvm-u79uwXL29TY76Z2rM5mHXA, Lucas De Marchi, John Stultz,
	x86-DgEjT+Ai2ygdnm+yROfE0A, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Fengzhe Zhang, Christian Dietrich, Ingo Molnar, Avi Kivity,
	H. Peter Anvin, Thomas Gleixner

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.
_______________________________________________
Lguest mailing list
Lguest@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/lguest

^ permalink raw reply	[flat|nested] 5+ 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; 5+ 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] 5+ messages in thread

end of thread, other threads:[~2011-06-07  3:37 UTC | newest]

Thread overview: 5+ 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:37 ` [PATCH 8/8] arch/x86: use printk_ratelimited instead of printk_ratelimit Christian Dietrich
     [not found] ` <fce87f1efab55e15e91b21f1b73f0e86016a27d9.1307199715.git.christian.dietrich@informatik.uni-erlangen.de>
2011-06-06  6:35   ` Rusty Russell
     [not found]   ` <874o43ii1m.fsf@rustcorp.com.au>
2011-06-06  8:11     ` richard -rw- weinberger
     [not found]       ` <BANLkTinS67qH-pm2=Z9G1UXk4OOuZNsN9g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
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