<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/arch/x86/kvm/irq.c, branch v4.14</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v4.14</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v4.14'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2017-04-12T18:17:13+00:00</updated>
<entry>
<title>KVM: x86: get rid of pic_irqchip()</title>
<updated>2017-04-12T18:17:13+00:00</updated>
<author>
<name>David Hildenbrand</name>
<email>david@redhat.com</email>
</author>
<published>2017-04-07T08:50:23+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=90bca0529e1bc94fd36659217603e8a1c3f9ad83'/>
<id>urn:sha1:90bca0529e1bc94fd36659217603e8a1c3f9ad83</id>
<content type='text'>
It seemed like a nice idea to encapsulate access to kvm-&gt;arch.vpic. But
as the usage is already mixed, internal locks are taken outside of i8259.c
and grepping for "vpic" only is much easier, let's just get rid of
pic_irqchip().

Signed-off-by: David Hildenbrand &lt;david@redhat.com&gt;
Signed-off-by: Radim Krčmář &lt;rkrcmar@redhat.com&gt;
</content>
</entry>
<entry>
<title>x86/kvm: Audit and remove any unnecessary uses of module.h</title>
<updated>2016-07-14T13:07:00+00:00</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2016-07-14T00:19:00+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=1767e931e3c3024b1f0d115082179191f5d652c2'/>
<id>urn:sha1:1767e931e3c3024b1f0d115082179191f5d652c2</id>
<content type='text'>
Historically a lot of these existed because we did not have
a distinction between what was modular code and what was providing
support to modules via EXPORT_SYMBOL and friends.  That changed
when we forked out support for the latter into the export.h file.

This means we should be able to reduce the usage of module.h
in code that is obj-y Makefile or bool Kconfig.  In the case of
kvm where it is modular, we can extend that to also include files
that are building basic support functionality but not related
to loading or registering the final module; such files also have
no need whatsoever for module.h

The advantage in removing such instances is that module.h itself
sources about 15 other headers; adding significantly to what we feed
cpp, and it can obscure what headers we are effectively using.

Since module.h was the source for init.h (for __init) and for
export.h (for EXPORT_SYMBOL) we consider each instance for the
presence of either and replace as needed.

Several instances got replaced with moduleparam.h since that was
really all that was required for those particular files.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
Acked-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Radim Krčmář &lt;rkrcmar@redhat.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: kvm@vger.kernel.org
Link: http://lkml.kernel.org/r/20160714001901.31603-8-paul.gortmaker@windriver.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: x86: consolidate "has lapic" checks into irq.c</title>
<updated>2016-02-09T15:57:39+00:00</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2016-01-08T12:41:16+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=1e3161b4147caf2045ac4aae3d71fae6ac1a1d65'/>
<id>urn:sha1:1e3161b4147caf2045ac4aae3d71fae6ac1a1d65</id>
<content type='text'>
Do for kvm_cpu_has_pending_timer and kvm_inject_pending_timer_irqs
what the other irq.c routines have been doing.

Reviewed-by: Radim Krčmář &lt;rkrcmar@redhat.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>kvm/x86: per-vcpu apicv deactivation support</title>
<updated>2015-11-25T16:24:21+00:00</updated>
<author>
<name>Andrey Smetanin</name>
<email>asmetanin@virtuozzo.com</email>
</author>
<published>2015-11-10T12:36:33+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=d62caabb41f33d96333f9ef15e09cd26e1c12760'/>
<id>urn:sha1:d62caabb41f33d96333f9ef15e09cd26e1c12760</id>
<content type='text'>
The decision on whether to use hardware APIC virtualization used to be
taken globally, based on the availability of the feature in the CPU
and the value of a module parameter.

However, under certain circumstances we want to control it on per-vcpu
basis.  In particular, when the userspace activates HyperV synthetic
interrupt controller (SynIC), APICv has to be disabled as it's
incompatible with SynIC auto-EOI behavior.

To achieve that, introduce 'apicv_active' flag on struct
kvm_vcpu_arch, and kvm_vcpu_deactivate_apicv() function to turn APICv
off.  The flag is initialized based on the module parameter and CPU
capability, and consulted whenever an APICv-specific action is
performed.

