From: Tom Lendacky <thomas.lendacky@amd.com>
To: David Woodhouse <dwmw2@infradead.org>,
Borislav Petkov <bp@alien8.de>, Brian Gerst <brgerst@gmail.com>
Cc: Usama Arif <usama.arif@bytedance.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"Phillips, Kim" <kim.phillips@amd.com>,
"piotrgorski@cachyos.org" <piotrgorski@cachyos.org>,
"oleksandr@natalenko.name" <oleksandr@natalenko.name>,
"arjan@linux.intel.com" <arjan@linux.intel.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"hpa@zytor.com" <hpa@zytor.com>,
"x86@kernel.org" <x86@kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"paulmck@kernel.org" <paulmck@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"rcu@vger.kernel.org" <rcu@vger.kernel.org>,
"mimoja@mimoja.de" <mimoja@mimoja.de>,
"hewenliang4@huawei.com" <hewenliang4@huawei.com>,
"seanjc@google.com" <seanjc@google.com>,
"pmenzel@molgen.mpg.de" <pmenzel@molgen.mpg.de>,
"fam.zheng@bytedance.com" <fam.zheng@bytedance.com>,
"punit.agrawal@bytedance.com" <punit.agrawal@bytedance.com>,
"simon.evans@bytedance.com" <simon.evans@bytedance.com>,
"liangma@liangbit.com" <liangma@liangbit.com>,
"gpiccoli@igalia.com" <gpiccoli@igalia.com>,
Sabin Rapan <sabrapan@amazon.com>
Subject: Re: [PATCH v16 8/8] x86/smpboot: Allow parallel bringup for SEV-ES
Date: Mon, 27 Mar 2023 14:14:15 -0500 [thread overview]
Message-ID: <2f5c1d5b-c275-fbd5-4cf4-f7b6d0cbff62@amd.com> (raw)
In-Reply-To: <e0e76d1de1e90aafa2d14f95648fff2569b21a73.camel@infradead.org>
On 3/27/23 13:14, David Woodhouse wrote:
> On Mon, 2023-03-27 at 19:47 +0200, Borislav Petkov wrote:
>>> Making sure that the stack protector is either disabled or properly
>>> set up, and disabling any instrumentation/profiling/debug crap that
>>> isn't initialized yet.
>>
>> Lemme dump brain of what Tom and I were talking about today so that it
>> is documented somewhere.
>>
>> * re: stack protector: I was thinking to mark this function
>>
>> __attribute__((no_stack_protector))
>>
>> but gcc added the function attribute way later:
>>
>> ~/src/gcc/gcc.git> git tag --contains 346b302d09c1e6db56d9fe69048acb32fbb97845
>> basepoints/gcc-12
>> basepoints/gcc-13
>> releases/gcc-11.1.0
>> releases/gcc-11.2.0
>> releases/gcc-11.3.0
>> releases/gcc-12.1.0
>> releases/gcc-12.2.0
>>
>> which means, that function would have to live somewhere in a file which
>> has stack protector disabled. One possible place would be
>> arch/x86/mm/mem_encrypt_identity.c which is kinda related.
>
> Shouldn't the rest of head64.c have the stack protector disabled, for
> similar reasons?
>
>> * re: stack: in order to be able to call a C function that early, we'd
>> have to put the VA of the initial stack back into %rsp as we switch
>> pagetables a bit earlier in there (thx Tom).
>
> Hm, don't you have a stack at the point you added that call? I thought
> you did? It doesn't have to be *the* stack for the AP in question.
> Just "a" stack. And you have the lock on the real-mode one that you're
> using.
Unfortunately RSP has the identity mapped stack value and when the
pagetable switch is performed the mapping to that stack is lost. It would
need to be updated to the equivalent of __va(RSP) to get a stack that can
be used without page faulting.
Thanks,
Tom
>
>> So by then, doing all that cargo-cult just in order to not have a bunch
>> of lines in asm doesn't sound all that great anymore.
>>
>> * The __head per-function attribute is easily solved by lifting the
>> __head define into a common header.
>>
>> So meh, dunno. I guess we can do the asm thing for now, until a cleaner
>> solution without too many warts presents itself.
>
> Hm, doesn't most of that just go away (or at least become "Already
> Broken; Someone Else's Problem™") if you just concede to put your new C
> function into head64.c along with a whole bunch of other existing
> CONFIG_AMD_MEM_ENCRYPT support?
>
> (We still have to fix it if it's Someone Else's Problem, of course.
> It's just that you don't have to count that complexity towards your own
> part.)
next prev parent reply other threads:[~2023-03-27 19:14 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 19:40 [PATCH v16 0/8] Parallel CPU bringup for x86_64 Usama Arif
2023-03-21 19:40 ` [PATCH v16 1/8] cpu/hotplug: Move idle_thread_get() to <linux/smpboot.h> Usama Arif
2023-03-21 19:40 ` [PATCH v16 2/8] cpu/hotplug: Reset task stack state in _cpu_up() Usama Arif
2023-03-22 11:06 ` Mark Rutland
2023-03-21 19:40 ` [PATCH v16 3/8] cpu/hotplug: Add dynamic parallel bringup states before CPUHP_BRINGUP_CPU Usama Arif
2023-03-23 22:36 ` Thomas Gleixner
2023-03-23 22:49 ` David Woodhouse
2023-03-23 23:48 ` Thomas Gleixner
2023-03-24 0:06 ` David Woodhouse
2023-03-23 23:05 ` Thomas Gleixner
2023-03-23 23:12 ` David Woodhouse
2023-03-24 1:16 ` Thomas Gleixner
2023-03-24 9:31 ` David Woodhouse
2023-03-24 13:57 ` Thomas Gleixner
2023-03-24 15:33 ` David Woodhouse
2023-03-24 14:07 ` Thomas Gleixner
2023-03-24 9:46 ` Thomas Gleixner
2023-03-24 10:00 ` David Woodhouse
2023-03-27 18:48 ` David Woodhouse
2023-03-21 19:40 ` [PATCH v16 4/8] x86/smpboot: Split up native_cpu_up into separate phases and document them Usama Arif
2023-03-21 19:40 ` [PATCH v16 5/8] x86/smpboot: Support parallel startup of secondary CPUs Usama Arif
2023-03-21 19:40 ` [PATCH v16 6/8] x86/smpboot: Send INIT/SIPI/SIPI to secondary CPUs in parallel Usama Arif
2023-03-21 19:40 ` [PATCH v16 7/8] x86/smpboot: Serialize topology updates for secondary bringup Usama Arif
2023-03-21 19:40 ` [PATCH v16 8/8] x86/smpboot: Allow parallel bringup for SEV-ES Usama Arif
2023-03-22 22:47 ` Borislav Petkov
2023-03-23 8:32 ` David Woodhouse
2023-03-23 8:51 ` Borislav Petkov
2023-03-23 9:04 ` David Woodhouse
2023-03-23 14:23 ` Brian Gerst
2023-03-27 17:47 ` Borislav Petkov
2023-03-27 18:14 ` David Woodhouse
2023-03-27 19:14 ` Tom Lendacky [this message]
2023-03-27 19:32 ` Borislav Petkov
2023-03-23 13:16 ` Tom Lendacky
[not found] ` <751f572f940220775054dc09324b20b929d7d66d.camel@amazon.co.uk>
2023-03-23 18:28 ` Tom Lendacky
2023-03-23 22:13 ` Borislav Petkov
2023-03-23 22:30 ` [EXTERNAL][PATCH " David Woodhouse
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=2f5c1d5b-c275-fbd5-4cf4-f7b6d0cbff62@amd.com \
--to=thomas.lendacky@amd.com \
--cc=arjan@linux.intel.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dave.hansen@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=fam.zheng@bytedance.com \
--cc=gpiccoli@igalia.com \
--cc=hewenliang4@huawei.com \
--cc=hpa@zytor.com \
--cc=kim.phillips@amd.com \
--cc=kvm@vger.kernel.org \
--cc=liangma@liangbit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mimoja@mimoja.de \
--cc=mingo@redhat.com \
--cc=oleksandr@natalenko.name \
--cc=paulmck@kernel.org \
--cc=pbonzini@redhat.com \
--cc=piotrgorski@cachyos.org \
--cc=pmenzel@molgen.mpg.de \
--cc=punit.agrawal@bytedance.com \
--cc=rcu@vger.kernel.org \
--cc=sabrapan@amazon.com \
--cc=seanjc@google.com \
--cc=simon.evans@bytedance.com \
--cc=tglx@linutronix.de \
--cc=usama.arif@bytedance.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
all inboxes | Powered by JetHome®