* [PATCH v1] selftests: iou-zcrx: Get the page size at runtime
@ 2025-04-19 14:10 Haiyue Wang
2025-04-24 13:55 ` Simon Horman
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Haiyue Wang @ 2025-04-19 14:10 UTC (permalink / raw)
To: io-uring
Cc: Haiyue Wang, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Shuah Khan, David Wei, Jens Axboe,
open list:NETWORKING DRIVERS, open list:KERNEL SELFTEST FRAMEWORK,
open list
Use the API `sysconf()` to query page size at runtime, instead of using
hard code number 4096.
And use `posix_memalign` to allocate the page size aligned momory.
Signed-off-by: Haiyue Wang <haiyuewa@163.com>
---
.../selftests/drivers/net/hw/iou-zcrx.c | 23 ++++++++++++-------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/hw/iou-zcrx.c b/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
index c26b4180eddd..8aa426014c87 100644
--- a/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
+++ b/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
@@ -37,8 +37,8 @@
#include <liburing.h>
-#define PAGE_SIZE (4096)
-#define AREA_SIZE (8192 * PAGE_SIZE)
+static long page_size;
+#define AREA_SIZE (8192 * page_size)
#define SEND_SIZE (512 * 4096)
#define min(a, b) \
({ \
@@ -66,7 +66,7 @@ static int cfg_oneshot_recvs;
static int cfg_send_size = SEND_SIZE;
static struct sockaddr_in6 cfg_addr;
-static char payload[SEND_SIZE] __attribute__((aligned(PAGE_SIZE)));
+static char *payload;
static void *area_ptr;
static void *ring_ptr;
static size_t ring_size;
@@ -114,8 +114,8 @@ static inline size_t get_refill_ring_size(unsigned int rq_entries)
ring_size = rq_entries * sizeof(struct io_uring_zcrx_rqe);
/* add space for the header (head/tail/etc.) */
- ring_size += PAGE_SIZE;
- return ALIGN_UP(ring_size, 4096);
+ ring_size += page_size;
+ return ALIGN_UP(ring_size, page_size);
}
static void setup_zcrx(struct io_uring *ring)
@@ -219,7 +219,7 @@ static void process_accept(struct io_uring *ring, struct io_uring_cqe *cqe)
connfd = cqe->res;
if (cfg_oneshot)
- add_recvzc_oneshot(ring, connfd, PAGE_SIZE);
+ add_recvzc_oneshot(ring, connfd, page_size);
else
add_recvzc(ring, connfd);
}
@@ -245,7 +245,7 @@ static void process_recvzc(struct io_uring *ring, struct io_uring_cqe *cqe)
if (cfg_oneshot) {
if (cqe->res == 0 && cqe->flags == 0 && cfg_oneshot_recvs) {
- add_recvzc_oneshot(ring, connfd, PAGE_SIZE);
+ add_recvzc_oneshot(ring, connfd, page_size);
cfg_oneshot_recvs--;
}
} else if (!(cqe->flags & IORING_CQE_F_MORE)) {
@@ -370,7 +370,7 @@ static void usage(const char *filepath)
static void parse_opts(int argc, char **argv)
{
- const int max_payload_len = sizeof(payload) -
+ const int max_payload_len = SEND_SIZE -
sizeof(struct ipv6hdr) -
sizeof(struct tcphdr) -
40 /* max tcp options */;
@@ -443,6 +443,13 @@ int main(int argc, char **argv)
const char *cfg_test = argv[argc - 1];
int i;
+ page_size = sysconf(_SC_PAGESIZE);
+ if (page_size < 0)
+ return 1;
+
+ if (posix_memalign((void **)&payload, page_size, SEND_SIZE))
+ return 1;
+
parse_opts(argc, argv);
for (i = 0; i < SEND_SIZE; i++)
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v1] selftests: iou-zcrx: Get the page size at runtime
2025-04-19 14:10 [PATCH v1] selftests: iou-zcrx: Get the page size at runtime Haiyue Wang
@ 2025-04-24 13:55 ` Simon Horman
2025-04-24 18:09 ` David Wei
2025-04-24 23:06 ` David Wei
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Simon Horman @ 2025-04-24 13:55 UTC (permalink / raw)
To: Haiyue Wang
Cc: io-uring, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Shuah Khan, David Wei, Jens Axboe,
open list:NETWORKING DRIVERS, open list:KERNEL SELFTEST FRAMEWORK,
open list
On Sat, Apr 19, 2025 at 10:10:15PM +0800, Haiyue Wang wrote:
> Use the API `sysconf()` to query page size at runtime, instead of using
> hard code number 4096.
>
> And use `posix_memalign` to allocate the page size aligned momory.
>
> Signed-off-by: Haiyue Wang <haiyuewa@163.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1] selftests: iou-zcrx: Get the page size at runtime
2025-04-24 13:55 ` Simon Horman
@ 2025-04-24 18:09 ` David Wei
0 siblings, 0 replies; 9+ messages in thread
From: David Wei @ 2025-04-24 18:09 UTC (permalink / raw)
To: Simon Horman, Haiyue Wang
Cc: io-uring, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Shuah Khan, Jens Axboe,
open list:NETWORKING DRIVERS, open list:KERNEL SELFTEST FRAMEWORK,
open list
On 2025-04-24 06:55, Simon Horman wrote:
> On Sat, Apr 19, 2025 at 10:10:15PM +0800, Haiyue Wang wrote:
>> Use the API `sysconf()` to query page size at runtime, instead of using
>> hard code number 4096.
>>
>> And use `posix_memalign` to allocate the page size aligned momory.
>>
>> Signed-off-by: Haiyue Wang <haiyuewa@163.com>
>
> Reviewed-by: Simon Horman <horms@kernel.org>
>
Thanks Simon. I'll apply the patch and run the selftest to make sure it
still works.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1] selftests: iou-zcrx: Get the page size at runtime
2025-04-19 14:10 [PATCH v1] selftests: iou-zcrx: Get the page size at runtime Haiyue Wang
2025-04-24 13:55 ` Simon Horman
@ 2025-04-24 23:06 ` David Wei
2025-04-24 23:09 ` Jens Axboe
2025-04-25 0:00 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 9+ messages in thread
From: David Wei @ 2025-04-24 23:06 UTC (permalink / raw)
To: Haiyue Wang, io-uring
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Shuah Khan, Jens Axboe, open list:NETWORKING DRIVERS,
open list:KERNEL SELFTEST FRAMEWORK, open list
On 2025-04-19 07:10, Haiyue Wang wrote:
> Use the API `sysconf()` to query page size at runtime, instead of using
> hard code number 4096.
>
> And use `posix_memalign` to allocate the page size aligned momory.
>
> Signed-off-by: Haiyue Wang <haiyuewa@163.com>
> ---
> .../selftests/drivers/net/hw/iou-zcrx.c | 23 ++++++++++++-------
> 1 file changed, 15 insertions(+), 8 deletions(-)
>
Reviewed-by: David Wei <dw@davidwei.uk>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1] selftests: iou-zcrx: Get the page size at runtime
2025-04-19 14:10 [PATCH v1] selftests: iou-zcrx: Get the page size at runtime Haiyue Wang
2025-04-24 13:55 ` Simon Horman
2025-04-24 23:06 ` David Wei
@ 2025-04-24 23:09 ` Jens Axboe
2025-04-24 23:29 ` Jakub Kicinski
2025-04-25 0:00 ` patchwork-bot+netdevbpf
3 siblings, 1 reply; 9+ messages in thread
From: Jens Axboe @ 2025-04-24 23:09 UTC (permalink / raw)
To: io-uring, Haiyue Wang
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Shuah Khan, David Wei, netdev, linux-kselftest,
linux-kernel
On Sat, 19 Apr 2025 22:10:15 +0800, Haiyue Wang wrote:
> Use the API `sysconf()` to query page size at runtime, instead of using
> hard code number 4096.
>
> And use `posix_memalign` to allocate the page size aligned momory.
>
>
Applied, thanks!
[1/1] selftests: iou-zcrx: Get the page size at runtime
commit: 6f4cc653bf408ad0cc203c6ab3088b11f5da11df
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1] selftests: iou-zcrx: Get the page size at runtime
2025-04-24 23:09 ` Jens Axboe
@ 2025-04-24 23:29 ` Jakub Kicinski
2025-04-24 23:34 ` Jens Axboe
0 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2025-04-24 23:29 UTC (permalink / raw)
To: Jens Axboe
Cc: io-uring, Haiyue Wang, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, Shuah Khan, David Wei, netdev, linux-kselftest,
linux-kernel
On Thu, 24 Apr 2025 17:09:28 -0600 Jens Axboe wrote:
> On Sat, 19 Apr 2025 22:10:15 +0800, Haiyue Wang wrote:
> > Use the API `sysconf()` to query page size at runtime, instead of using
> > hard code number 4096.
> >
> > And use `posix_memalign` to allocate the page size aligned momory.
> >
> >
>
> Applied, thanks!
>
> [1/1] selftests: iou-zcrx: Get the page size at runtime
> commit: 6f4cc653bf408ad0cc203c6ab3088b11f5da11df
Why are you applying this, Jens?
tools/testing/selftests/drivers/net/hw/iou-zcrx.c
^^^^^^^^^^^
This is a test which runs in netdev infra, and which we asked for.
It was incorrectly initially routed via io-uring trees and then
we had to deal with the breakage during the merge window because
net/lib has diverged.
Please revert.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1] selftests: iou-zcrx: Get the page size at runtime
2025-04-24 23:29 ` Jakub Kicinski
@ 2025-04-24 23:34 ` Jens Axboe
2025-04-24 23:58 ` Jakub Kicinski
0 siblings, 1 reply; 9+ messages in thread
From: Jens Axboe @ 2025-04-24 23:34 UTC (permalink / raw)
To: Jakub Kicinski
Cc: io-uring, Haiyue Wang, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, Shuah Khan, David Wei, netdev, linux-kselftest,
linux-kernel
On 4/24/25 5:29 PM, Jakub Kicinski wrote:
> On Thu, 24 Apr 2025 17:09:28 -0600 Jens Axboe wrote:
>> On Sat, 19 Apr 2025 22:10:15 +0800, Haiyue Wang wrote:
>>> Use the API `sysconf()` to query page size at runtime, instead of using
>>> hard code number 4096.
>>>
>>> And use `posix_memalign` to allocate the page size aligned momory.
>>>
>>>
>>
>> Applied, thanks!
>>
>> [1/1] selftests: iou-zcrx: Get the page size at runtime
>> commit: 6f4cc653bf408ad0cc203c6ab3088b11f5da11df
>
> Why are you applying this, Jens?
Nobody else had picked it up so far, and I already did the equivalent
one on the liburing side.
>
> tools/testing/selftests/drivers/net/hw/iou-zcrx.c
> ^^^^^^^^^^^
>
> This is a test which runs in netdev infra, and which we asked for.
> It was incorrectly initially routed via io-uring trees and then
> we had to deal with the breakage during the merge window because
> net/lib has diverged.
Come on, it was a one line conflict due to another added test, the
simplest of all conflicts. If that's "breakage" worth mentioning,
well...
> Please revert.
Sure, I can drop it. Doesn't matter to me, as long as gets merged.
--
Jens Axboe
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1] selftests: iou-zcrx: Get the page size at runtime
2025-04-24 23:34 ` Jens Axboe
@ 2025-04-24 23:58 ` Jakub Kicinski
0 siblings, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2025-04-24 23:58 UTC (permalink / raw)
To: Jens Axboe
Cc: io-uring, Haiyue Wang, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, Shuah Khan, David Wei, netdev, linux-kselftest,
linux-kernel
On Thu, 24 Apr 2025 17:34:00 -0600 Jens Axboe wrote:
> On 4/24/25 5:29 PM, Jakub Kicinski wrote:
> > On Thu, 24 Apr 2025 17:09:28 -0600 Jens Axboe wrote:
> >> Applied, thanks!
> >>
> >> [1/1] selftests: iou-zcrx: Get the page size at runtime
> >> commit: 6f4cc653bf408ad0cc203c6ab3088b11f5da11df
> >
> > Why are you applying this, Jens?
>
> Nobody else had picked it up so far, and I already did the equivalent
> one on the liburing side.
I pinged David yesterday and was waiting for his tag.
> > tools/testing/selftests/drivers/net/hw/iou-zcrx.c
> > ^^^^^^^^^^^
> >
> > This is a test which runs in netdev infra, and which we asked for.
> > It was incorrectly initially routed via io-uring trees and then
> > we had to deal with the breakage during the merge window because
> > net/lib has diverged.
>
> Come on, it was a one line conflict due to another added test, the
> simplest of all conflicts. If that's "breakage" worth mentioning,
> well...
c0f21784bca5 ("io_uring/zcrx: fix selftests w/ updated netdev Python helpers")
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1] selftests: iou-zcrx: Get the page size at runtime
2025-04-19 14:10 [PATCH v1] selftests: iou-zcrx: Get the page size at runtime Haiyue Wang
` (2 preceding siblings ...)
2025-04-24 23:09 ` Jens Axboe
@ 2025-04-25 0:00 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-25 0:00 UTC (permalink / raw)
To: Haiyue Wang
Cc: io-uring, andrew+netdev, davem, edumazet, kuba, pabeni, shuah, dw,
axboe, netdev, linux-kselftest, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sat, 19 Apr 2025 22:10:15 +0800 you wrote:
> Use the API `sysconf()` to query page size at runtime, instead of using
> hard code number 4096.
>
> And use `posix_memalign` to allocate the page size aligned momory.
>
> Signed-off-by: Haiyue Wang <haiyuewa@163.com>
>
> [...]
Here is the summary with links:
- [v1] selftests: iou-zcrx: Get the page size at runtime
https://git.kernel.org/netdev/net-next/c/df8cf32413fa
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-04-24 23:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-19 14:10 [PATCH v1] selftests: iou-zcrx: Get the page size at runtime Haiyue Wang
2025-04-24 13:55 ` Simon Horman
2025-04-24 18:09 ` David Wei
2025-04-24 23:06 ` David Wei
2025-04-24 23:09 ` Jens Axboe
2025-04-24 23:29 ` Jakub Kicinski
2025-04-24 23:34 ` Jens Axboe
2025-04-24 23:58 ` Jakub Kicinski
2025-04-25 0:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox