<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/testing/selftests/kvm/include/userfaultfd_util.h, branch v6.12.80</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-05-12T07:18:11+00:00</updated>
<entry>
<title>Merge tag 'kvm-x86-selftests_utils-6.10' of https://github.com/kvm-x86/linux into HEAD</title>
<updated>2024-05-12T07:18:11+00:00</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2024-05-12T07:18:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dee7ea42a1eba18bf4722a27b10773607c66e21d'/>
<id>urn:sha1:dee7ea42a1eba18bf4722a27b10773607c66e21d</id>
<content type='text'>
KVM selftests treewide updates for 6.10:

 - Define _GNU_SOURCE for all selftests to fix a warning that was introduced by
   a change to kselftest_harness.h late in the 6.9 cycle, and because forcing
   every test to #define _GNU_SOURCE is painful.

 - Provide a global psuedo-RNG instance for all tests, so that library code can
   generate random, but determinstic numbers.

 - Use the global pRNG to randomly force emulation of select writes from guest
   code on x86, e.g. to help validate KVM's emulation of locked accesses.

 - Rename kvm_util_base.h back to kvm_util.h, as the weird layer of indirection
   was added purely to avoid manually #including ucall_common.h in a handful of
   locations.

 - Allocate and initialize x86's GDT, IDT, TSS, segments, and default exception
   handlers at VM creation, instead of forcing tests to manually trigger the
   related setup.
</content>
</entry>
<entry>
<title>KVM: selftests: Define _GNU_SOURCE for all selftests code</title>
<updated>2024-04-29T19:49:10+00:00</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2024-04-23T19:03:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=730cfa45b5f4f170095707b526dc7af99c9f0959'/>
<id>urn:sha1:730cfa45b5f4f170095707b526dc7af99c9f0959</id>
<content type='text'>
Define _GNU_SOURCE is the base CFLAGS instead of relying on selftests to
manually #define _GNU_SOURCE, which is repetitive and error prone.  E.g.
kselftest_harness.h requires _GNU_SOURCE for asprintf(), but if a selftest
includes kvm_test_harness.h after stdio.h, the include guards result in
the effective version of stdio.h consumed by kvm_test_harness.h not
defining asprintf():

  In file included from x86_64/fix_hypercall_test.c:12:
  In file included from include/kvm_test_harness.h:11:
 ../kselftest_harness.h:1169:2: error: call to undeclared function
  'asprintf'; ISO C99 and later do not support implicit function declarations
  [-Wimplicit-function-declaration]
   1169 |         asprintf(&amp;test_name, "%s%s%s.%s", f-&gt;name,
        |         ^

When including the rseq selftest's "library" code, #undef _GNU_SOURCE so
that rseq.c controls whether or not it wants to build with _GNU_SOURCE.

Reported-by: Muhammad Usama Anjum &lt;usama.anjum@collabora.com&gt;
Acked-by: Claudio Imbrenda &lt;imbrenda@linux.ibm.com&gt;
Acked-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Acked-by: Anup Patel &lt;anup@brainfault.org&gt;
Reviewed-by: Muhammad Usama Anjum &lt;usama.anjum@collabora.com&gt;
Link: https://lore.kernel.org/r/20240423190308.2883084-1-seanjc@google.com
Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Allow many vCPUs and reader threads per UFFD in demand paging test</title>
<updated>2024-04-09T21:28:53+00:00</updated>
<author>
<name>Anish Moorthy</name>
<email>amoorthy@google.com</email>
</author>
<published>2024-02-15T23:54:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=df4ec5aada9da30486d5464f34ffc80acd0373d6'/>
<id>urn:sha1:df4ec5aada9da30486d5464f34ffc80acd0373d6</id>
<content type='text'>
At the moment, demand_paging_test does not support profiling/testing
multiple vCPU threads concurrently faulting on a single uffd because

    (a) "-u" (run test in userfaultfd mode) creates a uffd for each vCPU's
        region, so that each uffd services a single vCPU thread.
    (b) "-u -o" (userfaultfd mode + overlapped vCPU memory accesses)
        simply doesn't work: the test tries to register the same memory
        to multiple uffds, causing an error.

Add support for many vcpus per uffd by
    (1) Keeping "-u" behavior unchanged.
    (2) Making "-u -a" create a single uffd for all of guest memory.
    (3) Making "-u -o" implicitly pass "-a", solving the problem in (b).
In cases (2) and (3) all vCPU threads fault on a single uffd.

With potentially multiple vCPUs per UFFD, it makes sense to allow
configuring the number of reader threads per UFFD as well: add the "-r"
flag to do so.

Signed-off-by: Anish Moorthy &lt;amoorthy@google.com&gt;
Acked-by: James Houghton &lt;jthoughton@google.com&gt;
Link: https://lore.kernel.org/r/20240215235405.368539-12-amoorthy@google.com
[sean: fix kernel style violations, use calloc() for arrays]
Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
</content>
</entry>
<entry>
<title>KVM: selftests: Add a userfaultfd library</title>
<updated>2022-11-10T19:10:27+00:00</updated>
<author>
<name>Ricardo Koller</name>
<email>ricarkol@google.com</email>
</author>
<published>2022-10-17T19:58:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a93871d0ea9fd59fb5eb783619334183d7f07f51'/>
<id>urn:sha1:a93871d0ea9fd59fb5eb783619334183d7f07f51</id>
<content type='text'>
Move the generic userfaultfd code out of demand_paging_test.c into a
common library, userfaultfd_util. This library consists of a setup and a
stop function. The setup function starts a thread for handling page
faults using the handler callback function. This setup returns a
uffd_desc object which is then used in the stop function (to wait and
destroy the threads).

Reviewed-by: Oliver Upton &lt;oliver.upton@linux.dev&gt;
Reviewed-by: Ben Gardon &lt;bgardon@google.com&gt;
Signed-off-by: Ricardo Koller &lt;ricarkol@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20221017195834.2295901-2-ricarkol@google.com
</content>
</entry>
</feed>
