Message ID | 20241206-test-vsock-leaks-v1-1-c31e8c875797@rbox.co (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | vsock/test: Tests for memory leaks | expand |
> Series adds tests for recently fixed memory leaks[1]: > > d7b0ff5a8667 ("virtio/vsock: Fix accept_queue memory leak") > fbf7085b3ad1 ("vsock: Fix sk_error_queue memory leak") > 60cf6206a1f5 ("virtio/vsock: Improve MSG_ZEROCOPY error handling") > > First patch is a non-functional preparatory cleanup. > > I initially considered triggering (and parsing) a kmemleak scan after each > test, but ultimately concluded that the slowdown and the required > privileges would be too much. > > [1]: https://lore.kernel.org/netdev/20241107-vsock-mem-leaks-v2-0-4e21bfcfc818@rbox.co/ > > Signed-off-by: Michal Luczaj <mhal@rbox.co> > --- > Michal Luczaj (4): > vsock/test: Use NSEC_PER_SEC > vsock/test: Add test for accept_queue memory leak > vsock/test: Add test for sk_error_queue memory leak > vsock/test: Add test for MSG_ZEROCOPY completion memory leak > > tools/testing/vsock/vsock_test.c | 159 ++++++++++++++++++++++++++++++++++++++- > 1 file changed, 157 insertions(+), 2 deletions(-) > --- > base-commit: 51db5c8943001186be0b5b02456e7d03b3be1f12 > change-id: 20241203-test-vsock-leaks-38f9559f5636 > > Best regards, > -- > Michal Luczaj <mhal@rbox.co> Thanks! Reviewed-by: Luigi Leonardi <leonardi@redhat.com>
> > Series adds tests for recently fixed memory leaks[1]: > > > > d7b0ff5a8667 ("virtio/vsock: Fix accept_queue memory leak") > > fbf7085b3ad1 ("vsock: Fix sk_error_queue memory leak") > > 60cf6206a1f5 ("virtio/vsock: Improve MSG_ZEROCOPY error handling") > > > > First patch is a non-functional preparatory cleanup. > > > > I initially considered triggering (and parsing) a kmemleak scan after each > > test, but ultimately concluded that the slowdown and the required > > privileges would be too much. > > > > [1]: https://lore.kernel.org/netdev/20241107-vsock-mem-leaks-v2-0-4e21bfcfc818@rbox.co/ > > > > Signed-off-by: Michal Luczaj <mhal@rbox.co> > > --- > > Michal Luczaj (4): > > vsock/test: Use NSEC_PER_SEC > > vsock/test: Add test for accept_queue memory leak > > vsock/test: Add test for sk_error_queue memory leak > > vsock/test: Add test for MSG_ZEROCOPY completion memory leak > > > > tools/testing/vsock/vsock_test.c | 159 ++++++++++++++++++++++++++++++++++++++- > > 1 file changed, 157 insertions(+), 2 deletions(-) > > --- > > base-commit: 51db5c8943001186be0b5b02456e7d03b3be1f12 > > change-id: 20241203-test-vsock-leaks-38f9559f5636 > > > > Best regards, > > -- > > Michal Luczaj <mhal@rbox.co> > > Thanks! > > Reviewed-by: Luigi Leonardi <leonardi@redhat.com> For maintainers: I made a mess with git send-email, this R-b is only for patch 1, I haven't checked the others yet. Luigi
On Fri, Dec 06, 2024 at 07:34:51PM +0100, Michal Luczaj wrote: >Replace 1000000000ULL with NSEC_PER_SEC. > >No functional change intended. > >Signed-off-by: Michal Luczaj <mhal@rbox.co> >--- > tools/testing/vsock/vsock_test.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> > >diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c >index 48f17641ca504316d1199926149c9bd62eb2921d..38fd8d96eb83ef1bd45728cfaac6adb3c1e07cfe 100644 >--- a/tools/testing/vsock/vsock_test.c >+++ b/tools/testing/vsock/vsock_test.c >@@ -22,6 +22,7 @@ > #include <signal.h> > #include <sys/ioctl.h> > #include <linux/sockios.h> >+#include <linux/time64.h> > > #include "vsock_test_zerocopy.h" > #include "timeout.h" >@@ -559,7 +560,7 @@ static time_t current_nsec(void) > exit(EXIT_FAILURE); > } > >- return (ts.tv_sec * 1000000000ULL) + ts.tv_nsec; >+ return (ts.tv_sec * NSEC_PER_SEC) + ts.tv_nsec; > } > > #define RCVTIMEO_TIMEOUT_SEC 1 >@@ -599,7 +600,7 @@ static void test_seqpacket_timeout_client(const struct test_opts *opts) > } > > read_overhead_ns = current_nsec() - read_enter_ns - >- 1000000000ULL * RCVTIMEO_TIMEOUT_SEC; >+ NSEC_PER_SEC * RCVTIMEO_TIMEOUT_SEC; > > if (read_overhead_ns > READ_OVERHEAD_NSEC) { > fprintf(stderr, > >-- >2.47.1 >
diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c index 48f17641ca504316d1199926149c9bd62eb2921d..38fd8d96eb83ef1bd45728cfaac6adb3c1e07cfe 100644 --- a/tools/testing/vsock/vsock_test.c +++ b/tools/testing/vsock/vsock_test.c @@ -22,6 +22,7 @@ #include <signal.h> #include <sys/ioctl.h> #include <linux/sockios.h> +#include <linux/time64.h> #include "vsock_test_zerocopy.h" #include "timeout.h" @@ -559,7 +560,7 @@ static time_t current_nsec(void) exit(EXIT_FAILURE); } - return (ts.tv_sec * 1000000000ULL) + ts.tv_nsec; + return (ts.tv_sec * NSEC_PER_SEC) + ts.tv_nsec; } #define RCVTIMEO_TIMEOUT_SEC 1 @@ -599,7 +600,7 @@ static void test_seqpacket_timeout_client(const struct test_opts *opts) } read_overhead_ns = current_nsec() - read_enter_ns - - 1000000000ULL * RCVTIMEO_TIMEOUT_SEC; + NSEC_PER_SEC * RCVTIMEO_TIMEOUT_SEC; if (read_overhead_ns > READ_OVERHEAD_NSEC) { fprintf(stderr,
Replace 1000000000ULL with NSEC_PER_SEC. No functional change intended. Signed-off-by: Michal Luczaj <mhal@rbox.co> --- tools/testing/vsock/vsock_test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)