Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4142053ybc; Thu, 14 Nov 2019 22:49:32 -0800 (PST) X-Google-Smtp-Source: APXvYqx85uxW96McOfDomItVk6vnordk8mwKBfNZrdg2iqhM8TRKYeYYvWBdgLAiDmREcnHg9cgp X-Received: by 2002:a17:906:a38d:: with SMTP id k13mr11477217ejz.213.1573800572521; Thu, 14 Nov 2019 22:49:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573800572; cv=none; d=google.com; s=arc-20160816; b=Rlm0ME5pBbMp0+2gVHoYfJf9a19u9Au37citnYqhrC7c+WNTmaBGHF99uBS79/gDQK w0cIGABm7U3dmZxmuoX9M12sn3/46iClXBl9AeS2pqaOyVML+jqbcZt+Id6eo59G0xoa ohu382MEWysNiyofs4HU3do8nuth+RIFzo0K2P21lxma8L0lIEsSGYaXU2iQQOuvTW5t f6R2svi/5vVrAQ7naxP4aeSe9KbIywVzLykh9l/jUCLHCfmIJRTDbyin5QYYFxTZdSuf 7PLkDBpeMdU53yE70hkpl2y0jCHJqm9XALKFfurHictokJlBZYwHd0ziH0k56H7ZDayF IEkg== 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=mCUbL9EpZx57AOCx5QySbLbcUV4qIirAKwUJuW5dG7s=; b=h+K8MOYib7nvqXxhdLMyQjPjzz4isrv15LDSalQKzmrcIGYE3pXKbhPwndD0SreQaM eLyXEtxQmJtMFaow3h9L/hsJrnH6ZWY/ntLrC1WXFzjEpiYt/x5wm8ph8vPDSd1+uP0c SgyoKd9IzICfToVuZJflvS0GUKPXN8qDdFjkVu39aGVkNe8LNf4eHAlbQDcHXU53E4zo GW+mPc7SHGdwF6PaqVWVy28DRA7erghtfCx50M/5niHJ3ToIE+bHQKzdjPRZvb/a8qCC AUknB9Yi4V5Q1QBxzfK30574ZXU2n7eoXUNQf2RBz4BBk0TK+628quvDoKa8uRrU5REL 0YYQ== 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 x18si4960980ejc.97.2019.11.14.22.49.08; Thu, 14 Nov 2019 22:49:32 -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 S1727032AbfKOGsG (ORCPT + 99 others); Fri, 15 Nov 2019 01:48:06 -0500 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:39901 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbfKOGsG (ORCPT ); Fri, 15 Nov 2019 01:48:06 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R911e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=shile.zhang@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0Ti7ujx6_1573800472; Received: from e18g09479.et15sqa.tbsite.net(mailfrom:shile.zhang@linux.alibaba.com fp:SMTPD_---0Ti7ujx6_1573800472) by smtp.aliyun-inc.com(127.0.0.1); Fri, 15 Nov 2019 14:48:00 +0800 From: Shile Zhang To: Peter Zijlstra , Josh Poimboeuf , Masahiro Yamada , Michal Marek , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org Cc: "H . Peter Anvin" , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Shile Zhang Subject: [RFC PATCH v3 0/7] Speed booting by sorting ORC unwind tables at build time Date: Fri, 15 Nov 2019 14:47:43 +0800 Message-Id: <20191115064750.47888-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 Hi, I refactored the sortextable code and add ORC unwind tables sort support, for kernel boot speedup by sorting kernel tables at build time as much as possible. Followed Peter's suggestion, I put ORC tables sort into a separated thread makes these tables sort concurrently. That helps to avoid kernel's link time as possible. What I did: [1-4] : refacorting code sortextable.{ch}, for more readable and extendable, prepare for further rework; [5] : rename the sortextable to sorttable, and related Kconfig, for commonly extend. [6-7] : Add ORC unwind tables sorting, and remove the runtime sort. Further works: Put more kernel tables be sorted at build time: - __jump_table: I found jump table sort in jump_label_init() does not cost more boot time, seems not more benefit to sort it at build time. Maybe can consider it in future for more boot-time sensitive case. - .static_call_sites: This tables not merged yet, needs to check the runtime sort cost in future. https://lore.kernel.org/lkml/20191007081716.07616230.8@infradead.org/ Thanks! Changes from RFC v3: - Discard new added sortorctable tool and related Kconfig changes. - Refactored sortextable, makes it more readable and extendable. - Rename 'sortextable' to 'sorttable', for more kernel tables extend. - Add ORC unwind tables sort into sorttable. - Remove the runtime ORC tables sort. Changes from RFC v2: - Removed new added Kconfig and runtime sort code, advised by Josh Poimboeuf. - Some minor refactoring. https://www.lkml.org/lkml/2019/11/8/56 v1: - Added a new sortorctable tool to sort ORC unwind tables at build time, same as sortextable. - Add a new Kconfigure to control if ORC unwind tables sort at build time. https://www.lkml.org/lkml/2019/11/7/611 Shile Zhang (7): scripts/sortextable: Rewrite error/success handling scripts/sortextable: kernel coding style formating scripts/sortextable: Remove dead code scripts/sortextable: refactor do_func() function scripts/sorttable: rename sortextable to sorttable scripts/sorttable: Add ORC unwind tables sort concurrently x86/unwind/orc: remove run-time ORC unwind tables sort arch/arc/Kconfig | 2 +- arch/arm/Kconfig | 2 +- arch/arm64/Kconfig | 2 +- arch/microblaze/Kconfig | 2 +- arch/mips/Kconfig | 2 +- arch/parisc/Kconfig | 2 +- arch/parisc/kernel/vmlinux.lds.S | 2 +- arch/powerpc/Kconfig | 2 +- arch/s390/Kconfig | 2 +- arch/x86/Kconfig | 2 +- arch/x86/kernel/unwind_orc.c | 8 +- arch/xtensa/Kconfig | 2 +- init/Kconfig | 2 +- scripts/.gitignore | 2 +- scripts/Makefile | 9 +- scripts/link-vmlinux.sh | 10 +- scripts/sortextable.h | 209 ------------- scripts/{sortextable.c => sorttable.c} | 299 ++++++++---------- scripts/sorttable.h | 412 +++++++++++++++++++++++++ 19 files changed, 578 insertions(+), 395 deletions(-) delete mode 100644 scripts/sortextable.h rename scripts/{sortextable.c => sorttable.c} (67%) create mode 100644 scripts/sorttable.h -- 2.24.0.rc2