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