<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/tools/testing/selftests/kvm/aarch64/arch_timer.c, branch linux-6.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.2.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.2.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2022-12-02T18:22:33Z</updated>
<entry>
<title>KVM: selftests: Use non-atomic clear/set bit helpers in KVM tests</title>
<updated>2022-12-02T18:22:33Z</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2022-11-19T01:34:47Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=03a0c819e71755398d59993b9adee203544617d5'/>
<id>urn:sha1:03a0c819e71755398d59993b9adee203544617d5</id>
<content type='text'>
Use the dedicated non-atomic helpers for {clear,set}_bit() and their
test variants, i.e. the double-underscore versions.  Depsite being
defined in atomic.h, and despite the kernel versions being atomic in the
kernel, tools' {clear,set}_bit() helpers aren't actually atomic.  Move
to the double-underscore versions so that the versions that are expected
to be atomic (for kernel developers) can be made atomic without affecting
users that don't want atomic operations.

Leave the usage in ucall_free() as-is, it's the one place in tools/ that
actually wants/needs atomic behavior.

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Message-Id: &lt;20221119013450.2643007-7-seanjc@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: move common startup logic to kvm_util.c</title>
<updated>2022-11-17T00:58:56Z</updated>
<author>
<name>Vishal Annapurve</name>
<email>vannapurve@google.com</email>
</author>
<published>2022-11-15T21:38:43Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=197ebb713ad04518ffef6d966954b519a0805100'/>
<id>urn:sha1:197ebb713ad04518ffef6d966954b519a0805100</id>
<content type='text'>
Consolidate common startup logic in one place by implementing a single
setup function with __attribute((constructor)) for all selftests within
kvm_util.c.

This allows moving logic like:
        /* Tell stdout not to buffer its content */
        setbuf(stdout, NULL);
to a single file for all selftests.

This will also allow any required setup at entry in future to be done in
common main function.

Link: https://lore.kernel.org/lkml/Ywa9T+jKUpaHLu%2Fl@google.com
Suggested-by: Sean Christopherson &lt;seanjc@google.com&gt;
Reviewed-by: Andrew Jones &lt;andrew.jones@linux.dev&gt;
Reviewed-by: Peter Gonda &lt;pgonda@google.com&gt;
Signed-off-by: Vishal Annapurve &lt;vannapurve@google.com&gt;
Link: https://lore.kernel.org/r/20221115213845.3348210-2-vannapurve@google.com
Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Automatically do init_ucall() for non-barebones VMs</title>
<updated>2022-11-17T00:58:51Z</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2022-10-06T00:34:05Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=dc88244bf5488b04fb7bbe47d8d9c38ff8f7dbb4'/>
<id>urn:sha1:dc88244bf5488b04fb7bbe47d8d9c38ff8f7dbb4</id>
<content type='text'>
Do init_ucall() automatically during VM creation to kill two (three?)
birds with one stone.

First, initializing ucall immediately after VM creations allows forcing
aarch64's MMIO ucall address to immediately follow memslot0.  This is
still somewhat fragile as tests could clobber the MMIO address with a
new memslot, but it's safe-ish since tests have to be conversative when
accounting for memslot0.  And this can be hardened in the future by
creating a read-only memslot for the MMIO page (KVM ARM exits with MMIO
if the guest writes to a read-only memslot).  Add a TODO to document that
selftests can and should use a memslot for the ucall MMIO (doing so
requires yet more rework because tests assumes thay can use all memslots
except memslot0).

Second, initializing ucall for all VMs prepares for making ucall
initialization meaningful on all architectures.  aarch64 is currently the
only arch that needs to do any setup, but that will change in the future
by switching to a pool-based implementation (instead of the current
stack-based approach).

Lastly, defining the ucall MMIO address from common code will simplify
switching all architectures (except s390) to a common MMIO-based ucall
implementation (if there's ever sufficient motivation to do so).

Cc: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Reviewed-by: Andrew Jones &lt;andrew.jones@linux.dev&gt;
Tested-by: Peter Gonda &lt;pgonda@google.com&gt;
Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Link: https://lore.kernel.org/r/20221006003409.649993-4-seanjc@google.com
</content>
</entry>
<entry>
<title>KVM: selftests: Add atoi_positive() and atoi_non_negative() for input validation</title>
<updated>2022-11-16T18:03:24Z</updated>
<author>
<name>Vipin Sharma</name>
<email>vipinsh@google.com</email>
</author>
<published>2022-11-03T19:17:18Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=0001725d0f9b5d749540021befb67c117d566416'/>
<id>urn:sha1:0001725d0f9b5d749540021befb67c117d566416</id>
<content type='text'>
Many KVM selftests take command line arguments which are supposed to be
positive (&gt;0) or non-negative (&gt;=0). Some tests do these validation and
some missed adding the check.

Add atoi_positive() and atoi_non_negative() to validate inputs in
selftests before proceeding to use those values.

Signed-off-by: Vipin Sharma &lt;vipinsh@google.com&gt;
Reviewed-by: Sean Christopherson &lt;seanjc@google.com&gt;
Link: https://lore.kernel.org/r/20221103191719.1559407-7-vipinsh@google.com
Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Add atoi_paranoid() to catch errors missed by atoi()</title>
<updated>2022-11-16T18:03:24Z</updated>
<author>
<name>Vipin Sharma</name>
<email>vipinsh@google.com</email>
</author>
<published>2022-11-03T19:17:15Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=018ea2d71a43372cb984021f03514dc6dd3d46df'/>
<id>urn:sha1:018ea2d71a43372cb984021f03514dc6dd3d46df</id>
<content type='text'>
atoi() doesn't detect errors. There is no way to know that a 0 return
is correct conversion or due to an error.

Introduce atoi_paranoid() to detect errors and provide correct
conversion. Replace all atoi() calls with atoi_paranoid().

Signed-off-by: Vipin Sharma &lt;vipinsh@google.com&gt;
Suggested-by: David Matlack &lt;dmatlack@google.com&gt;
Suggested-by: Sean Christopherson &lt;seanjc@google.com&gt;
Reviewed-by: Sean Christopherson &lt;seanjc@google.com&gt;
Link: https://lore.kernel.org/r/20221103191719.1559407-4-vipinsh@google.com
Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Fix filename reporting in guest asserts</title>
<updated>2022-07-14T01:14:08Z</updated>
<author>
<name>Colton Lewis</name>
<email>coltonlewis@google.com</email>
</author>
<published>2022-06-15T19:31:16Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=594a1c271c159c9c5f0ff2d92ebfda469e94e48d'/>
<id>urn:sha1:594a1c271c159c9c5f0ff2d92ebfda469e94e48d</id>
<content type='text'>
Fix filename reporting in guest asserts by ensuring the GUEST_ASSERT
macro records __FILE__ and substituting REPORT_GUEST_ASSERT for many
repetitive calls to TEST_FAIL.

Previously filename was reported by using __FILE__ directly in the
selftest, wrongly assuming it would always be the same as where the
assertion failed.

Signed-off-by: Colton Lewis &lt;coltonlewis@google.com&gt;
Reported-by: Ricardo Koller &lt;ricarkol@google.com&gt;
Fixes: 4e18bccc2e5544f0be28fc1c4e6be47a469d6c60
Link: https://lore.kernel.org/r/20220615193116.806312-5-coltonlewis@google.com
[sean: convert more TEST_FAIL =&gt; REPORT_GUEST_ASSERT instances]
Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Add TEST_REQUIRE macros to reduce skipping copy+paste</title>
<updated>2022-06-11T15:47:29Z</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2022-05-27T23:24:02Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=7ed397d107d461a53e350e5025d68ec3c4a8934d'/>
<id>urn:sha1:7ed397d107d461a53e350e5025d68ec3c4a8934d</id>
<content type='text'>
Add TEST_REQUIRE() and __TEST_REQUIRE() to replace the myriad open coded
instances of selftests exiting with KSFT_SKIP after printing an
informational message.  In addition to reducing the amount of boilerplate
code in selftests, the UPPERCASE macro names make it easier to visually
identify a test's requirements.

Convert usage that erroneously uses something other than print_skip()
and/or "exits" with '0' or some other non-KSFT_SKIP value.

Intentionally drop a kvm_vm_free() in aarch64/debug-exceptions.c as part
of the conversion.  All memory and file descriptors are freed on process
exit, so the explicit free is superfluous.

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Purge vm+vcpu_id == vcpu silliness</title>
<updated>2022-06-11T15:47:22Z</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2022-06-02T20:41:33Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=768e9a61856b75de08f5efa5813bb3e7f16ec271'/>
<id>urn:sha1:768e9a61856b75de08f5efa5813bb3e7f16ec271</id>
<content type='text'>
Take a vCPU directly instead of a VM+vcpu pair in all vCPU-scoped helpers
and ioctls.

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Convert arch_timer away from VCPU_ID</title>
<updated>2022-06-11T15:47:07Z</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2022-02-16T19:40:33Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=7a5e4ae3db643e4b14453c5f67e4670a83284644'/>
<id>urn:sha1:7a5e4ae3db643e4b14453c5f67e4670a83284644</id>
<content type='text'>
Convert arch_timer to use vm_create_with_vcpus() and pass around a
'struct kvm_vcpu' object instead of requiring that the index into the
array of vCPUs for a given vCPU is also the ID of the vCPU

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Split get/set device_attr helpers</title>
<updated>2022-06-11T15:46:23Z</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2022-06-09T20:06:57Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=4091818426d98f4e7093808264caf86ad90287c8'/>
<id>urn:sha1:4091818426d98f4e7093808264caf86ad90287c8</id>
<content type='text'>
Split the get/set device_attr helpers instead of using a boolean param to
select between get and set.  Duplicating upper level wrappers is a very,
very small price to pay for improved readability, and having constant (at
compile time) inputs will allow the selftests framework to sanity check
ioctl() invocations.

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
</feed>
