<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/virt/kvm, branch v4.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.3</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2015-10-20T16:09:13Z</updated>
<entry>
<title>arm/arm64: KVM: Fix disabled distributor operation</title>
<updated>2015-10-20T16:09:13Z</updated>
<author>
<name>Christoffer Dall</name>
<email>christoffer.dall@linaro.org</email>
</author>
<published>2015-10-17T17:05:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0d997491f814c87310a6ad7be30a9049c7150489'/>
<id>urn:sha1:0d997491f814c87310a6ad7be30a9049c7150489</id>
<content type='text'>
We currently do a single update of the vgic state when the distributor
enable/disable control register is accessed and then bypass updating the
state for as long as the distributor remains disabled.

This is incorrect, because updating the state does not consider the
distributor enable bit, and this you can end up in a situation where an
interrupt is marked as pending on the CPU interface, but not pending on
the distributor, which is an impossible state to be in, and triggers a
warning.  Consider for example the following sequence of events:

1. An interrupt is marked as pending on the distributor
   - the interrupt is also forwarded to the CPU interface
2. The guest turns off the distributor (it's about to do a reboot)
   - we stop updating the CPU interface state from now on
3. The guest disables the pending interrupt
   - we remove the pending state from the distributor, but don't touch
     the CPU interface, see point 2.

Since the distributor disable bit really means that no interrupts should
be forwarded to the CPU interface, we modify the code to keep updating
the internal VGIC state, but always set the CPU interface pending bits
to zero when the distributor is disabled.

Signed-off-by: Christoffer Dall &lt;christoffer.dall@linaro.org&gt;
</content>
</entry>
<entry>
<title>arm/arm64: KVM: Clear map-&gt;active on pend/active clear</title>
<updated>2015-10-20T16:06:34Z</updated>
<author>
<name>Christoffer Dall</name>
<email>christoffer.dall@linaro.org</email>
</author>
<published>2015-10-17T15:55:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=544c572e03174438b6656ed24a4516b9a9d5f14a'/>
<id>urn:sha1:544c572e03174438b6656ed24a4516b9a9d5f14a</id>
<content type='text'>
When a guest reboots or offlines/onlines CPUs, it is not uncommon for it
to clear the pending and active states of an interrupt through the
emulated VGIC distributor.  However, since the architected timers are
defined by the architecture to be level triggered and the guest
rightfully expects them to be that, but we emulate them as
edge-triggered, we have to mimic level-triggered behavior for an
edge-triggered virtual implementation.

We currently do not signal the VGIC when the map-&gt;active field is true,
because it indicates that the guest has already been signalled of the
interrupt as required.  Normally this field is set to false when the
guest deactivates the virtual interrupt through the sync path.

We also need to catch the case where the guest deactivates the interrupt
through the emulated distributor, again allowing guests to boot even if
the original virtual timer signal hit before the guest's GIC
initialization sequence is run.

Reviewed-by: Eric Auger &lt;eric.auger@linaro.org&gt;
Signed-off-by: Christoffer Dall &lt;christoffer.dall@linaro.org&gt;
</content>
</entry>
<entry>
<title>arm/arm64: KVM: Fix arch timer behavior for disabled interrupts</title>
<updated>2015-10-20T16:04:54Z</updated>
<author>
<name>Christoffer Dall</name>
<email>christoffer.dall@linaro.org</email>
</author>
<published>2015-10-16T10:41:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cff9211eb1a1f58ce7f5a2d596b617928fd4be0e'/>
<id>urn:sha1:cff9211eb1a1f58ce7f5a2d596b617928fd4be0e</id>
<content type='text'>
We have an interesting issue when the guest disables the timer interrupt
on the VGIC, which happens when turning VCPUs off using PSCI, for
example.

The problem is that because the guest disables the virtual interrupt at
the VGIC level, we never inject interrupts to the guest and therefore
never mark the interrupt as active on the physical distributor.  The
host also never takes the timer interrupt (we only use the timer device
to trigger a guest exit and everything else is done in software), so the
interrupt does not become active through normal means.

The result is that we keep entering the guest with a programmed timer
that will always fire as soon as we context switch the hardware timer
state and run the guest, preventing forward progress for the VCPU.

Since the active state on the physical distributor is really part of the
timer logic, it is the job of our virtual arch timer driver to manage
this state.

The timer-&gt;map-&gt;active boolean field indicates whether we have signalled
this interrupt to the vgic and if that interrupt is still pending or
active.  As long as that is the case, the hardware doesn't have to
generate physical interrupts and therefore we mark the interrupt as
active on the physical distributor.

We also have to restore the pending state of an interrupt that was
queued to an LR but was retired from the LR for some reason, while
remaining pending in the LR.

Cc: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Reported-by: Lorenzo Pieralisi &lt;lorenzo.pieralisi@arm.com&gt;
Signed-off-by: Christoffer Dall &lt;christoffer.dall@linaro.org&gt;
</content>
</entry>
<entry>
<title>KVM: arm/arm64: Do not inject spurious interrupts</title>
<updated>2015-10-20T16:04:43Z</updated>
<author>
<name>Pavel Fedin</name>
<email>p.fedin@samsung.com</email>
</author>
<published>2015-09-25T14:00:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=437f9963bc4fd75889c1fe9289a92dea9124a439'/>
<id>urn:sha1:437f9963bc4fd75889c1fe9289a92dea9124a439</id>
<content type='text'>
When lowering a level-triggered line from userspace, we forgot to lower
the pending bit on the emulated CPU interface and we also did not
re-compute the pending_on_cpu bitmap for the CPU affected by the change.

Update vgic_update_irq_pending() to fix the two issues above and also
raise a warning in vgic_quue_irq_to_lr if we encounter an interrupt
pending on a CPU which is neither marked active nor pending.

  [ Commit text reworked completely - Christoffer ]

Signed-off-by: Pavel Fedin &lt;p.fedin@samsung.com&gt;
Signed-off-by: Christoffer Dall &lt;christoffer.dall@linaro.org&gt;
</content>
</entry>
<entry>
<title>KVM: disable halt_poll_ns as default for s390x</title>
<updated>2015-09-25T08:31:30Z</updated>
<author>
<name>David Hildenbrand</name>
<email>dahi@linux.vnet.ibm.com</email>
</author>
<published>2015-09-18T10:34:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=920552b213e3dc832a874b4e7ba29ecddbab31bc'/>
<id>urn:sha1:920552b213e3dc832a874b4e7ba29ecddbab31bc</id>
<content type='text'>
We observed some performance degradation on s390x with dynamic
halt polling. Until we can provide a proper fix, let's enable
halt_poll_ns as default only for supported architectures.

Architectures are now free to set their own halt_poll_ns
default value.

Signed-off-by: David Hildenbrand &lt;dahi@linux.vnet.ibm.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'kvm-arm-for-4.3-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into kvm-master</title>
<updated>2015-09-17T14:51:59Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2015-09-17T14:51:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=efe4d36a75d4dfd1a9c161b2bbf9b90beb4d9648'/>
<id>urn:sha1:efe4d36a75d4dfd1a9c161b2bbf9b90beb4d9648</id>
<content type='text'>
Second set of KVM/ARM changes for 4.3-rc2

- Workaround for a Cortex-A57 erratum
- Bug fix for the debugging infrastructure
- Fix for 32bit guests with more than 4GB of address space
  on a 32bit host
- A number of fixes for the (unusual) case when we don't use
  the in-kernel GIC emulation
- Removal of ThumbEE handling on arm64, since these have been
  dropped from the architecture before anyone actually ever
  built a CPU
- Remove the KVM_ARM_MAX_VCPUS limitation which has become
  fairly pointless
</content>
</entry>
<entry>
<title>arm/arm64: KVM: Remove 'config KVM_ARM_MAX_VCPUS'</title>
<updated>2015-09-17T12:13:27Z</updated>
<author>
<name>Ming Lei</name>
<email>ming.lei@canonical.com</email>
</author>
<published>2015-09-02T06:31:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ef748917b529847277f07c98c55e1c0ce416449f'/>
<id>urn:sha1:ef748917b529847277f07c98c55e1c0ce416449f</id>
<content type='text'>
This patch removes config option of KVM_ARM_MAX_VCPUS,
and like other ARCHs, just choose the maximum allowed
value from hardware, and follows the reasons:

1) from distribution view, the option has to be
defined as the max allowed value because it need to
meet all kinds of virtulization applications and
need to support most of SoCs;

2) using a bigger value doesn't introduce extra memory
consumption, and the help text in Kconfig isn't accurate
because kvm_vpu structure isn't allocated until request
of creating VCPU is sent from QEMU;

3) the main effect is that the field of vcpus[] in 'struct kvm'
becomes a bit bigger(sizeof(void *) per vcpu) and need more cache
lines to hold the structure, but 'struct kvm' is one generic struct,
and it has worked well on other ARCHs already in this way. Also,
the world switch frequecy is often low, for example, it is ~2000
when running kernel building load in VM from APM xgene KVM host,
so the effect is very small, and the difference can't be observed
in my test at all.

Cc: Dann Frazier &lt;dann.frazier@canonical.com&gt;
Signed-off-by: Ming Lei &lt;ming.lei@canonical.com&gt;
Reviewed-by: Christoffer Dall &lt;christoffer.dall@linaro.org&gt;
Signed-off-by: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
</content>
</entry>
<entry>
<title>KVM: add halt_attempted_poll to VCPU stats</title>
<updated>2015-09-16T10:17:00Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2015-09-15T16:27:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=62bea5bff486644ecf363fe8a1a2f6f32c614a49'/>
<id>urn:sha1:62bea5bff486644ecf363fe8a1a2f6f32c614a49</id>
<content type='text'>
This new statistic can help diagnosing VCPUs that, for any reason,
trigger bad behavior of halt_poll_ns autotuning.

For example, say halt_poll_ns = 480000, and wakeups are spaced exactly
like 479us, 481us, 479us, 481us. Then KVM always fails polling and wastes
10+20+40+80+160+320+480 = 1110 microseconds out of every
479+481+479+481+479+481+479 = 3359 microseconds. The VCPU then
is consuming about 30% more CPU than it would use without
polling.  This would show as an abnormally high number of
attempted polling compared to the successful polls.

Acked-by: Christian Borntraeger &lt;borntraeger@de.ibm.com&lt;
Reviewed-by: David Matlack &lt;dmatlack@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>kvm: fix zero length mmio searching</title>
<updated>2015-09-15T14:59:46Z</updated>
<author>
<name>Jason Wang</name>
<email>jasowang@redhat.com</email>
</author>
<published>2015-09-15T06:41:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8f4216c7d28976f7ec1b2bcbfa0a9f787133c45e'/>
<id>urn:sha1:8f4216c7d28976f7ec1b2bcbfa0a9f787133c45e</id>
<content type='text'>
Currently, if we had a zero length mmio eventfd assigned on
KVM_MMIO_BUS. It will never be found by kvm_io_bus_cmp() since it
always compares the kvm_io_range() with the length that guest
wrote. This will cause e.g for vhost, kick will be trapped by qemu
userspace instead of vhost. Fixing this by using zero length if an
iodevice is zero length.

Cc: stable@vger.kernel.org
Cc: Gleb Natapov &lt;gleb@kernel.org&gt;
Cc: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Jason Wang &lt;jasowang@redhat.com&gt;
Reviewed-by: Cornelia Huck &lt;cornelia.huck@de.ibm.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>kvm: fix double free for fast mmio eventfd</title>
<updated>2015-09-15T14:59:31Z</updated>
<author>
<name>Jason Wang</name>
<email>jasowang@redhat.com</email>
</author>
<published>2015-09-15T06:41:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=eefd6b06b17c5478e7c24bea6f64beaa2c431ca6'/>
<id>urn:sha1:eefd6b06b17c5478e7c24bea6f64beaa2c431ca6</id>
<content type='text'>
We register wildcard mmio eventfd on two buses, once for KVM_MMIO_BUS
and once on KVM_FAST_MMIO_BUS but with a single iodev
instance. This will lead to an issue: kvm_io_bus_destroy() knows
nothing about the devices on two buses pointing to a single dev. Which
will lead to double free[1] during exit. Fix this by allocating two
instances of iodevs then registering one on KVM_MMIO_BUS and another
on KVM_FAST_MMIO_BUS.

CPU: 1 PID: 2894 Comm: qemu-system-x86 Not tainted 3.19.0-26-generic #28-Ubuntu
Hardware name: LENOVO 2356BG6/2356BG6, BIOS G7ET96WW (2.56 ) 09/12/2013
task: ffff88009ae0c4b0 ti: ffff88020e7f0000 task.ti: ffff88020e7f0000
RIP: 0010:[&lt;ffffffffc07e25d8&gt;]  [&lt;ffffffffc07e25d8&gt;] ioeventfd_release+0x28/0x60 [kvm]
RSP: 0018:ffff88020e7f3bc8  EFLAGS: 00010292
RAX: dead000000200200 RBX: ffff8801ec19c900 RCX: 000000018200016d
RDX: ffff8801ec19cf80 RSI: ffffea0008bf1d40 RDI: ffff8801ec19c900
RBP: ffff88020e7f3bd8 R08: 000000002fc75a01 R09: 000000018200016d
R10: ffffffffc07df6ae R11: ffff88022fc75a98 R12: ffff88021e7cc000
R13: ffff88021e7cca48 R14: ffff88021e7cca50 R15: ffff8801ec19c880
FS:  00007fc1ee3e6700(0000) GS:ffff88023e240000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f8f389d8000 CR3: 000000023dc13000 CR4: 00000000001427e0
Stack:
ffff88021e7cc000 0000000000000000 ffff88020e7f3be8 ffffffffc07e2622
ffff88020e7f3c38 ffffffffc07df69a ffff880232524160 ffff88020e792d80
 0000000000000000 ffff880219b78c00 0000000000000008 ffff8802321686a8
Call Trace:
[&lt;ffffffffc07e2622&gt;] ioeventfd_destructor+0x12/0x20 [kvm]
[&lt;ffffffffc07df69a&gt;] kvm_put_kvm+0xca/0x210 [kvm]
[&lt;ffffffffc07df818&gt;] kvm_vcpu_release+0x18/0x20 [kvm]
[&lt;ffffffff811f69f7&gt;] __fput+0xe7/0x250
[&lt;ffffffff811f6bae&gt;] ____fput+0xe/0x10
[&lt;ffffffff81093f04&gt;] task_work_run+0xd4/0xf0
[&lt;ffffffff81079358&gt;] do_exit+0x368/0xa50
[&lt;ffffffff81082c8f&gt;] ? recalc_sigpending+0x1f/0x60
[&lt;ffffffff81079ad5&gt;] do_group_exit+0x45/0xb0
[&lt;ffffffff81085c71&gt;] get_signal+0x291/0x750
[&lt;ffffffff810144d8&gt;] do_signal+0x28/0xab0
[&lt;ffffffff810f3a3b&gt;] ? do_futex+0xdb/0x5d0
[&lt;ffffffff810b7028&gt;] ? __wake_up_locked_key+0x18/0x20
[&lt;ffffffff810f3fa6&gt;] ? SyS_futex+0x76/0x170
[&lt;ffffffff81014fc9&gt;] do_notify_resume+0x69/0xb0
[&lt;ffffffff817cb9af&gt;] int_signal+0x12/0x17
Code: 5d c3 90 0f 1f 44 00 00 55 48 89 e5 53 48 89 fb 48 83 ec 08 48 8b 7f 20 e8 06 d6 a5 c0 48 8b 43 08 48 8b 13 48 89 df 48 89 42 08 &lt;48&gt; 89 10 48 b8 00 01 10 00 00
 RIP  [&lt;ffffffffc07e25d8&gt;] ioeventfd_release+0x28/0x60 [kvm]
 RSP &lt;ffff88020e7f3bc8&gt;

Cc: stable@vger.kernel.org
Cc: Gleb Natapov &lt;gleb@kernel.org&gt;
Cc: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Jason Wang &lt;jasowang@redhat.com&gt;
Reviewed-by: Cornelia Huck &lt;cornelia.huck@de.ibm.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
</feed>
