rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.41k stars 12.73k forks source link

Tracking issue for core::arch::{x86, x86_64}::has_cpuid #60123

Closed gnzlbg closed 4 months ago

gnzlbg commented 5 years ago

This issue tracks the stabilization of the has_cpuid intrinsic.

The "mini-RFC" is part of the stabilization PR: https://github.com/rust-lang-nursery/stdsimd/pull/730

cc @rust-lang/libs @alexcrichton

briansmith commented 4 months ago

But if we are arguing that, then we should just have the courage to make __cpuid() a safe function on x86-64 CPUs, and make this function reachable only on 32-bit x86. Except even that wouldn't apply, due to SGX existing. In truth, the problem is this: Intel is quite clearly willing to alter the deal. We can only pray they do not change it further!

You usually cannot rely on what CPUID reports when you are operating in a kernel context or in other special contexts (probably signal handlers). This, combined with the SGX and i586 complexity, is why I suggested that this be made a target feature.

Amanieu commented 4 months ago

@rfcbot fcp close

We don't have any targets for i386/i486 (which don't support CPUID) and we're happy to let SGX targets figure out feature detection on their own. As such, let's just remove has_cpuid.

rfcbot commented 4 months ago

Team member @Amanieu has proposed to close this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

rfcbot commented 4 months ago

:bell: This is now entering its final comment period, as per the review above. :bell:

joshtriplett commented 4 months ago

Speaking for myself here: I'd be in favor of having is_x86_feature_detected be available in core, ideally in a fully functional way.

jethrogb commented 4 months ago

I'd be in favor of having is_x86_feature_detected be available in core, ideally in a fully functional way.

The "fully functional" part isn't possible on SGX, where platform support is needed for feature detection. So if the definition is moved to core, there needs to be a way for std to plug-in functionality.

RalfJung commented 4 months ago

I assume it would only exist in core for targets where that is possible, i.e., not the SGX targets.

jethrogb commented 4 months ago

It seems pretty strange to me to have target-specific (beyond arch) items in core.

workingjubilee commented 4 months ago

I mean, it seems pretty strange to me to have architectures which can't actually execute their ISA.

rfcbot commented 4 months ago

The final comment period, with a disposition to close, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

workingjubilee commented 4 months ago

false