[PATCH bpf-next 2/5] selftests/bpf: Set CONFIG_HZ_100 for riscv64

Pu Lehui pulehui at huaweicloud.com
Tue Sep 29 01:39:21 PDT 2026


From: Pu Lehui <pulehui at huawei.com>

The setget_sockopt selftest fails on riscv64, specifically in the
TCP_BPF_DELACK_MAX and TCP_BPF_RTO_MIN sub-tests.

The test sets a socket option value in microseconds using
bpf_setsockopt() and immediately reads it back via bpf_getsockopt() to
verify that it matches. However, the kernel converts the value to
jiffies internally for storage, and converts it back to microseconds
upon retrieval. On riscv64, the default timer frequency is HZ=250 (4000
us per jiffy). When a value cannot be divided evenly (e.g. 30000 us),
quantization error occurs during these conversions:

  usecs_to_jiffies(30000) -> 8 jiffies
  jiffies_to_usecs(8)     -> 32000 us (!= 30000 us)

This mismatch triggers an assertion failure.

Let's set CONFIG_HZ_100=y in config.riscv64 to align with other archs
and fix this issue.

Signed-off-by: Pu Lehui <pulehui at huawei.com>
---
 tools/testing/selftests/bpf/config.riscv64 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/config.riscv64 b/tools/testing/selftests/bpf/config.riscv64
index 655cb05a7689..de45a76fdbcd 100644
--- a/tools/testing/selftests/bpf/config.riscv64
+++ b/tools/testing/selftests/bpf/config.riscv64
@@ -29,6 +29,7 @@ CONFIG_FRAME_POINTER=y
 CONFIG_HARDLOCKUP_DETECTOR=y
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_HUGETLBFS=y
+CONFIG_HZ_100=y
 CONFIG_INET=y
 CONFIG_IP_ADVANCED_ROUTER=y
 CONFIG_IP_MULTICAST=y
-- 
2.34.1




More information about the linux-riscv mailing list