Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1974969pxp; Sun, 13 Mar 2022 05:42:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8CiUkt0ChNFCYmyLSRdewh1HyiMs6UohgJQiqZYUMGedVg/oVZITO5FG06rtHPDXjZTny X-Received: by 2002:a17:902:ce83:b0:151:dad5:d6b1 with SMTP id f3-20020a170902ce8300b00151dad5d6b1mr18723281plg.111.1647175321880; Sun, 13 Mar 2022 05:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647175321; cv=none; d=google.com; s=arc-20160816; b=ZQUGHwSL7Eykyz16lo6qq4sLh9AgR2NtsfkUCADMyBcODkOiNgO6U9eSrwJAIN8yCJ JxitR4pxTsNlnNoUyNOWzvk6AenUXx0gBqhj2IvI/xC75sz4ROETu9t5/6fikN2XwhcQ h4sGoJChp4OEBOmO2QN1elM9hSsPzrRsa6NHbF0l+37ZqfEJuKUUMXA5TkehDjMA/i27 fFZ1QhfLbokUgqGjfv18W2GXbsVq03TYE2SKOe647lBIVQSGUX9E8PuPiwVaZ0ipufHE 61pVKaR+b4G8fWMx6gwEUgC0Nv+zi8WBtB39dSg7IVI/2F+pT0arvBnuslgWtKFIB0uO KXPg== 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=tq7dwFIJbITsNO2LekYJLHOEN8UGoQm1/wacvzkLbv0=; b=CQsJVsrsRLeGCh6TgKmQjmIUy0iZu+mIp4keM2o0xXrDBJaQC/bfccmvW4f1arXgE1 F9seCOwDsVbbylYo5BLAb5uXk0Pn+PtWRSDu0EWEcdypeKP6NHlpXBwRuJJgxuvMLkgY T+gQj76qBicV0qcrH0Jqn1C5dz7sTrwk77y/mva48Sg5hxcFQz/mH59qCzw+B7fpOI+I mPP4aTyUrfBdfYSh3+tEAX7ctntwhSAn0X5B99uUBfnpicidvhV1IGQZp+FH7/XMRaRj nYtBrip/FE1eAy5aJAyI+ETTegzXiFRTtSUsWWNQ6F1d0rjLIRmroCkArDDy+Trccn31 GnOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=QEGGguWE; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a73-20020a63904c000000b0037ff549bca2si12437899pge.327.2022.03.13.05.41.49; Sun, 13 Mar 2022 05:42:01 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b=QEGGguWE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232704AbiCLVTL (ORCPT + 99 others); Sat, 12 Mar 2022 16:19:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231760AbiCLVTK (ORCPT ); Sat, 12 Mar 2022 16:19:10 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9232752E47 for ; Sat, 12 Mar 2022 13:18:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=tq7dwFIJbITsNO2LekYJLHOEN8UGoQm1/wacvzkLbv0=; b=QEGGguWEurttr7a484QMGxNOnT bMcz2DoLTNGga+oL/TL05wvm6YSQAHWk1UGQWNdZpawwzDSpMODKCE8Reqb5uHEp3NlpxeWuU0Fua jImJdMMiRFQthX5KfgIaJYUSVHZNDmJYNf0ttCAAVVaywxSOaDKFJo5wFhtppdhlh/Zq+077dacIp 1t18ytWYfLJ0mGPzt3z/S9nYt2jJxp3szQFxeZ20gcpi/XdnbnNfytzbczsbfyY8n8ow/tEb7aMHH NduGxYyn+no5uDWLMBby8ZKIpXI2wetN0W7v9fKly2hdJ75v7AtWZAmsWrfEtNcV0CLGbqw+i8lRB 2oQPsn4w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nT97O-002hIm-J3; Sat, 12 Mar 2022 21:17:43 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 499A1987D0D; Sat, 12 Mar 2022 22:17:40 +0100 (CET) Date: Sat, 12 Mar 2022 22:17:40 +0100 From: Peter Zijlstra To: Alexey Dobriyan Cc: x86@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/5] x86/alternative: record .altinstructions section entity size Message-ID: <20220312211740.GG28057@worktop.programming.kicks-ass.net> References: <20220311144312.88466-1-adobriyan@gmail.com> <20220311144312.88466-3-adobriyan@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220311144312.88466-3-adobriyan@gmail.com> 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_NONE,T_SCC_BODY_TEXT_LINE 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 On Fri, Mar 11, 2022 at 05:43:10PM +0300, Alexey Dobriyan wrote: > .altinstructions entry was 12 bytes in size, then it was 13 bytes, > now it is 12 again. It was 24 bytes on some distros as well. > Record this information as section sh_entsize value so that tools > which parse .altinstructions have easier time. Which tools would that be? Because afaict you've not actually updated objtool. > Signed-off-by: Alexey Dobriyan (CloudLinux) > --- > arch/x86/include/asm/alternative.h | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h > index 58eee6402832..cf7722a106b3 100644 > --- a/arch/x86/include/asm/alternative.h > +++ b/arch/x86/include/asm/alternative.h > @@ -9,6 +9,8 @@ > #define ALTINSTR_FLAG_INV (1 << 15) > #define ALT_NOT(feat) ((feat) | ALTINSTR_FLAG_INV) > > +#define sizeof_struct_alt_instr 12 > + > #ifndef __ASSEMBLY__ > > #include > @@ -66,6 +68,7 @@ struct alt_instr { > u8 instrlen; /* length of original instruction */ > u8 replacementlen; /* length of new instruction */ > } __packed; > +_Static_assert(sizeof(struct alt_instr) == sizeof_struct_alt_instr, ""); Would it not be much simpler to have this in asm-offsets.h ? > + ".pushsection .altinstructions,\"aM\",@progbits," __stringify(sizeof_struct_alt_instr) "\n"\ > + ".pushsection .altinstructions,\"aM\",@progbits," __stringify(sizeof_struct_alt_instr) "\n"\ > + ".pushsection .altinstructions,\"aM\",@progbits," __stringify(sizeof_struct_alt_instr) "\n"\ > + .pushsection .altinstructions,"aM",@progbits,sizeof_struct_alt_instr > + .pushsection .altinstructions,"aM",@progbits,sizeof_struct_alt_instr Aside of adding entsize, you're also adding the M(ergable) bit. Also, those lines are on the unwieldy side of things.