* FAILED: patch "[PATCH] KVM: x86: fix interrupt window handling in split IRQ chip" failed to apply to 4.3-stable tree
@ 2015-12-07 7:37 gregkh
2015-12-07 23:27 ` Matt Gingell
0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2015-12-07 7:37 UTC (permalink / raw)
To: gingell, pbonzini; +Cc: stable
The patch below does not apply to the 4.3-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 127a457acb2131fdb31c68c98cf11eda8ba7b380 Mon Sep 17 00:00:00 2001
From: Matt Gingell <gingell@google.com>
Date: Tue, 17 Nov 2015 17:32:05 +0100
Subject: [PATCH] KVM: x86: fix interrupt window handling in split IRQ chip
case
This patch ensures that dm_request_for_irq_injection and
post_kvm_run_save are in sync, avoiding that an endless ping-pong
between userspace (who correctly notices that IF=0) and
the kernel (who insists that userspace handles its request
for the interrupt window).
To synchronize them, it also adds checks for kvm_arch_interrupt_allowed
and !kvm_event_needs_reinjection. These are always needed, not
just for in-kernel LAPIC.
Signed-off-by: Matt Gingell <gingell@google.com>
[A collage of two patches from Matt. - Paolo]
Fixes: 1c1a9ce973a7863dd46767226bce2a5f12d48bc6
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 00462bd63129..46ed8edad793 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2763,6 +2763,12 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
return 0;
}
+static int kvm_cpu_accept_dm_intr(struct kvm_vcpu *vcpu)
+{
+ return (!lapic_in_kernel(vcpu) ||
+ kvm_apic_accept_pic_intr(vcpu));
+}
+
static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
struct kvm_interrupt *irq)
{
@@ -5921,12 +5927,16 @@ static int dm_request_for_irq_injection(struct kvm_vcpu *vcpu)
if (!vcpu->run->request_interrupt_window || pic_in_kernel(vcpu->kvm))
return false;
+ if (!kvm_arch_interrupt_allowed(vcpu))
+ return false;
+
if (kvm_cpu_has_interrupt(vcpu))
return false;
- return (irqchip_split(vcpu->kvm)
- ? kvm_apic_accept_pic_intr(vcpu)
- : kvm_arch_interrupt_allowed(vcpu));
+ if (kvm_event_needs_reinjection(vcpu))
+ return false;
+
+ return kvm_cpu_accept_dm_intr(vcpu);
}
static void post_kvm_run_save(struct kvm_vcpu *vcpu)
@@ -5937,17 +5947,12 @@ static void post_kvm_run_save(struct kvm_vcpu *vcpu)
kvm_run->flags = is_smm(vcpu) ? KVM_RUN_X86_SMM : 0;
kvm_run->cr8 = kvm_get_cr8(vcpu);
kvm_run->apic_base = kvm_get_apic_base(vcpu);
- if (!irqchip_in_kernel(vcpu->kvm))
- kvm_run->ready_for_interrupt_injection =
- kvm_arch_interrupt_allowed(vcpu) &&
- !kvm_cpu_has_interrupt(vcpu) &&
- !kvm_event_needs_reinjection(vcpu);
- else if (!pic_in_kernel(vcpu->kvm))
- kvm_run->ready_for_interrupt_injection =
- kvm_apic_accept_pic_intr(vcpu) &&
- !kvm_cpu_has_interrupt(vcpu);
- else
- kvm_run->ready_for_interrupt_injection = 1;
+ kvm_run->ready_for_interrupt_injection =
+ pic_in_kernel(vcpu->kvm) ||
+ (kvm_arch_interrupt_allowed(vcpu) &&
+ !kvm_cpu_has_interrupt(vcpu) &&
+ !kvm_event_needs_reinjection(vcpu) &&
+ kvm_cpu_accept_dm_intr(vcpu));
}
static void update_cr8_intercept(struct kvm_vcpu *vcpu)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: FAILED: patch "[PATCH] KVM: x86: fix interrupt window handling in split IRQ chip" failed to apply to 4.3-stable tree
2015-12-07 7:37 FAILED: patch "[PATCH] KVM: x86: fix interrupt window handling in split IRQ chip" failed to apply to 4.3-stable tree gregkh
@ 2015-12-07 23:27 ` Matt Gingell
2015-12-07 23:32 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Matt Gingell @ 2015-12-07 23:27 UTC (permalink / raw)
To: gregkh; +Cc: pbonzini, stable
These can wait for 4.4.
Thanks,
Matt
> On Dec 6, 2015, at 11:37 PM, <gregkh@linuxfoundation.org> <gregkh@linuxfoundation.org> wrote:
>
>
> The patch below does not apply to the 4.3-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
>
> thanks,
>
> greg k-h
>
> ------------------ original commit in Linus's tree ------------------
>
> From 127a457acb2131fdb31c68c98cf11eda8ba7b380 Mon Sep 17 00:00:00 2001
> From: Matt Gingell <gingell@google.com>
> Date: Tue, 17 Nov 2015 17:32:05 +0100
> Subject: [PATCH] KVM: x86: fix interrupt window handling in split IRQ chip
> case
>
> This patch ensures that dm_request_for_irq_injection and
> post_kvm_run_save are in sync, avoiding that an endless ping-pong
> between userspace (who correctly notices that IF=0) and
> the kernel (who insists that userspace handles its request
> for the interrupt window).
>
> To synchronize them, it also adds checks for kvm_arch_interrupt_allowed
> and !kvm_event_needs_reinjection. These are always needed, not
> just for in-kernel LAPIC.
>
> Signed-off-by: Matt Gingell <gingell@google.com>
> [A collage of two patches from Matt. - Paolo]
> Fixes: 1c1a9ce973a7863dd46767226bce2a5f12d48bc6
> Cc: stable@vger.kernel.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 00462bd63129..46ed8edad793 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2763,6 +2763,12 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
> return 0;
> }
>
> +static int kvm_cpu_accept_dm_intr(struct kvm_vcpu *vcpu)
> +{
> + return (!lapic_in_kernel(vcpu) ||
> + kvm_apic_accept_pic_intr(vcpu));
> +}
> +
> static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
> struct kvm_interrupt *irq)
> {
> @@ -5921,12 +5927,16 @@ static int dm_request_for_irq_injection(struct kvm_vcpu *vcpu)
> if (!vcpu->run->request_interrupt_window || pic_in_kernel(vcpu->kvm))
> return false;
>
> + if (!kvm_arch_interrupt_allowed(vcpu))
> + return false;
> +
> if (kvm_cpu_has_interrupt(vcpu))
> return false;
>
> - return (irqchip_split(vcpu->kvm)
> - ? kvm_apic_accept_pic_intr(vcpu)
> - : kvm_arch_interrupt_allowed(vcpu));
> + if (kvm_event_needs_reinjection(vcpu))
> + return false;
> +
> + return kvm_cpu_accept_dm_intr(vcpu);
> }
>
> static void post_kvm_run_save(struct kvm_vcpu *vcpu)
> @@ -5937,17 +5947,12 @@ static void post_kvm_run_save(struct kvm_vcpu *vcpu)
> kvm_run->flags = is_smm(vcpu) ? KVM_RUN_X86_SMM : 0;
> kvm_run->cr8 = kvm_get_cr8(vcpu);
> kvm_run->apic_base = kvm_get_apic_base(vcpu);
> - if (!irqchip_in_kernel(vcpu->kvm))
> - kvm_run->ready_for_interrupt_injection =
> - kvm_arch_interrupt_allowed(vcpu) &&
> - !kvm_cpu_has_interrupt(vcpu) &&
> - !kvm_event_needs_reinjection(vcpu);
> - else if (!pic_in_kernel(vcpu->kvm))
> - kvm_run->ready_for_interrupt_injection =
> - kvm_apic_accept_pic_intr(vcpu) &&
> - !kvm_cpu_has_interrupt(vcpu);
> - else
> - kvm_run->ready_for_interrupt_injection = 1;
> + kvm_run->ready_for_interrupt_injection =
> + pic_in_kernel(vcpu->kvm) ||
> + (kvm_arch_interrupt_allowed(vcpu) &&
> + !kvm_cpu_has_interrupt(vcpu) &&
> + !kvm_event_needs_reinjection(vcpu) &&
> + kvm_cpu_accept_dm_intr(vcpu));
> }
>
> static void update_cr8_intercept(struct kvm_vcpu *vcpu)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FAILED: patch "[PATCH] KVM: x86: fix interrupt window handling in split IRQ chip" failed to apply to 4.3-stable tree
2015-12-07 23:27 ` Matt Gingell
@ 2015-12-07 23:32 ` Greg KH
2015-12-09 14:57 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2015-12-07 23:32 UTC (permalink / raw)
To: Matt Gingell; +Cc: pbonzini, stable
On Mon, Dec 07, 2015 at 03:27:20PM -0800, Matt Gingell wrote:
> These can wait for 4.4.
Then why were they marked for stable?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FAILED: patch "[PATCH] KVM: x86: fix interrupt window handling in split IRQ chip" failed to apply to 4.3-stable tree
2015-12-07 23:32 ` Greg KH
@ 2015-12-09 14:57 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2015-12-09 14:57 UTC (permalink / raw)
To: Greg KH, Matt Gingell; +Cc: stable
On 08/12/2015 00:32, Greg KH wrote:
> On Mon, Dec 07, 2015 at 03:27:20PM -0800, Matt Gingell wrote:
>> These can wait for 4.4.
>
> Then why were they marked for stable?
Even though the bugs were found while testing a new feature in 4.4, the
bug exists in 4.3 as well. The patches don't apply because of the
context changes caused by the new feature.
I'll do the backport and post them to stable@vger.kernel.org.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-12-09 14:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-07 7:37 FAILED: patch "[PATCH] KVM: x86: fix interrupt window handling in split IRQ chip" failed to apply to 4.3-stable tree gregkh
2015-12-07 23:27 ` Matt Gingell
2015-12-07 23:32 ` Greg KH
2015-12-09 14:57 ` Paolo Bonzini
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).