Signed-off-by: Andrey Smetanin &lt;asmetanin@virtuozzo.com&gt;
Reviewed-by: Roman Kagan &lt;rkagan@virtuozzo.com&gt;
Signed-off-by: Denis V. Lunev &lt;den@openvz.org&gt;
CC: Gleb Natapov &lt;gleb@kernel.org&gt;
CC: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
CC: Roman Kagan &lt;rkagan@virtuozzo.com&gt;
CC: Denis V. Lunev &lt;den@openvz.org&gt;
CC: qemu-devel@nongnu.org
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: x86: Add support for local interrupt requests from userspace</title>
<updated>2015-10-01T13:06:29+00:00</updated>
<author>
<name>Steve Rutherford</name>
<email>srutherford@google.com</email>
</author>
<published>2015-07-30T09:27:16+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=1c1a9ce973a7863dd46767226bce2a5f12d48bc6'/>
<id>urn:sha1:1c1a9ce973a7863dd46767226bce2a5f12d48bc6</id>
<content type='text'>
In order to enable userspace PIC support, the userspace PIC needs to
be able to inject local interrupts even when the APICs are in the
kernel.

KVM_INTERRUPT now supports sending local interrupts to an APIC when
APICs are in the kernel.

The ready_for_interrupt_request flag is now only set when the CPU/APIC
will immediately accept and inject an interrupt (i.e. APIC has not
masked the PIC).

When the PIC wishes to initiate an INTA cycle with, say, CPU0, it
kicks CPU0 out of the guest, and renedezvous with CPU0 once it arrives
in userspace.

When the CPU/APIC unmasks the PIC, a KVM_EXIT_IRQ_WINDOW_OPEN is
triggered, so that userspace has a chance to inject a PIC interrupt
if it had been pending.

Overall, this design can lead to a small number of spurious userspace
renedezvous. In particular, whenever the PIC transistions from low to
high while it is masked and whenever the PIC becomes unmasked while
it is low.

Note: this does not buffer more than one local interrupt in the
kernel, so the VMM needs to enter the guest in order to complete
interrupt injection before injecting an additional interrupt.

Compiles for x86.

Can pass the KVM Unit Tests.

Signed-off-by: Steve Rutherford &lt;srutherford@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: x86: introduce lapic_in_kernel</title>
<updated>2015-10-01T13:06:25+00:00</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2015-07-29T10:05:37+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=35754c987f252e859bfa390a6816e85563afe79d'/>
<id>urn:sha1:35754c987f252e859bfa390a6816e85563afe79d</id>
<content type='text'>
Avoid pointer chasing and memory barriers, and simplify the code
when split irqchip (LAPIC in kernel, IOAPIC/PIC in userspace)
is introduced.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: x86: replace vm_has_apicv hook with cpu_uses_apicv</title>
<updated>2015-10-01T13:06:24+00:00</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2015-07-29T09:49:59+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=d50ab6c1a2b24e12d3012d7beb343eba5b94a6ca'/>
<id>urn:sha1:d50ab6c1a2b24e12d3012d7beb343eba5b94a6ca</id>
<content type='text'>
This will avoid an unnecessary trip to -&gt;kvm and from there to the VPIC.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: nVMX: fix "acknowledge interrupt on exit" when APICv is in use</title>
<updated>2014-08-05T13:00:24+00:00</updated>
<author>
<name>Wanpeng Li</name>
<email>wanpeng.li@linux.intel.com</email>
</author>
<published>2014-08-05T04:42:24+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=56cc2406d68c0f09505c389e276f27a99f495cbd'/>
<id>urn:sha1:56cc2406d68c0f09505c389e276f27a99f495cbd</id>
<content type='text'>
After commit 77b0f5d (KVM: nVMX: Ack and write vector info to intr_info
if L1 asks us to), "Acknowledge interrupt on exit" behavior can be
emulated. To do so, KVM will ask the APIC for the interrupt vector if
during a nested vmexit if VM_EXIT_ACK_INTR_ON_EXIT is set.  With APICv,
kvm_get_apic_interrupt would return -1 and give the following WARNING:

Call Trace:
 [&lt;ffffffff81493563&gt;] dump_stack+0x49/0x5e
 [&lt;ffffffff8103f0eb&gt;] warn_slowpath_common+0x7c/0x96
 [&lt;ffffffffa059709a&gt;] ? nested_vmx_vmexit+0xa4/0x233 [kvm_intel]
 [&lt;ffffffff8103f11a&gt;] warn_slowpath_null+0x15/0x17
 [&lt;ffffffffa059709a&gt;] nested_vmx_vmexit+0xa4/0x233 [kvm_intel]
 [&lt;ffffffffa0594295&gt;] ? nested_vmx_exit_handled+0x6a/0x39e [kvm_intel]
 [&lt;ffffffffa0537931&gt;] ? kvm_apic_has_interrupt+0x80/0xd5 [kvm]
 [&lt;ffffffffa05972ec&gt;] vmx_check_nested_events+0xc3/0xd3 [kvm_intel]
 [&lt;ffffffffa051ebe9&gt;] inject_pending_event+0xd0/0x16e [kvm]
 [&lt;ffffffffa051efa0&gt;] vcpu_enter_guest+0x319/0x704 [kvm]

To fix this, we cannot rely on the processor's virtual interrupt delivery,
because "acknowledge interrupt on exit" must only update the virtual
ISR/PPR/IRR registers (and SVI, which is just a cache of the virtual ISR)
but it should not deliver the interrupt through the IDT.  Thus, KVM has
to deliver the interrupt "by hand", similar to the treatment of EOI in
commit fc57ac2c9ca8 (KVM: lapic: sync highest ISR to hardware apic on
EOI, 2014-05-14).

The patch modifies kvm_cpu_get_interrupt to always acknowledge an
interrupt; there are only two callers, and the other is not affected
because it is never reached with kvm_apic_vid_enabled() == true.  Then it
modifies apic_set_isr and apic_clear_irr to update SVI and RVI in addition
to the registers.

Suggested-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Suggested-by: "Zhang, Yang Z" &lt;yang.z.zhang@intel.com&gt;
Tested-by: Liu, RongrongX &lt;rongrongx.liu@intel.com&gt;
Tested-by: Felipe Reyes &lt;freyes@suse.com&gt;
Fixes: 77b0f5d67ff2781f36831cba79674c3e97bd7acf
Cc: stable@vger.kernel.org
Signed-off-by: Wanpeng Li &lt;wanpeng.li@linux.intel.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: nVMX: Ack and write vector info to intr_info if L1 asks us to</title>
<updated>2014-04-22T21:41:33+00:00</updated>
<author>
<name>Bandan Das</name>
<email>bsd@redhat.com</email>
</author>
<published>2014-04-19T22:17:45+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=77b0f5d67ff2781f36831cba79674c3e97bd7acf'/>
<id>urn:sha1:77b0f5d67ff2781f36831cba79674c3e97bd7acf</id>
<content type='text'>
This feature emulates the "Acknowledge interrupt on exit" behavior.
We can safely emulate it for L1 to run L2 even if L0 itself has it
disabled (to run L1).

Signed-off-by: Bandan Das &lt;bsd@redhat.com&gt;
Signed-off-by: Marcelo Tosatti &lt;mtosatti@redhat.com&gt;
</content>
</entry>
<entry>
<title>x86, apicv: add virtual interrupt delivery support</title>
<updated>2013-01-29T08:48:19+00:00</updated>
<author>
<name>Yang Zhang</name>
<email>yang.z.zhang@Intel.com</email>
</author>
<published>2013-01-25T02:18:51+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=c7c9c56ca26f7b9458711b2d78b60b60e0d38ba7'/>
<id>urn:sha1:c7c9c56ca26f7b9458711b2d78b60b60e0d38ba7</id>
<content type='text'>
Virtual interrupt delivery avoids KVM to inject vAPIC interrupts
manually, which is fully taken care of by the hardware. This needs
some special awareness into existing interrupr injection path:

- for pending interrupt, instead of direct injection, we may need
  update architecture specific indicators before resuming to guest.

- A pending interrupt, which is masked by ISR, should be also
  considered in above update action, since hardware will decide
  when to inject it at right time. Current has_interrupt and
  get_interrupt only returns a valid vector from injection p.o.v.

Reviewed-by: Marcelo Tosatti &lt;mtosatti@redhat.com&gt;
Signed-off-by: Kevin Tian &lt;kevin.tian@intel.com&gt;
Signed-off-by: Yang Zhang &lt;yang.z.zhang@Intel.com&gt;
Signed-off-by: Gleb Natapov &lt;gleb@redhat.com&gt;
</content>
</entry>
</feed>
