Add SO_PREFER_BUSY_POLL and SO_BUSY_POLL_BUDGET#3917
Conversation
|
From the CI results (i686-unknown-linux-musl) it seems like the machine does not have a uapi header with the constant. |
|
for the time being, need to add those constants as exception (for CI), as if musl then ignore those two. |
|
@devnexen Got it. I was wondering if someone tried to update the kernel headers for the musl CI. |
|
I updated the CI to use the alpine headers here: tammela@17af7ba Seems to be passing the CI scripts, let me know if it's worth the shot and I can open up a PR |
|
nice, it might be best to create a PR for this musl update alone tough. cc @tgross35 |
|
Needs this one to pass CI: #3921 |
Head branch was pushed to by a user without write access
|
It looks like CI is passing - is this ready to be merged or is there something else to be done? (I've held off because of the labels) |
I gave in and gated the new constants for !musl. So it should be good from my side. |
libc-test/semver/TODO-linux.txt
Outdated
| SO_BINDTOIFINDEX | ||
| SO_BPF_EXTENSIONS | ||
| SO_BSDCOMPAT | ||
| SO_BUSY_POLL_BUDGET |
There was a problem hiding this comment.
Could you instead add these to linux-gnu.txt or linux-gnu-x86_64.txt instead?
Since there is something left to do, maybe leave a // FIXME(musl) in the .rs file rather than using the TODO semver.
There was a problem hiding this comment.
Good catch, will do!
There was a problem hiding this comment.
I think it needs to go in one of the linux-gnu* files rather than linux-{arch} since these aren't yet available on musl
There was a problem hiding this comment.
I added to the x86 one, but it should be fine for everything except musl, but it doesn't seem to have such a file
72bf054 to
8ddba26
Compare
| pub const SO_PREFER_BUSY_POLL: c_int = 69; | ||
| pub const SO_BUSY_POLL_BUDGET: c_int = 70; | ||
| } | ||
| } | ||
| // pub const SO_PREFER_BUSY_POLL: c_int = 69; | ||
| // pub const SO_BUSY_POLL_BUDGET: c_int = 70; |
There was a problem hiding this comment.
Sorry, this slipped under the radar. I don't understand what the change is here; it looks like the net effect is changing SO_PREFER_BUSY_POLL and SO_BUSY_POLL_BUDGET from being available on all platforms to only being available on non-musl platforms. Why is this needed? Musl does seem to define them https://github.com/kraj/musl/blob/1880359b54ff7dd9f5016002bfdae4b136007dde/include/sys/socket.h#L292-L293.
There was a problem hiding this comment.
At the time they didn't have this constants, let me push with them outside and see if it works now!
There was a problem hiding this comment.
So I went a bit further in the upgrading musl rabbit hole.
Musl 1.2.x now defines time to be 64 bits on 32 bit systems. Unfortunately, that's the version that has the constants we are looking for.
Time in 64 bits changes a bunch of struct definitions and even syscalls so it's a big change [1].
I can open up a PR changing some low hanging fruits to kickstart the transition.
One deficiency we have is that two new types are being used to help the transition: __kernel_ulong_t and __kernel_long_t. These can be redefined on 32bits to be long long variants [2], so far x86 is the only arch expanding them.
The syscall change is more challenging, the tests fail with:
bad recvmmsg function pointer: rust: 139377735 (0x84ebc47) != c 139259307 (0x84cedab)
bad gettimeofday function pointer: rust: 139376444 (0x84eb73c) != c 139362562 (0x84e8102)
bad adjtimex function pointer: rust: 139375084 (0x84eb1ec) != c 139209963 (0x84c2ceb)
bad clock_adjtime function pointer: rust: 139375189 (0x84eb255) != c 139210036 (0x84c2d34)
Not sure how to this fix those as SYS_recvmmsg works on 64-bit but on 32-bit you would need SYS_recvmmsg_time64 + something else?
[1] https://git.musl-libc.org/cgit/musl/tree/src/network/recvmmsg.c#n21
[2] https://elixir.bootlin.com/linux/v6.13.4/source/arch/x86/include/uapi/asm/posix_types_x32.h#L15
There was a problem hiding this comment.
If the SO_ constants are useful then we can add them but just skip tests on musl in libc-test/build.rs, separate from the musl upgrade.
The musl upgrade is unfortunately tricky, but very much needs to happen. #3791 does most of the changes (and I left some review there), that PR is a cleaned up version of #3068. Cc #4148 which made linux uapi configurable - we'd probably want something similar for musl so we can unstably test before 1.0.
(If you're considering working on this, feel free to ask me questions on zulip)
There was a problem hiding this comment.
Oh great! I didn't know about this PR.
I did a quick run with my patch applied on top of it and it works just fine!
There was a problem hiding this comment.
To be clear, that PR cannot be merged in its current state. This doesn't need to block the change here though, you can just skip the constants on musl in libc-test/build.rs.
There was a problem hiding this comment.
To be clear, that PR cannot be merged in its current state
Oh, what is missing?
This doesn't need to block the change here though, you can just skip the constants on musl in libc-test/build.rs.
Will do
There was a problem hiding this comment.
Oh, what is missing?
Not that there is anything fundamentally wrong with the change, but it is pretty out of date and there are a lot of open review comments. I haven't heard from the author in a while so unfortunately it likely needs somebody else to pick it up.
473158f to
597ae13
Compare
ba7e8fd to
dc5cb31
Compare
libc-test/build.rs
Outdated
| if loongarch64 && (name == "MFD_NOEXEC_SEAL" || name == "MFD_EXEC") { | ||
| return true; | ||
| } | ||
| // FIXME: Requires musl >= 1.2 |
There was a problem hiding this comment.
Could you make this FIXME(musl)? Trying to keep all our fixmes greppable since we have so many of them
Remove the comment of these socket options. Reference: https://elixir.bootlin.com/linux/latest/source/include/uapi/asm-generic/socket.h Note, musl hardcodes 'SO_*' constants instead of inheriting them from the OS. Signed-off-by: Pedro Tammela <pctammela@gmail.com>
|
Thanks! |
Remove the comment of these socket options. Reference: https://elixir.bootlin.com/linux/latest/source/include/uapi/asm-generic/socket.h Note, musl hardcodes 'SO_*' constants instead of inheriting them from the OS. Signed-off-by: Pedro Tammela <pctammela@gmail.com> (backport <rust-lang#3917>) (cherry picked from commit b3884fb)
Remove the comment of these socket options. Reference: https://elixir.bootlin.com/linux/latest/source/include/uapi/asm-generic/socket.h Note, musl hardcodes 'SO_*' constants instead of inheriting them from the OS. Signed-off-by: Pedro Tammela <pctammela@gmail.com> (backport <rust-lang#3917>) (cherry picked from commit b3884fb)
Remove the comment of these socket options.
Reference: https://elixir.bootlin.com/linux/latest/source/include/uapi/asm-generic/socket.h