* [PATCH] KVM: x86: don't notify userspace IOAPIC on edge EOI
@ 2015-10-08 18:30 Radim Krčmář
2015-10-08 18:34 ` Radim Krčmář
0 siblings, 1 reply; 3+ messages in thread
From: Radim Krčmář @ 2015-10-08 18:30 UTC (permalink / raw)
To: linux-kernel; +Cc: kvm, Paolo Bonzini, Steve Rutherford
On real hardware, edge-triggered interrupts don't set a bit in TMR,
which means that IOAPIC isn't notified on EOI. Do the same here.
Staying in guest/kernel mode after edge EOI is what we want for most
devices. If some bugs could be nicely worked around with edge EOI
notifications, we should invest in a better interface.
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
Completely untested.
arch/x86/kvm/irq_comm.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c
index c89228980230..8f4499c7ffc1 100644
--- a/arch/x86/kvm/irq_comm.c
+++ b/arch/x86/kvm/irq_comm.c
@@ -389,13 +389,15 @@ void kvm_scan_ioapic_routes(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap)
for (i = 0; i < nr_ioapic_pins; ++i) {
hlist_for_each_entry(entry, &table->map[i], link) {
u32 dest_id, dest_mode;
+ bool level;
if (entry->type != KVM_IRQ_ROUTING_MSI)
continue;
dest_id = (entry->msi.address_lo >> 12) & 0xff;
dest_mode = (entry->msi.address_lo >> 2) & 0x1;
- if (kvm_apic_match_dest(vcpu, NULL, 0, dest_id,
- dest_mode)) {
+ level = entry->msi.data & MSI_DATA_TRIGGER_LEVEL;
+ if (level && kvm_apic_match_dest(vcpu, NULL, 0,
+ dest_id, dest_mode)) {
u32 vector = entry->msi.data & 0xff;
__set_bit(vector,
--
2.5.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: x86: don't notify userspace IOAPIC on edge EOI
2015-10-08 18:30 [PATCH] KVM: x86: don't notify userspace IOAPIC on edge EOI Radim Krčmář
@ 2015-10-08 18:34 ` Radim Krčmář
2015-10-09 11:03 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Radim Krčmář @ 2015-10-08 18:34 UTC (permalink / raw)
To: linux-kernel; +Cc: kvm, Paolo Bonzini, Steve Rutherford
2015-10-08 20:30+0200, Radim Krčmář:
> On real hardware, edge-triggered interrupts don't set a bit in TMR,
> which means that IOAPIC isn't notified on EOI. Do the same here.
>
> Staying in guest/kernel mode after edge EOI is what we want for most
> devices. If some bugs could be nicely worked around with edge EOI
> notifications, we should invest in a better interface.
>
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
> Completely untested.
>
> diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c
> @@ -389,13 +389,15 @@ void kvm_scan_ioapic_routes(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap)
> for (i = 0; i < nr_ioapic_pins; ++i) {
> hlist_for_each_entry(entry, &table->map[i], link) {
> u32 dest_id, dest_mode;
> + bool level;
>
> if (entry->type != KVM_IRQ_ROUTING_MSI)
> continue;
> dest_id = (entry->msi.address_lo >> 12) & 0xff;
> dest_mode = (entry->msi.address_lo >> 2) & 0x1;
> - if (kvm_apic_match_dest(vcpu, NULL, 0, dest_id,
> - dest_mode)) {
> + level = entry->msi.data & MSI_DATA_TRIGGER_LEVEL;
> + if (level && kvm_apic_match_dest(vcpu, NULL, 0,
Describing that result is an overkill -- I'll send v2 if the idea is
accepted.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: x86: don't notify userspace IOAPIC on edge EOI
2015-10-08 18:34 ` Radim Krčmář
@ 2015-10-09 11:03 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-10-09 11:03 UTC (permalink / raw)
To: Radim Krčmář, linux-kernel; +Cc: kvm, Steve Rutherford
On 08/10/2015 20:34, Radim Krčmář wrote:
> 2015-10-08 20:30+0200, Radim Krčmář:
>> On real hardware, edge-triggered interrupts don't set a bit in TMR,
>> which means that IOAPIC isn't notified on EOI. Do the same here.
>>
>> Staying in guest/kernel mode after edge EOI is what we want for most
>> devices. If some bugs could be nicely worked around with edge EOI
>> notifications, we should invest in a better interface.
>>
>> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
>> ---
>> Completely untested.
>>
>> diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c
>> @@ -389,13 +389,15 @@ void kvm_scan_ioapic_routes(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap)
>> for (i = 0; i < nr_ioapic_pins; ++i) {
>> hlist_for_each_entry(entry, &table->map[i], link) {
>> u32 dest_id, dest_mode;
>> + bool level;
>>
>> if (entry->type != KVM_IRQ_ROUTING_MSI)
>> continue;
>> dest_id = (entry->msi.address_lo >> 12) & 0xff;
>> dest_mode = (entry->msi.address_lo >> 2) & 0x1;
>> - if (kvm_apic_match_dest(vcpu, NULL, 0, dest_id,
>> - dest_mode)) {
>> + level = entry->msi.data & MSI_DATA_TRIGGER_LEVEL;
>> + if (level && kvm_apic_match_dest(vcpu, NULL, 0,
>
> Describing that result is an overkill -- I'll send v2 if the idea is
> accepted.
It's okay and it matches the other lines before. I'm applying this too,
but I would appreciate Steve's Tested-by before moving it to kvm/next.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-09 11:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-08 18:30 [PATCH] KVM: x86: don't notify userspace IOAPIC on edge EOI Radim Krčmář
2015-10-08 18:34 ` Radim Krčmář
2015-10-09 11:03 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.