Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1052520ybx; Thu, 7 Nov 2019 06:36:00 -0800 (PST) X-Google-Smtp-Source: APXvYqyAPlU2SzoHZkkTQv6WJTcmIqsU4m5T1idKEKDS1gLHWUu2M4NFaTDT7ZLLQsb3dqR0isXV X-Received: by 2002:a05:6402:138c:: with SMTP id b12mr3973267edv.28.1573137360858; Thu, 07 Nov 2019 06:36:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573137360; cv=none; d=google.com; s=arc-20160816; b=vGsRhYF+I+AaXwevYXxIWgAwtintCDvbWia7kvkWw/ol3RDPvb6/eNYK3nRD4G4QgQ oe/Rml2mCdf0aqBqss9gmJKho5/lJrGxIxD5zaRq17w5MdXP6gTbfbVDHUgBGw4NccLE sCFanx9qWBCPBGDjIyjpzCPzty6VdoCKt6y6PPfg3wqJVXDDxGOj3LJctaLcC16yyx5B o6i4idGI2J9ReNmrTl6QVsRsZK43QyAZSi76KJaZxsH4O7J5J9jeVYlubYx3fRIV+QUp xgtlfOpTQKU/xopTw38Nxxmo1SQJYvUn+qfAtj5vwihxc0T+7eJrDL38QaubPsgcpS+3 imxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=SxITtYJFPGkEIvNxralC90lrIAJqnHD9/hk0Ai1Smj4=; b=SeywklBo3mc2T4b6JwnMuxTnblLTH9vdu7a9kLh24DcuVQt642KHACwfiaHtDWSfOY 6WZhFs2P3MRrx/ahZACuToeQqfQ/5HeWOsa1vRA0YGBDTqIU70c2GO2WWIH4pkQIPq4L c1t9SM/ub4exW2vemTpOLutIacouZ/FAjGt/xGSth13uqwc30WvFJbHSMN6pYlATUZ5W bvHtO0IZtJ5qslGarTnIxVX8yPmwluIYvmuLT51yE5XtYEGUTH8wkyaLgn+938OGH5fo 7LsEQaQcXi18xmYqNrQEC0UbjxpgutS7XG5NmcCL8/u1o7MF53wMLb6vsxN1+CyyWRHH nBqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y56si1592116edd.275.2019.11.07.06.35.37; Thu, 07 Nov 2019 06:36:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733250AbfKGOeA (ORCPT + 99 others); Thu, 7 Nov 2019 09:34:00 -0500 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:45369 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729047AbfKGOeA (ORCPT ); Thu, 7 Nov 2019 09:34:00 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01451;MF=shile.zhang@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0ThQoCKT_1573137161; Received: from e18g09479.et15sqa.tbsite.net(mailfrom:shile.zhang@linux.alibaba.com fp:SMTPD_---0ThQoCKT_1573137161) by smtp.aliyun-inc.com(127.0.0.1); Thu, 07 Nov 2019 22:32:49 +0800 From: shile.zhang@linux.alibaba.com To: Masahiro Yamada , Michal Marek , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Josh Poimboeuf , x86@kernel.org Cc: "H . Peter Anvin" , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Shile Zhang Subject: [RFC PATCH 0/4] Speed booting by sorting ORC unwind tables at build time Date: Thu, 7 Nov 2019 22:32:01 +0800 Message-Id: <20191107143205.206606-1-shile.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.24.0.rc2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shile Zhang Hi, I found the unwind_init taken long time (more than 90ms) in kernel booting, mainly spent on sorting the two ORC unwind tables, orc_unwind and orc_unwind_ip. I also noticed that this issued has reported and discussed last year: https://lkml.org/lkml/2018/10/8/342 But seems no final solution until now, I tried to sort the ORC tables at build time, followed the helpful hints from Josh and Ingo in that thread. And mainly referred the implementation of 'sortextable' tool: https://lore.kernel.org/linux-mips/1334872799-14589-1-git-send-email-ddaney.cavm@gmail.com/ What I did: - Add a Kconfig to control build-time sorting or runtime sorting; - Referred 'sortextable', create a similar helper tool 'sortorctable', help to sort the ORC unwind tables at vmlinux link process. One potential improvement is to sort the module ORC tables in future. Thanks! Shile Zhang (4): scripts: Add sortorctable to sort ORC unwind tables kbuild: Sort ORC unwind tables in vmlinux link process x86/unwind/orc: Skip sorting if BUILDTIME_ORCTABLE_SORT is configured x86/Kconfig: Add a Kconfig option to sort ORC tables at build time arch/x86/Kconfig.debug | 9 ++ arch/x86/kernel/unwind_orc.c | 2 + scripts/.gitignore | 1 + scripts/Makefile | 2 + scripts/link-vmlinux.sh | 10 ++ scripts/sortorctable.c | 246 +++++++++++++++++++++++++++++++++++ scripts/sortorctable.h | 25 ++++ 7 files changed, 295 insertions(+) create mode 100644 scripts/sortorctable.c create mode 100644 scripts/sortorctable.h -- 2.24.0.rc2