tools/testing/selftests/net/ipv6_route_update_soft_lockup.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/ipv6_route_update_soft_lockup.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/ipv6_route_update_soft_lockup.sh
Extension
.sh
Size
11039 bytes
Lines
262
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Testing for potential kernel soft lockup during IPv6 routing table
# refresh under heavy outgoing IPv6 traffic. If a kernel soft lockup
# occurs, a kernel panic will be triggered to prevent associated issues.
#
#
#                            Test Environment Layout
#
# ┌----------------┐                                         ┌----------------┐
# |     SOURCE_NS  |                                         |     SINK_NS    |
# |    NAMESPACE   |                                         |    NAMESPACE   |
# |(iperf3 clients)|                                         |(iperf3 servers)|
# |                |                                         |                |
# |                |                                         |                |
# |    ┌-----------|                             nexthops    |---------┐      |
# |    |veth_source|<--------------------------------------->|veth_sink|<┐    |
# |    └-----------|2001:0DB8:1::0:1/96  2001:0DB8:1::1:1/96 |---------┘ |    |
# |                |         ^           2001:0DB8:1::1:2/96 |           |    |
# |                |         .                   .           |       fwd |    |
# |  ┌---------┐   |         .                   .           |           |    |
# |  |   IPv6  |   |         .                   .           |           V    |
# |  | routing |   |         .           2001:0DB8:1::1:80/96|        ┌-----┐ |
# |  |  table  |   |         .                               |        | lo  | |
# |  | nexthop |   |         .                               └--------┴-----┴-┘
# |  | update  |   |         ............................> 2001:0DB8:2::1:1/128
# |  └-------- ┘   |
# └----------------┘
#
# The test script sets up two network namespaces, source_ns and sink_ns,
# connected via a veth link. Within source_ns, it continuously updates the
# IPv6 routing table by flushing and inserting IPV6_NEXTHOP_ADDR_COUNT nexthop
# IPs destined for SINK_LOOPBACK_IP_ADDR in sink_ns. This refresh occurs at a
# rate of 1/ROUTING_TABLE_REFRESH_PERIOD per second for TEST_DURATION seconds.
#
# Simultaneously, multiple iperf3 clients within source_ns generate heavy
# outgoing IPv6 traffic. Each client is assigned a unique port number starting
# at 5000 and incrementing sequentially. Each client targets a unique iperf3
# server running in sink_ns, connected to the SINK_LOOPBACK_IFACE interface
# using the same port number.
#
# The number of iperf3 servers and clients is set to half of the total
# available cores on each machine.
#
# NOTE: We have tested this script on machines with various CPU specifications,
# ranging from lower to higher performance as listed below. The test script
# effectively triggered a kernel soft lockup on machines running an unpatched
# kernel in under a minute:
#
# - 1x Intel Xeon E-2278G 8-Core Processor @ 3.40GHz
# - 1x Intel Xeon E-2378G Processor 8-Core @ 2.80GHz
# - 1x AMD EPYC 7401P 24-Core Processor @ 2.00GHz
# - 1x AMD EPYC 7402P 24-Core Processor @ 2.80GHz
# - 2x Intel Xeon Gold 5120 14-Core Processor @ 2.20GHz
# - 1x Ampere Altra Q80-30 80-Core Processor @ 3.00GHz
# - 2x Intel Xeon Gold 5120 14-Core Processor @ 2.20GHz
# - 2x Intel Xeon Silver 4214 24-Core Processor @ 2.20GHz
# - 1x AMD EPYC 7502P 32-Core @ 2.50GHz
# - 1x Intel Xeon Gold 6314U 32-Core Processor @ 2.30GHz
# - 2x Intel Xeon Gold 6338 32-Core Processor @ 2.00GHz
#
# On less performant machines, you may need to increase the TEST_DURATION
# parameter to enhance the likelihood of encountering a race condition leading
# to a kernel soft lockup and avoid a false negative result.
#
# NOTE: The test may not produce the expected result in virtualized
# environments (e.g., qemu) due to differences in timing and CPU handling,
# which can affect the conditions needed to trigger a soft lockup.

Annotation

Implementation Notes