From nobody Sat Jul 25 00:48:14 2026 Received: from va-1-111.ptr.blmpb.com (va-1-111.ptr.blmpb.com [209.127.230.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FA30400E1A for ; Tue, 21 Jul 2026 15:05:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.230.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784646344; cv=none; b=sGH0SDk9GZBrTm23gzi0buawsS2nGjLxmZV9IKo1aay4e3xL5bCLmgO2B/ICGBoWWR69CWReG+8eDOTN2bj2Qm0kuMTXqxX9dhy9LHnkN0TJaL7RJuBN+UkZ3rTpxZkb9PHUFIXw9x0ryBWEFYqaCb8Obwi5F2HbizioTeN10ho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784646344; c=relaxed/simple; bh=4gQHGD0Nt8iAAXuAeBJKyOdr3679YPlCGhREZLcnl6E=; h=Subject:To:Cc:From:Content-Type:Message-Id:Mime-Version:Date; b=gv696UPpKRD5DRlRvwQbKJJM4y1akLFOEIRae3Xx8Tgyy5qXiXl5ixuKIULtkVVRm7ek9I3V1hRPyVDk+zqX8EF9WqhAtKUEx+kH9S1PB6Pi8sRGGbSwz1n8u1qP5z6o6k5nx2ywEMKUsoZ++wwX6Hc6Ey8feJFRX36ZqNso20M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=XNskzERj; arc=none smtp.client-ip=209.127.230.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="XNskzERj" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1784646330; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=gX5iLP2z4bs17qGVKXq5rYDX7dWy680RM49G92z9hH8=; b=XNskzERjUx+C8RthLqexr9yDzUmC8clNWWOHwT1x0+sW1FGmtKFQ5Jl/dzBE29lp/LU57l DP+i/kjCl3SK/X2tJIhUBiJXuhFgVEWAmItvd4Oii/P19yJhEZB4Lu2Npk61+BdFd+BQAU bX9tawz8iG7h0IK6izFqyhqLNIBRkKtSiwepJ4ZbLkvxJK2Uditu2hRJAtAOO/rn+SKQfI hjcJK2uo9AaKKcKdTvW9RRYhmL4u3/trKZyC0hP3JkhjsKO5c5SpZU8lymOMbZaiB4QQL9 IvvufSGgUSCkMPHkb5Hj/zjPdigpszwY0/ePUBbeoqA+5Sq7Fm2tk0mrjAT6Vw== Subject: [PATCH] riscv: hwprobe: Register unaligned probes before usermode X-Lms-Return-Path: Content-Transfer-Encoding: quoted-printable To: Cc: "Rui Qi" , "Paul Walmsley" , "Palmer Dabbelt" , "Albert Ou" , "Alexandre Ghiti" , "Nam Cao" , "Kees Cook" , "Jingwei Wang" , "open list" From: "Rui Qi" X-Mailer: git-send-email 2.20.1 Message-Id: <20260721150511.1607105-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 Date: Tue, 21 Jul 2026 23:05:09 +0800 X-Original-From: Rui Qi Content-Type: text/plain; charset="utf-8" The hwprobe vDSO data is populated by the first riscv_hwprobe syscall. Some values, such as MISALIGNED_VECTOR_PERF, may depend on the async vector unaligned access speed probe registered by check_unaligned_access_all_cpus(). That initcall currently runs at late_initcall level. However, rootfs_initcall enables usermode helpers before late initcalls run, so an early helper can execute userspace and call riscv_hwprobe first. In that case complete_hwprobe_vdso_data() consumes the initial pending_boot_probes reference, populates the vDSO cache, and marks it ready before the later async probe is registered. The eventual probe result then cannot update the already-ready cache. Move check_unaligned_access_all_cpus() to fs_initcall_sync. This still runs after clocksource_done_booting(), so the ktime_get_mono_fast_ns() benchmark uses a stable clocksource, but it runs before rootfs_initcall enables usermode helpers. Any async hwprobe probe is therefore registered before userspace can trigger the one-time vDSO cache population. Fixes: 6455c6c11827 ("riscv: Clean up & optimize unaligned scalar access pr= obe") Signed-off-by: Rui Qi Reviewed-by: Nam Cao --- arch/riscv/kernel/unaligned_access_speed.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/unaligned_access_speed.c b/arch/riscv/kernel= /unaligned_access_speed.c index bb57eb5d19df..ee2ac9972510 100644 --- a/arch/riscv/kernel/unaligned_access_speed.c +++ b/arch/riscv/kernel/unaligned_access_speed.c @@ -411,4 +411,10 @@ static int __init check_unaligned_access_all_cpus(void) return 0; } =20 -late_initcall(check_unaligned_access_all_cpus); +/* + * Run after clocksource_done_booting() so measure_cycles() uses a stable + * clocksource, but before rootfs_initcall() enables usermode helpers. Tho= se + * helpers can reach hwprobe and populate the vDSO cache, so async hwprobe + * probes must be registered first. + */ +fs_initcall_sync(check_unaligned_access_all_cpus); --=20 2.20.1