From: Paolo Bonzini <pbonzini@redhat.com>
To: Liran Alon <liran.alon@oracle.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v2] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress
Date: Tue, 2 Apr 2019 11:06:36 +0200 [thread overview]
Message-ID: <461676dd-8a04-3d3e-86c0-76e143fa27b9@redhat.com> (raw)
In-Reply-To: <7B2302D0-7277-4C14-9FEA-DDAE70EF005E@oracle.com>
On 02/04/19 10:23, Liran Alon wrote:
>> +#define SUCCESSIVE_IRQ_MAX_COUNT 10000
>> +
>> +static void ioapic_timer(void *opaque)
> I suggest rename method to something such as “delayed_ioapic_service_timer_handler()”.
>
I renamed them to delayed_ioapic_service_{timer,cb} and queued the patch.
>>
>> + if (((entry & IOAPIC_VECTOR_MASK) != vector) ||
>> + !(entry & IOAPIC_LVT_REMOTE_IRR)) {
>> + continue;
>> + }
>> +
>> + trace_ioapic_clear_remote_irr(n, vector);
>> + s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR;
>
> remote-irr is only set for level-triggered interrupt.
> Thus, I think in the “if” above you should “continue;” in case trigger-mode != IOAPIC_TRIGGER_LEVEL.
> i.e. Replace condition "!(entry & IOAPIC_LVT_REMOTE_IRR)” with “trigger-mode != IOAPIC_TRIGGER_LEVEL”.
> Then you can also remove the “if” below.
Like this?
@@ -232,19 +232,18 @@ void ioapic_eoi_broadcast(int vector)
for (n = 0; n < IOAPIC_NUM_PINS; n++) {
entry = s->ioredtbl[n];
- if (((entry & IOAPIC_VECTOR_MASK) != vector) ||
- !(entry & IOAPIC_LVT_REMOTE_IRR)) {
+ if ((entry & IOAPIC_VECTOR_MASK) != vector ||
+ ((entry >> IOAPIC_LVT_TRIGGER_MODE_SHIFT) & 1) != IOAPIC_TRIGGER_LEVEL) {
continue;
}
- trace_ioapic_clear_remote_irr(n, vector);
- s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR;
-
- if (((entry >> IOAPIC_LVT_TRIGGER_MODE_SHIFT) & 1) !=
- IOAPIC_TRIGGER_LEVEL) {
+ if (!(entry & IOAPIC_LVT_REMOTE_IRR)) {
continue;
}
+ trace_ioapic_clear_remote_irr(n, vector);
+ s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR;
+
if (!(entry & IOAPIC_LVT_MASKED) && (s->irr & (1 << n))) {
++s->irq_eoi[vector];
if (s->irq_eoi[vector] >= SUCCESSIVE_IRQ_MAX_COUNT) {
Paolo
next prev parent reply other threads:[~2019-04-02 9:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-02 8:02 [Qemu-devel] [PATCH v2] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress Vitaly Kuznetsov
2019-04-02 8:23 ` Liran Alon
2019-04-02 9:06 ` Paolo Bonzini [this message]
2019-04-02 9:08 ` Liran Alon
2019-04-02 10:20 ` Paolo Bonzini
2019-04-02 11:36 ` Liran Alon
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=461676dd-8a04-3d3e-86c0-76e143fa27b9@redhat.com \
--to=pbonzini@redhat.com \
--cc=liran.alon@oracle.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vkuznets@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;
as well as URLs for NNTP newsgroup(s).