<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/tools/testing/selftests/kvm/x86_64/debug_regs.c, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/tools/testing/selftests/kvm/x86_64/debug_regs.c?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/tools/testing/selftests/kvm/x86_64/debug_regs.c?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2021-08-20T20:06:39Z</updated>
<entry>
<title>KVM: selftests: test KVM_GUESTDBG_BLOCKIRQ</title>
<updated>2021-08-20T20:06:39Z</updated>
<author>
<name>Maxim Levitsky</name>
<email>mlevitsk@redhat.com</email>
</author>
<published>2021-08-11T12:29:27Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=85cc207b8e07df8ee05ee83115c9086aef20a1f5'/>
<id>urn:sha1:85cc207b8e07df8ee05ee83115c9086aef20a1f5</id>
<content type='text'>
Modify debug_regs test to create a pending interrupt
and see that it is blocked when single stepping is done
with KVM_GUESTDBG_BLOCKIRQ

Signed-off-by: Maxim Levitsky &lt;mlevitsk@redhat.com&gt;
Message-Id: &lt;20210811122927.900604-7-mlevitsk@redhat.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: x86: Set supported CPUIDs on default VM</title>
<updated>2020-11-16T18:14:20Z</updated>
<author>
<name>Andrew Jones</name>
<email>drjones@redhat.com</email>
</author>
<published>2020-11-11T12:26:35Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=22f232d134e142022f5e4cf2de4587a34d5b7d65'/>
<id>urn:sha1:22f232d134e142022f5e4cf2de4587a34d5b7d65</id>
<content type='text'>
Almost all tests do this anyway and the ones that don't don't
appear to care. Only vmx_set_nested_state_test assumes that
a feature (VMX) is disabled until later setting the supported
CPUIDs. It's better to disable that explicitly anyway.

Signed-off-by: Andrew Jones &lt;drjones@redhat.com&gt;
Message-Id: &lt;20201111122636.73346-11-drjones@redhat.com&gt;
[Restore CPUID_VMX, or vmx_set_nested_state breaks. - Paolo]
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>selftests: kvm: Fix assert failure in single-step test</title>
<updated>2020-09-23T14:23:56Z</updated>
<author>
<name>Yang Weijiang</name>
<email>weijiang.yang@intel.com</email>
</author>
<published>2020-08-26T01:55:24Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=18391e5e9cf59226354a864e5befa3c764eb8903'/>
<id>urn:sha1:18391e5e9cf59226354a864e5befa3c764eb8903</id>
<content type='text'>
This is a follow-up patch to fix an issue left in commit:
98b0bf02738004829d7e26d6cb47b2e469aaba86
selftests: kvm: Use a shorter encoding to clear RAX

With the change in the commit, we also need to modify "xor" instruction
length from 3 to 2 in array ss_size accordingly to pass below check:

for (i = 0; i &lt; (sizeof(ss_size) / sizeof(ss_size[0])); i++) {
        target_rip += ss_size[i];
        CLEAR_DEBUG();
        debug.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;
        debug.arch.debugreg[7] = 0x00000400;
        APPLY_DEBUG();
        vcpu_run(vm, VCPU_ID);
        TEST_ASSERT(run-&gt;exit_reason == KVM_EXIT_DEBUG &amp;&amp;
                    run-&gt;debug.arch.exception == DB_VECTOR &amp;&amp;
                    run-&gt;debug.arch.pc == target_rip &amp;&amp;
                    run-&gt;debug.arch.dr6 == target_dr6,
                    "SINGLE_STEP[%d]: exit %d exception %d rip 0x%llx "
                    "(should be 0x%llx) dr6 0x%llx (should be 0x%llx)",
                    i, run-&gt;exit_reason, run-&gt;debug.arch.exception,
                    run-&gt;debug.arch.pc, target_rip, run-&gt;debug.arch.dr6,
                    target_dr6);
}

Reported-by: kernel test robot &lt;rong.a.chen@intel.com&gt;
Signed-off-by: Yang Weijiang &lt;weijiang.yang@intel.com&gt;
Message-Id: &lt;20200826015524.13251-1-weijiang.yang@intel.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>selftests: kvm: Use a shorter encoding to clear RAX</title>
<updated>2020-08-17T17:45:22Z</updated>
<author>
<name>Yang Weijiang</name>
<email>weijiang.yang@intel.com</email>
</author>
<published>2020-08-14T13:21:05Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=98b0bf02738004829d7e26d6cb47b2e469aaba86'/>
<id>urn:sha1:98b0bf02738004829d7e26d6cb47b2e469aaba86</id>
<content type='text'>
If debug_regs.c is built with newer binutils, the resulting binary is "optimized"
by the assembler:

asm volatile("ss_start: "
             "xor %%rax,%%rax\n\t"
             "cpuid\n\t"
             "movl $0x1a0,%%ecx\n\t"
             "rdmsr\n\t"
             : : : "rax", "ecx");

is translated to :

  000000000040194e &lt;ss_start&gt;:
  40194e:       31 c0                   xor    %eax,%eax     &lt;----- rax-&gt;eax?
  401950:       0f a2                   cpuid
  401952:       b9 a0 01 00 00          mov    $0x1a0,%ecx
  401957:       0f 32                   rdmsr

As you can see rax is replaced with eax in target binary code.
This causes a difference is the length of xor instruction (2 Byte vs 3 Byte),
and makes the hard-coded instruction length check fail:

        /* Instruction lengths starting at ss_start */
        int ss_size[4] = {
                3,              /* xor */   &lt;-------- 2 or 3?
                2,              /* cpuid */
                5,              /* mov */
                2,              /* rdmsr */
        };

Encode the shorter version directly and, while at it, fix the "clobbers"
of the asm.

Cc: stable@vger.kernel.org
Signed-off-by: Yang Weijiang &lt;weijiang.yang@intel.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: VMX: pass correct DR6 for GD userspace exit</title>
<updated>2020-05-08T11:44:31Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2020-05-06T09:59:39Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=45981dedf555bd66d86ccb51e4049d9f7ec45bd5'/>
<id>urn:sha1:45981dedf555bd66d86ccb51e4049d9f7ec45bd5</id>
<content type='text'>
When KVM_EXIT_DEBUG is raised for the disabled-breakpoints case (DR7.GD),
DR6 was incorrectly copied from the value in the VM.  Instead,
DR6.BD should be set in order to catch this case.

On AMD this does not need any special code because the processor triggers
a #DB exception that is intercepted.  However, the testcase would fail
without the previous patch because both DR6.BS and DR6.BD would be set.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Add KVM_SET_GUEST_DEBUG test</title>
<updated>2020-05-07T10:13:42Z</updated>
<author>
<name>Peter Xu</name>
<email>peterx@redhat.com</email>
</author>
<published>2020-05-05T20:50:00Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=449aa906e67e57636086967bf0edc1328fd0ca9f'/>
<id>urn:sha1:449aa906e67e57636086967bf0edc1328fd0ca9f</id>
<content type='text'>
Covers fundamental tests for KVM_SET_GUEST_DEBUG. It is very close to the debug
test in kvm-unit-test, but doing it from outside the guest.

Signed-off-by: Peter Xu &lt;peterx@redhat.com&gt;
Message-Id: &lt;20200505205000.188252-4-peterx@redhat.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
</feed>
