Print this page
13902 Fix for 13717 may break 8-disk raidz2

@@ -1386,20 +1386,10 @@
                         fp_save(&pl->lwp_pcb.pcb_fpu);
                 pl->lwp_pcb.pcb_fpu.fpu_flags |= FPU_KERNEL;
                 kpreempt_enable();
         }
 
-        /*
-         * Set the context operations for kernel FPU usage. Note that this
-         * cannot be done with pre-emption and interrupts disabled, since
-         * installctx does a sleeping allocation. We haven't finished
-         * initializing our kernel FPU state yet, but in the rare case that we
-         * happen to save/restore before that, no harm is done.
-         */
-        installctx(curthread, kfpu, kernel_fpu_ctx_save, kernel_fpu_ctx_restore,
-            NULL, NULL, NULL, NULL);
-
         curthread->t_flag |= T_KFPU;
 
         if ((flags & KFPU_USE_LWP) == KFPU_USE_LWP) {
                 /*
                  * For pure kernel threads with an LWP, we can use the LWP's

@@ -1418,10 +1408,20 @@
                 pf->fpu_flags = FPU_EN | FPU_KERNEL;
         } else {
                 /* initialize the kfpu state */
                 kernel_fpu_ctx_restore(kfpu);
         }
+
+        /*
+         * Set the context operations for kernel FPU usage. Note that this
+         * cannot be done with pre-emption and interrupts disabled, since
+         * installctx does a sleeping allocation. We haven't finished
+         * initializing our kernel FPU state yet, but in the rare case that we
+         * happen to save/restore before that, no harm is done.
+         */
+        installctx(curthread, kfpu, kernel_fpu_ctx_save, kernel_fpu_ctx_restore,
+            NULL, NULL, NULL, NULL);
 }
 
 void
 kernel_fpu_end(kfpu_state_t *kfpu, uint_t flags)
 {