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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/ia32/os/fpu.c
          +++ new/usr/src/uts/intel/ia32/os/fpu.c
↓ open down ↓ 1380 lines elided ↑ open up ↑
1381 1381           * by fp_save, as is the FPU_EN check.
1382 1382           */
1383 1383          if (pl != NULL) {
1384 1384                  kpreempt_disable();
1385 1385                  if ((flags & KFPU_USE_LWP) == 0)
1386 1386                          fp_save(&pl->lwp_pcb.pcb_fpu);
1387 1387                  pl->lwp_pcb.pcb_fpu.fpu_flags |= FPU_KERNEL;
1388 1388                  kpreempt_enable();
1389 1389          }
1390 1390  
1391      -        /*
1392      -         * Set the context operations for kernel FPU usage. Note that this
1393      -         * cannot be done with pre-emption and interrupts disabled, since
1394      -         * installctx does a sleeping allocation. We haven't finished
1395      -         * initializing our kernel FPU state yet, but in the rare case that we
1396      -         * happen to save/restore before that, no harm is done.
1397      -         */
1398      -        installctx(curthread, kfpu, kernel_fpu_ctx_save, kernel_fpu_ctx_restore,
1399      -            NULL, NULL, NULL, NULL);
1400      -
1401 1391          curthread->t_flag |= T_KFPU;
1402 1392  
1403 1393          if ((flags & KFPU_USE_LWP) == KFPU_USE_LWP) {
1404 1394                  /*
1405 1395                   * For pure kernel threads with an LWP, we can use the LWP's
1406 1396                   * pcb_fpu to save/restore context.
1407 1397                   */
1408 1398                  fpu_ctx_t *pf = &pl->lwp_pcb.pcb_fpu;
1409 1399  
1410 1400                  VERIFY(curthread->t_procp->p_flag & SSYS);
↓ open down ↓ 2 lines elided ↑ open up ↑
1413 1403  
1414 1404                  /* Always restore the fpu to the initial state. */
1415 1405                  if (fp_save_mech == FP_XSAVE)
1416 1406                          pf->fpu_xsave_mask = XFEATURE_FP_ALL;
1417 1407                  fpinit();
1418 1408                  pf->fpu_flags = FPU_EN | FPU_KERNEL;
1419 1409          } else {
1420 1410                  /* initialize the kfpu state */
1421 1411                  kernel_fpu_ctx_restore(kfpu);
1422 1412          }
     1413 +
     1414 +        /*
     1415 +         * Set the context operations for kernel FPU usage. Note that this
     1416 +         * cannot be done with pre-emption and interrupts disabled, since
     1417 +         * installctx does a sleeping allocation. We haven't finished
     1418 +         * initializing our kernel FPU state yet, but in the rare case that we
     1419 +         * happen to save/restore before that, no harm is done.
     1420 +         */
     1421 +        installctx(curthread, kfpu, kernel_fpu_ctx_save, kernel_fpu_ctx_restore,
     1422 +            NULL, NULL, NULL, NULL);
1423 1423  }
1424 1424  
1425 1425  void
1426 1426  kernel_fpu_end(kfpu_state_t *kfpu, uint_t flags)
1427 1427  {
1428 1428          ulong_t iflags;
1429 1429  
1430 1430          if ((curthread->t_flag & T_KFPU) == 0) {
1431 1431                  panic("curthread attempting to clear kernel FPU state "
1432 1432                      "without using it");
↓ open down ↓ 87 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX