public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Borislav Petkov <bp@alien8.de>
Cc: thomas.lendacky@amd.com, David Gow <davidgow@google.com>,
	"x86@kernel.org" <x86@kernel.org>,
	Brendan Higgins <brendan.higgins@linux.dev>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: sev_es_trampoline_start undefined symbol referenced errors during kunit run
Date: Tue, 15 Apr 2025 18:54:23 -0600	[thread overview]
Message-ID: <a640e6f0-075d-4af7-a26f-293c1a9d4ceb@linuxfoundation.org> (raw)
In-Reply-To: <88a4052c-ac37-4958-af2a-a3066e8b82bd@linuxfoundation.org>

On 4/15/25 16:29, Shuah Khan wrote:
> On 4/15/25 16:17, Borislav Petkov wrote:
>> On Tue, Apr 15, 2025 at 01:06:49PM -0600, Shuah Khan wrote:
>>> Does your arch/x86/realmode/rm/pasyms.h has reference to sev_es_trampoline_start?
>>>
>>> The one in my tree has it.
>>>
>>> arch/x86/realmode/rm/pasyms.h:pa_sev_es_trampoline_start = sev_es_trampoline_start
>>
>>
>> # ./tools/testing/kunit/kunit.py run --arch x86_64
>> ...
>>
>> [00:15:36] Elapsed time: 58.840s total, 2.096s configuring, 53.170s building, 3.487s running
>>
>> # cat arch/x86/realmode/rm/pasyms.h
>> cat: arch/x86/realmode/rm/pasyms.h: No such file or directory
>>
>> Could explain why I don't see the issue...
>>
> 
> I see arch/x86/realmode/rm/pasyms.h on my system. It is a generated
> file from arch/x86/realmode/rm Makefile
> 
> Here is the target information.
> 
> REALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y))
> 
> sed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p'
> 
> quiet_cmd_pasyms = PASYMS  $@
>        cmd_pasyms = $(NM) $(real-prereqs) | sed $(sed-pasyms) | sort | uniq > $@
> 
> targets += pasyms.h
> $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
>          $(call if_changed,pasyms)
> 
> The key is how and why this file gets generated and why the reference
> 
> pa_sev_es_trampoline_start = sev_es_trampoline_start
> 
> is added unconditionally even when  CONFIG_AMD_MEM_ENCRYPT is not
> enabled. I think the logic should be fixed to take AMD_MEM_ENCRYPT
> enabled or disabled into account when this pasyms.h file is generated.
> 

Okay - I think the logic to extract symbols to include in pasyms.h
will have to take AMD_MEM_ENCRYPT enabled vs. disabled into account.

running git grep sev_es_trampoline_start in arch/x86/realmode/rm shows:

header.S:       .long   pa_sev_es_trampoline_start
trampoline_64.S:SYM_CODE_START(sev_es_trampoline_start)
trampoline_64.S:SYM_CODE_END(sev_es_trampoline_start)

All of the above are under ifdef AMD_MEM_ENCRYPT conditional.
Even if pasyms.h is generated sev_es_trampoline_start should not
be included in pasyms.h if AMD_MEM_ENCRYPT is disabled.

thanks,
-- Shuah


      parent reply	other threads:[~2025-04-16  0:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 22:28 sev_es_trampoline_start undefined symbol referenced errors during kunit run Shuah Khan
2025-04-14 23:00 ` Borislav Petkov
2025-04-15  8:54   ` David Gow
2025-04-15 14:25   ` Shuah Khan
2025-04-15 18:01     ` Borislav Petkov
2025-04-15 19:06       ` Shuah Khan
2025-04-15 22:17         ` Borislav Petkov
2025-04-15 22:29           ` Shuah Khan
2025-04-16  0:32             ` David Gow
2025-04-16  1:09               ` Shuah Khan
2025-04-16  9:18               ` Borislav Petkov
2025-04-16  0:54             ` Shuah Khan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a640e6f0-075d-4af7-a26f-293c1a9d4ceb@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=bp@alien8.de \
    --cc=brendan.higgins@linux.dev \
    --cc=davidgow@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox