From patchwork Thu Feb 23 08:32:07 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: 60842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp204342wrd; Thu, 23 Feb 2023 00:42:18 -0800 (PST) X-Google-Smtp-Source: AK7set9I8NZtNY9ysYX4uMjaDjL2M3Fn32McdkyBNdMM/tcbgbA/soe5N78dIAuvWlaEDmCzr3BM X-Received: by 2002:a17:902:e5c1:b0:196:82d5:1ec4 with SMTP id u1-20020a170902e5c100b0019682d51ec4mr12435364plf.0.1677141737740; Thu, 23 Feb 2023 00:42:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677141737; cv=none; d=google.com; s=arc-20160816; b=WpSAvpawKYidHiSMpPXC2ak5cqUSiZNtxWBSakIK2e9PtRxC6OoCxUpCUuZ+0Wq6xn Xaa5clx4lFs1R2EQyg49+g7zYX4WDLa22uHE3IgeUPlSu6Q9E+9PvJT5+LSqqf6TFcbO NvDQOMIlHnlHH+bLJP92DyqYpUo8Wudd/tdJzNa4fUEXg5YRnMhD7QnrCI+5eEGAyJ+6 huXRdLhx1RtgIHbH4653YvWNnNZozVjTAeDKvp56zPPKOJ1MVidq+EZWHlMueamaIhUB +IYuG0FhPf+AegcPnsV5f7CvDTRwNXD2phrU4XYOxVt9rrG+0GxBHVBW5LD/pLpWmv09 cQUA== 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=J3nzDb9QEcHYe7mq8a7GFpQl7B2oF3ScZnDCdv2yMnk=; b=YjhsjSShkxLvZj4Gy5gpmb/EWSXCUGwuApMu9XRQnpwD0qGGo5mk7DtR3++fEKVDjm zyr44/z4MMYBsqoTZqT7j6Hz03Yta1e9elp+oDPI3BI1AYSv7N/i1FFXCNHnDUGHcDC0 vaXK9P+3suJnyngzp+Jwy/RWmXJ70Y+4ExJf3Xygyhs+IkP4Z0kXYn5doGS6SQk0ISpm +OYEJ5AupHB7cFgF9SQGmoICbSta7TFICetYCyh/5JWo4ePLb8x3921aMoU/mG9REsvM IBsxMQg736z3ZguSmB+WioDAcL+ny2jmAf3CcOuXu/MofZLkvQE5Q/aYBVbnefpTpKVy C7Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Ze1aNFLW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=qb0B8Jr+; 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 jx5-20020a170903138500b0019c33d386e5si1560800plb.517.2023.02.23.00.42.04; Thu, 23 Feb 2023 00:42:17 -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=Ze1aNFLW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=qb0B8Jr+; 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 S233682AbjBWIcg (ORCPT + 99 others); Thu, 23 Feb 2023 03:32:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233620AbjBWIcN (ORCPT ); Thu, 23 Feb 2023 03:32:13 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A6624D621; Thu, 23 Feb 2023 00:32:12 -0800 (PST) Date: Thu, 23 Feb 2023 08:32:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1677141128; 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=J3nzDb9QEcHYe7mq8a7GFpQl7B2oF3ScZnDCdv2yMnk=; b=Ze1aNFLWewR4YnFI62PIanLKbWcWkIqv3stFPN6q5xOoJTXRoXAoUHfWNnWGPzVgl7SHmb NTMSnhrn+bmtImtQ0e30C0MppwxuL+i+GpAktfGhovtsF1mZZO1d0rAWIrzIK7mu8GXp6v pKIHoa5xIqpRg4ci5gi381VYtZivl20eTefHcc3O2DjcoRqwShf0yifpPyA1dW5FurIYSF r30Z/KvDlo4m3nOeuENOHEDZpnf8Py7a8Orq83Q0LOp/JqKykDsPc176+SmyZMeOp/9iQ8 LJ1PZoyTjyDMhmVANIvtMbh3AdbEYvAW2xfiIPindhn221wQ07kAC5Fxbab4qQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1677141128; 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=J3nzDb9QEcHYe7mq8a7GFpQl7B2oF3ScZnDCdv2yMnk=; b=qb0B8Jr++8HLW2exMkGrP9VjiqVg7mKnf2U18klDTtBrbau08RJAecrYS1oMRi9wUZAOzH dP/bgJRtp/h6yUCg== 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)" , Ingo Molnar , 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: <167714112770.5837.10453236541325422066.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?1758610574535381119?= The following commit has been merged into the objtool/core branch of tip: Commit-ID: d54066546121426ecd7ad01a53ae429c4e37a9d5 Gitweb: https://git.kernel.org/tip/d54066546121426ecd7ad01a53ae429c4e37a9d5 Author: Peter Zijlstra AuthorDate: Wed, 08 Feb 2023 18:17:59 +01:00 Committer: Ingo Molnar CommitterDate: Thu, 23 Feb 2023 09:21:06 +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) Signed-off-by: Ingo Molnar 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;