<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/testing/selftests/kvm/lib, branch v5.10.258</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.10.258</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.10.258'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2022-08-21T13:16:03+00:00</updated>
<entry>
<title>selftests: kvm: set rax before vmcall</title>
<updated>2022-08-21T13:16:03+00:00</updated>
<author>
<name>Andrei Vagin</name>
<email>avagin@google.com</email>
</author>
<published>2022-07-22T23:02:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c0ba87f3e7b4bc5a4b8c3f132a9c63d594c4af21'/>
<id>urn:sha1:c0ba87f3e7b4bc5a4b8c3f132a9c63d594c4af21</id>
<content type='text'>
[ Upstream commit 281106f938d3daaea6f8b6723a8217a2a1ef6936 ]

kvm_hypercall has to place the hypercall number in rax.

Trace events show that kvm_pv_test doesn't work properly:
     kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0
     kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0
     kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0

With this change, it starts working as expected:
     kvm_pv_test-54285: kvm_hypercall: nr 0x5 a0 0x0 a1 0x0 a2 0x0 a3 0x0
     kvm_pv_test-54285: kvm_hypercall: nr 0xa a0 0x0 a1 0x0 a2 0x0 a3 0x0
     kvm_pv_test-54285: kvm_hypercall: nr 0xb a0 0x0 a1 0x0 a2 0x0 a3 0x0

Signed-off-by: Andrei Vagin &lt;avagin@google.com&gt;
Message-Id: &lt;20220722230241.1944655-5-avagin@google.com&gt;
Fixes: ac4a4d6de22e ("selftests: kvm: test enforcement of paravirtual cpuid features")
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: KVM: Handle compiler optimizations in ucall</title>
<updated>2022-08-11T11:06:45+00:00</updated>
<author>
<name>Raghavendra Rao Ananta</name>
<email>rananta@google.com</email>
</author>
<published>2022-06-15T18:57:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=50763f0ac0706e63c0ba550adccfca25eb3d0667'/>
<id>urn:sha1:50763f0ac0706e63c0ba550adccfca25eb3d0667</id>
<content type='text'>
[ Upstream commit 9e2f6498efbbc880d7caa7935839e682b64fe5a6 ]

The selftests, when built with newer versions of clang, is found
to have over optimized guests' ucall() function, and eliminating
the stores for uc.cmd (perhaps due to no immediate readers). This
resulted in the userspace side always reading a value of '0', and
causing multiple test failures.

As a result, prevent the compiler from optimizing the stores in
ucall() with WRITE_ONCE().

Suggested-by: Ricardo Koller &lt;ricarkol@google.com&gt;
Suggested-by: Reiji Watanabe &lt;reijiw@google.com&gt;
Signed-off-by: Raghavendra Rao Ananta &lt;rananta@google.com&gt;
Message-Id: &lt;20220615185706.1099208-1-rananta@google.com&gt;
Reviewed-by: Andrew Jones &lt;drjones@redhat.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Fix nested SVM tests when built with clang</title>
<updated>2021-11-18T13:04:10+00:00</updated>
<author>
<name>Jim Mattson</name>
<email>jmattson@google.com</email>
</author>
<published>2021-09-30T00:36:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7cd4af996cd296f36676416fc1618b3df6fbc985'/>
<id>urn:sha1:7cd4af996cd296f36676416fc1618b3df6fbc985</id>
<content type='text'>
[ Upstream commit ed290e1c20da19fa100a3e0f421aa31b65984960 ]

Though gcc conveniently compiles a simple memset to "rep stos," clang
prefers to call the libc version of memset. If a test is dynamically
linked, the libc memset isn't available in L1 (nor is the PLT or the
GOT, for that matter). Even if the test is statically linked, the libc
memset may choose to use some CPU features, like AVX, which may not be
enabled in L1. Note that __builtin_memset doesn't solve the problem,
because (a) the compiler is free to call memset anyway, and (b)
__builtin_memset may also choose to use features like AVX, which may
not be available in L1.

To avoid a myriad of problems, use an explicit "rep stos" to clear the
VMCB in generic_svm_setup(), which is called both from L0 and L1.

