<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/testing/selftests/kvm, branch linux-5.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-08-17T13:15:41Z</updated>
<entry>
<title>selftests: kvm: set rax before vmcall</title>
<updated>2022-08-17T13:15:41Z</updated>
<author>
<name>Andrei Vagin</name>
</author>
<published>2022-07-22T23:02:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4ef616730a967138fd0d784eab1d55437207773f'/>
<id>urn:sha1:4ef616730a967138fd0d784eab1d55437207773f</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>KVM: selftests: Use vm_create_with_vcpus() in max_guest_memory_test</title>
<updated>2022-08-17T13:15:21Z</updated>
<author>
<name>Sean Christopherson</name>
</author>
<published>2022-04-19T18:35:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2b1a324933bdda27b00c877d3cd3a6bac3a01440'/>
<id>urn:sha1:2b1a324933bdda27b00c877d3cd3a6bac3a01440</id>
<content type='text'>
[ Upstream commit 3468fd7d883110e481dfb8c8c7b802dc252ab186 ]

Use vm_create_with_vcpus() in max_guest_memory_test and reference vCPUs
by their 'struct kvm_vcpu' object instead of their ID.

Signed-off-by: Sean Christopherson &lt;seanjc@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: Convert s390x/diag318_test_handler away from VCPU_ID</title>
<updated>2022-08-17T13:15:21Z</updated>
<author>
<name>Sean Christopherson</name>
</author>
<published>2022-02-16T20:40:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5bb7f541d07dc63131519ae13a3bdee022ab054e'/>
<id>urn:sha1:5bb7f541d07dc63131519ae13a3bdee022ab054e</id>
<content type='text'>
[ Upstream commit 7cdcdfe50d8d68b7b9ba2e1b0345ff47fdda390f ]

Convert diag318_test_handler to use vm_create_with_vcpus() and pass around a
'struct kvm_vcpu' object instead of passing around vCPU IDs.  Note, this is
a "functional" change in the sense that the test now creates a vCPU with
vcpu_id==0 instead of vcpu_id==6.  The non-zero VCPU_ID was 100% arbitrary
and added little to no validation coverage.  If testing non-zero vCPU IDs
is desirable for generic tests, that can be done in the future by tweaking
the VM creation helpers.

Signed-off-by: Sean Christopherson &lt;seanjc@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 target thread to be migrated in rseq_test</title>
<updated>2022-07-19T13:03:49Z</updated>
<author>
<name>Gavin Shan</name>
</author>
<published>2022-07-19T02:08:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e923b0537d28e15c9d31ce8b38f810b325816903'/>
<id>urn:sha1:e923b0537d28e15c9d31ce8b38f810b325816903</id>
<content type='text'>
In rseq_test, there are two threads, which are vCPU thread and migration
worker separately. Unfortunately, the test has the wrong PID passed to
sched_setaffinity() in the migration worker. It forces migration on the
migration worker because zeroed PID represents the calling thread, which
is the migration worker itself. It means the vCPU thread is never enforced
to migration and it can migrate at any time, which eventually leads to
failure as the following logs show.

  host# uname -r
  5.19.0-rc6-gavin+
  host# # cat /proc/cpuinfo | grep processor | tail -n 1
  processor    : 223
  host# pwd
  /home/gavin/sandbox/linux.main/tools/testing/selftests/kvm
  host# for i in `seq 1 100`; do \
        echo "--------&gt; $i"; ./rseq_test; done
  --------&gt; 1
  --------&gt; 2
  --------&gt; 3
  --------&gt; 4
  --------&gt; 5
  --------&gt; 6
  ==== Test Assertion Failure ====
    rseq_test.c:265: rseq_cpu == cpu
    pid=3925 tid=3925 errno=4 - Interrupted system call
       1  0x0000000000401963: main at rseq_test.c:265 (discriminator 2)
       2  0x0000ffffb044affb: ?? ??:0
       3  0x0000ffffb044b0c7: ?? ??:0
       4  0x0000000000401a6f: _start at ??:?
    rseq CPU = 4, sched CPU = 27

Fix the issue by passing correct parameter, TID of the vCPU thread, to
sched_setaffinity() in the migration worker.

Fixes: 61e52f1630f5 ("KVM: selftests: Add a test for KVM_RUN+rseq to detect task migration bugs")
Suggested-by: Sean Christopherson &lt;seanjc@google.com&gt;
Signed-off-by: Gavin Shan &lt;gshan@redhat.com&gt;
Reviewed-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Message-Id: &lt;20220719020830.3479482-1-gshan@redhat.com&gt;
Reviewed-by: Andrew Jones &lt;andrew.jones@linux.dev&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>selftests: KVM: Handle compiler optimizations in ucall</title>
<updated>2022-06-23T14:26:41Z</updated>
<author>
<name>Raghavendra Rao Ananta</name>
</author>
<published>2022-06-15T18:57:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9e2f6498efbbc880d7caa7935839e682b64fe5a6'/>
<id>urn:sha1:9e2f6498efbbc880d7caa7935839e682b64fe5a6</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>KVM: selftests: Restrict test region to 48-bit physical addresses when using nested</title>
<updated>2022-06-09T14:52:27Z</updated>
<author>
<name>David Matlack</name>
</author>
<published>2022-05-20T23:32:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e0f3f46e42064a51573914766897b4ab95d943e3'/>
<id>urn:sha1:e0f3f46e42064a51573914766897b4ab95d943e3</id>
<content type='text'>
The selftests nested code only supports 4-level paging at the moment.
This means it cannot map nested guest physical addresses with more than
48 bits. Allow perf_test_util nested mode to work on hosts with more
than 48 physical addresses by restricting the guest test region to
48-bits.

While here, opportunistically fix an off-by-one error when dealing with
vm_get_max_gfn(). perf_test_util.c was treating this as the maximum
number of GFNs, rather than the maximum allowed GFN. This didn't result
in any correctness issues, but it did end up shifting the test region
down slightly when using huge pages.

Suggested-by: Sean Christopherson &lt;seanjc@google.com&gt;
Signed-off-by: David Matlack &lt;dmatlack@google.com&gt;
Message-Id: &lt;20220520233249.3776001-12-dmatlack@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Add option to run dirty_log_perf_test vCPUs in L2</title>
<updated>2022-06-09T14:52:27Z</updated>
<author>
<name>David Matlack</name>
</author>
<published>2022-05-20T23:32:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=71d489661904fcc3ec31b343acd5c0dac84b5410'/>
<id>urn:sha1:71d489661904fcc3ec31b343acd5c0dac84b5410</id>
<content type='text'>
Add an option to dirty_log_perf_test that configures the vCPUs to run in
L2 instead of L1. This makes it possible to benchmark the dirty logging
performance of nested virtualization, which is particularly interesting
because KVM must shadow L1's EPT/NPT tables.

For now this support only works on x86_64 CPUs with VMX. Otherwise
passing -n results in the test being skipped.

Signed-off-by: David Matlack &lt;dmatlack@google.com&gt;
Message-Id: &lt;20220520233249.3776001-11-dmatlack@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Clean up LIBKVM files in Makefile</title>
<updated>2022-06-09T14:52:26Z</updated>
<author>
<name>David Matlack</name>
</author>
<published>2022-05-20T23:32:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cf97d5e99f69f876dc310ea21b5f97c3a493a18a'/>
<id>urn:sha1:cf97d5e99f69f876dc310ea21b5f97c3a493a18a</id>
<content type='text'>
Break up the long lines for LIBKVM and alphabetize each architecture.
This makes reading the Makefile easier, and will make reading diffs to
LIBKVM easier.

No functional change intended.

Reviewed-by: Peter Xu &lt;peterx@redhat.com&gt;
Signed-off-by: David Matlack &lt;dmatlack@google.com&gt;
Message-Id: &lt;20220520233249.3776001-10-dmatlack@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Link selftests directly with lib object files</title>
<updated>2022-06-09T14:52:25Z</updated>
<author>
<name>David Matlack</name>
</author>
<published>2022-05-20T23:32:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cdc979dae265cc77a035b736f78f58e4c7309bb2'/>
<id>urn:sha1:cdc979dae265cc77a035b736f78f58e4c7309bb2</id>
<content type='text'>
The linker does obey strong/weak symbols when linking static libraries,
it simply resolves an undefined symbol to the first-encountered symbol.
This means that defining __weak arch-generic functions and then defining
arch-specific strong functions to override them in libkvm will not
always work.

More specifically, if we have:

lib/generic.c:

  void __weak foo(void)
  {
          pr_info("weak\n");
  }

  void bar(void)
  {
          foo();
  }

lib/x86_64/arch.c:

  void foo(void)
  {
          pr_info("strong\n");
  }

And a selftest that calls bar(), it will print "weak". Now if you make
generic.o explicitly depend on arch.o (e.g. add function to arch.c that
is called directly from generic.c) it will print "strong". In other
words, it seems that the linker is free to throw out arch.o when linking
because generic.o does not explicitly depend on it, which causes the
linker to lose the strong symbol.

One solution is to link libkvm.a with --whole-archive so that the linker
doesn't throw away object files it thinks are unnecessary. However that
is a bit difficult to plumb since we are using the common selftests
makefile rules. An easier solution is to drop libkvm.a just link
selftests with all the .o files that were originally in libkvm.a.

Reviewed-by: Peter Xu &lt;peterx@redhat.com&gt;
Signed-off-by: David Matlack &lt;dmatlack@google.com&gt;
Message-Id: &lt;20220520233249.3776001-9-dmatlack@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Drop unnecessary rule for STATIC_LIBS</title>
<updated>2022-06-09T14:52:25Z</updated>
<author>
<name>David Matlack</name>
</author>
<published>2022-05-20T23:32:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=acf57736e755ba5c467fc6fa85e4a0750cc36150'/>
<id>urn:sha1:acf57736e755ba5c467fc6fa85e4a0750cc36150</id>
<content type='text'>
Drop the "all: $(STATIC_LIBS)" rule. The KVM selftests already depend
on $(STATIC_LIBS), so there is no reason to have an extra "all" rule.

Suggested-by: Peter Xu &lt;peterx@redhat.com&gt;
Signed-off-by: David Matlack &lt;dmatlack@google.com&gt;
Message-Id: &lt;20220520233249.3776001-8-dmatlack@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
</feed>
