From: Steve Rutherford <srutherford@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v7 1/4] KVM: x86: Split the APIC from the rest of IRQCHIP.
Date: Thu, 30 Jul 2015 01:37:39 -0700 [thread overview]
Message-ID: <20150730083739.GB19524@google.com> (raw)
In-Reply-To: <55B9DEA2.1070304@redhat.com>
On Thu, Jul 30, 2015 at 10:21:54AM +0200, Paolo Bonzini wrote:
> Please review this diff:
>
> diff --git b/arch/x86/kvm/irq.h a/arch/x86/kvm/irq.h
> index 72af5a989a2e..975cf33ef306 100644
> --- b/arch/x86/kvm/irq.h
> +++ a/arch/x86/kvm/irq.h
> @@ -93,11 +90,11 @@ static inline int irqchip_split(struct kvm *kvm)
> bool ret;
> struct kvm_pic *vpic = pic_irqchip(kvm);
>
> - /* Read vpic before kvm->irq_routing. */
> - smp_rmb();
> ret = (vpic != NULL);
> ret |= irqchip_split(kvm);
>
> + /* Read vpic before kvm->irq_routing. */
> + smp_rmb();
> return ret;
> }
>
> diff --git b/arch/x86/kvm/lapic.c a/arch/x86/kvm/lapic.c
> index 2f486d8ecdae..a86324ca9cc3 100644
> --- b/arch/x86/kvm/lapic.c
> +++ a/arch/x86/kvm/lapic.c
> @@ -209,7 +209,7 @@ out:
> if (old)
> kfree_rcu(old, rcu);
>
> - if (!irqchip_split(kvm))
> + if (ioapic_in_kernel(kvm))
> kvm_vcpu_request_scan_ioapic(kvm);
> }
>
> @@ -1846,7 +1846,7 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu,
> kvm_x86_ops->hwapic_isr_update(vcpu->kvm,
> apic_find_highest_isr(apic));
> kvm_make_request(KVM_REQ_EVENT, vcpu);
> - if (!ioapic_in_kernel(vcpu->kvm))
> + if (ioapic_in_kernel(vcpu->kvm))
> kvm_rtc_eoi_tracking_restore_one(vcpu);
> }
>
> diff --git b/arch/x86/kvm/x86.c a/arch/x86/kvm/x86.c
> index 49a98608e3f6..5d2b8695732c 100644
> --- b/arch/x86/kvm/x86.c
> +++ a/arch/x86/kvm/x86.c
> @@ -3573,16 +3573,14 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
> r = -EEXIST;
> if (irqchip_in_kernel(kvm))
> goto split_irqchip_unlock;
> - if (!irqchip_split(kvm)) {
> - if (atomic_read(&kvm->online_vcpus))
> - goto split_irqchip_unlock;
> - r = kvm_setup_empty_irq_routing(kvm);
> - if (r)
> - goto split_irqchip_unlock;
> - /* Pairs with irqchip_in_kernel. */
> - smp_wmb();
> - kvm->arch.irqchip_split = true;
> - }
> + if (atomic_read(&kvm->online_vcpus))
> + goto split_irqchip_unlock;
> + r = kvm_setup_empty_irq_routing(kvm);
> + if (r)
> + goto split_irqchip_unlock;
> + /* Pairs with irqchip_in_kernel. */
> + smp_wmb();
> + kvm->arch.irqchip_split = true;
This looks a bit non-sensical, but is overprepared for the introduction
IOAPIC hotplug, which two patches down the line. Changing it is fine,
you'll just need to merge the very same change back.
> r = 0;
> split_irqchip_unlock:
> mutex_unlock(&kvm->lock);
> @@ -3701,7 +3699,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
> }
>
> r = -ENXIO;
> - if (!irqchip_in_kernel(kvm) || !ioapic_in_kernel(kvm))
> + if (!irqchip_in_kernel(kvm) || irqchip_split(kvm))
> goto get_irqchip_out;
> r = kvm_vm_ioctl_get_irqchip(kvm, chip);
> if (r)
> @@ -3725,7 +3723,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
> }
>
> r = -ENXIO;
> - if (!irqchip_in_kernel(kvm) || !ioapic_in_kernel(kvm))
> + if (!irqchip_in_kernel(kvm) || irqchip_split(kvm))
> goto set_irqchip_out;
> r = kvm_vm_ioctl_set_irqchip(kvm, chip);
> if (r)
>
> No need to resend.
>
> Paolo
Looks good.
next prev parent reply other threads:[~2015-07-30 8:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-30 6:21 [PATCH v7 1/4] KVM: x86: Split the APIC from the rest of IRQCHIP Steve Rutherford
2015-07-30 6:21 ` [PATCH v7 2/4] KVM: x86: Add KVM exit for IOAPIC EOIs Steve Rutherford
2015-07-30 6:21 ` [PATCH v7 3/4] KVM: x86: Add EOI exit bitmap inference Steve Rutherford
2015-07-30 6:21 ` [PATCH v7 4/4] KVM: x86: Add support for local interrupt requests from userspace Steve Rutherford
2015-07-30 8:21 ` Paolo Bonzini
2015-07-30 9:33 ` Paolo Bonzini
2015-07-30 8:21 ` [PATCH v7 1/4] KVM: x86: Split the APIC from the rest of IRQCHIP Paolo Bonzini
2015-07-30 8:37 ` Steve Rutherford [this message]
2015-07-30 9:38 ` Paolo Bonzini
2015-07-30 21:19 ` Steve Rutherford
2015-07-31 8:32 ` Jan Kiszka
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=20150730083739.GB19524@google.com \
--to=srutherford@google.com \
--cc=kvm@vger.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 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.