From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB3071E5714 for ; Mon, 13 Jul 2026 17:40:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783964415; cv=none; b=WdZG7D09xA8VtSa/PC6K6rGH5VxBEIJf4Ff9KXnn5x/nnBVboPYJc8qBWp4TLsTV1M5TMK/tCukoBjFsSlgah8RJVJwpLbQSlKw/oAQzvkTYy07PwaG9mKJ0Q0fJQ0BuhGdUWuOjEhbAmNb8CtH8RxiqfzgiRujjNyhAoaRqnhg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783964415; c=relaxed/simple; bh=x2NSzirLX+1gsmG1LgOeFy9/VbK8/ZnbKZFRXZRlKEU=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=SiGiAABBUkHtxZhCJSTCIs7p7kMIo1yXfObt3VoVOjJJ0/GL5K/pZCNMnOtXh0kFsi71v6EwYwKUpeTCsUBsLQkXrn5YVHC7SlU4Nkkz/uJA/2fj1FC8Joq8LNuXYGmZu/yEI2/CnBKarP0ZhFUeJ7I2d53JPvTiszpjMQF3pjg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ncnNgxNQ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ncnNgxNQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6D311F000E9; Mon, 13 Jul 2026 17:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783964414; bh=zFtG0nvrj3NH4oQfVqsdZuKnWzNdjcmSutSX77OAy68=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=ncnNgxNQDHgL/D4fmP+v4PhhqBUNuku1df2jFag9T79beLLfxxUntnTHnUA7vCIyg FzKcxCXVZzM1/wWCDDr7EDdBuOHmAJ8MWgPjndb4wY617EwPMKTkpte5UXedrvf/C9 qgUk+AOlvQTaTBrzYv4iEghO8R54/vgloB8VKh2QCCkTDJ2yzexOsq0c6/mKGBF6AY +RftqSaNkxgpfRDGjoDpHjZVbpG64H+pk3hp86xk46Bgb2+xisyPmTTyRsEYdplUBf ntDrlW7ZUBQIdDSJzEMsXTXRhSUTvpqKWWZf1th2fuUrYaEsBFWgZYNhPb6rxiFzuM JOIzborr4J6Gw== Date: Mon, 13 Jul 2026 11:40:10 -0600 (MDT) From: Paul Walmsley To: Rui Qi cc: palmer@dabbelt.com, pjw@kernel.org, aou@eecs.berkeley.edu, Alexandre Ghiti , Andy Chiu , =?ISO-8859-15?Q?Bj=F6rn_T=F6pel?= , "open list:RISC-V ARCHITECTURE" , open list Subject: Re: [PATCH] riscv: Gate FUNCTION_ALIGNMENT_4B on DYNAMIC_FTRACE In-Reply-To: <20260706130415.463682-1-qirui.001@bytedance.com> Message-ID: <03933583-e2ce-ead0-65c8-320e43d9be97@kernel.org> References: <20260706130415.463682-1-qirui.001@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Mon, 6 Jul 2026, Rui Qi wrote: > The FUNCTION_ALIGNMENT_4B select forces the whole kernel to be built > with -fmin-function-alignment=4. This alignment is only needed so the > patchable-function-entry NOPs, which arch/riscv/Makefile emits under > CONFIG_DYNAMIC_FTRACE, can be patched reliably on RISCV_ISA_C=y builds > where compressed instructions otherwise allow 2-byte function > alignment. > > The select is currently gated on HAVE_DYNAMIC_FTRACE, a capability bit > that is selected whenever the toolchain supports dynamic ftrace, rather > than on whether tracing is actually enabled. As a result every > RISCV_ISA_C=y build gets 4-byte function alignment across the entire > kernel even when function tracing is disabled, needlessly growing the > kernel image and wasting instruction cache for a feature that is not > in use. > > Gate the select on DYNAMIC_FTRACE instead, matching the condition under > which arch/riscv/Makefile emits -fpatchable-function-entry, so the > alignment is only applied when it is actually needed. > > Fixes: c41bf4326c7b ("riscv: ftrace: align patchable functions to 4 Byte boundary") > Signed-off-by: Rui Qi Thanks, queued for v7.2-rc. - Paul From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54C7DC43458 for ; Mon, 13 Jul 2026 17:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Message-ID: In-Reply-To:Subject:cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RhttdtFAW4PEqd+RbLg+dB4ECvEe+t1Y2tvALVCPD9w=; b=cudfX71bVoIRYw KXSoridYZs4GBFyxNfr4gssD0C6+E5B89f8J9Tmtqy3TLEt2MHzueIZCNWW6auJlFzDPXNjTo56QF Xdtdx6w8P+QS6deBlSwIAGH6vq6EtOCHe7sc6Pq/BYP+biwLaDVq1bYEPhgAp3X+EOCw6x8LQhlSw nwMzwG+9fadaPJ8sHBn7zutKXkRyo0ySYduY2rdh78RisSEcO78H6T7GElNiSQziF8UmTh4VdInmK 1YplDvHPZuR4J6o4lkhdgtIbXDSaX0Fwjln3qmTgXKS1ymGv97//UU8/DWYOMwZrrT9NQIPD2wfzI BcQTe/Zv95an1GQ74f6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wjKdb-0000000A8CY-3q3p; Mon, 13 Jul 2026 17:40:15 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wjKdb-0000000A8CS-0fhV for linux-riscv@lists.infradead.org; Mon, 13 Jul 2026 17:40:15 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 9C6B442E5A; Mon, 13 Jul 2026 17:40:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6D311F000E9; Mon, 13 Jul 2026 17:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783964414; bh=zFtG0nvrj3NH4oQfVqsdZuKnWzNdjcmSutSX77OAy68=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=ncnNgxNQDHgL/D4fmP+v4PhhqBUNuku1df2jFag9T79beLLfxxUntnTHnUA7vCIyg FzKcxCXVZzM1/wWCDDr7EDdBuOHmAJ8MWgPjndb4wY617EwPMKTkpte5UXedrvf/C9 qgUk+AOlvQTaTBrzYv4iEghO8R54/vgloB8VKh2QCCkTDJ2yzexOsq0c6/mKGBF6AY +RftqSaNkxgpfRDGjoDpHjZVbpG64H+pk3hp86xk46Bgb2+xisyPmTTyRsEYdplUBf ntDrlW7ZUBQIdDSJzEMsXTXRhSUTvpqKWWZf1th2fuUrYaEsBFWgZYNhPb6rxiFzuM JOIzborr4J6Gw== Date: Mon, 13 Jul 2026 11:40:10 -0600 (MDT) From: Paul Walmsley To: Rui Qi cc: palmer@dabbelt.com, pjw@kernel.org, aou@eecs.berkeley.edu, Alexandre Ghiti , Andy Chiu , =?ISO-8859-15?Q?Bj=F6rn_T=F6pel?= , "open list:RISC-V ARCHITECTURE" , open list Subject: Re: [PATCH] riscv: Gate FUNCTION_ALIGNMENT_4B on DYNAMIC_FTRACE In-Reply-To: <20260706130415.463682-1-qirui.001@bytedance.com> Message-ID: <03933583-e2ce-ead0-65c8-320e43d9be97@kernel.org> References: <20260706130415.463682-1-qirui.001@bytedance.com> MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Mon, 6 Jul 2026, Rui Qi wrote: > The FUNCTION_ALIGNMENT_4B select forces the whole kernel to be built > with -fmin-function-alignment=4. This alignment is only needed so the > patchable-function-entry NOPs, which arch/riscv/Makefile emits under > CONFIG_DYNAMIC_FTRACE, can be patched reliably on RISCV_ISA_C=y builds > where compressed instructions otherwise allow 2-byte function > alignment. > > The select is currently gated on HAVE_DYNAMIC_FTRACE, a capability bit > that is selected whenever the toolchain supports dynamic ftrace, rather > than on whether tracing is actually enabled. As a result every > RISCV_ISA_C=y build gets 4-byte function alignment across the entire > kernel even when function tracing is disabled, needlessly growing the > kernel image and wasting instruction cache for a feature that is not > in use. > > Gate the select on DYNAMIC_FTRACE instead, matching the condition under > which arch/riscv/Makefile emits -fpatchable-function-entry, so the > alignment is only applied when it is actually needed. > > Fixes: c41bf4326c7b ("riscv: ftrace: align patchable functions to 4 Byte boundary") > Signed-off-by: Rui Qi Thanks, queued for v7.2-rc. - Paul _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv