From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796246709; b=0roPFrGjBBFrMhzcf+ULA5SILEAh3mt6S5pp8hp4rjgE2DEI1+dXZJNtF1qI/c6iP8n0 S8OZQ4ycj/+0EKhJfGPjDz/3Mia5kZ4quVQURcZTriKUWu0z9CR5UcqLw1z2ayuxECPgI LFna+TaUoCS4uMoJUzxZ+ey/j7RmPZslpw/9IPzgba+Rv+auBjptf1ZEoE0Va9ULM1DcX 3TF+1wrlpSH82GzY0Aa0H5kW+/r0mbahU2cbpTuE6Mm/6EMBUJn7sOT9ONlx5ezRWZtFj UYJfd1cBF1ndEXjhsiHMnF1GSGnfqkS20vjxNwxEQWd5uhoKpJ8or3ReRWxmfg+LX/g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796246709; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=alO9JJyw6dx3mssD+j71jMxTtDAJ/clmTDc0CJxeC/c=; b=awCVW2w4WSkH4KNWUQKAGDHC9Lf4X3E8jRMS3MnNBumQOozfcDLgS/eebuaO63XMM0hq f0dGHSkARStv033/mxgCI/tj/BGv3kxTRLW545mVMkGlIj/9D5K09tp6XuXX7jy4OktHq pL0eSfDSrboqmBHpVcfTyamXUH1plE1HhqDtkrvoi0+3WSW16vO3nm6Vr39epmBjKUFhb PDkkb6ug23c9WRmH0r/WcNQQ+4u/TTpKhlxXYiMW8saMJGwsZ83ZnxWahmzPpdeRAz6ge NyJ7GprPMIpmaazRLp9INVikhJH9/atu/nIuojzYLX3Ev0o5dnmfIgX9G9c+Bh7qnzw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SV9RBQGL; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68CFE606A322 for ; Wed, 2 Dec 2026 21:25:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SV9RBQGL Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4AC01F000C1; Wed, 2 Dec 2026 21:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796246708; bh=alO9JJyw6dx3mssD+j71jMxTtDAJ/clmTDc0CJxeC/c=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=SV9RBQGLXcaHaLlgMlMe1eA2jWBjSSnARTsAUThJit4Hxbh8ev1U/f/9UMlXySiTi wVNr5TNCv6Hi2zydxqquHRdtgn4p/n0ZF1gSPhq+qkIC+I1NfCekfDQ2sao90/PIaY psinN+wNebCP6AW5MwEdlz0/nNTGMsUrSRXp/o36yoZRX4kTr+12tpoSRvzWXqZJpw VvsvVg5bKl+ggTHU8nRRCNJQc59aBs1FcP7WFw4CAgMwIOV5IWG1awj6S0LZLhgjxF aQO59idQYg7dlyZ/Y92IGtL2OwTowo8OcyJg4+OG0f/N0sN3sgzf8raPBIVvwVr9Tc XvJ+uBJS2kc0Q== Date: Wed, 2 Dec 2026 13:25:06 -0800 From: Josh Poimboeuf To: Shivang Upadhyay Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, ritesh.list@gmail.com, sshegde@linux.ibm.com, peterz@infradead.org, ardb@kernel.org, will@kernel.org, sv@linux.ibm.com, joe.lawrence@redhat.com, song@kernel.org, mingo@kernel.org, mbenes@suse.cz Subject: Re: [PATCH v3 00/11] objtool/powerpc: Fix up feature section alternatives at build time Message-ID: References: <20261202074059.899491-1-shivangu@linux.ibm.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20261202074059.899491-1-shivangu@linux.ibm.com> On Wed, Dec 02, 2026 at 01:10:47PM +0530, Shivang Upadhyay wrote: > The replacement code of a powerpc feature section (BEGIN_FTR_SECTION / > FTR_SECTION_ELSE / ALT_FTR_SECTION_END macros) is emitted into a __ftr_alt_* > section. At boot, apply_feature_fixups() copies the replacement code over it. > Since the copy lands at a different address than the one it was linked for, the > PC-relative branches in it have to be translated, which is currently done at > runtime by patch_feature_section(). > > This has two drawbacks: > > - __ftr_alt_* sections are allocatable but not executable, so the > linker cannot insert branch stubs for them. They therefore have to > be placed close to .text, and every branch in them must reach its > target directly. This can break the build as the kernel grows. Is this a real issue or is it theoretical? > - The branches are translated on every boot, although everything > needed to do it is known at link time. x86 also does something similar for its alternatives, I'm not sure that's much of a drawback though. Presumably objtool-on-vmlinux adds some slowness to the build. > This series moves the translation to build time. After vmlinux is > linked, objtool is run on it with the new --alt-fixup option. It parses > the __ftr_fixup, __mmu_ftr_fixup and __fw_ftr_fixup tables, and for each > PC-relative relocation in the replacement code, asks the arch to rewrite > the instruction so that it is valid at the place it will be copied to. > With that, the __ftr_alt_* sections are marked executable and moved out > of .text into their own output section, so the linker can insert stubs > where needed. > > Objtool does not process modules or the VDSO, so the runtime translation > is kept for those and only skipped for the core kernel. So now there are two translation methods of instead of one? Is there any reason why objtool coudn't be run on linked vDSO and modules as well? > Previously, Nicholas Piggin proposed a build-time solution using a custom > powerpc tool [1]. The approach here builds on that idea, but uses > objtool's existing ELF parsing and instruction patching infrastructure > instead of a separate tool. I notice that last approach was almost 10 years ago, just wondering if this is a real problem that people are hitting. -- Josh