Mercurial > illumos > git > illumos-joyent
changeset 25225:c159faf41709
12968 curthread swtch-ing while the kernel is using the FPU
Reviewed by: Jason King <jason.king@joyent.com>
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Patrick Mooney <pmooney@pfmooney.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Joshua M. Clulow <josh@sysmgr.org>
author | Jerry Jelinek <jerry.jelinek@joyent.com> |
---|---|
date | Mon, 20 Jul 2020 11:15:11 -0600 |
parents | 6e95ce0404c6 |
children | 67c78ce4f29a cb682dc3fdcd |
files | usr/src/uts/intel/ia32/os/fpu.c |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/intel/ia32/os/fpu.c Mon Apr 13 10:27:15 2020 +0300 +++ b/usr/src/uts/intel/ia32/os/fpu.c Mon Jul 20 11:15:11 2020 -0600 @@ -1420,14 +1420,15 @@ if ((flags & KFPU_NO_STATE) == 0) { /* - * Disable preemption so that we don't swtch after removing - * the context handlers but before we turn off T_KFPU. + * Disable preemption so that we don't swtch in the middle of + * removing the context handlers. We turn off T_KFPU first, + * since it is possible to voluntarily swtch during kmem_free + * while removing the context handlers. */ kpreempt_disable(); + curthread->t_flag &= ~T_KFPU; removectx(curthread, kfpu, kernel_fpu_ctx_save, kernel_fpu_ctx_restore, NULL, NULL, NULL, NULL); - - curthread->t_flag &= ~T_KFPU; kpreempt_enable(); if (kfpu != NULL) {