Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp952172pxb; Wed, 6 Apr 2022 05:10:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyA9nmhnCme+9Vp9b8WgglRwNcmI36gV7snNp+RefavWf3qr57TJmBv3+fXQIoB67PPrGQX X-Received: by 2002:a05:6602:2e12:b0:64a:7f74:ac18 with SMTP id o18-20020a0566022e1200b0064a7f74ac18mr3887587iow.212.1649247042341; Wed, 06 Apr 2022 05:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649247042; cv=none; d=google.com; s=arc-20160816; b=rzKtSXICS7tGySfFpQvScQfzxCULm0uQW31OLfpoZjEiC75zdqRYreAYtVUKj496dC 29sujGb2aePALvwlBoQkQZgQ7h8n7MS2JOrj7h4Pe2HeNOyZBdN7vw9OKnbHtwPjtDQZ N3T2R22v5KB1CIJ9aic9EwVW6dSKJVIJ+kRksB4FJziFubWgTOHp1LAxdBxjPHxz6C+9 fts5LtALkDdKwKwv0/zHVYLYVeZWfY5imZUrRng47gQoWnrmFWxM2bj6k2NrupTVH+6t r9LpT7+MK/j/Wpw67NYwXHv6Nd/q4iDFOs1B4dS5ssvUqvtYYAfRF/cO1OIzWoMyYMUu p+/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=PBpB8VyxqrML+VkIgBACu3iDqkhROgmwY7tjmIL4eEE=; b=dhL8L6xiG9jCl2rRqa36GVNNKU5ddoKCrP4J6fIqrF43JB2vEQpgJaS5l/1bnIEuju snlgmQosOSyJ1jv7ieWiH80mp0W5vPuW74lRFXvzHw8KJjQk7lRjKORqrRQohkj5yfFn wqoI7uY/GVB0kaWlw9scX1XsKI/aunqpO8emlGcAFO9GcLdH18D7O27xonh4p88OUoAO hAhJsozlxVvtAt/RW1kXMnciyFFX/6flsRu6e10Pyyn3+S3u/uGL4udAUlyLQw6iuXTu EncCEy056xgG+vdXt2PsMKE9qr/VmjFKvEpYtn7eexHJj5ob9lB7gIXpym6/gXjKJfEs 3Bsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0YmWQ54G; dkim=neutral (no key) header.i=@linutronix.de; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x6-20020a056638160600b0031a2a4215edsi9964776jas.15.2022.04.06.05.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:10:42 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0YmWQ54G; dkim=neutral (no key) header.i=@linutronix.de; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 50A156A267F; Wed, 6 Apr 2022 03:44:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1449900AbiDFAVx (ORCPT + 99 others); Tue, 5 Apr 2022 20:21:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573627AbiDET0E (ORCPT ); Tue, 5 Apr 2022 15:26:04 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EF532A724 for ; Tue, 5 Apr 2022 12:24:05 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1649186643; h=from:from: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=PBpB8VyxqrML+VkIgBACu3iDqkhROgmwY7tjmIL4eEE=; b=0YmWQ54GkWT2NyXGn63FPu1pDnwVGzslkscg3ZFExIQ8m2BaT52W5VRmmFm6Jo912toFTf X1OEXx87VodFjGDyTmiHx1DvSOdlVcAl0GGIWPAms8941lMbULhzTHxmbCQWN3DGQdigxs L3IxfFvVyj6LTuVtR5vn3kGGlEHVaygjtThf/A/4IfIOlggVPigp5uIhEZa2RFY+Dgss61 91M9Z4H4Kvx/vT1d52k3eagql13WZLcdzVzp9NYWbQhR6ow7ALfiUtrK2EKh2Ak6zkEJc+ /hWejh+vKveLC+yyzAFKE8HiAKM8qZ4FM/NAThEbUejeXneaQ2VJ52nKQzjT4A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1649186643; h=from:from: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=PBpB8VyxqrML+VkIgBACu3iDqkhROgmwY7tjmIL4eEE=; b=WclwfULHFh8wlhXABkAJLoc04RlSlmfsy2db9G/uVbLQm27G9toMbYtAdwMQ+WHfCWRaX6 WWuYxxTGDwCY/yDQ== To: Alexey Dobriyan , Peter Zijlstra Cc: x86@kernel.org, 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 In-Reply-To: References: <20220311144312.88466-1-adobriyan@gmail.com> <20220311144312.88466-3-adobriyan@gmail.com> <20220312211740.GG28057@worktop.programming.kicks-ass.net> Date: Tue, 05 Apr 2022 21:24:02 +0200 Message-ID: <87o81f1gh9.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Sun, Mar 13 2022 at 21:05, Alexey Dobriyan wrote: > On Sat, Mar 12, 2022 at 10:17:40PM +0100, Peter Zijlstra wrote: >> On Fri, Mar 11, 2022 at 05:43:10PM +0300, Alexey Dobriyan wrote: >> > + ".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"\ >>=20 >> > + .pushsection .altinstructions,"aM",@progbits,sizeof_struct_alt_instr >> > + .pushsection .altinstructions,"aM",@progbits,sizeof_struct_alt_instr >>=20 >> Aside of adding entsize, you're also adding the M(ergable) bit. Also, >> those lines are on the unwieldy side of things. > > binutils doc says > > https://sourceware.org/binutils/docs/as/Section.html > > If flags contains the M symbol then the type argument must be specified = as well as an extra argument=E2=80=94entsize=E2=80=94like this: > > .section name , "flags"M, @type, entsize > > Sections with the M flag but not S flag must contain fixed size constant= s, > each entsize octets long. Sections with both M and S must contain zero > terminated strings where each character is entsize bytes long. The linker > may remove duplicates within sections with the same name, same entity si= ze > and same flags. entsize must be an absolute expression. For sections with > both M and S, a string which is a suffix of a larger string is considered > a duplicate. Thus "def" will be merged with "abcdef"; A reference to the > first "def" will be changed to a reference to "abcdef"+3. > > "a"M doesn't work, but "aM" does. > > I don't know if merging is the issue, it is not like alt replacements hav= e names. That does not matter. M merges any duplications in sections with the same [section] name, entity size and flags. .pushsection .bar "aM" @progbits, 4 .byte 0x01, 0x02, 0x03, 0x04 .popsection .pushsection .bar "aM" @progbits, 4 .byte 0x01, 0x02, 0x03, 0x04 .popsection Will create a section .bar with lenght 4 and the content: 0x1,0x2,0x3,0x4 What saves you here is the fact that the altinstruction entries are guaranteed to be unique, but that wants a big fat comment. Thanks, tglx