All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huaixin Chang <changhuaixin@linux.alibaba.com>
To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Cc: bp@alien8.de, hpa@zytor.com, jpoimboe@redhat.com,
	luto@amacapital.net, michal.lkml@markovi.net, mingo@redhat.com,
	peterz@infradead.org, tglx@linutronix.de, x86@kernel.org,
	yamada.masahiro@socionext.com
Subject: [PATCH 2/2] x86/unwind/orc: Remove unwind_init() from x86 boot
Date: Wed, 29 Apr 2020 14:46:26 +0800	[thread overview]
Message-ID: <20200429064626.16389-3-changhuaixin@linux.alibaba.com> (raw)
In-Reply-To: <20200429064626.16389-1-changhuaixin@linux.alibaba.com>

All preparation has been moved to scripts/sorttable tool. No need to
init unwind on boot now.

Signed-off-by: Huaixin Chang <changhuaixin@linux.alibaba.com>
Signed-off-by: Shile Zhang <shile.zhang@linux.alibaba.com>
---
 arch/x86/include/asm/unwind.h |  2 --
 arch/x86/kernel/setup.c       |  2 --
 arch/x86/kernel/unwind_orc.c  | 51 -------------------------------------------
 3 files changed, 55 deletions(-)

diff --git a/arch/x86/include/asm/unwind.h b/arch/x86/include/asm/unwind.h
index 499578f7e6d7..db5aea8c9d98 100644
--- a/arch/x86/include/asm/unwind.h
+++ b/arch/x86/include/asm/unwind.h
@@ -89,11 +89,9 @@ static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state,
 #endif
 
 #ifdef CONFIG_UNWINDER_ORC
-void unwind_init(void);
 void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size,
 			void *orc, size_t orc_size);
 #else
-static inline void unwind_init(void) {}
 static inline
 void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size,
 			void *orc, size_t orc_size) {}
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 4b3fa6cd3106..4a17026c6550 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1243,8 +1243,6 @@ void __init setup_arch(char **cmdline_p)
 	if (efi_enabled(EFI_BOOT))
 		efi_apply_memmap_quirks();
 #endif
-
-	unwind_init();
 }
 
 #ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index e9cc182aa97e..3db43e6e75f2 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -20,7 +20,6 @@ int *cur_orc_ip_table = __start_orc_unwind_ip;
 struct orc_entry *cur_orc_table = __start_orc_unwind;
 
 unsigned int lookup_num_blocks;
-bool orc_init;
 
 static inline unsigned long orc_ip(const int *ip)
 {
@@ -142,9 +141,6 @@ static struct orc_entry *orc_find(unsigned long ip)
 {
 	static struct orc_entry *orc;
 
-	if (!orc_init)
-		return NULL;
-
 	if (ip == 0)
 		return &null_orc_entry;
 
@@ -259,53 +255,6 @@ void unwind_module_init(struct module *mod, void *_orc_ip, size_t orc_ip_size,
 }
 #endif
 
-void __init unwind_init(void)
-{
-	size_t orc_ip_size = (void *)__stop_orc_unwind_ip - (void *)__start_orc_unwind_ip;
-	size_t orc_size = (void *)__stop_orc_unwind - (void *)__start_orc_unwind;
-	size_t num_entries = orc_ip_size / sizeof(int);
-	struct orc_entry *orc;
-	int i;
-
-	if (!num_entries || orc_ip_size % sizeof(int) != 0 ||
-	    orc_size % sizeof(struct orc_entry) != 0 ||
-	    num_entries != orc_size / sizeof(struct orc_entry)) {
-		orc_warn("WARNING: Bad or missing .orc_unwind table.  Disabling unwinder.\n");
-		return;
-	}
-
-	/*
-	 * Note, the orc_unwind and orc_unwind_ip tables were already
-	 * sorted at build time via the 'sorttable' tool.
-	 * It's ready for binary search straight away, no need to sort it.
-	 */
-
-	/* Initialize the fast lookup table: */
-	lookup_num_blocks = orc_lookup_end - orc_lookup;
-	for (i = 0; i < lookup_num_blocks-1; i++) {
-		orc = __orc_find(__start_orc_unwind_ip, __start_orc_unwind,
-				 num_entries,
-				 LOOKUP_START_IP + (LOOKUP_BLOCK_SIZE * i));
-		if (!orc) {
-			orc_warn("WARNING: Corrupt .orc_unwind table.  Disabling unwinder.\n");
-			return;
-		}
-
-		orc_lookup[i] = orc - __start_orc_unwind;
-	}
-
-	/* Initialize the ending block: */
-	orc = __orc_find(__start_orc_unwind_ip, __start_orc_unwind, num_entries,
-			 LOOKUP_STOP_IP);
-	if (!orc) {
-		orc_warn("WARNING: Corrupt .orc_unwind table.  Disabling unwinder.\n");
-		return;
-	}
-	orc_lookup[lookup_num_blocks-1] = orc - __start_orc_unwind;
-
-	orc_init = true;
-}
-
 unsigned long unwind_get_return_address(struct unwind_state *state)
 {
 	if (unwind_done(state))
-- 
2.14.4.44.g2045bb6


  parent reply	other threads:[~2020-04-29  6:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29  6:46 [PATCH 0/2] Build ORC fast lookup table in scripts/sorttable tool Huaixin Chang
2020-04-29  6:46 ` [PATCH 1/2] scripts/sorttable: Build orc fast lookup table via sorttable tool Huaixin Chang
2020-04-29  6:46 ` Huaixin Chang [this message]
2020-04-29  8:49 ` [PATCH 0/2] Build ORC fast lookup table in scripts/sorttable tool Peter Zijlstra
2020-04-30  2:32   ` changhuaixin
2020-04-30  4:06     ` Josh Poimboeuf
2020-04-30  4:10       ` Josh Poimboeuf
2020-05-22 18:28 ` Josh Poimboeuf
2020-05-25  3:33   ` changhuaixin
     [not found]   ` <482837A8-E9D9-4229-B7B1-8E14403FB2AC@linux.alibaba.com>
2020-06-01 17:38     ` Josh Poimboeuf
2020-06-03 13:47       ` changhuaixin
2020-06-03 14:31       ` [PATCH v2 0/3] " Huaixin Chang
2020-06-03 14:31         ` [PATCH 1/3] scripts/sorttable: Change section type of orc_lookup to SHT_PROGBITS Huaixin Chang
2020-06-03 14:31         ` [PATCH 2/3] scripts/sorttable: Build orc fast lookup table via sorttable tool Huaixin Chang
2020-06-03 14:31         ` [PATCH 3/3] x86/unwind/orc: Simplify unwind_init() for x86 boot Huaixin Chang
2020-06-03 14:39       ` [PATCH v3 0/3] Build ORC fast lookup table in scripts/sorttable tool Huaixin Chang
2020-06-03 14:39         ` [PATCH 1/3] scripts/sorttable: Change section type of orc_lookup to SHT_PROGBITS Huaixin Chang
2020-06-03 14:39         ` [PATCH 2/3] scripts/sorttable: Build orc fast lookup table via sorttable tool Huaixin Chang
2020-06-03 14:39         ` [PATCH 3/3] x86/unwind/orc: Simplify unwind_init() for x86 boot Huaixin Chang
2020-06-29  2:14         ` [PATCH v3 0/3] Build ORC fast lookup table in scripts/sorttable tool changhuaixin

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=20200429064626.16389-3-changhuaixin@linux.alibaba.com \
    --to=changhuaixin@linux.alibaba.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=michal.lkml@markovi.net \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yamada.masahiro@socionext.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.