Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2722830imi; Mon, 25 Jul 2022 06:41:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tE4C0HxwC5+4xBfwqQSZWMtGo3L3p4JoVdBbobbOmCMR7BVeg5iscJPsJWNqeuPf2OhXjb X-Received: by 2002:a9d:4e1e:0:b0:61c:cad5:355d with SMTP id p30-20020a9d4e1e000000b0061ccad5355dmr4591980otf.308.1658756498225; Mon, 25 Jul 2022 06:41:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658756498; cv=none; d=google.com; s=arc-20160816; b=hVb0Z0pshxjD1erpXM8jSahlLxryCayQwEqUsCKY93soUm8cmmfueHBOm8XdhNRz52 eH3eh7a+sw6JqkN3PvXuIozIgPi0Dz2KWkdnNGKeXHhEDReeuAt3VN8ydLDVTUYorh02 pwRftXgvhMv6eVXNxFx6tYDzIa8qzNiCn/g8Wfr84mgC9rdZX5hl5gnU089KxZ2VM388 Uh1I0orZTLYxZO0gc+69A9CSA3MnDkEcPLxDMgPdAH7EqFfaWK82sFC7uH6spo5BW/zQ JL4wUXJYiD+kzXpcBKwiEJLLwOr6S8wn3EE1NKgNC6cA7oYzuXPiF3IJRUpVy/8qLQH1 fFyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:to:subject:message-id :date:from:in-reply-to:references:mime-version:dkim-signature; bh=3b1v6Mgf7ucnDr/oMrJlG8tjEQ/ANlrgzIFnlkN8kLM=; b=gz8FeaaeghtmqppTMYaqgjYCn84oDqFKJTB5FJ+R6liqWrUjJcgeQzB5SnuIip4+Co jrzvuV4Ep08KPIvvfq4dAy1d83pnTLwL7wuo42NYXDWUTtIig90yQ0msBs1123QzXyQG nfUh2cpzqN214NKbqp22jkLvvXjjN0VieoGP2rKMY9SdH0PcaUgfqc5+pOqVpVV22OJh VAHWJ3cLPN+TdE6B8WU/80ByCmZwDDYZSq0aUSpy6/jpyGf8nM+P21ZgdNCeWpv/oCR9 QMREJDRHUYKASe3WW9Qj/LElCmpbScEl7FDjZv0lR4iaoM5Nvrn0hRfDZPlV225sCKTU nuHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=doWIbhSF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a056870d15400b0010c13584e3bsi10227240oac.99.2022.07.25.06.41.20; Mon, 25 Jul 2022 06:41:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=doWIbhSF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235275AbiGYMzT (ORCPT + 99 others); Mon, 25 Jul 2022 08:55:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235148AbiGYMzO (ORCPT ); Mon, 25 Jul 2022 08:55:14 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8576D1E6 for ; Mon, 25 Jul 2022 05:55:10 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id h16so5633510ila.2 for ; Mon, 25 Jul 2022 05:55:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=3b1v6Mgf7ucnDr/oMrJlG8tjEQ/ANlrgzIFnlkN8kLM=; b=doWIbhSFyCtiiI4N1Cx8+iT6a//VvEss4vVJnKiTZr9DnqaVLlfT5qWvONZl/zvlqq ySpANVja0ZFf0zreJzIPc4ln00o5uQCZ1bfGznHa09MiTxbf/++U4ox+I4xcHEg242cc WRTr+3qyNQyMyWI53IEKJeX18qJ5+jUpc9ZkKugENjfDajNh2MIgMBPspBwILb/hLr3p keKtO56m3njzgfdhbif7EZm1v7Uia69yQOr6uMa1nrDouxrse5sUGlghAu+ROYRmSuFR UQUXDU995xGTSTVa+tpjuBlKgHzUA7z1RBSIgO1eZAXt2nagUZ1z3QbWRrCWNADZbdnn AZ2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=3b1v6Mgf7ucnDr/oMrJlG8tjEQ/ANlrgzIFnlkN8kLM=; b=pNwLE/rfUfqA0+/pbRsc0I9MoZLJuFsRRm1QXx63utDlFs+f7En5/xXTJUAmJTHiE2 hx5EogfRrEnwJSi3ru2aEPSJLVf6NJRzUdaSTYpz8h1A68LcZ1P3LvVcJ2vH6AMfr41o DboAsDISjLPKCLETKgxHNs9OuRFVjImVhB9bb5wHaJVsF779TIbVo8zsoLwPs+al6+tB r2sAN93wP6KZM7MF1w4t6p9UMZMvcpvWeXI/jJvJr9Dx4d9xgTnbY5w6AEqDDe7+w8JL M2c9XN3BIURCqyJ4VrCeSnLPrm5AVy7B/fy2hiZeJOuR5VjE6hLVVgbhr19wKtX7CKTo ElGg== X-Gm-Message-State: AJIora+5/3H2mT2NYUJNrJNUn6uBGPjaEHjcbIyuVMsaxV2MAYT/GFuf e8SGTfChJ0zrrzzlM6WeW1qT3k1gAVKd8vc49ELAkoUVgGo= X-Received: by 2002:a05:6e02:1e04:b0:2dd:46f6:87ae with SMTP id g4-20020a056e021e0400b002dd46f687aemr2397357ila.36.1658753709680; Mon, 25 Jul 2022 05:55:09 -0700 (PDT) MIME-Version: 1.0 References: <20220725083904.56552-1-huangjie.albert@bytedance.com> In-Reply-To: <20220725083904.56552-1-huangjie.albert@bytedance.com> From: =?UTF-8?B?6buE5p2w?= Date: Mon, 25 Jul 2022 20:54:58 +0800 Message-ID: Subject: Fwd: [PATCH 0/4] faster kexec reboot To: linux-kernel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ---------- Forwarded message --------- =E5=8F=91=E4=BB=B6=E4=BA=BA=EF=BC=9A Albert Huang Date: 2022=E5=B9=B47=E6=9C=8825=E6=97=A5=E5=91=A8=E4=B8=80 16:39 Subject: [PATCH 0/4] faster kexec reboot To: Cc: huangjie.albert , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , H. Peter Anvin , Eric Biederman , Masahiro Yamada , Michal Marek , Nick Desaulniers , Kirill A. Shutemov , Michael Roth , Kuppuswamy Sathyanarayanan , Nathan Chancellor , Peter Zijlstra , Sean Christopherson , Joerg Roedel , Mark Rutland , Kees Cook , , , From: "huangjie.albert" In many time-sensitive scenarios, we need a shorter time to restart the kernel. However, in the current kexec fast restart code, there are many places in the memory copy operation, verification operation and decompression operation, which take more time than 500ms. Through the following patch series. machine_kexec-->start_kernel only takes 15ms How to measure time: c code: uint64_t current_cycles(void) { uint32_t low, high; asm volatile("rdtsc" : "=3Da"(low), "=3Dd"(high)); return ((uint64_t)low) | ((uint64_t)high << 32); } assembly code: pushq %rax pushq %rdx rdtsc mov %eax,%eax shl $0x20,%rdx or %rax,%rdx movq %rdx,0x840(%r14) popq %rdx popq %rax the timestamp may store in boot_params or kexec control page, so we can get the all timestamp after kernel boot up. huangjie.albert (4): kexec: reuse crash kernel reserved memory for normal kexec kexec: add CONFING_KEXEC_PURGATORY_SKIP_SIG x86: Support the uncompressed kernel to speed up booting x86: boot: avoid memory copy if kernel is uncompressed arch/x86/Kconfig | 10 +++++++++ arch/x86/boot/compressed/Makefile | 5 ++++- arch/x86/boot/compressed/head_64.S | 8 +++++-- arch/x86/boot/compressed/misc.c | 35 +++++++++++++++++++++++++----- arch/x86/purgatory/purgatory.c | 7 ++++++ include/linux/kexec.h | 9 ++++---- include/uapi/linux/kexec.h | 2 ++ kernel/kexec.c | 19 +++++++++++++++- kernel/kexec_core.c | 16 ++++++++------ kernel/kexec_file.c | 20 +++++++++++++++-- scripts/Makefile.lib | 5 +++++ 11 files changed, 114 insertions(+), 22 deletions(-) -- 2.31.1