Reported-by: Ricardo Koller &lt;ricarkol@google.com&gt;
Signed-off-by: Jim Mattson &lt;jmattson@google.com&gt;
Fixes: 20ba262f8631a ("selftests: KVM: AMD Nested test infrastructure")
Message-Id: &lt;20210930003649.4026553-1-jmattson@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Add operand to vmsave/vmload/vmrun in svm.c</title>
<updated>2021-11-18T13:04:10+00:00</updated>
<author>
<name>Ricardo Koller</name>
<email>ricarkol@google.com</email>
</author>
<published>2021-02-10T03:17:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=293fa72d62e46bc5f8044be7204869efad4b4d0c'/>
<id>urn:sha1:293fa72d62e46bc5f8044be7204869efad4b4d0c</id>
<content type='text'>
[ Upstream commit 47bc726fe8d1910872dc3d7e7ec70f8b9e6043b7 ]

Building the KVM selftests with LLVM's integrated assembler fails with:

  $ CFLAGS=-fintegrated-as make -C tools/testing/selftests/kvm CC=clang
  lib/x86_64/svm.c:77:16: error: too few operands for instruction
          asm volatile ("vmsave\n\t" : : "a" (vmcb_gpa) : "memory");
                        ^
  &lt;inline asm&gt;:1:2: note: instantiated into assembly here
          vmsave
          ^
  lib/x86_64/svm.c:134:3: error: too few operands for instruction
                  "vmload\n\t"
                  ^
  &lt;inline asm&gt;:1:2: note: instantiated into assembly here
          vmload
          ^
This is because LLVM IAS does not currently support calling vmsave,
vmload, or vmload without an explicit %rax operand.

Add an explicit operand to vmsave, vmload, and vmrum in svm.c. Fixing
this was suggested by Sean Christopherson.

Tested: building without this error in clang 11. The following patch
(not queued yet) needs to be applied to solve the other remaining error:
"selftests: kvm: remove reassignment of non-absolute variables".

Suggested-by: Sean Christopherson &lt;seanjc@google.com&gt;
Link: https://lore.kernel.org/kvm/X+Df2oQczVBmwEzi@google.com/
Reviewed-by: Jim Mattson &lt;jmattson@google.com&gt;
Signed-off-by: Ricardo Koller &lt;ricarkol@google.com&gt;
Message-Id: &lt;20210210031719.769837-1-ricarkol@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Fix kvm_check_cap() assertion</title>
<updated>2021-06-30T12:47:22+00:00</updated>
<author>
<name>Fuad Tabba</name>
<email>tabba@google.com</email>
</author>
<published>2021-06-15T15:04:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4658a8d3079137d8d407892bdc95b390a419c261'/>
<id>urn:sha1:4658a8d3079137d8d407892bdc95b390a419c261</id>
<content type='text'>
[ Upstream commit d8ac05ea13d789d5491a5920d70a05659015441d ]

KVM_CHECK_EXTENSION ioctl can return any negative value on error,
and not necessarily -1. Change the assertion to reflect that.

Signed-off-by: Fuad Tabba &lt;tabba@google.com&gt;
Message-Id: &lt;20210615150443.1183365-1-tabba@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Introduce the dirty log perf test</title>
<updated>2020-11-08T11:04:08+00:00</updated>
<author>
<name>Ben Gardon</name>
<email>bgardon@google.com</email>
</author>
<published>2020-10-27T23:37:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4fd94ec7d566ee2f0b52111cc6d26dd311f8a7c3'/>
<id>urn:sha1:4fd94ec7d566ee2f0b52111cc6d26dd311f8a7c3</id>
<content type='text'>
The dirty log perf test will time verious dirty logging operations
(enabling dirty logging, dirtying memory, getting the dirty log,
clearing the dirty log, and disabling dirty logging) in order to
quantify dirty logging performance. This test can be used to inform
future performance improvements to KVM's dirty logging infrastructure.

This series was tested by running the following invocations on an Intel
Skylake machine:
dirty_log_perf_test -b 20m -i 100 -v 64
dirty_log_perf_test -b 20g -i 5 -v 4
dirty_log_perf_test -b 4g -i 5 -v 32
demand_paging_test -b 20m -v 64
demand_paging_test -b 20g -v 4
demand_paging_test -b 4g -v 32
All behaved as expected.

Signed-off-by: Ben Gardon &lt;bgardon@google.com&gt;
Message-Id: &lt;20201027233733.1484855-6-bgardon@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Drop pointless vm_create wrapper</title>
<updated>2020-11-08T11:03:36+00:00</updated>
<author>
<name>Andrew Jones</name>
<email>drjones@redhat.com</email>
</author>
<published>2020-11-04T21:23:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f663132d1e09166db419afb9832d463e0a79f3d5'/>
<id>urn:sha1:f663132d1e09166db419afb9832d463e0a79f3d5</id>
<content type='text'>
Signed-off-by: Andrew Jones &lt;drjones@redhat.com&gt;
Message-Id: &lt;20201104212357.171559-3-drjones@redhat.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Simplify demand_paging_test with timespec_diff_now</title>
<updated>2020-11-08T11:03:35+00:00</updated>
<author>
<name>Ben Gardon</name>
<email>bgardon@google.com</email>
</author>
<published>2020-10-27T23:37:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1eafbd27edb5098ed6b6bc404c35d56c78beb0fd'/>
<id>urn:sha1:1eafbd27edb5098ed6b6bc404c35d56c78beb0fd</id>
<content type='text'>
Add a helper function to get the current time and return the time since
a given start time. Use that function to simplify the timekeeping in the
demand paging test.

This series was tested by running the following invocations on an Intel
Skylake machine:
dirty_log_perf_test -b 20m -i 100 -v 64
dirty_log_perf_test -b 20g -i 5 -v 4
dirty_log_perf_test -b 4g -i 5 -v 32
demand_paging_test -b 20m -v 64
demand_paging_test -b 20g -v 4
demand_paging_test -b 4g -v 32
All behaved as expected.

Signed-off-by: Ben Gardon &lt;bgardon@google.com&gt;
Message-Id: &lt;20201027233733.1484855-4-bgardon@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Add aarch64 get-reg-list test</title>
<updated>2020-11-08T11:02:45+00:00</updated>
<author>
<name>Andrew Jones</name>
<email>drjones@redhat.com</email>
</author>
<published>2020-10-29T20:17:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fd02029a9e019e941835e110651486e2d77d3f84'/>
<id>urn:sha1:fd02029a9e019e941835e110651486e2d77d3f84</id>
<content type='text'>
Check for KVM_GET_REG_LIST regressions. The blessed list was
created by running on v4.15 with the --core-reg-fixup option.
The following script was also used in order to annotate system
registers with their names when possible. When new system
registers are added the names can just be added manually using
the same grep.

while read reg; do
	if [[ ! $reg =~ ARM64_SYS_REG ]]; then
		printf "\t$reg\n"
		continue
	fi
	encoding=$(echo "$reg" | sed "s/ARM64_SYS_REG(//;s/),//")
	if ! name=$(grep "$encoding" ../../../../arch/arm64/include/asm/sysreg.h); then
		printf "\t$reg\n"
		continue
	fi
	name=$(echo "$name" | sed "s/.*SYS_//;s/[\t ]*sys_reg($encoding)$//")
	printf "\t$reg\t/* $name */\n"
done &lt; &lt;(aarch64/get-reg-list --core-reg-fixup --list)

Signed-off-by: Andrew Jones &lt;drjones@redhat.com&gt;
Message-Id: &lt;20201029201703.102716-3-drjones@redhat.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>selftests: kvm: test enforcement of paravirtual cpuid features</title>
<updated>2020-11-08T11:02:16+00:00</updated>
<author>
<name>Oliver Upton</name>
<email>oupton@google.com</email>
</author>
<published>2020-10-27T23:10:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ac4a4d6de22e674cd6e3fe57199a15383496aad2'/>
<id>urn:sha1:ac4a4d6de22e674cd6e3fe57199a15383496aad2</id>
<content type='text'>
Add a set of tests that ensure the guest cannot access paravirtual msrs
and hypercalls that have been disabled in the KVM_CPUID_FEATURES leaf.
Expect a #GP in the case of msr accesses and -KVM_ENOSYS from
hypercalls.

Cc: Jim Mattson &lt;jmattson@google.com&gt;
Signed-off-by: Oliver Upton &lt;oupton@google.com&gt;
Reviewed-by: Peter Shier &lt;pshier@google.com&gt;
Reviewed-by: Aaron Lewis &lt;aaronlewis@google.com&gt;
Message-Id: &lt;20201027231044.655110-7-oupton@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
</feed>
