Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io_uring: fix regression #19501

Merged
merged 3 commits into from
Apr 1, 2024
Merged

io_uring: fix regression #19501

merged 3 commits into from
Apr 1, 2024

Conversation

ianic
Copy link
Contributor

@ianic ianic commented Mar 31, 2024

Fixes #19451 which describes io_uring regression introduced in #18757.

First commit adds failing test from the issue which fails with panic: @memcpy arguments have non-equal lengths.

1/1 IoUring.test.failing test for issue 19451... thread 248254 panic: @memcpy arguments have non-equal lengths
/usr/local/zig/zig-linux-x86_64-0.12.0-dev.3496+a2df84d0f/lib/std/os/linux/IoUring.zig:289:45: 0x103d50a in copy_cqes_ready (test)
        @memcpy(cqes[0..count], self.cq.cqes[head..tail]);
                                            ^
/usr/local/zig/zig-linux-x86_64-0.12.0-dev.3496+a2df84d0f/lib/std/os/linux/IoUring.zig:276:36: 0x103d1c4 in copy_cqes (test)
        return self.copy_cqes_ready(cqes);
                                   ^
/usr/local/zig/zig-linux-x86_64-0.12.0-dev.3496+a2df84d0f/lib/compiler/IoUring.zig:4251:40: 0x103df00 in test.failing test for issue 19451 (test)
/usr/local/zig/zig-linux-x86_64-0.12.0-dev.3496+a2df84d0f/lib/compiler/test_runner.zig:158:25: 0x107847c in mainTerminal (test)
        if (test_fn.func()) |_| {
                        ^
/usr/local/zig/zig-linux-x86_64-0.12.0-dev.3496+a2df84d0f/lib/compiler/test_runner.zig:35:28: 0x104088b in main (test)
        return mainTerminal();
                           ^
/usr/local/zig/zig-linux-x86_64-0.12.0-dev.3496+a2df84d0f/lib/std/start.zig:501:22: 0x103e579 in posixCallMainAndExit (test)
            root.main();
                     ^
/usr/local/zig/zig-linux-x86_64-0.12.0-dev.3496+a2df84d0f/lib/std/start.zig:253:5: 0x103e0e1 in _start (test)
    asm volatile (switch (native_arch) {
    ^
???:?:?: 0x0 in ??? (???)
error: the following test command crashed:

Second commit is one character fix.

Third simplifies logic in copy_sqes and adds test which touches both paths in copys_sqes.

First copy as much as we can in this cycle. If there is more needed
wrap and start from the buffer 0 position.
@andrewrk andrewrk enabled auto-merge April 1, 2024 00:35
@andrewrk
Copy link
Member

andrewrk commented Apr 1, 2024

Thanks, nice work on coming up with a unit test.

@andrewrk andrewrk merged commit 3cb987f into ziglang:master Apr 1, 2024
10 checks passed
@ianic ianic deleted the io_uring_19451 branch April 3, 2024 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IoUring.copy_cqes_ready panics on @memcopy
2 participants