Skip to content

Commit ec642e3

Browse files
committed
x86/unwind/orc: Remove boot-time ORC unwind tables sorting
commit f14bf6a upstream. Now that the orc_unwind and orc_unwind_ip tables are sorted at build time, remove the boot time sorting pass. No change in functionality. [ mingo: Rewrote the changelog and code comments. ] Signed-off-by: Shile Zhang <shile.zhang@linux.alibaba.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: linux-kbuild@vger.kernel.org Link: https://lkml.kernel.org/r/20191204004633.88660-8-shile.zhang@linux.alibaba.com Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Caspar Zhang <caspar@linux.alibaba.com>
1 parent 4aa2b0b commit ec642e3

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

arch/x86/kernel/unwind_orc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ static struct orc_entry *orc_find(unsigned long ip)
176176
return orc_ftrace_find(ip);
177177
}
178178

179+
#ifdef CONFIG_MODULES
179180
static void orc_sort_swap(void *_a, void *_b, int size)
180181
{
181182
struct orc_entry *orc_a, *orc_b;
@@ -218,7 +219,6 @@ static int orc_sort_cmp(const void *_a, const void *_b)
218219
return orc_a->sp_reg == ORC_REG_UNDEFINED && !orc_a->end ? -1 : 1;
219220
}
220221

221-
#ifdef CONFIG_MODULES
222222
void unwind_module_init(struct module *mod, void *_orc_ip, size_t orc_ip_size,
223223
void *_orc, size_t orc_size)
224224
{
@@ -262,9 +262,11 @@ void __init unwind_init(void)
262262
return;
263263
}
264264

265-
/* Sort the .orc_unwind and .orc_unwind_ip tables: */
266-
sort(__start_orc_unwind_ip, num_entries, sizeof(int), orc_sort_cmp,
267-
orc_sort_swap);
265+
/*
266+
* Note, the orc_unwind and orc_unwind_ip tables were already
267+
* sorted at build time via the 'sorttable' tool.
268+
* It's ready for binary search straight away, no need to sort it.
269+
*/
268270

269271
/* Initialize the fast lookup table: */
270272
lookup_num_blocks = orc_lookup_end - orc_lookup;

scripts/link-vmlinux.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ vmlinux_link "${kallsymso}" vmlinux
283283

284284
if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then
285285
info SORTTAB vmlinux
286-
sorttable vmlinux
286+
if ! sorttable vmlinux; then
287+
echo >&2 Failed to sort kernel tables
288+
exit 1
289+
fi
287290
fi
288291

289292
info SYSMAP System.map

0 commit comments

Comments
 (0)