Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2573341imi; Mon, 25 Jul 2022 02:15:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vd4P6duidpu9BaE1iWke8J/v/SI1iR72Vj8yHd87tncuH8CtYiyVR7wD1q7sWV633kj+5B X-Received: by 2002:a05:6402:1d4c:b0:43b:c85f:5c95 with SMTP id dz12-20020a0564021d4c00b0043bc85f5c95mr12292826edb.213.1658740544995; Mon, 25 Jul 2022 02:15:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658740544; cv=none; d=google.com; s=arc-20160816; b=leh8FL1z/XzcOIqJ23xdbT2cLD/YgjtFHYcgrOJ3i6LUrBznmOS/jijIqJ1juLmg7u C6y26cDBwO5tTQlFng0KkMNGg+Jxv8CU8JHiU67nTKkf18BIVeUv5k5fDqRWLkIbMj8J 1b7UzDxgoztYKGD2I6yGZqp1GFN2uKltBOKD6UmJQIR472+ol7yoJDQexeAx05e/a85E hsV/RnBxRj3BGKL4yrHx3wKKRqKImwhSLTKPKZk5mKgM82s89jxH4OUevBn8tqzHw4Da kggrGAxYlyefuqD/odp4bIFw/lukAmwf4m7AM3ECcIYOS1QoS0N8JtaGRfWpSyXHTwT8 Kypg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=Amwcf3EAj1ZxcGutEEAzUz751/Dy5KvsTcGRq8AfA0Q=; b=jzx7MdAvupoqgtPUmUaC4Bj1HsrhjBiXYtcvg9lx3IN5Mb/V4Lz7xW8G7WzKWJApOA O/09ETT/vrVox12lPIr/iokwZhiue2wnoXEhgaJt0tK3IA7IH+ipz0WZWt5J75jnb5gx ob6WhcRBZKBVD5jO0T3PIZRFUkyDuFP2ACgyQOB3/9jHh7FtssZCwAjPlrwsM2Thnx6M FFBtqcoBcc+YTzOAdgjuFc1hS0HRCJI6J+dUzpvYFyIiGrb/dn6qUL/KWFJMws8DvIdv 9ZgYEKkttYYMKaStaKQWqVN0FSA9Rt/eJIJQxAN9m949EONo6cv5Zd/B+My82ZNagyIs W+jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=jo8T+MgU; 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 sd16-20020a1709076e1000b006feb8cc7e2asi13892803ejc.503.2022.07.25.02.15.20; Mon, 25 Jul 2022 02:15:44 -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=fail header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=jo8T+MgU; 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 S233941AbiGYIjb (ORCPT + 99 others); Mon, 25 Jul 2022 04:39:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232613AbiGYIja (ORCPT ); Mon, 25 Jul 2022 04:39:30 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0083D13FBB for ; Mon, 25 Jul 2022 01:39:28 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id gn24so9742884pjb.3 for ; Mon, 25 Jul 2022 01:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Amwcf3EAj1ZxcGutEEAzUz751/Dy5KvsTcGRq8AfA0Q=; b=jo8T+MgUl15kH1BqxkbwiWY/qbgoEYehBHZY0ciEJqcTGxiQvzgqHT3qYG64kZB09L Ldp30ym3utCxsNXD0V4cE/IQTpTcr9nRvBMD8Q7YAAWg3nuvXaPW8p0T+Ss6vm0Y/Yz2 c3ItMQi8wGERX8KSJ2K/S66Eusd/msC+By5V0onbSOZucoh+78CE4Quq8eUB9G/ZjX/r VAcg/FmLu8rR5LtaIHTj5E1hEJjbErtRfjTCu/r8mUSjd3FlSVr66dNJmqOnSGXCzka7 O4gm4SAldX1ww5OQz2FoSYCoBaXaUHuiE0sTeH4IAX89RZRT44a1VE2hEWrb87YYQU1t vaKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Amwcf3EAj1ZxcGutEEAzUz751/Dy5KvsTcGRq8AfA0Q=; b=Eaa6Wu+wjhLbdIkbjtyGlPpXG0mULUSJf6yU1ukLSfBRMeEhsB5GxpSDwVyiVrdHXs yiW/FBHI9kcLJqJV/m7hvmQvNcbetwuXj78sPPV2OLyGTbOs9M5/W+nZ3fS87n51bAcL kVzzjLMN4TclMc8hz55Xl7iapjXM7mn4rR7tP97C+kWi6rqvDSCTgAsFugUHZUorI2GN XQDAxkFqtCCg7FCEEdxA2cjTC9kFhOGzBPS4Y807uT5A8sV6yo/Bj1K0J4ywLSOPb6Fl GJPXcIWK2u9ubvnSdnM4huR+PCNhjVt4sl4AvcMmKLBLDiDgsxBs4WU2MJCH+NbhIfWL xVow== X-Gm-Message-State: AJIora/NKGvodlOILxF1njSelFyE1Sd3DbT73/o42IcpwIVDBUw/VD/z Y9vrzH2KAhchBCOWqea211RV+A== X-Received: by 2002:a17:90a:c907:b0:1ef:7655:98d7 with SMTP id v7-20020a17090ac90700b001ef765598d7mr12871560pjt.117.1658738368493; Mon, 25 Jul 2022 01:39:28 -0700 (PDT) Received: from C02FG34NMD6R.bytedance.net ([139.177.225.241]) by smtp.gmail.com with ESMTPSA id 128-20020a621886000000b0052abc2438f1sm8893479pfy.55.2022.07.25.01.39.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jul 2022 01:39:28 -0700 (PDT) From: Albert Huang Cc: "huangjie.albert" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "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 , linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-kbuild@vger.kernel.org Subject: [PATCH 0/4] faster kexec reboot Date: Mon, 25 Jul 2022 16:38:52 +0800 Message-Id: <20220725083904.56552-1-huangjie.albert@bytedance.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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" : "=a"(low), "=d"(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