<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/ipv4/tcp_metrics.c, branch v6.7</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.7</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.7'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-10-03T08:05:22Z</updated>
<entry>
<title>tcp_metrics: optimize tcp_metrics_flush_all()</title>
<updated>2023-10-03T08:05:22Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-09-22T22:03:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6532e257aa73645e28dee5b2232cc3c88be62083'/>
<id>urn:sha1:6532e257aa73645e28dee5b2232cc3c88be62083</id>
<content type='text'>
This is inspired by several syzbot reports where
tcp_metrics_flush_all() was seen in the traces.

We can avoid acquiring tcp_metrics_lock for empty buckets,
and we should add one cond_resched() to break potential long loops.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Acked-by: Neal Cardwell &lt;ncardwell@google.com&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
</entry>
<entry>
<title>tcp_metrics: do not create an entry from tcp_init_metrics()</title>
<updated>2023-10-03T08:05:22Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-09-22T22:03:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a135798e6e200ecb2f864cecca6d257ba278370c'/>
<id>urn:sha1:a135798e6e200ecb2f864cecca6d257ba278370c</id>
<content type='text'>
tcp_init_metrics() only wants to get metrics if they were
previously stored in the cache. Creating an entry is adding
useless costs, especially when tcp_no_metrics_save is set.

Fixes: 51c5d0c4b169 ("tcp: Maintain dynamic metrics in local cache.")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Acked-by: Neal Cardwell &lt;ncardwell@google.com&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
</entry>
<entry>
<title>tcp_metrics: properly set tp-&gt;snd_ssthresh in tcp_init_metrics()</title>
<updated>2023-10-03T08:05:22Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-09-22T22:03:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=081480014a64a69d901f8ef1ffdd56d6085cf87e'/>
<id>urn:sha1:081480014a64a69d901f8ef1ffdd56d6085cf87e</id>
<content type='text'>
We need to set tp-&gt;snd_ssthresh to TCP_INFINITE_SSTHRESH
in the case tcp_get_metrics() fails for some reason.

Fixes: 9ad7c049f0f7 ("tcp: RFC2988bis + taking RTT sample from 3WHS for the passive open side")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Acked-by: Neal Cardwell &lt;ncardwell@google.com&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
</entry>
<entry>
<title>tcp_metrics: add missing barriers on delete</title>
<updated>2023-10-03T08:05:22Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-09-22T22:03:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cbc3a153222805d65f821e10f4f78b6afce06f86'/>
<id>urn:sha1:cbc3a153222805d65f821e10f4f78b6afce06f86</id>
<content type='text'>
When removing an item from RCU protected list, we must prevent
store-tearing, using rcu_assign_pointer() or WRITE_ONCE().

