Re: [PATCH v14 00/22] TDX KVM selftests

Ackerley Tng <[email protected]>
Newsgroups org.kernel.vger.linux-kselftest,dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-kernel
Message-ID <CAEvNRgELDhXvPFKaoz+w-yywoJn0WMWvA-Y2jfdnwJVSbCSWyw@mail.gmail.com>
"Edgecombe, Rick P" <[email protected]> writes:

> On Thu, 2026-08-13 at 15:47 -0700, Rick Edgecombe wrote:
>> On Wed, 2026-07-22 at 23:13 +0000, Lisa Wang wrote:
>> > v14 revision for TDX KVM selftests based on kvm/next and guest_memfd:
>> > In-place conversion support[1]. This series needs some changes from
>> > in-place conversion v9. For ease of testing, an extra hack commit has
>> > been added. The complete code is available at:
>> > https://github.com/googleprodkernel/linux-cc/commits/tdx-selftests-v14
>>
>> Are you able to get sashiko review on this? Or did you internally somehow? It
>> seems the public sashiko cannot figure out this stack.
>
> Actually why is this on top of in-place conversion? I thought the idea was to
> break the series apart to get something basic upstream:
> https://lore.kernel.org/all/[email protected]/
>
> Adding in-place conversion tests seems to be going in the opposite direction.
>

We wanted to have this series based on in-place conversion since
non-in-place conversion is on a deprecation path. Also, it makes the set
up easier :)

At this point I don't think this series is going to make it for 7.3, so
at best it makes it for 7.4 (together with in-place conversion), which I
think works out?

Sean, let us know what you think about scheduling. We can rebase without
in-place conversion if necessary.

>
> Also, the branch does not build for me:
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:26:
> undefined reference to `TD_BOOT_PARAMETERS_PER_VCPU'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:30:
> undefined reference to `TD_PER_VCPU_PARAMETERS_ESP_GVA'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:33:
> undefined reference to `TD_BOOT_PARAMETERS_GDT'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:37:
> undefined reference to `TD_BOOT_PARAMETERS_IDT'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:44:
> undefined reference to `TD_BOOT_PARAMETERS_CR4'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:46:
> undefined reference to `TD_BOOT_PARAMETERS_CR3'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:48:
> undefined reference to `TD_BOOT_PARAMETERS_CR0'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:54:
> undefined reference to `TD_PER_VCPU_PARAMETERS_GUEST_CODE'
> collect2: error: ld returned 1 exit status
> make: *** [Makefile.kvm:351:
> .../linux/tools/testing/selftests/kvm/demand_paging_test] Error 1
> make: *** Waiting for unfinished jobs....
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.o: in
> function `td_boot':
> .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:24: undefined
> reference to `SIZEOF_TD_PER_VCPU_PARAMETERS'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:26:
> undefined reference to `TD_BOOT_PARAMETERS_PER_VCPU'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:30:
> undefined reference to `TD_PER_VCPU_PARAMETERS_ESP_GVA'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:33:
> undefined reference to `TD_BOOT_PARAMETERS_GDT'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:37:
> undefined reference to `TD_BOOT_PARAMETERS_IDT'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:44:
> undefined reference to `TD_BOOT_PARAMETERS_CR4'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:46:
> undefined reference to `TD_BOOT_PARAMETERS_CR3'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:48:
> undefined reference to `TD_BOOT_PARAMETERS_CR0'
> /usr/bin/ld: .../linux/tools/testing/selftests/kvm/lib/x86/tdx/td_boot.S:54:
> undefined reference to `TD_PER_VCPU_PARAMETERS_GUEST_CODE'
> collect2: error: ld returned 1 exit status
> make: *** [Makefile.kvm:351:
> .../linux/tools/testing/selftests/kvm/dirty_log_test] Error 1
>
> If I apply these patches on 8cf3969a0b7d4 from the branch, it builds though. It
> looks like a few changes are missing from the branch:
>
> diff --git a/tools/testing/selftests/kvm/guest_memfd_test.c
> b/tools/testing/selftests/kvm/guest_memfd_test.c
> index d6528c6f5e031..b099b09cbae3d 100644
> --- a/tools/testing/selftests/kvm/guest_memfd_test.c
> +++ b/tools/testing/selftests/kvm/guest_memfd_test.c
> @@ -14,7 +14,7 @@
>  #include <linux/bitmap.h>
>  #include <linux/falloc.h>
>  #include <linux/sizes.h>
> -#include <sys/mman.h>
> +#include <linux/mman.h>

I recall a similar fix [1] you posted, I think both Lisa and I are
relying on some LSP auto-including, we'll adopt <linux/mman.h>. Let me
know you know a good way to configure the auto-includes.

[1] https://lore.kernel.org/all/[email protected]/

What compiler/version are you using? We'd like to reproduce.

>  #include <sys/types.h>
>  #include <sys/stat.h>
>
> diff --git a/tools/testing/selftests/kvm/lib/x86/tdx/td_boot_offsets.c
> b/tools/testing/selftests/kvm/lib/x86/tdx/td_boot_offsets.c
> index b81cd16198ecf..7f76a3585b99a 100644
> --- a/tools/testing/selftests/kvm/lib/x86/tdx/td_boot_offsets.c
> +++ b/tools/testing/selftests/kvm/lib/x86/tdx/td_boot_offsets.c
> @@ -5,7 +5,7 @@
>
>  #include "tdx/td_boot.h"
>
> -static void __used common(void)
> +static void __attribute__((used)) common(void)

Not sure about this, I'll let Lisa look at this in more detail. I wonder
if declaring __used is necessary at all.

>  {
>         OFFSET(TD_BOOT_PARAMETERS_CR0, td_boot_parameters, cr0);
>         OFFSET(TD_BOOT_PARAMETERS_CR3, td_boot_parameters, cr3);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.