From: ebiederm@xmission.com (Eric W. Biederman)
To: "Jan H. Schönherr" <jschoenh@amazon.de>
Cc: Thomas Gleixner <tglx@linutronix.de>, kexec@lists.infradead.org
Subject: Re: [PATCH] kexec: Allow to skip digest calculation for speed
Date: Thu, 01 Feb 2018 19:42:39 -0600 [thread overview]
Message-ID: <87h8r0jhf4.fsf@xmission.com> (raw)
In-Reply-To: <20180201231116.28077-1-jschoenh@amazon.de> ("Jan H. \=\?utf-8\?Q\?Sch\=C3\=B6nherr\=22's\?\= message of "Fri, 2 Feb 2018 00:11:16 +0100")
Jan H. Schönherr <jschoenh@amazon.de> writes:
> Give the administrator the ability to trade kexec safety for kexec speed
> by disabling the digest calculation/verification for regular kexecs.
>
> The behavior of kexec-on-crash is not touched.
The performance of the digest caculation is acceptable on 386s. Or it
was years ago when I tested it on a 386. What is the problem you are
having.
Is there something silly like a cache disable in your configuration?
Eric
> Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
> ---
> arch/x86/Kconfig | 12 ++++++++++++
> arch/x86/purgatory/purgatory.c | 9 +++++++++
> kernel/kexec_file.c | 5 +++++
> 3 files changed, 26 insertions(+)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 20da391b5f32..7b257f655327 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -1984,6 +1984,18 @@ config KEXEC_BZIMAGE_VERIFY_SIG
> ---help---
> Enable bzImage signature verification support.
>
> +config KEXEC_SKIP_NONCRASH_DIGEST
> + bool "Disable digest calculation for regular kexec"
> + depends on KEXEC
> + ---help---
> + Disable the calculation and verification of the SHA digest before
> + and during a regular kexec. This speeds up kexec a bit at the cost
> + of a bit of safety.
> +
> + Note, that the digest calculation is still done for a kexec-on-crash.
> +
> + If unsure, say N.
> +
> config CRASH_DUMP
> bool "kernel crash dumps"
> depends on X86_64 || (X86_32 && HIGHMEM)
> diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c
> index 470edad96bb9..2b5189b851b3 100644
> --- a/arch/x86/purgatory/purgatory.c
> +++ b/arch/x86/purgatory/purgatory.c
> @@ -44,6 +44,15 @@ static int verify_sha256_digest(void)
> u8 digest[SHA256_DIGEST_SIZE];
> struct sha256_state sctx;
>
> +#ifdef CONFIG_KEXEC_SKIP_NONCRASH_DIGEST
> + /*
> + * Skip digest verification for non-crash kernels, we trust the
> + * mechanism enough to trade-off the digest for a quicker kexec
> + */
> + if (!purgatory_backup_dest)
> + return 0;
> +#endif
> +
> sha256_init(&sctx);
> end = purgatory_sha_regions + ARRAY_SIZE(purgatory_sha_regions);
>
> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
> index e5bcd94c1efb..ac01b34a7f87 100644
> --- a/kernel/kexec_file.c
> +++ b/kernel/kexec_file.c
> @@ -532,6 +532,11 @@ static int kexec_calculate_store_digests(struct kimage *image)
> struct kexec_sha_region *sha_regions;
> struct purgatory_info *pi = &image->purgatory_info;
>
> +#ifdef CONFIG_KEXEC_SKIP_NONCRASH_DIGEST
> + if (image->type != KEXEC_TYPE_CRASH)
> + return 0;
> +#endif
> +
> zero_buf = __va(page_to_pfn(ZERO_PAGE(0)) << PAGE_SHIFT);
> zero_buf_sz = PAGE_SIZE;
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2018-02-02 1:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-01 23:11 [PATCH] kexec: Allow to skip digest calculation for speed Jan H. Schönherr
2018-02-02 1:42 ` Eric W. Biederman [this message]
2018-02-02 21:54 ` Jan H. Schönherr
2018-02-06 22:22 ` Eric W. Biederman
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=87h8r0jhf4.fsf@xmission.com \
--to=ebiederm@xmission.com \
--cc=jschoenh@amazon.de \
--cc=kexec@lists.infradead.org \
--cc=tglx@linutronix.de \
/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