Fixes: 04f721c671656 ("tcp_metrics: Rewrite tcp_metrics_flush_all")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Acked-by: Neal Cardwell &lt;ncardwell@google.com&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
</entry>
<entry>
<title>tcp_metrics: hash table allocation cleanup</title>
<updated>2023-08-04T22:33:39Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-08-03T13:54:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c4a6b2da4b59d4819e1d35446ca9363166388051'/>
<id>urn:sha1:c4a6b2da4b59d4819e1d35446ca9363166388051</id>
<content type='text'>
After commit 098a697b497e ("tcp_metrics: Use a single hash table
for all network namespaces.") we can avoid calling tcp_net_metrics_init()
for each new netns.

Instead, rename tcp_net_metrics_init() to tcp_metrics_hash_alloc(),
and move it to __init section.

Also move tcpmhash_entries to __initdata section.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reviewed-by: Simon Horman &lt;horms@kernel.org&gt;
Reviewed-by: Kuniyuki Iwashima &lt;kuniyu@amazon.com&gt;
Link: https://lore.kernel.org/r/20230803135417.2716879-1-edumazet@google.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>tcp_metrics: fix data-race in tcpm_suck_dst() vs fastopen</title>
<updated>2023-08-03T17:58:24Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-08-02T13:15:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ddf251fa2bc1d3699eec0bae6ed0bc373b8fda79'/>
<id>urn:sha1:ddf251fa2bc1d3699eec0bae6ed0bc373b8fda79</id>
<content type='text'>
Whenever tcpm_new() reclaims an old entry, tcpm_suck_dst()
would overwrite data that could be read from tcp_fastopen_cache_get()
or tcp_metrics_fill_info().

We need to acquire fastopen_seqlock to maintain consistency.

For newly allocated objects, tcpm_new() can switch to kzalloc()
to avoid an extra fastopen_seqlock acquisition.

Fixes: 1fe4c481ba63 ("net-tcp: Fast Open client - cookie cache")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Yuchung Cheng &lt;ycheng@google.com&gt;
Reviewed-by: Kuniyuki Iwashima &lt;kuniyu@amazon.com&gt;
Link: https://lore.kernel.org/r/20230802131500.1478140-7-edumazet@google.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>tcp_metrics: annotate data-races around tm-&gt;tcpm_net</title>
<updated>2023-08-03T17:58:24Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-08-02T13:14:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d5d986ce42c71a7562d32c4e21e026b0f87befec'/>
<id>urn:sha1:d5d986ce42c71a7562d32c4e21e026b0f87befec</id>
<content type='text'>
tm-&gt;tcpm_net can be read or written locklessly.

Instead of changing write_pnet() and read_pnet() and potentially
hurt performance, add the needed READ_ONCE()/WRITE_ONCE()
in tm_net() and tcpm_new().

Fixes: 849e8a0ca8d5 ("tcp_metrics: Add a field tcpm_net and verify it matches on lookup")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Reviewed-by: Kuniyuki Iwashima &lt;kuniyu@amazon.com&gt;
Link: https://lore.kernel.org/r/20230802131500.1478140-6-edumazet@google.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>tcp_metrics: annotate data-races around tm-&gt;tcpm_vals[]</title>
<updated>2023-08-03T17:58:24Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-08-02T13:14:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8c4d04f6b443869d25e59822f7cec88d647028a9'/>
<id>urn:sha1:8c4d04f6b443869d25e59822f7cec88d647028a9</id>
<content type='text'>
tm-&gt;tcpm_vals[] values can be read or written locklessly.

Add needed READ_ONCE()/WRITE_ONCE() to document this,
and force use of tcp_metric_get() and tcp_metric_set()

Fixes: 51c5d0c4b169 ("tcp: Maintain dynamic metrics in local cache.")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Reviewed-by: Kuniyuki Iwashima &lt;kuniyu@amazon.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>tcp_metrics: annotate data-races around tm-&gt;tcpm_lock</title>
<updated>2023-08-03T17:58:24Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-08-02T13:14:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=285ce119a3c6c4502585936650143e54c8692788'/>
<id>urn:sha1:285ce119a3c6c4502585936650143e54c8692788</id>
<content type='text'>
tm-&gt;tcpm_lock can be read or written locklessly.

Add needed READ_ONCE()/WRITE_ONCE() to document this.

Fixes: 51c5d0c4b169 ("tcp: Maintain dynamic metrics in local cache.")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Reviewed-by: Kuniyuki Iwashima &lt;kuniyu@amazon.com&gt;
Link: https://lore.kernel.org/r/20230802131500.1478140-4-edumazet@google.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>tcp_metrics: annotate data-races around tm-&gt;tcpm_stamp</title>
<updated>2023-08-03T17:58:24Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2023-08-02T13:14:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=949ad62a5d5311d36fce2e14fe5fed3f936da51c'/>
<id>urn:sha1:949ad62a5d5311d36fce2e14fe5fed3f936da51c</id>
<content type='text'>
tm-&gt;tcpm_stamp can be read or written locklessly.

Add needed READ_ONCE()/WRITE_ONCE() to document this.

Also constify tcpm_check_stamp() dst argument.

Fixes: 51c5d0c4b169 ("tcp: Maintain dynamic metrics in local cache.")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Reviewed-by: Kuniyuki Iwashima &lt;kuniyu@amazon.com&gt;
Link: https://lore.kernel.org/r/20230802131500.1478140-3-edumazet@google.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
</feed>
