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

definitions for linux hardware timestamping #3155

Merged
merged 1 commit into from
Apr 3, 2023

Conversation

folkertdev
Copy link
Contributor

Definitions can be found here https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/net_tstamp.h#L76

These definitions are relevant for (PTP and NTP) hardware timestamping

@rustbot
Copy link
Collaborator

rustbot commented Mar 19, 2023

r? @JohnTitor

(rustbot has picked a reviewer for you, use r? to override)

@folkertdev
Copy link
Contributor Author

I'm not sure what this CI error means

  cargo:warning=/checkout/target/i686-unknown-linux-gnu/debug/build/libc-test-1d150dc772ee3115/out/main.c:35676:80: error: 'HWTSTAMP_FLAG_BONDED_PHC_INDEX' undeclared here (not in a function)
  cargo:warning=35676 |             static const int __test_const_HWTSTAMP_FLAG_BONDED_PHC_INDEX_val = HWTSTAMP_FLAG_BONDED_PHC_INDEX;
  cargo:warning=      |                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cargo:warning=/checkout/target/i686-unknown-linux-gnu/debug/build/libc-test-1d150dc772ee3115/out/main.c:35682:68: error: 'HWTSTAMP_FLAG_LAST' undeclared here (not in a function)
  cargo:warning=35682 |             static const int __test_const_HWTSTAMP_FLAG_LAST_val = HWTSTAMP_FLAG_LAST;
  cargo:warning=      |                                                                    ^~~~~~~~~~~~~~~~~~
  cargo:warning=/checkout/target/i686-unknown-linux-gnu/debug/build/libc-test-1d150dc772ee3115/out/main.c:35688:68: error: 'HWTSTAMP_FLAG_MASK' undeclared here (not in a function)
  cargo:warning=35688 |             static const int __test_const_HWTSTAMP_FLAG_MASK_val = HWTSTAMP_FLAG_MASK;
  cargo:warning=      |                                                                    ^~~~~~~~~~~~~~~~~~
  cargo:warning=cc1: note: unrecognized command-line option '-Wno-unknown-warning-option' may have been intended to silence earlier diagnostics

maybe the system libc on CI does not (yet?) have these symbols? They are not important to me so I'd be OK with removing them (just thought I might as well add them for completeness)

@JohnTitor
Copy link
Member

maybe the system libc on CI does not (yet?) have these symbols?

Correct.

Could you squash commits into one?

@folkertdev folkertdev force-pushed the hardware-timestamping branch 2 times, most recently from 687f7bc to b409bdc Compare March 23, 2023 10:16
@JohnTitor
Copy link
Member

Thank you, @bors r+

@bors
Copy link
Contributor

bors commented Mar 23, 2023

📌 Commit b409bdc has been approved by JohnTitor

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Mar 23, 2023

⌛ Testing commit b409bdc with merge 38ff53a...

bors added a commit that referenced this pull request Mar 23, 2023
definitions for linux hardware timestamping

Definitions can be found here https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/net_tstamp.h#L76

These definitions are relevant for (PTP and NTP) hardware timestamping
@bors
Copy link
Contributor

bors commented Mar 23, 2023

💔 Test failed - checks-actions

@folkertdev
Copy link
Contributor Author

I'm not sure what went wrong here. I assume the action needs to just be re-run?

@folkertdev
Copy link
Contributor Author

I added two extra constants that are needed (SIOCSHWTSTAMP and SIOCGHWTSTAMP) and rebased. Maybe that makes bors happier?

though CI seems to be broken at the moment.

@JohnTitor
Copy link
Member

The FreeBSD failure is unrelated and it's already fixed on master.
But #3155 (comment) is legit. That's because (probably) musl toolchain on CI is old, could you skip tests on that env?

@folkertdev
Copy link
Contributor Author

ok, rebased again to fix that freebsd problem

could you skip tests on that env

how would I do this? do you mean a cfg for the undefined constants?

@JohnTitor
Copy link
Member

https://github.com/rust-lang/libc/blob/master/libc-test/build.rs is a place to tweak, like:

libc/libc-test/build.rs

Lines 1739 to 1754 in 68e06ad

