linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] KVM: x86: degrade WARN to pr_warn_ratelimited
@ 2019-06-26 12:18 Paolo Bonzini
  2019-06-26 12:24 ` Alexander Potapenko
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2019-06-26 12:18 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: Alexander Potapenko

This warning can be triggered easily by userspace, so it should certainly not
cause a panic if panic_on_warn is set.

Suggested-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/x86.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 83aefd759846..66585cf42d7f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1557,7 +1557,7 @@ static int set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale)
 			vcpu->arch.tsc_always_catchup = 1;
 			return 0;
 		} else {
-			WARN(1, "user requested TSC rate below hardware speed\n");
+			pr_warn_ratelimited("user requested TSC rate below hardware speed\n");
 			return -1;
 		}
 	}
@@ -1567,8 +1567,8 @@ static int set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale)
 				user_tsc_khz, tsc_khz);
 
 	if (ratio == 0 || ratio >= kvm_max_tsc_scaling_ratio) {
-		WARN_ONCE(1, "Invalid TSC scaling ratio - virtual-tsc-khz=%u\n",
-			  user_tsc_khz);
+		pr_warn_ratelimited("Invalid TSC scaling ratio - virtual-tsc-khz=%u\n",
+			            user_tsc_khz);
 		return -1;
 	}
 
-- 
1.8.3.1


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

* Re: [PATCH v2] KVM: x86: degrade WARN to pr_warn_ratelimited
  2019-06-26 12:18 [PATCH v2] KVM: x86: degrade WARN to pr_warn_ratelimited Paolo Bonzini
@ 2019-06-26 12:24 ` Alexander Potapenko
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Potapenko @ 2019-06-26 12:24 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: LKML, kvm

On Wed, Jun 26, 2019 at 2:19 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> This warning can be triggered easily by userspace, so it should certainly not
> cause a panic if panic_on_warn is set.
>
Can you please also add the Reported-by tag here?

Reported-by: syzbot+c03f30b4f4c46bdf8575@syzkaller.appspotmail.com
> Suggested-by: Alexander Potapenko <glider@google.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Alexander Potapenko <glider@google.com>
> ---
>  arch/x86/kvm/x86.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 83aefd759846..66585cf42d7f 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1557,7 +1557,7 @@ static int set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale)
>                         vcpu->arch.tsc_always_catchup = 1;
>                         return 0;
>                 } else {
> -                       WARN(1, "user requested TSC rate below hardware speed\n");
> +                       pr_warn_ratelimited("user requested TSC rate below hardware speed\n");
>                         return -1;
>                 }
>         }
> @@ -1567,8 +1567,8 @@ static int set_tsc_khz(struct kvm_vcpu *vcpu, u32 user_tsc_khz, bool scale)
>                                 user_tsc_khz, tsc_khz);
>
>         if (ratio == 0 || ratio >= kvm_max_tsc_scaling_ratio) {
> -               WARN_ONCE(1, "Invalid TSC scaling ratio - virtual-tsc-khz=%u\n",
> -                         user_tsc_khz);
> +               pr_warn_ratelimited("Invalid TSC scaling ratio - virtual-tsc-khz=%u\n",
> +                                   user_tsc_khz);
>                 return -1;
>         }
>
> --
> 1.8.3.1
>


-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

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

end of thread, other threads:[~2019-06-26 12:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26 12:18 [PATCH v2] KVM: x86: degrade WARN to pr_warn_ratelimited Paolo Bonzini
2019-06-26 12:24 ` Alexander Potapenko

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).