Page MenuHomeFreeBSD

amd64: gate WRMSRNS immediate form on compiler support
ClosedPublic

Authored by brooks on Fri, Sep 25, 12:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 15, 5:12 AM
Unknown Object (File)
Wed, Oct 14, 4:41 PM
Unknown Object (File)
Wed, Oct 14, 9:55 AM
Unknown Object (File)
Tue, Oct 13, 11:23 PM
Unknown Object (File)
Sun, Oct 11, 2:09 PM
Unknown Object (File)
Fri, Oct 9, 5:58 AM
Unknown Object (File)
Thu, Oct 8, 8:50 AM
Unknown Object (File)
Wed, Oct 7, 10:53 PM
Subscribers

Details

Summary

This support was introduced in LLVM 20 and we still support releases
with LLVM 19 so it's too early to require LLVM 20. Decay to the
non-immediate form when the compiler it too old. This makes the ifunc
pointless, but limits the need for other ifdefs.

Fixes: 20c09e6fece2 ("amd64: use WRMSRNS immediate form to update splitlock control, when available")
Sponsored by: Innovate UK

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Ideally there would be a GCC gate as well, but I couldn't immediately find when support was added.

I suggest to do always define wrmsr_imm in the cpufunc.h header, but reduce it to wrmsr() if the compiler is too old. Then the calling sites do not need to care about compiler. It would generate pointless ifunc resolvers, but I do not think we should care.

WRT gcc, gcc version is irrelevant. It is gas (binutils) version that matters, but I do not think there is any way to detect gas version from C compilation environment. See amd64/sigtramp.S recent changes for cfi, where the same question was discussed.

Decay immediate form to non-immediate when clang is too old

This revision is now accepted and ready to land.Sat, Sep 26, 11:40 AM