<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/testing/selftests/net/tcp_mmap.c, branch master</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=master</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-08-02T10:40:49Z</updated>
<entry>
<title>selftests/net: report rcv_mss in tcp_mmap</title>
<updated>2023-08-02T10:40:49Z</updated>
<author>
<name>Willem de Bruijn</name>
</author>
<published>2023-07-31T18:08:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bd60438eeb1ebe9415b157398083b4910c7f0aa3'/>
<id>urn:sha1:bd60438eeb1ebe9415b157398083b4910c7f0aa3</id>
<content type='text'>
tcp_mmap tests TCP_ZEROCOPY_RECEIVE. If 0% of data is received using
mmap, this may be due to mss. Report rcv_mss to identify this cause.

Output of a run failed due to too small mss:

    received 32768 MB (0 % mmap'ed) in 8.40458 s, 32.7057 Gbit
      cpu usage user:0.027922 sys:8.21126, 251.44 usec per MB, 3252 c-switches, rcv_mss 1428

Output on a successful run:

    received 32768 MB (99.9507 % mmap'ed) in 4.69023 s, 58.6064 Gbit
      cpu usage user:0.029172 sys:2.56105, 79.0473 usec per MB, 57591 c-switches, rcv_mss 4096

Suggested-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: Willem de Bruijn &lt;willemb@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>selftests/net: fix typo in tcp_mmap</title>
<updated>2023-04-06T11:19:25Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2023-04-05T07:15:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=905a9eb5f636f3312964b162362e4d6ca4e37378'/>
<id>urn:sha1:905a9eb5f636f3312964b162362e4d6ca4e37378</id>
<content type='text'>
kernel test robot reported the following warning:

All warnings (new ones prefixed by &gt;&gt;):

   tcp_mmap.c: In function 'child_thread':
&gt;&gt; tcp_mmap.c:211:61: warning: 'lu' may be used uninitialized in this function [-Wmaybe-uninitialized]
     211 |                         zc.length = min(chunk_size, FILE_SZ - lu);

We want to read FILE_SZ bytes, so the correct expression
should be (FILE_SZ - total)

Fixes: 5c5945dc695c ("selftests/net: Add SHA256 computation over data sent in tcp_mmap")
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Link: https://lore.kernel.org/oe-kbuild-all/202304042104.UFIuevBp-lkp@intel.com/
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Xiaoyan Li &lt;lixiaoyan@google.com&gt;
Cc: Kuniyuki Iwashima &lt;kuniyu@amazon.com&gt;
Link: https://lore.kernel.org/r/20230405071556.1019623-1-edumazet@google.com
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
</entry>
<entry>
<title>selftests/net: Add SHA256 computation over data sent in tcp_mmap</title>
<updated>2023-03-22T14:34:31Z</updated>
<author>
<name>Xiaoyan Li</name>
</author>
<published>2023-03-21T08:12:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5c5945dc695c54f2b55a934a10b6c4e220f9c140'/>
<id>urn:sha1:5c5945dc695c54f2b55a934a10b6c4e220f9c140</id>
<content type='text'>
Add option to compute and send SHA256 over data sent (-i).

This is to ensure the correctness of data received.
Data is randomly populated from /dev/urandom.

Tested:
./tcp_mmap -s -z -i
./tcp_mmap -z -H $ADDR -i
SHA256 is correct

./tcp_mmap -s -i
./tcp_mmap -H $ADDR -i
SHA256 is correct

Signed-off-by: Coco Li &lt;lixiaoyan@google.com&gt;
Reviewed-by: Eric Dumazet &lt;edumazet@google.com&gt;
Link: https://lore.kernel.org/r/20230321081202.2370275-2-lixiaoyan@google.com
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
</entry>
<entry>
<title>selftests: net: tcp_mmap: populate pages in send path</title>
<updated>2023-01-24T05:24:29Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2023-01-20T18:11:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=057fb03160a88925877548979ab4ab7f9223e118'/>
<id>urn:sha1:057fb03160a88925877548979ab4ab7f9223e118</id>
<content type='text'>
In commit 72653ae5303c ("selftests: net: tcp_mmap:
Use huge pages in send path") I made a change to use hugepages
for the buffer used by the client (tx path)

Today, I understood that the cause for poor zerocopy
performance was that after a mmap() for a 512KB memory
zone, kernel uses a single zeropage, mapped 128 times.

This was really the reason for poor tx path performance
in zero copy mode, because this zero page refcount is
under high pressure, especially when TCP ACK packets
are processed on another cpu.

We need either to force a COW on all the memory range,
or use MAP_POPULATE so that a zero page is not abused.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Link: https://lore.kernel.org/r/20230120181136.3764521-1-edumazet@google.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: net: tcp_mmap: Use huge pages in receive path</title>
<updated>2020-08-20T23:14:53Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2020-08-20T17:11:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=59c0d31988fb366189502a8ac66b7fe1486b7e40'/>
<id>urn:sha1:59c0d31988fb366189502a8ac66b7fe1486b7e40</id>
<content type='text'>
One down side of using TCP rx zerocopy is one extra TLB miss
per page after the mapping operation.

While if the application is using hugepages, the non zerocopy
recvmsg() will not have to pay these TLB costs.

This patch allows server side to use huge pages for
the non zero copy case, to allow fair comparisons when
both solutions use optimal conditions.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Arjun Roy &lt;arjunroy@google.com&gt;
Cc: Soheil Hassas Yeganeh &lt;soheil@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>selftests: net: tcp_mmap: Use huge pages in send path</title>
<updated>2020-08-20T23:14:53Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2020-08-20T17:11:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=72653ae5303c626ca29fcbcbb8165a894a104adf'/>
<id>urn:sha1:72653ae5303c626ca29fcbcbb8165a894a104adf</id>
<content type='text'>
There are significant gains using huge pages when
available, as shown in [1].

This patch adds mmap_large_buffer() and uses it
in client side (tx path of this reference tool)

Following patch will use the feature for server side.

[1] https://patchwork.ozlabs.org/project/netdev/patch/20200820154359.1806305-1-edumazet@google.com/

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Arjun Roy &lt;arjunroy@google.com&gt;
Cc: Soheil Hassas Yeganeh &lt;soheil@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>selftests: net: tcp_mmap: use madvise(MADV_DONTNEED)</title>
<updated>2020-08-20T23:14:53Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2020-08-20T17:11:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0d89419319ef68f8acc1b78377ad3e7523fead4a'/>
<id>urn:sha1:0d89419319ef68f8acc1b78377ad3e7523fead4a</id>
<content type='text'>
When TCP_ZEROCOPY_RECEIVE operation has been added,
I made the mistake of automatically un-mapping prior
content before mapping new pages.

This has the unfortunate effect of adding potentially long
MMU operations (like TLB flushes) while socket lock is held.

Using madvise(MADV_DONTNEED) right after pages has been used
has two benefits :

1) This releases pages sooner, allowing pages to be recycled
if they were part of a page pool in a NIC driver.

2) No more long unmap operations while preventing immediate
processing of incoming packets.

The cost of the added system call is small enough.

Arjun will submit a kernel patch allowing to opt out from
the unmap attempt in tcp_zerocopy_receive()

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Arjun Roy &lt;arjunroy@google.com&gt;
Cc: Soheil Hassas Yeganeh &lt;soheil@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>selftests/net: tcp_mmap: fix clang warning for target arch PowerPC</title>
<updated>2020-07-27T19:56:59Z</updated>
<author>
<name>Tanner Love</name>
</author>
<published>2020-07-27T16:25:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=94b6c13be57cdedb7cf4d33dbcd066fad133f22b'/>
<id>urn:sha1:94b6c13be57cdedb7cf4d33dbcd066fad133f22b</id>
<content type='text'>
When size_t maps to unsigned int (e.g. on 32-bit powerpc), then the
comparison with 1&lt;&lt;35 is always true. Clang 9 threw:
warning: result of comparison of constant 34359738368 with \
expression of type 'size_t' (aka 'unsigned int') is always true \
[-Wtautological-constant-out-of-range-compare]
        while (total &lt; FILE_SZ) {

Tested: make -C tools/testing/selftests TARGETS="net" run_tests

Fixes: 192dc405f308 ("selftests: net: add tcp_mmap program")
Signed-off-by: Tanner Love &lt;tannerlove@google.com&gt;
Acked-by: Willem de Bruijn &lt;willemb@google.com&gt;
Reviewed-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>selftests: net: tcp_mmap: fix SO_RCVLOWAT setting</title>
<updated>2020-05-06T22:01:30Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2020-05-06T16:21:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a84724178bd7081cf3bd5b558616dd6a9a4ca63b'/>
<id>urn:sha1:a84724178bd7081cf3bd5b558616dd6a9a4ca63b</id>
<content type='text'>
Since chunk_size is no longer an integer, we can not
use it directly as an argument of setsockopt().

This patch should fix tcp_mmap for Big Endian kernels.

Fixes: 597b01edafac ("selftests: net: avoid ptl lock contention in tcp_mmap")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Soheil Hassas Yeganeh &lt;soheil@google.com&gt;
Cc: Arjun Roy &lt;arjunroy@google.com&gt;
Acked-by: Soheil Hassas Yeganeh &lt;soheil@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>selftests: net: tcp_mmap: clear whole tcp_zerocopy_receive struct</title>
<updated>2020-05-06T20:45:09Z</updated>
<author>
<name>Eric Dumazet</name>
</author>
<published>2020-05-06T03:51:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bf5525f3a8e3248be5aa5defe5aaadd60e1c1ba1'/>
<id>urn:sha1:bf5525f3a8e3248be5aa5defe5aaadd60e1c1ba1</id>
<content type='text'>
We added fields in tcp_zerocopy_receive structure,
so make sure to clear all fields to not pass garbage to the kernel.

We were lucky because recent additions added 'out' parameters,
still we need to clean our reference implementation, before folks
copy/paste it.

Fixes: c8856c051454 ("tcp-zerocopy: Return inq along with tcp receive zerocopy.")
Fixes: 33946518d493 ("tcp-zerocopy: Return sk_err (if set) along with tcp receive zerocopy.")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Arjun Roy &lt;arjunroy@google.com&gt;
Cc: Soheil Hassas Yeganeh &lt;soheil@google.com&gt;
Acked-by: Soheil Hassas Yeganeh &lt;soheil@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
