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

Linux 5.16 compat: don't use XSTATE_XSAVE to save FPU state #13059

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

AttilaFueloep
Copy link
Contributor

Motivation and Context

Linux 5.16 moved XSTATE_XSAVE and XSTATE_XRESTORE out of our reach.

Closes #13042

Description

Add our own XSAVE{,OPT,S} code and use it for Linux 5.16.

Please note that this differs from previous behavior in that it
won't handle exception created by XSAVE an XRSTOR. This is sensible
for three reasons.

  • Exceptions during XSAVE and XRSTOR can only occur if the feature
    is not supported or enabled or the memory operand isn't aligned
    on a 64 byte boundary. If this happens something else went
    terribly wrong, and it may be better to stop execution.

  • Previously we just printed a warning and didn't handle the fault,
    this is arguable for the above reason.

  • All other *SAVE instruction also don't handle exceptions, so this
    at least aligns behavior.

How Has This Been Tested?

Verified with gdb that the FPU registers are properly restored.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

@AttilaFueloep
Copy link
Contributor Author

Sorry, pushed from wrong branch, fixed now. If there is a need to handle exceptions as the previous version was doing, I can try to wrap my head around the .fixup, __ex_table etc. stuff.

@rincebrain
Copy link
Contributor

Might it make sense to switch over unconditionally, not just for 5.16+, if there's no important downsides? (Or, if we think there might be but we haven't spotted them yet, to rip off the band-aid and spot them faster?)

@AttilaFueloep
Copy link
Contributor Author

Yes, it might, I just choose the least intrusive approach to play it safe. There may also be a slight performance loss involved since the XSTATE_XSAVE macro used ALTERNATIVE* to choose between the different XSAVE instruction, but I'm just using a plain C if statement. This, and the changed exception handling may justify to use it only for 5.16+, but I'm somewhat undecided here.

@@ -322,7 +441,7 @@ kfpu_end(void)
#define kfpu_init() 0
#define kfpu_fini() ((void) 0)

#endif /* defined(HAVE_KERNEL_FPU_INTERNAL) */
#endif /* defined HAVE_KERNEL_FPU_INTERNAL || HAVE_KERNEL_FPU_XSAVE INTERNAL */
Copy link
Contributor

Choose a reason for hiding this comment

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

space in HAVE_KERNEL_FPU_XSAVE INTERNAL (also a better phrasing would be defined(HAVE_KERNEL_FPU_INTERNAL) || defined(HAVE_KERNEL_FPU_XSAVE_INTERNAL) or defined(HAVE_KERNEL_FPU_INTERNAL || HAVE_KERNEL_FPU_XSAVE_INTERNAL))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching that, fixed.

@tonyhutter
Copy link
Contributor

Might it make sense to switch over unconditionally, not just for 5.16+, if there's no important downsides? (Or, if we think there might be but we haven't spotted them yet, to rip off the band-aid and spot them faster?)

I would vote for this as well. That way it gets exercised by buildbot for all kernels and simplifies the code. If there is a slight performance loss, that's fine, since it's just something we're going to have to live with going forward anyway.

@behlendorf
Copy link
Contributor

Applying these changes to just 5.16+ kernels would be the lowest risk option, and it's consistent with how we've tried to handle this in the past. But in this case I could see making an exception. Applying this to all kernels which don't provide fpu symbols looks like it would significantly simplify the code which would be nice.

Perhaps a reasonable compromise would be to apply this patch to master which only using the new code for 5.16+. This could then be easily backported for the 2.1.3 release. Then follow up with a commit to master which uses the new code unconditionally. Which is really what we'd prefer to maintain long term.

Previously we found that running the mprime stress test from https://www.mersenne.org/download/ while performing read/write IO was an excellent way to verify the fpu was being saved/restored correctly. Running it over night would be a good way to develop confidence in the change.

