From nobody Fri Apr 17 10:34:47 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E46817E792 for ; Sat, 21 Feb 2026 02:56:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771642561; cv=none; b=IbMXQ6p4js6SqWtb9tYjlr+K4KbOGKYJE6ptZBhHqq9OW4U+qjDID5TwB7f4l0qWy2mWNZ6grXMALMJ6KCd9K65VZY1OQHN2XOdmbjKxoNHjTMxUWaRIPTIDvQNSALst5y8YGYs0pTKf+NMJt9PK5TMZM0EjqtRZSe46o0n2Z58= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771642561; c=relaxed/simple; bh=CWYITnkXgzNyfLnHj5X6xXIaWL2MvqJ/EQQYMsFAqRw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GeSFvAJtxEcOLzpbhruBRpXag8B8UDgm9wkfFgebyRJ9Hp2fePMKOab33wkrVixsElUXQ0Ir/OIjw68ZNEydIfJpw1OjzZGatFz2yrktIferxN7U16hVHZyYUcSaK08OH8f716AbEcIpdQC5m1sGuBkwTBqKTQq32V6KpJ4Ucs8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SA/NzOzN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SA/NzOzN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17D8EC116C6; Sat, 21 Feb 2026 02:55:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771642560; bh=CWYITnkXgzNyfLnHj5X6xXIaWL2MvqJ/EQQYMsFAqRw=; h=From:To:Cc:Subject:Date:From; b=SA/NzOzNr00ofjEGxz1dT6rP+E4jUWDm4xsr0fzgyjAjwjChonPiZmgXbfa949diq bDPU9f2FVgWYvtt2JHpNdp+5+tEZaWirfPCylx6z6Ynsa16jrbU9IztOgMW1YYuNUd F7IMSK8Xo3d8PPfYMh0F8NEoDBJq18ZJ1OaI14+3s5Yr2IqoB4ZjyT9KWnv/0Fr5F7 Ojr5kvynGWda/UtDyEifJ3kgh+ND0MssG4FgdEGbPv+9DP8TPmeHrNqN+HpkbTmabM rBAbIshWUX4sNKX0ANVf73O/41oCnLsqnt0+HmwBtc9NaStzMEsLRnhRu1zuJJ2NKq LDPSnD76lMhEA== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] riscv: make runtime const not usable by modules Date: Sat, 21 Feb 2026 10:37:31 +0800 Message-ID: <20260221023731.3476-1-jszhang@kernel.org> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Similar as commit 284922f4c563 ("x86: uaccess: don't use runtime-const rewriting in modules") does, make riscv's runtime const not usable by modules too, to "make sure this doesn't get forgotten the next time somebody wants to do runtime constant optimizations". The reason is well explained in the above commit: "The runtime-const infrastructure was never designed to handle the modular case, because the constant fixup is only done at boot time for core kernel code." Signed-off-by: Jisheng Zhang --- arch/riscv/include/asm/runtime-const.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/include/asm/runtime-const.h b/arch/riscv/include/as= m/runtime-const.h index d766e2b9e6df..900db0a103d0 100644 --- a/arch/riscv/include/asm/runtime-const.h +++ b/arch/riscv/include/asm/runtime-const.h @@ -2,6 +2,10 @@ #ifndef _ASM_RISCV_RUNTIME_CONST_H #define _ASM_RISCV_RUNTIME_CONST_H =20 +#ifdef MODULE + #error "Cannot use runtime-const infrastructure from modules" +#endif + #include #include #include --=20 2.51.0