<feed xmlns='http://www.w3.org/2005/Atom'>
<title>bwlp/qemu.git/accel/kvm, branch spice_video_codecs</title>
<subtitle>Experimental fork of QEMU with video encoding patches</subtitle>
<id>https://git.openslx.org/bwlp/qemu.git/atom/accel/kvm?h=spice_video_codecs</id>
<link rel='self' href='https://git.openslx.org/bwlp/qemu.git/atom/accel/kvm?h=spice_video_codecs'/>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/'/>
<updated>2022-10-11T07:36:00+00:00</updated>
<entry>
<title>i386: add notify VM exit support</title>
<updated>2022-10-11T07:36:00+00:00</updated>
<author>
<name>Chenyi Qiang</name>
</author>
<published>2022-09-29T07:20:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=e2e69f6bb907a70ac518230c54e98e7abcb0c911'/>
<id>urn:sha1:e2e69f6bb907a70ac518230c54e98e7abcb0c911</id>
<content type='text'>
There are cases that malicious virtual machine can cause CPU stuck (due
to event windows don't open up), e.g., infinite loop in microcode when
nested #AC (CVE-2015-5307). No event window means no event (NMI, SMI and
IRQ) can be delivered. It leads the CPU to be unavailable to host or
other VMs. Notify VM exit is introduced to mitigate such kind of
attacks, which will generate a VM exit if no event window occurs in VM
non-root mode for a specified amount of time (notify window).

A new KVM capability KVM_CAP_X86_NOTIFY_VMEXIT is exposed to user space
so that the user can query the capability and set the expected notify
window when creating VMs. The format of the argument when enabling this
capability is as follows:
  Bit 63:32 - notify window specified in qemu command
  Bit 31:0  - some flags (e.g. KVM_X86_NOTIFY_VMEXIT_ENABLED is set to
              enable the feature.)

Users can configure the feature by a new (x86 only) accel property:
    qemu -accel kvm,notify-vmexit=run|internal-error|disable,notify-window=n

The default option of notify-vmexit is run, which will enable the
capability and do nothing if the exit happens. The internal-error option
raises a KVM internal error if it happens. The disable option does not
enable the capability. The default value of notify-window is 0. It is valid
only when notify-vmexit is not disabled. The valid range of notify-window
is non-negative. It is even safe to set it to zero since there's an
internal hardware threshold to be added to ensure no false positive.

Because a notify VM exit may happen with VM_CONTEXT_INVALID set in exit
qualification (no cases are anticipated that would set this bit), which
means VM context is corrupted. It would be reflected in the flags of
KVM_EXIT_NOTIFY exit. If KVM_NOTIFY_CONTEXT_INVALID bit is set, raise a KVM
internal error unconditionally.

Acked-by: Peter Xu &lt;peterx@redhat.com&gt;
Signed-off-by: Chenyi Qiang &lt;chenyi.qiang@intel.com&gt;
Message-Id: &lt;20220929072014.20705-5-chenyi.qiang@intel.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>kvm: expose struct KVMState</title>
<updated>2022-10-11T07:36:00+00:00</updated>
<author>
<name>Chenyi Qiang</name>
</author>
<published>2022-09-29T07:20:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=5f8a6bce1f1080058ed29d716cae81ea805142ae'/>
<id>urn:sha1:5f8a6bce1f1080058ed29d716cae81ea805142ae</id>
<content type='text'>
Expose struct KVMState out of kvm-all.c so that the field of struct
KVMState can be accessed when defining target-specific accelerator
properties.

Signed-off-by: Chenyi Qiang &lt;chenyi.qiang@intel.com&gt;
Message-Id: &lt;20220929072014.20705-4-chenyi.qiang@intel.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>kvm: allow target-specific accelerator properties</title>
<updated>2022-10-10T07:23:16+00:00</updated>
<author>
<name>Paolo Bonzini</name>
</author>
<published>2022-09-29T07:20:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=3dba0a335cf5c53146b606be6ddfab4df81c464e'/>
<id>urn:sha1:3dba0a335cf5c53146b606be6ddfab4df81c464e</id>
<content type='text'>
Several hypervisor capabilities in KVM are target-specific.  When exposed
to QEMU users as accelerator properties (i.e. -accel kvm,prop=value), they
should not be available for all targets.

Add a hook for targets to add their own properties to -accel kvm, for
now no such property is defined.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Message-Id: &lt;20220929072014.20705-3-chenyi.qiang@intel.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>accel/kvm: move kvm_update_guest_debug to inline stub</title>
<updated>2022-10-06T10:53:41+00:00</updated>
<author>
<name>Alex Bennée</name>
</author>
<published>2022-09-29T11:42:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=c7f1c5373507de48250dcff3487787a674a0ac5e'/>
<id>urn:sha1:c7f1c5373507de48250dcff3487787a674a0ac5e</id>
<content type='text'>
Signed-off-by: Alex Bennée &lt;alex.bennee@linaro.org&gt;
Message-Id: &lt;20220929114231.583801-47-alex.bennee@linaro.org&gt;
</content>
</entry>
<entry>
<title>gdbstub: move guest debug support check to ops</title>
<updated>2022-10-06T10:53:41+00:00</updated>
<author>
<name>Alex Bennée</name>
</author>
<published>2022-09-29T11:42:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=a48e7d9e52f8fe8b47f4c74f3e99d9d677b87fe5'/>
<id>urn:sha1:a48e7d9e52f8fe8b47f4c74f3e99d9d677b87fe5</id>
<content type='text'>
This removes the final hard coding of kvm_enabled() in gdbstub and
moves the check to an AccelOps.

Reviewed-by: Philippe Mathieu-Daudé &lt;f4bug@amsat.org&gt;
Signed-off-by: Alex Bennée &lt;alex.bennee@linaro.org&gt;
Reviewed-by: Mads Ynddal &lt;mads@ynddal.dk&gt;
Message-Id: &lt;20220929114231.583801-46-alex.bennee@linaro.org&gt;
</content>
</entry>
<entry>
<title>gdbstub: move breakpoint logic to accel ops</title>
<updated>2022-10-06T10:53:41+00:00</updated>
<author>
<name>Alex Bennée</name>
</author>
<published>2022-09-29T11:42:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=ae7467b1ac49e10c548099e9f9c59af895af2d3f'/>
<id>urn:sha1:ae7467b1ac49e10c548099e9f9c59af895af2d3f</id>
<content type='text'>
As HW virtualization requires specific support to handle breakpoints
lets push out special casing out of the core gdbstub code and into
AccelOpsClass. This will make it easier to add other accelerator
support and reduces some of the stub shenanigans.

Reviewed-by: Richard Henderson &lt;richard.henderson@linaro.org&gt;
Signed-off-by: Alex Bennée &lt;alex.bennee@linaro.org&gt;
Reviewed-by: Mads Ynddal &lt;mads@ynddal.dk&gt;
Message-Id: &lt;20220929114231.583801-45-alex.bennee@linaro.org&gt;
</content>
</entry>
<entry>
<title>gdbstub: move sstep flags probing into AccelClass</title>
<updated>2022-10-06T10:53:41+00:00</updated>
<author>
<name>Alex Bennée</name>
</author>
<published>2022-09-29T11:42:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=3b7a93880a88fb2e3c0e71378a7d39d25103d734'/>
<id>urn:sha1:3b7a93880a88fb2e3c0e71378a7d39d25103d734</id>
<content type='text'>
The support of single-stepping is very much dependent on support from
the accelerator we are using. To avoid special casing in gdbstub move
the probing out to an AccelClass function so future accelerators can
put their code there.

Reviewed-by: Richard Henderson &lt;richard.henderson@linaro.org&gt;
Reviewed-by: Philippe Mathieu-Daudé &lt;f4bug@amsat.org&gt;
Signed-off-by: Alex Bennée &lt;alex.bennee@linaro.org&gt;
Reviewed-by: Mads Ynddal &lt;mads@ynddal.dk&gt;
Message-Id: &lt;20220929114231.583801-44-alex.bennee@linaro.org&gt;
</content>
</entry>
<entry>
<title>kvm: fix memory leak on failure to read stats descriptors</title>
<updated>2022-09-18T07:17:40+00:00</updated>
<author>
<name>Paolo Bonzini</name>
</author>
<published>2022-09-05T10:06:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=21adec30f62e4e700e0e217da756723e189d7b29'/>
<id>urn:sha1:21adec30f62e4e700e0e217da756723e189d7b29</id>
<content type='text'>
Reported by Coverity as CID 1490142.  Since the size is constant and the
lifetime is the same as the StatsDescriptors struct, embed the struct
directly instead of using a separate allocation.

Suggested-by: Richard Henderson &lt;richard.henderson@linaro.org&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: use store-release to mark dirty pages as harvested</title>
<updated>2022-09-18T07:17:40+00:00</updated>
<author>
<name>Paolo Bonzini</name>
</author>
<published>2022-09-02T00:15:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=52281c6d11ec68b802e8a264780df2c4b981e6bc'/>
<id>urn:sha1:52281c6d11ec68b802e8a264780df2c4b981e6bc</id>
<content type='text'>
The following scenario can happen if QEMU sets more RESET flags while
the KVM_RESET_DIRTY_RINGS ioctl is ongoing on another host CPU:

    CPU0                     CPU1               CPU2
    ------------------------ ------------------ ------------------------
                                                fill gfn0
                                                store-rel flags for gfn0
                                                fill gfn1
                                                store-rel flags for gfn1
    load-acq flags for gfn0
    set RESET for gfn0
    load-acq flags for gfn1
    set RESET for gfn1
    do ioctl! -----------&gt;
                             ioctl(RESET_RINGS)
                                                fill gfn2
                                                store-rel flags for gfn2
    load-acq flags for gfn2
    set RESET for gfn2
                             process gfn0
                             process gfn1
                             process gfn2
    do ioctl!
    etc.

The three load-acquire in CPU0 synchronize with the three store-release
in CPU2, but CPU0 and CPU1 are only synchronized up to gfn1 and CPU1
may miss gfn2's fields other than flags.

The kernel must be able to cope with invalid values of the fields, and
userspace *will* invoke the ioctl once more.  However, once the RESET flag
is cleared on gfn2, it is lost forever, therefore in the above scenario
CPU1 must read the correct value of gfn2's fields.

Therefore RESET must be set with a store-release, that will synchronize
with KVM's load-acquire in CPU1.

Cc: Gavin Shan &lt;gshan@redhat.com&gt;
Reviewed-by: Peter Xu &lt;peterx@redhat.com&gt;
Reviewed-by: Philippe Mathieu-Daudé &lt;f4bug@amsat.org&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: dirty ring: add missing memory barrier</title>
<updated>2022-09-01T06:37:04+00:00</updated>
<author>
<name>Paolo Bonzini</name>
</author>
<published>2022-08-26T11:00:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=4802bf910eee98312c4a9777ac2567e6a0445c46'/>
<id>urn:sha1:4802bf910eee98312c4a9777ac2567e6a0445c46</id>
<content type='text'>
The KVM_DIRTY_GFN_F_DIRTY flag ensures that the entry is valid.  If
the read of the fields are not ordered after the read of the flag,
QEMU might see stale values.

Cc: Gavin Shan &lt;gshan@redhat.com&gt;
Reviewed-by: Philippe Mathieu-Daudé &lt;f4bug@amsat.org&gt;
Reviewed-by: Peter Xu &lt;peterx@redhat.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
</feed>