I also agree for the reasons you mentioned it's reasonable to not handle exceptions here. Thanks again for tackling this!

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Feb 3, 2022
@AttilaFueloep
Copy link
Contributor Author

Yes, I think this is a good idea, that way we would make sure that changes to stable releases are minimal, while having a broader range of systems running master exercising the new code.

Thinking more of it, I could come up with an edge case where things may break: a very old kernel with eagerfpu=off will use the CR0.TS bit during context switching and calling XSAVE with CR0.TS=1 will generate a #NM fault. So if this kernel happens to have backported the GPL only kfpu patch, it will panic. Not sure if we support such a setup at all. It's a very unlikely scenario also, and no one would intentionally set eagerfpu=off on a CPU supporting SIMD extension since manipulating the CT0.TS bits takes longer than storing the FPU state. So not sure if we should add a test for eagerfpu == off inside kfpu_init() if we remove XSTATE_XSAVE.

Setting up some test datasets with encryption, fletcher, sha2, skein and edonr checksums on a raidz pool and doing I/O in loop on them while running mprime is on my todo list. That should cover all code paths which use simd_x86.h. Since the testvm is on my notebook I can only do this overnight, and being in a UCT+1 timezone this will have to wait for ~16 hours. (Having traced with gdb the code path inside ICP makes me pretty confident that the tests will stand though..)

@behlendorf
Copy link
Contributor

If you get a chance to rebase and force update this PR this should clear up the CI failures,

@AttilaFueloep
Copy link
Contributor Author

I added a regression test to make sure FPU support won't break without notice again, not sure where to put it though. I'd appreciate any hint. Once I know where to put the test I'll squash and rebase.

@AttilaFueloep AttilaFueloep marked this pull request as draft February 7, 2022 08:55
@AttilaFueloep
Copy link
Contributor Author

The tests didn't went so well, I'm seeing system freezes. Have to look into it more deeply.

@AttilaFueloep
Copy link
Contributor Author

D'oh once you push from a wrong branch things will start to go south.. Will run the tests with the proper version tonight.

@behlendorf
Copy link
Contributor

Depending on exactly what the test case looks like I could see it/them living under functional/checksum/ and functional/raidz/. Putting it in in it's own functional/simd/ directory would be fine too.

@AttilaFueloep
Copy link
Contributor Author

It simply test if it's running under Linux on a x86 box with SSE support. If so, it checks if zfs_fletcher_4 has an SSE implementation and fails if not. So functional/checksum/ seems not to be utterly wrong but functional/simd/ feels more adequate, let's see.

As a side note, shouldn't Requires-builders: style in the last commit message just run checkstyle and nothing else?

@behlendorf
Copy link
Contributor

functional/simd/ sounds good.

The Requires-builders: style comment is currently only understood by the buildbit CI builders, and not the GitHub actions CI builders. So those always run.

@AttilaFueloep
Copy link
Contributor Author

functional/simd/ sounds good.

All right, will put it there.

The Requires-builders: style comment is currently only understood by the buildbit CI builders, and not the GitHub actions CI builders. So those always run.

I see, thanks for the explanation.

@rincebrain
Copy link
Contributor

rincebrain commented Feb 7, 2022 via email

@AttilaFueloep
Copy link
Contributor Author

Not that I know of. That may make sense, just trying to think of some edge cases where this may come in the way. Maybe an embedded system with a striped down Linux kernel? Does this make sense? I think if you make it hard fail, a configure option like --without-fpu should be put in place. Of course that would collide with a zfs-test. Since I wrote the test already, let me add it. If need be, we can remove it later with no fuss.

@rincebrain
Copy link
Contributor

rincebrain commented Feb 7, 2022 via email

@tonyhutter tonyhutter mentioned this pull request Feb 7, 2022
13 tasks
@AttilaFueloep
Copy link
Contributor Author

No sorry, you didn't come off that way. What I wanted to say was that it's a good idea, and you shouldn't feel that the zfs-test is in your way (and just go ahead as you see fit).

I've to leave the room now, four fio and a mprime torture run make for really noisy box :-)

@AttilaFueloep
Copy link
Contributor Author

Squashed and rebased. Added a regression test.

@AttilaFueloep
Copy link
Contributor Author

AttilaFueloep commented Feb 8, 2022

Tested this PR now. Made a 3 disk (actually 3 partition on the same SSD) raidz1 pool, created three datasets on it, one encrypted/fletcher3, one unencrypted/sha512 and one unencrypted/skein. Ran a 4 thread/16 files fio on each of them, started a mprime -t torture test and let all of this run for six hours on a six vCPU 16G mem kvm vm.

All went well, no mprime failures, no checksum error, no I/O errors, scrub showed no errors either. A mprime run on a version where the call to XRSTOR was comment out failed within seconds after starting a fio run, so this looks solid.

@AttilaFueloep
Copy link
Contributor Author

This is ready for review, looks like I can't remove the draft tag.

@rincebrain
Copy link
Contributor

IIRC there should be a button around the CI status window at the bottom for "ready for review? mark as not draft any more" - it has a notice that only people with write access to the branch can make that change, for me, here.

@AttilaFueloep AttilaFueloep marked this pull request as ready for review February 8, 2022 09:57
@AttilaFueloep
Copy link
Contributor Author

D'oh, yes there is, thanks!

@behlendorf
Copy link
Contributor

@AttilaFueloep thanks for tackling this one, merged.

@AttilaFueloep
Copy link
Contributor Author

As discussed here, I'll open a new PR, factoring out the XSTATE stuff for all kernels not exporting *kfpu_{begin,end}.

@rincebrain

I forget if I mentioned in this thread, but my intent after this gets fixed was to make a configure flag that would make the FPU configure checks hard fail on "not found' instead of continuing

I think the above mentioned PR will be fail-safe per se by not using any kernel fpu stuff.

AttilaFueloep added a commit to AttilaFueloep/zfs that referenced this pull request Feb 14, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Signed-off-by: Attila Fülöp <attila@fueloep.org>
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Feb 15, 2022
Linux 5.16 moved XSTATE_XSAVE and XSTATE_XRESTORE out of our reach,
so add our own XSAVE{,OPT,S} code and use it for Linux 5.16.

Please note that this differs from previous behavior in that it
won't handle exceptions created by XSAVE an XRSTOR. This is sensible
for three reasons.

 - Exceptions during XSAVE and XRSTOR can only occur if the feature
   is not supported or enabled or the memory operand isn't aligned
   on a 64 byte boundary. If this happens something else went
   terribly wrong, and it may be better to stop execution.

 - Previously we just printed a warning and didn't handle the fault,
   this is arguable for the above reason.

 - All other *SAVE instruction also don't handle exceptions, so this
   at least aligns behavior.

Finally add a test to catch such a regression in the future.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13042
Closes openzfs#13059
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Feb 16, 2022
Linux 5.16 moved XSTATE_XSAVE and XSTATE_XRESTORE out of our reach,
so add our own XSAVE{,OPT,S} code and use it for Linux 5.16.

Please note that this differs from previous behavior in that it
won't handle exceptions created by XSAVE an XRSTOR. This is sensible
for three reasons.

 - Exceptions during XSAVE and XRSTOR can only occur if the feature
   is not supported or enabled or the memory operand isn't aligned
   on a 64 byte boundary. If this happens something else went
   terribly wrong, and it may be better to stop execution.

 - Previously we just printed a warning and didn't handle the fault,
   this is arguable for the above reason.

 - All other *SAVE instruction also don't handle exceptions, so this
   at least aligns behavior.

Finally add a test to catch such a regression in the future.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13042
Closes openzfs#13059
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Feb 17, 2022
Linux 5.16 moved XSTATE_XSAVE and XSTATE_XRESTORE out of our reach,
so add our own XSAVE{,OPT,S} code and use it for Linux 5.16.

