Eric W. Biederman
2021-Nov-01 21:11 UTC
[PATCH v2 01/12] kexec: Allow architecture code to opt-out at runtime
Borislav Petkov <bp at alien8.de> writes:> On Mon, Sep 13, 2021 at 05:55:52PM +0200, Joerg Roedel wrote: >> From: Joerg Roedel <jroedel at suse.de> >> >> Allow a runtime opt-out of kexec support for architecture code in case >> the kernel is running in an environment where kexec is not properly >> supported yet. >> >> This will be used on x86 when the kernel is running as an SEV-ES >> guest. SEV-ES guests need special handling for kexec to hand over all >> CPUs to the new kernel. This requires special hypervisor support and >> handling code in the guest which is not yet implemented. >> >> Cc: stable at vger.kernel.org # v5.10+ >> Signed-off-by: Joerg Roedel <jroedel at suse.de> >> --- >> include/linux/kexec.h | 1 + >> kernel/kexec.c | 14 ++++++++++++++ >> kernel/kexec_file.c | 9 +++++++++ >> 3 files changed, 24 insertions(+) > > I guess I can take this through the tip tree along with the next one.I seem to remember the consensus when this was reviewed that it was unnecessary and there is already support for doing something like this at a more fine grained level so we don't need a new kexec hook. Eric
Joerg Roedel
2021-Nov-02 16:37 UTC
[PATCH v2 01/12] kexec: Allow architecture code to opt-out at runtime
On Mon, Nov 01, 2021 at 04:11:42PM -0500, Eric W. Biederman wrote:> I seem to remember the consensus when this was reviewed that it was > unnecessary and there is already support for doing something like > this at a more fine grained level so we don't need a new kexec hook.It was a discussion, no consenus :) I still think it is better to solve this in generic code for everybody to re-use than with an hack in the architecture hooks. More and more platforms which enable confidential computing features may need this hook in the future. Regards, -- J?rg R?del jroedel at suse.de SUSE Software Solutions Germany GmbH Maxfeldstr. 5 90409 N?rnberg Germany (HRB 36809, AG N?rnberg) Gesch?ftsf?hrer: Ivo Totev
Joerg Roedel
2021-Nov-02 17:00 UTC
[PATCH v2 01/12] kexec: Allow architecture code to opt-out at runtime
Hi again, On Mon, Nov 01, 2021 at 04:11:42PM -0500, Eric W. Biederman wrote:> I seem to remember the consensus when this was reviewed that it was > unnecessary and there is already support for doing something like > this at a more fine grained level so we don't need a new kexec hook.Forgot to state to problem again which these patches solve: Currently a Linux kernel running as an SEV-ES guest has no way to successfully kexec into a new kernel. The normal SIPI sequence to reset the non-boot VCPUs does not work in SEV-ES guests and special code is needed in Linux to safely hand over the VCPUs from one kernel to the next. What happens currently is that the kexec'ed kernel will just hang. The code which implements the VCPU hand-over is also included in this patch-set, but it requires a certain level of Hypervisor support which is not available everywhere. To make it clear to the user that kexec will not work in their environment, it is best to disable the respected syscalls. This is what the hook is needed for. Regards, -- J?rg R?del jroedel at suse.de SUSE Software Solutions Germany GmbH Maxfeldstr. 5 90409 N?rnberg Germany (HRB 36809, AG N?rnberg) Gesch?ftsf?hrer: Ivo Totev
Borislav Petkov
2021-Nov-02 17:17 UTC
[PATCH v2 01/12] kexec: Allow architecture code to opt-out at runtime
On Mon, Nov 01, 2021 at 04:11:42PM -0500, Eric W. Biederman wrote:> I seem to remember the consensus when this was reviewed that it was > unnecessary and there is already support for doing something like > this at a more fine grained level so we don't need a new kexec hook.Well, the executive summary is that you have a guest whose memory *and* registers are encrypted so the hypervisor cannot have a poke inside and reset the vCPU like it would normally do. So you need to do that dance differently, i.e, the patchset. If you try to kexec such a guest now, it'll init only the BSP, as Joerg said. So I guess a single-threaded kdump. And yes, one of the prominent use cases is kdumping from such a guest, as distros love doing kdump for debugging. I hope that explains it better. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette