Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1268212pxb; Wed, 20 Oct 2021 01:28:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPOc3tj9DTqfaTR7hrNdlcnFmg4xFharXbKwrhKpezX7rAQOJdB/TwsDqRoWFL+TL8XVxm X-Received: by 2002:a17:90b:1c90:: with SMTP id oo16mr5683405pjb.199.1634718489460; Wed, 20 Oct 2021 01:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634718489; cv=none; d=google.com; s=arc-20160816; b=q55MX03l53A0shlOVCTcvKjpo5BACmHNKEo3Lc6Hu2c6LIorD8ytZ20n68RqGBzlwj BMoYDMTcE2wClQw7Sk8t4vp+2YvbqV5Hikd8nw1AaepvCm//nne5M6/Xi0vGuHK2OWk0 AhPLWcGoJPJFIAX6LIjTGLICh5sAM+Dn0cw71Eccn9PYMBqVh66boqqK/4AQHhd+XHNB cSshZgtKEYxyFv/o7HUBLkhVBJwem1iAhenP/WhDGgKdiiHFdLH546a6XA9cN/+948P/ w2Bw68FAZVNBntfKf2TN9IMhDrKEV8T1dOUYuweGIPeETSIUCQUCco75CXL0cDrXUZYH TqOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rOJsmtKqHI3ca8h7TQv1QgPq4t/FlSc8JZWKfh2ltEw=; b=bPnnTsbhTqCTj5dKK7sXMXmsXCEm0eycUkMgtnp6tcw9+b+swlx+yXb3pBWbVvopOX 6Q4EvjD9yrOt4CPIHZR/PQmQPAU2GxXxD7jLrYwxVGd7uewdiCOGDkfxJRJkzQCxqSQh tQpnVUxGjuuAm47vfuTAlv+ZUkVN1uuAwUHIXrATrwpnzizJuzWyM96wjF7kvaCGrSZV +3JZv5yM7tC5gfCT7RVRZI+j16KeeFElC4TYyQ8KGAUvV7Op3awKXIPrs0ZL4tSLmRoB QeieWBlOY2K+HalnX0tGZo8ZRR2Yi1a+Nb7F9XJykxyL3Emenu/gJlg3lkBkqeWEVfom BUvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Ummb3gra; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o13si2342478pgv.20.2021.10.20.01.27.56; Wed, 20 Oct 2021 01:28:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Ummb3gra; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229864AbhJTI2V (ORCPT + 99 others); Wed, 20 Oct 2021 04:28:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbhJTI2U (ORCPT ); Wed, 20 Oct 2021 04:28:20 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACE97C061746 for ; Wed, 20 Oct 2021 01:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rOJsmtKqHI3ca8h7TQv1QgPq4t/FlSc8JZWKfh2ltEw=; b=Ummb3graQeR1ca+E2zpkYAvdDf Hdg5X+oj5cHUPOnYb8iC0JXFGF6PItLL/OPkwjITWjCJiX+1WYMPDAZokwE6HamSpWbYjXRZWxFu/ sh+xmSmaVOpM/zyQMDTfuaUdJWvKK9HaT+2ZFC+IpLaVA0tMlbYq8bIZkswh34JXElLyxRrHswiEp f3UUqMzXj4WqreLi+AMwKRgKoImW6dA5shIHvxdVjyjYVU9rsdNLpyb0W2AIB2Ck7ewg6UDXfbo/H fKkImviN4uLKw4pVYgdLbcFLifesF1UZKwYqdMTKAyY7zDtRre6jqXQ+Sqn3Bc+lLWcgp4+aouaUj voLGCgJQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1md6v5-00Auqk-7H; Wed, 20 Oct 2021 08:25:55 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A156B3002BC; Wed, 20 Oct 2021 10:25:52 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 89E5E20F080E8; Wed, 20 Oct 2021 10:25:52 +0200 (CEST) Date: Wed, 20 Oct 2021 10:25:52 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: x86@kernel.org, andrew.cooper3@citrix.com, linux-kernel@vger.kernel.org, alexei.starovoitov@gmail.com, ndesaulniers@google.com Subject: Re: [PATCH 4/9] x86/alternative: Implement .retpoline_sites support Message-ID: References: <20211013122217.304265366@infradead.org> <20211013123645.002402102@infradead.org> <20211013205259.44cvvaxiexiff5w5@treble> <20211019164659.dybir4wgfmdt4r47@treble> <20211019164913.2dsyyethdeblqjlq@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211019164913.2dsyyethdeblqjlq@treble> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 19, 2021 at 09:49:13AM -0700, Josh Poimboeuf wrote: > @@ -1916,8 +1930,25 @@ static int read_static_call_tramps(struct objtool_file *file) > list_for_each_entry(func, &sec->symbol_list, list) { > if (func->bind == STB_GLOBAL && > !strncmp(func->name, STATIC_CALL_TRAMP_PREFIX_STR, > - strlen(STATIC_CALL_TRAMP_PREFIX_STR))) > + strlen(STATIC_CALL_TRAMP_PREFIX_STR))) { > func->static_call_tramp = true; > + } > + } > + } > + > + return 0; > +} > + > +static int read_retpoline_thunks(struct objtool_file *file) > +{ > + struct section *sec; > + struct symbol *func; > + > + for_each_sec(file, sec) { > + list_for_each_entry(func, &sec->symbol_list, list) { > + if (func->bind == STB_GLOBAL && arch_is_retpoline(func)) { > + func->retpoline = true; > + } > } > } I've folded these two identical loops over all symbols into a single classify_symbols() function.