All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Chen, Tiejun" <tiejun.chen@intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] kvm: x86: remove vmx_vm_has_apicv() outside of hwapic_isr_update()
Date: Fri, 19 Dec 2014 12:12:26 +0100	[thread overview]
Message-ID: <5494081A.7020601@redhat.com> (raw)
In-Reply-To: <54938E4F.7060105@intel.com>



On 19/12/2014 03:32, Chen, Tiejun wrote:
> 
> Are you saying something below?
> 
> if (enable_apicv)
>     ...
> else {
>     kvm_x86_ops->hwapic_irr_update = NULL;

Yes.

> But this means we have to revise hadware_setup() to get 'kvm' inside,

This would not even be possible, since hardware_setup() is only called once.

However, for the only caller of hwapic_isr_update (but presumably all of
them, as is the case for hwapic_irr_update), you already know that
irqchip_in_kernel(kvm) is true.  You are in kvm_apic_post_state_restore,
which takes a kvm_lapic_state, and no lapic exists if
!irqchip_in_kernel(kvm).

(Yes, irqchip_in_kernel) is a bit weird and tests pic_irqchip(kvm)
instead, but it's the same.  It tests pic_irqchip(kvm) only because the
LAPIC is per-cpu and irqchip_in_kernel takes a struct kvm).

So it's possible to NULL out hwapic_isr_update in hardware_setup.  It
simply shouldn't happen that you call hwapic_isr_update without the
in-kernel irqchip.  The kernel knows nothing about ISR/IRR without the
in-kernel irqchip.

Paolo

> then rebase other callers to hwapic_isr_update(), is it really good?

  reply	other threads:[~2014-12-19 11:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01  9:28 [PATCH] kvm: x86: remove vmx_vm_has_apicv() outside of hwapic_isr_update() Tiejun Chen
2014-12-01 11:43 ` Paolo Bonzini
2014-12-19  2:32   ` Chen, Tiejun
2014-12-19 11:12     ` Paolo Bonzini [this message]
2014-12-22  9:01       ` Chen, Tiejun
2014-12-22  9:33         ` Paolo Bonzini

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=5494081A.7020601@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=tiejun.chen@intel.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.