From patchwork Mon Feb 13 11:10:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 56208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2284950wrn; Mon, 13 Feb 2023 03:12:29 -0800 (PST) X-Google-Smtp-Source: AK7set/RWU+q0U594iSnm21wfV7mgN49KzgxWAGIW80FlYWEp1OuPfMFfHZsFWOoRL6Gm6q1yGiP X-Received: by 2002:a17:907:7e96:b0:8aa:bf96:f7ce with SMTP id qb22-20020a1709077e9600b008aabf96f7cemr27530365ejc.56.1676286748833; Mon, 13 Feb 2023 03:12:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676286748; cv=none; d=google.com; s=arc-20160816; b=N51BHQTkTFNGeC3K2/jfotW2w+35uH4vdFSA6neYXDhh7gNLl3sqJO4O/ySy/ZBUlI CdOk6TgWY47x/stXzZ0Flh58X96jU8cgO6yqPtKztACay8F52Zxl+817q9ui0gyRejTH Ox9190meFVZ40iTioiT/SJRJ+ai/GVPgv/L0KH0rQ+JrSGbvJW/s+e1BxjKXLD5GrWFm fyPFOvQ0fPY62tyxklcL+cidqqkfHn34rHgYScNL87BENWs4vJhd08WIvhOpRqtOf20w XifmMR46AuZM8i18/ruRj/09KliRzG5F4WuMSUkRDf0wpmHBq/dc97qpMvLw6btq49kU eeMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=qE6sKEAxdaEOn/MvayvG0iNAnWXG66xfaAvtfMOWeCY=; b=gHKl53HOomIlcyNGbdyHQcSr2SD0WTq8OOo0SO0DKzku30q4aG7OxcqPgfddyLGLX4 CibjXJalk6NDaOhdU1qJXnfObLp3ch3rkSev/j2gnC8mbLkQKU9m2jTZsChitGsw/3Yp pueJ/JEjzvgUwVuvdp94mfNd6my9Lrg4tjpUyajTYeX4HuI951DKfnzRFJIFcxGsgdFw /L4qaIowxY+REzFi4K2Pg44aLC9T0W9byIJzu27gs9e51JzASXMkcbWYHi7a47wYN4VN aagLYEh7itYecKRrYaSVK63SNsjuK0OV/Ke9fSVf93hxz4yPfUsdCb+ID+9t7tGEaMne Tw3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=excPfzT0; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fn23-20020a1709069d1700b0089f4eb03c2asi11008238ejc.151.2023.02.13.03.12.05; Mon, 13 Feb 2023 03:12:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=excPfzT0; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230346AbjBMLK5 (ORCPT + 99 others); Mon, 13 Feb 2023 06:10:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230252AbjBMLKj (ORCPT ); Mon, 13 Feb 2023 06:10:39 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A7AFD53E; Mon, 13 Feb 2023 03:10:35 -0800 (PST) Date: Mon, 13 Feb 2023 11:10:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1676286630; 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: in-reply-to:in-reply-to:references:references; bh=qE6sKEAxdaEOn/MvayvG0iNAnWXG66xfaAvtfMOWeCY=; b=excPfzT0y78Hj0U+HcrRtEMRx8i2X8Urhi5zHmW515Pvnzpo/db6E/B+OpLFUtvQzb6mw2 sRRMD7CNR9cQ/3qGEU1Eql/nA8d65q2GurfRTAc6eyfte6+tD3HpjQySlc/XSlm/GSpBwK rjhjQ8NNQq1iC8nmNptqk9Jzvi0UmgXMG0/FAzWpxlxDIZpO6UxdtiXhG5OZqLU7DtA5Bg 40xUw5tNS3eDntMC713MCjotD07K7PSH1BKrSuovgtIIUZdmF78DJetMOqikQLFBYWkuFb AGJkKj4C88fxdnBSIaq5FgasMnsOs+lqoLpJ8U7Q1lDQH/p+9TFC5U+un6qQMQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1676286630; 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: in-reply-to:in-reply-to:references:references; bh=qE6sKEAxdaEOn/MvayvG0iNAnWXG66xfaAvtfMOWeCY=; b=VogRajpy3xzQmc/pNTWFqmrZ+UCXt0i7MkU6o0xesmBQK1Ka+v/DzWSN9OQ/uleT8ZCQAJ fk0qxzhJeiwQU0Dw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool: Make instruction::alts a single-linked list Cc: "Peter Zijlstra (Intel)" , Josh Poimboeuf , Nathan Chancellor , linux@weissschuh.net, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230208172245.430556498@infradead.org> References: <20230208172245.430556498@infradead.org> MIME-Version: 1.0 Message-ID: <167628663034.4906.12885630728217674124.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757285089969352082?= X-GMAIL-MSGID: =?utf-8?q?1757714054177110234?= The following commit has been merged into the objtool/core branch of tip: Commit-ID: d15b41e98079755f21e49a2e60465ded7b910ba2 Gitweb: https://git.kernel.org/tip/d15b41e98079755f21e49a2e60465ded7b910ba2 Author: Peter Zijlstra AuthorDate: Wed, 08 Feb 2023 18:17:59 +01:00 Committer: Peter Zijlstra CommitterDate: Mon, 13 Feb 2023 11:26:07 +01:00 objtool: Make instruction::alts a single-linked list struct instruction { struct list_head list; /* 0 16 */ struct hlist_node hash; /* 16 16 */ struct list_head call_node; /* 32 16 */ struct section * sec; /* 48 8 */ long unsigned int offset; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ unsigned int len; /* 64 4 */ enum insn_type type; /* 68 4 */ long unsigned int immediate; /* 72 8 */ u16 dead_end:1; /* 80: 0 2 */ u16 ignore:1; /* 80: 1 2 */ u16 ignore_alts:1; /* 80: 2 2 */ u16 hint:1; /* 80: 3 2 */ u16 save:1; /* 80: 4 2 */ u16 restore:1; /* 80: 5 2 */ u16 retpoline_safe:1; /* 80: 6 2 */ u16 noendbr:1; /* 80: 7 2 */ u16 entry:1; /* 80: 8 2 */ /* XXX 7 bits hole, try to pack */ s8 instr; /* 82 1 */ u8 visited; /* 83 1 */ /* XXX 4 bytes hole, try to pack */ struct alt_group * alt_group; /* 88 8 */ struct symbol * call_dest; /* 96 8 */ struct instruction * jump_dest; /* 104 8 */ struct instruction * first_jump_src; /* 112 8 */ struct reloc * jump_table; /* 120 8 */ /* --- cacheline 2 boundary (128 bytes) --- */ struct reloc * reloc; /* 128 8 */ - struct list_head alts; /* 136 16 */ - struct symbol * sym; /* 152 8 */ - struct stack_op * stack_ops; /* 160 8 */ - struct cfi_state * cfi; /* 168 8 */ + struct alternative * alts; /* 136 8 */ + struct symbol * sym; /* 144 8 */ + struct stack_op * stack_ops; /* 152 8 */ + struct cfi_state * cfi; /* 160 8 */ - /* size: 176, cachelines: 3, members: 29 */ - /* sum members: 170, holes: 1, sum holes: 4 */ + /* size: 168, cachelines: 3, members: 29 */ + /* sum members: 162, holes: 1, sum holes: 4 */ /* sum bitfield members: 9 bits, bit holes: 1, sum bit holes: 7 bits */ - /* last cacheline: 48 bytes */ + /* last cacheline: 40 bytes */ }; pre: 5:58.50 real, 229.64 user, 128.65 sys, 26221520 mem post: 5:48.86 real, 220.30 user, 128.34 sys, 24834672 mem Signed-off-by: Peter Zijlstra (Intel) Acked-by: Josh Poimboeuf Tested-by: Nathan Chancellor # build only Tested-by: Thomas Weißschuh # compile and run Link: https://lore.kernel.org/r/20230208172245.430556498@infradead.org --- tools/objtool/check.c | 18 +++++++++--------- tools/objtool/include/objtool/check.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 8109d74..9f83e85 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -23,7 +23,7 @@ #include struct alternative { - struct list_head list; + struct alternative *next; struct instruction *insn; bool skip_orig; }; @@ -397,7 +397,6 @@ static int decode_instructions(struct objtool_file *file) return -1; } memset(insn, 0, sizeof(*insn)); - INIT_LIST_HEAD(&insn->alts); INIT_LIST_HEAD(&insn->call_node); insn->sec = sec; @@ -1780,7 +1779,6 @@ static int handle_group_alt(struct objtool_file *file, return -1; } memset(nop, 0, sizeof(*nop)); - INIT_LIST_HEAD(&nop->alts); nop->sec = special_alt->new_sec; nop->offset = special_alt->new_off + special_alt->new_len; @@ -1978,7 +1976,8 @@ static int add_special_section_alts(struct objtool_file *file) alt->insn = new_insn; alt->skip_orig = special_alt->skip_orig; orig_insn->ignore_alts |= special_alt->skip_alt; - list_add_tail(&alt->list, &orig_insn->alts); + alt->next = orig_insn->alts; + orig_insn->alts = alt; list_del(&special_alt->list); free(special_alt); @@ -2037,7 +2036,8 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn, } alt->insn = dest_insn; - list_add_tail(&alt->list, &insn->alts); + alt->next = insn->alts; + insn->alts = alt; prev_offset = reloc->offset; } @@ -3594,10 +3594,10 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, if (propagate_alt_cfi(file, insn)) return 1; - if (!insn->ignore_alts && !list_empty(&insn->alts)) { + if (!insn->ignore_alts && insn->alts) { bool skip_orig = false; - list_for_each_entry(alt, &insn->alts, list) { + for (alt = insn->alts; alt; alt = alt->next) { if (alt->skip_orig) skip_orig = true; @@ -3796,11 +3796,11 @@ static int validate_entry(struct objtool_file *file, struct instruction *insn) insn->visited |= VISITED_ENTRY; - if (!insn->ignore_alts && !list_empty(&insn->alts)) { + if (!insn->ignore_alts && insn->alts) { struct alternative *alt; bool skip_orig = false; - list_for_each_entry(alt, &insn->alts, list) { + for (alt = insn->alts; alt; alt = alt->next) { if (alt->skip_orig) skip_orig = true; diff --git a/tools/objtool/include/objtool/check.h b/tools/objtool/include/objtool/check.h index 23e9819..7966f60 100644 --- a/tools/objtool/include/objtool/check.h +++ b/tools/objtool/include/objtool/check.h @@ -66,7 +66,7 @@ struct instruction { struct instruction *first_jump_src; struct reloc *jump_table; struct reloc *reloc; - struct list_head alts; + struct alternative *alts; struct symbol *sym; struct stack_op *stack_ops; struct cfi_state *cfi;