[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <65a8a91f-65af-e948-1386-fc7d0d413b77@gmail.com>
Date: Wed, 2 Aug 2023 21:09:29 -0700
From: Kui-Feng Lee <sinquersw@...il.com>
To: David Ahern <dsahern@...nel.org>, thinker.li@...il.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
netdev@...r.kernel.org, pabeni@...hat.com, martin.lau@...ux.dev,
kernel-team@...a.com, yhs@...a.com
Cc: kuifeng@...a.com
Subject: Re: [PATCH net-next v5 2/2] selftests: fib_tests: Add a test case for
IPv6 garbage collection
On 8/2/23 19:06, David Ahern wrote:
> On 8/1/23 6:43 PM, thinker.li@...il.com wrote:
> \> @@ -747,6 +750,97 @@ fib_notify_test()
>> cleanup &> /dev/null
>> }
>>
>> +fib6_gc_test()
>> +{
>> + echo
>> + echo "Fib6 garbage collection test"
>> +
>> + STRACE=$(which strace)
>> + if [ -z "$STRACE" ]; then
>> + echo " SKIP: strace not found"
>> + ret=$ksft_skip
>> + return
>> + fi
>> +
>> + EXPIRE=10
>> +
>> + setup
>> +
>> + set -e
>> +
>> + # Check expiration of routes every 3 seconds (GC)
>> + $NS_EXEC sysctl -wq net.ipv6.route.gc_interval=300
>> +
>> + $IP link add dummy_10 type dummy
>> + $IP link set dev dummy_10 up
>> + $IP -6 address add 2001:10::1/64 dev dummy_10
>> +
>> + $NS_EXEC sysctl -wq net.ipv6.route.flush=1
>> +
>> + # Temporary routes
>> + for i in $(seq 1 1000); do
>> + # Expire route after $EXPIRE seconds
>> + $IP -6 route add 2001:20::$i \
>> + via 2001:10::2 dev dummy_10 expires $EXPIRE
>> + done
>> + N_EXP=$($IP -6 route list |grep expires|wc -l)
>> + if [ $N_EXP -ne 1000 ]; then
>
> race condition here ... that you can install all 1000 routes and then
> run this command before any expire. 10 seconds is normally more than
> enough time, but on a loaded server it might not be. And really it does
> not matter. What matters is that you install routes with an expires and
> they disappear when expected - and I believe the flush below should not
> be needed to validate they have been removed.
Without the flush below, the result will be very unpredictable or need
to wait longer, at least two gc_interval seconds. We can
shorten gc_interval to 10s, but we need to wait for 20s to make it
certain. It is more predictable with the flush.
About race condition, I will remove the check. Just like what you said,
it is not necessary.
Powered by blists - more mailing lists