Please note that this differs from previous behavior in that it
won't handle exceptions created by XSAVE an XRSTOR. This is sensible
for three reasons.

 - Exceptions during XSAVE and XRSTOR can only occur if the feature
   is not supported or enabled or the memory operand isn't aligned
   on a 64 byte boundary. If this happens something else went
   terribly wrong, and it may be better to stop execution.

 - Previously we just printed a warning and didn't handle the fault,
   this is arguable for the above reason.

 - All other *SAVE instruction also don't handle exceptions, so this
   at least aligns behavior.

Finally add a test to catch such a regression in the future.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13042
Closes openzfs#13059
AttilaFueloep added a commit to AttilaFueloep/zfs that referenced this pull request Feb 17, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Signed-off-by: Attila Fülöp <attila@fueloep.org>
jonathonf pushed a commit to jonathonf/zfs that referenced this pull request Feb 21, 2022
Linux 5.16 moved XSTATE_XSAVE and XSTATE_XRESTORE out of our reach,
so add our own XSAVE{,OPT,S} code and use it for Linux 5.16.

Please note that this differs from previous behavior in that it
won't handle exceptions created by XSAVE an XRSTOR. This is sensible
for three reasons.

 - Exceptions during XSAVE and XRSTOR can only occur if the feature
   is not supported or enabled or the memory operand isn't aligned
   on a 64 byte boundary. If this happens something else went
   terribly wrong, and it may be better to stop execution.

 - Previously we just printed a warning and didn't handle the fault,
   this is arguable for the above reason.

 - All other *SAVE instruction also don't handle exceptions, so this
   at least aligns behavior.

Finally add a test to catch such a regression in the future.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13042
Closes openzfs#13059
AttilaFueloep added a commit to AttilaFueloep/zfs that referenced this pull request Feb 24, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Signed-off-by: Attila Fülöp <attila@fueloep.org>
AttilaFueloep added a commit to AttilaFueloep/zfs that referenced this pull request Feb 24, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Signed-off-by: Attila Fülöp <attila@fueloep.org>
behlendorf pushed a commit that referenced this pull request Mar 9, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see #13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes #13102
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Linux 5.16 moved XSTATE_XSAVE and XSTATE_XRESTORE out of our reach,
so add our own XSAVE{,OPT,S} code and use it for Linux 5.16.

Please note that this differs from previous behavior in that it
won't handle exceptions created by XSAVE an XRSTOR. This is sensible
for three reasons.

 - Exceptions during XSAVE and XRSTOR can only occur if the feature
   is not supported or enabled or the memory operand isn't aligned
   on a 64 byte boundary. If this happens something else went
   terribly wrong, and it may be better to stop execution.

 - Previously we just printed a warning and didn't handle the fault,
   this is arguable for the above reason.

 - All other *SAVE instruction also don't handle exceptions, so this
   at least aligns behavior.

Finally add a test to catch such a regression in the future.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13042
Closes openzfs#13059
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Linux 5.16 moved XSTATE_XSAVE and XSTATE_XRESTORE out of our reach,
so add our own XSAVE{,OPT,S} code and use it for Linux 5.16.

Please note that this differs from previous behavior in that it
won't handle exceptions created by XSAVE an XRSTOR. This is sensible
for three reasons.

 - Exceptions during XSAVE and XRSTOR can only occur if the feature
   is not supported or enabled or the memory operand isn't aligned
   on a 64 byte boundary. If this happens something else went
   terribly wrong, and it may be better to stop execution.

 - Previously we just printed a warning and didn't handle the fault,
   this is arguable for the above reason.

 - All other *SAVE instruction also don't handle exceptions, so this
   at least aligns behavior.

Finally add a test to catch such a regression in the future.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13042
Closes openzfs#13059
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Aug 30, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Sep 2, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see openzfs#13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes openzfs#13102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linux 5.16 broke FPU handling
5 participants