From nobody Sat Jun 13 22:19:44 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8186730BB9B; Tue, 5 May 2026 10:55:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777978555; cv=none; b=cjbAJRPLpFbG/ylf4wOjXjOYFj73QHmEp6JqMKp2HydH7hQHq8/Eg7MaD8Lyr2qDa9Yel2k7gMYkVtPsvQSE4kQDD3czn9HzWLqIsGOqeNV/UtmFuoSnf/ZcTNiPaGRbX8LO8TXJwv9QKbbLIifeeMpukIDSh6f5masr/QjCK8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777978555; c=relaxed/simple; bh=strXUM5zPNPD8lYbTfp1HFJ06duXyELsBCG/boYGI0M=; h=Date:From:To:Subject:Cc:MIME-Version:Message-ID:Content-Type; b=qHVuvc8rpa6+7bOVRgmcyYXP2DjxR8z8bCHovEoAJdBACo04W6p3gwECb+rX9newrNZrlCys9k5WhBZb7m/mQ9VptYj0XVU3SHOnfPvr8VNPk+GzTtOzvnkEBR/8PiQ8jNQCIXtC+x8UFnldj0ABK6U3I6Htn/Mjo6GeqJ5cIPM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=34y6SFei; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=pk91ODJA; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="34y6SFei"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="pk91ODJA" Date: Tue, 05 May 2026 10:55:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1777978552; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jqz3YsSRD3Er6YvFVKSdMaABhWuHoKubzisGZVt4umc=; b=34y6SFeiqp8PiAj4QpFtwtjyx+MEX3jcx+GWW56lX9vwSUxcZV3G8fMgxBHSaUtmVTVHUe /u5M3mQw/UltDmiW0RN0t3KKQ6nq3FWzYYl0k5d512LD/kqwXSW9jR+ani2Q5BVPQwIVbx ng8zW3YNOGdZEd8QAkMTUFMgLtJcaaGXaN8k/Xsl/H6x9jDsbYjA9UEn7yzLo48N4JI+Wt F9ixK+8qsNmh88xp5ljPQ+Q7m94a7dPgmWOkCC6tmlNrEFbc0MHI3WJbLXB8ZlUB2pyZ3G NJ1HpBGFVjmjq51laKxRbZCXRaRILW/k4+NyOQxhygvAN3pcviQwuwVa20yqfQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1777978552; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jqz3YsSRD3Er6YvFVKSdMaABhWuHoKubzisGZVt4umc=; b=pk91ODJAvjNxNC8Rf7LgFE8pZCqgPo1NEUW2pXDJfbN6n4u+RTr9DvLJ/7ZjPn8NK6y7p1 NhHSVemi3ma2HiCw== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool/klp: Cache dont_correlate() result Cc: Song Liu , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177797855063.424702.2754537930173242079.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the objtool/core branch of tip: Commit-ID: 2d3bb398861ad3ddbf87959cc2e34a7001f0b3ad Gitweb: https://git.kernel.org/tip/2d3bb398861ad3ddbf87959cc2e34a700= 1f0b3ad Author: Josh Poimboeuf AuthorDate: Sun, 19 Apr 2026 21:06:28 -07:00 Committer: Josh Poimboeuf CommitterDate: Mon, 04 May 2026 21:16:07 -07:00 objtool/klp: Cache dont_correlate() result Cache the dont_correlate() result once per symbol at the start of correlate_symbols(). This reduces klp diff time on an arm64 LTO vmlinux.o from 2m51s to 35s. Acked-by: Song Liu Signed-off-by: Josh Poimboeuf --- tools/objtool/include/objtool/elf.h | 1 +- tools/objtool/klp-diff.c | 29 ++++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/ob= jtool/elf.h index fccf72c..d9c44df 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -96,6 +96,7 @@ struct symbol { u8 changed : 1; u8 included : 1; u8 klp : 1; + u8 dont_correlate : 1; struct list_head pv_target; struct reloc *relocs; struct section *group_sec; diff --git a/tools/objtool/klp-diff.c b/tools/objtool/klp-diff.c index ed3bf1c..f8787d7 100644 --- a/tools/objtool/klp-diff.c +++ b/tools/objtool/klp-diff.c @@ -524,7 +524,7 @@ static struct symbol *find_twin(struct elfs *e, struct = symbol *sym1) =20 /* Count orig candidates */ for_each_sym_by_demangled_name(e->orig, sym1->demangled_name, sym2) { - if (sym2->twin || sym1->type !=3D sym2->type || dont_correlate(sym2) || + if (sym2->twin || sym1->type !=3D sym2->type || sym2->dont_correlate || (!maybe_same_file(sym1, sym2))) continue; =20 @@ -550,7 +550,7 @@ static struct symbol *find_twin(struct elfs *e, struct = symbol *sym1) =20 /* Count patched candidates */ for_each_sym_by_demangled_name(e->patched, sym1->demangled_name, sym2) { - if (sym2->twin || sym1->type !=3D sym2->type || dont_correlate(sym2) || + if (sym2->twin || sym1->type !=3D sym2->type || sym2->dont_correlate || !maybe_same_file(sym1, sym2)) continue; =20 @@ -693,7 +693,7 @@ static struct symbol *find_twin_suffixed(struct elf *el= f, struct symbol *sym1) return NULL; =20 for_each_sym_by_name(elf, name, sym2) { - if (sym2->twin || sym1->type !=3D sym2->type || dont_correlate(sym2)) + if (sym2->twin || sym1->type !=3D sym2->type || sym2->dont_correlate) continue; count++; match =3D sym2; @@ -733,7 +733,7 @@ static struct symbol *find_twin_positional(struct elfs = *e, struct symbol *sym1) struct symbol *sym2, *match =3D NULL; =20 for_each_sym_by_demangled_name(e->orig, sym1->demangled_name, sym2) { - if (sym2->twin || sym1->type !=3D sym2->type || dont_correlate(sym2) || + if (sym2->twin || sym1->type !=3D sym2->type || sym2->dont_correlate || !maybe_same_file(sym1, sym2)) continue; if (is_tu_local_sym(sym1) !=3D is_tu_local_sym(sym2) || @@ -745,7 +745,7 @@ static struct symbol *find_twin_positional(struct elfs = *e, struct symbol *sym1) } =20 for_each_sym_by_demangled_name(e->patched, sym1->demangled_name, sym2) { - if (sym2->twin || sym1->type !=3D sym2->type || dont_correlate(sym2) || + if (sym2->twin || sym1->type !=3D sym2->type || sym2->dont_correlate || !maybe_same_file(sym1, sym2)) continue; if (is_tu_local_sym(sym1) !=3D is_tu_local_sym(sym2) || @@ -777,6 +777,11 @@ static int correlate_symbols(struct elfs *e) struct symbol *sym1, *sym2; bool progress; =20 + for_each_sym(e->orig, sym1) + sym1->dont_correlate =3D dont_correlate(sym1); + for_each_sym(e->patched, sym2) + sym2->dont_correlate =3D dont_correlate(sym2); + /* Correlate FILE symbols */ file1_sym =3D first_file_symbol(e->orig); file2_sym =3D first_file_symbol(e->patched); @@ -817,7 +822,7 @@ static int correlate_symbols(struct elfs *e) do { progress =3D false; for_each_sym(e->orig, sym1) { - if (sym1->twin || dont_correlate(sym1)) + if (sym1->twin || sym1->dont_correlate) continue; sym2 =3D find_twin(e, sym1); if (!sym2) @@ -831,7 +836,7 @@ static int correlate_symbols(struct elfs *e) return -1; =20 for_each_sym(e->orig, sym1) { - if (sym1->twin || dont_correlate(sym1)) + if (sym1->twin || sym1->dont_correlate) continue; sym2 =3D find_twin_suffixed(e->patched, sym1); if (!sym2) @@ -843,7 +848,7 @@ static int correlate_symbols(struct elfs *e) } while (progress); =20 for_each_sym(e->orig, sym1) { - if (sym1->twin || dont_correlate(sym1)) + if (sym1->twin || sym1->dont_correlate) continue; sym2 =3D find_twin_positional(e, sym1); if (!sym2) @@ -853,7 +858,7 @@ static int correlate_symbols(struct elfs *e) } =20 for_each_sym(e->orig, sym1) { - if (sym1->twin || dont_correlate(sym1)) + if (sym1->twin || sym1->dont_correlate) continue; WARN("no correlation: %s", sym1->name); } @@ -1066,7 +1071,7 @@ static int mark_changed_functions(struct elfs *e) =20 /* Find changed functions */ for_each_sym(e->orig, orig_sym) { - if (dont_correlate(orig_sym)) + if (orig_sym->dont_correlate) continue; =20 patched_sym =3D orig_sym->twin; @@ -1087,7 +1092,7 @@ static int mark_changed_functions(struct elfs *e) =20 /* Find added functions and print them */ for_each_sym(e->patched, patched_sym) { - if (!is_func_sym(patched_sym) || dont_correlate(patched_sym)) + if (!is_func_sym(patched_sym) || patched_sym->dont_correlate) continue; =20 if (!patched_sym->twin) { @@ -1193,7 +1198,7 @@ static bool klp_reloc_needed(struct reloc *patched_re= loc) struct export *export; =20 /* no external symbol to reference */ - if (dont_correlate(patched_sym)) + if (patched_sym->dont_correlate) return false; =20 /* For included functions, a regular reloc will do. */