cfg.skip_const(move |name| {
match name {
// The IPV6 constants are tested in the `linux_ipv6.rs` tests:
| "IPV6_FLOWINFO"
| "IPV6_FLOWLABEL_MGR"
| "IPV6_FLOWINFO_SEND"
| "IPV6_FLOWINFO_FLOWLABEL"
| "IPV6_FLOWINFO_PRIORITY"
// The F_ fnctl constants are tested in the `linux_fnctl.rs` tests:
| "F_CANCELLK"
| "F_ADD_SEALS"
| "F_GET_SEALS"
| "F_SEAL_SEAL"
| "F_SEAL_SHRINK"
| "F_SEAL_GROW"
| "F_SEAL_WRITE" => true,

@folkertdev
Copy link
Contributor Author

allright, I added logic to ignore the constant for i686 and mips. that should make the tests that failed before pass, but there might be other (cancelled) ci runs that also should skip this constant. Is there a better way to figure that out than trial and error?

@JohnTitor
Copy link
Member

There's a trade-off, we could disable the fail-fast but we may want to find failures fast.
@bors r+

@@ -3724,6 +3724,8 @@ fn test_linux(target: &str) {
=> true,
"SCTP_FUTURE_ASSOC" | "SCTP_CURRENT_ASSOC" | "SCTP_ALL_ASSOC" | "SCTP_PEER_ADDR_THLDS_V2" => true, // linux 5.5+

"HWTSTAMP_TX_ONESTEP_P2P" if i686 || mips || aarch64_musl => true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the below should work like others:

Suggested change
"HWTSTAMP_TX_ONESTEP_P2P" if i686 || mips || aarch64_musl => true,
// FIXME: Requires more recent kernel headers
"HWTSTAMP_TX_ONESTEP_P2P" if mips || musl => true,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, fixed. A couple more linux flavors to get through

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition doesn't seem to be changed. It should mips || musl as we use older kernels for these targets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tests bors also fail for aarch with musl here https://github.com/rust-lang/libc/actions/runs/4593954920/jobs/8112512429

based on https://elixir.bootlin.com/linux/v5.6/C/ident/HWTSTAMP_TX_ONESTEP_P2P, linux version 5.6 is the first one that defines this symbol.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though maybe musl is more relevant than aarch here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so i686 || mips || musl, or only musl even?

Copy link
Member

@JohnTitor JohnTitor Apr 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I mean the condition should be sparc64 || musl, not mips.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sparc64, see:

# FIXME: Update to 22.04 once Debian image of sparc64 has a newer glibc.
FROM ubuntu:20.04

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i686 itself isn't related to the failure, it fails due to the musl toolchain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, I've updated it

@folkertdev folkertdev force-pushed the hardware-timestamping branch 2 times, most recently from 89b13ab to 58ffdf4 Compare April 3, 2023 11:17
@JohnTitor
Copy link
Member

Let's try again, @bors r+

@bors
Copy link
Contributor

bors commented Apr 3, 2023

📌 Commit 58ffdf4 has been approved by JohnTitor

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Apr 3, 2023

⌛ Testing commit 58ffdf4 with merge c8de3b4...

bors added a commit that referenced this pull request Apr 3, 2023
definitions for linux hardware timestamping

Definitions can be found here https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/net_tstamp.h#L76

These definitions are relevant for (PTP and NTP) hardware timestamping
@bors
Copy link
Contributor

bors commented Apr 3, 2023

💔 Test failed - checks-actions

@folkertdev
Copy link
Contributor Author

we're getting closer. I'm not sure what this is trying to do though:

RUNNING ALL TESTS
rust[8] = 0 != 8 (C): Rust "hwtstamp_config" -> C
rust[9] = 0 != 9 (C): Rust "hwtstamp_config" -> C
rust[10] = 0 != 10 (C): Rust "hwtstamp_config" -> C
rust[11] = 0 != 11 (C): Rust "hwtstamp_config" -> C
thread 'main' panicked at 'some tests failed', /checkout/target/sparc64-unknown-linux-gnu/debug/build/libc-test-298fd54f1fef40cd/out/main.rs:12:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: test failed, to rerun pass `--test main`

Caused by:
  process didn't exit successfully: `/test-runner-linux sparc64 /checkout/target/sparc64-unknown-linux-gnu/debug/deps/main-973f2bcc439c5f8d` (exit status: 1)

should we skip the hwtstamp_config struct on this target?

@folkertdev
Copy link
Contributor Author

rather looks like this is an ABI roundtrip test. That this fails is extremely surprising to me, given that the struct is just three ints, so nothing tricky is going on. Should we just ignore the roundtrip for sparc64?

@JohnTitor
Copy link
Member

I guess #1558 is related. Yeah, skipping would be fine 👍

@folkertdev
Copy link
Contributor Author

allright let's hope that's it

@JohnTitor
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 3, 2023

📌 Commit 4949998 has been approved by JohnTitor

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Apr 3, 2023

⌛ Testing commit 4949998 with merge 2dc31a7...

@bors
Copy link
Contributor

bors commented Apr 3, 2023

☀️ Test successful - checks-actions, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13, checks-cirrus-freebsd-14
Approved by: JohnTitor
Pushing 2dc31a7 to master...

@bors bors merged commit 2dc31a7 into rust-lang:master Apr 3, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants