From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Chris Mason <mason@kernel.org>,
Amirmohammad Eftekhar <amirmohammad.eftekhar@cispa.de>,
Josef Bacik <josef@toxicpanda.com>
Subject: [PATCH] KVM: x86: Ratelimit all I/O APIC and local APIC kernel log messages
Date: Thu, 22 Oct 2026 12:38:08 -0700 [thread overview]
Message-ID: <20261022193808.557206-1-seanjc@google.com> (raw)
From: Amirmohammad Eftekhar <amirmohammad.eftekhar@cispa.de>
Ratelimit all of the kernel messages in the APIC code, as every single one
can be triggered at will by the guest.
Opportunistically use the more modern APIs so that the messages are run
through pr_fmt(), i.e. get prefixed with KVM's name and info.
Fixes: 1fd4f2a5ed8f ("KVM: In-kernel I/O APIC model")
Fixes: 8f423a80d299 ("KVM: SVM: Support MMIO for an SEV-ES guest")
Cc: Chris Mason <mason@kernel.org>
Signed-off-by: Amirmohammad Eftekhar <amirmohammad.eftekhar@cispa.de>
Co-developed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
[sean: smush everything into one patch]
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
arch/x86/kvm/ioapic.c | 4 ++--
arch/x86/kvm/lapic.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c
index 0d59b9c758c2..df15d940181c 100644
--- a/arch/x86/kvm/ioapic.c
+++ b/arch/x86/kvm/ioapic.c
@@ -647,7 +647,7 @@ static int ioapic_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this,
memcpy(val, (char *)&result, len);
break;
default:
- printk(KERN_WARNING "ioapic: wrong length %d\n", len);
+ pr_warn_ratelimited("ioapic: wrong length %d\n", len);
}
return 0;
}
@@ -672,7 +672,7 @@ static int ioapic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this,
data = *(u8 *) val;
break;
default:
- printk(KERN_WARNING "ioapic: Unsupported size %d\n", len);
+ pr_warn_ratelimited("ioapic: Unsupported size %d\n", len);
return 0;
}
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index ecf611845fb1..a49bb38b4f70 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1123,7 +1123,7 @@ static void kvm_apic_disabled_lapic_found(struct kvm *kvm)
{
if (!kvm->arch.disabled_lapic_found) {
kvm->arch.disabled_lapic_found = true;
- pr_info("Disabled LAPIC found during irq injection\n");
+ pr_info_ratelimited("Disabled LAPIC found during irq injection\n");
}
}
@@ -1359,7 +1359,7 @@ int __kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
if (irq->dest_mode == APIC_DEST_PHYSICAL &&
irq->dest_id == 0xff && kvm_lowest_prio_delivery(irq)) {
- pr_info("apic: phys broadcast and lowest prio\n");
+ pr_info_ratelimited("apic: phys broadcast and lowest prio\n");
irq->delivery_mode = APIC_DM_FIXED;
}
@@ -1826,8 +1826,8 @@ static int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len,
memcpy(data, (char *)&result + alignment, len);
break;
default:
- printk(KERN_ERR "Local APIC read with len = %x, "
- "should be 1,2, or 4 instead\n", len);
+ pr_err_ratelimited("Local APIC read with len = %x, should be 1,2, or 4 instead\n",
+ len);
break;
}
return 0;
base-commit: 164405e8e9a0378c7e1aff2254625a6553a291f1
--
2.56.0.257.gf7497c7d27-goog
reply other threads:[~2026-10-22 19:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261022193808.557206-1-seanjc@google.com \
--to=seanjc@google.com \
--cc=amirmohammad.eftekhar@cispa.de \
--cc=josef@toxicpanda.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®