Print this page
10924 Need mitigation of L1TF (CVE-2018-3646)
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Peter Tribble <peter.tribble@gmail.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/disp.h
          +++ new/usr/src/uts/common/sys/disp.h
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   *
  25   25   * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
       26 + *
       27 + * Copyright 2018 Joyent, Inc.
  26   28   */
  27   29  
  28   30  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  29   31  /*        All Rights Reserved   */
  30   32  
  31   33  
  32   34  #ifndef _SYS_DISP_H
  33   35  #define _SYS_DISP_H
  34   36  
  35   37  #include <sys/priocntl.h>
↓ open down ↓ 20 lines elided ↑ open up ↑
  56   58  typedef struct _disp {
  57   59          disp_lock_t     disp_lock;      /* protects dispatching fields */
  58   60          pri_t           disp_npri;      /* # of priority levels in queue */
  59   61          dispq_t         *disp_q;                /* the dispatch queue */
  60   62          dispq_t         *disp_q_limit;  /* ptr past end of dispatch queue */
  61   63          ulong_t         *disp_qactmap;  /* bitmap of active dispatch queues */
  62   64  
  63   65          /*
  64   66           * Priorities:
  65   67           *      disp_maxrunpri is the maximum run priority of runnable threads
  66      -         *      on this queue.  It is -1 if nothing is runnable.
       68 +         *      on this queue.  It is -1 if nothing is runnable.
  67   69           *
  68   70           *      disp_max_unbound_pri is the maximum run priority of threads on
  69   71           *      this dispatch queue but runnable by any CPU.  This may be left
  70      -         *      artificially high, then corrected when some CPU tries to take
       72 +         *      artificially high, then corrected when some CPU tries to take
  71   73           *      an unbound thread.  It is -1 if nothing is runnable.
  72   74           */
  73   75          pri_t           disp_maxrunpri; /* maximum run priority */
  74   76          pri_t           disp_max_unbound_pri;   /* max pri of unbound threads */
  75   77  
  76   78          volatile int    disp_nrunnable; /* runnable threads in cpu dispq */
  77   79  
  78   80          struct cpu      *disp_cpu;      /* cpu owning this queue or NULL */
  79   81          hrtime_t        disp_steal;     /* time when threads become stealable */
  80   82  } disp_t;
↓ open down ↓ 63 lines elided ↑ open up ↑
 144  146  extern void             setfrontdq(kthread_t *);
 145  147  extern void             swtch(void);
 146  148  extern void             swtch_to(kthread_t *);
 147  149  extern void             swtch_from_zombie(void)
 148  150                                  __NORETURN;
 149  151  extern void             dq_sruninc(kthread_t *);
 150  152  extern void             dq_srundec(kthread_t *);
 151  153  extern void             cpu_rechoose(kthread_t *);
 152  154  extern void             cpu_surrender(kthread_t *);
 153  155  extern void             kpreempt(int);
 154      -extern struct cpu       *disp_lowpri_cpu(struct cpu *, struct lgrp_ld *, pri_t,
 155      -                            struct cpu *);
      156 +extern struct cpu       *disp_lowpri_cpu(struct cpu *, kthread_t *, pri_t);
 156  157  extern int              disp_bound_threads(struct cpu *, int);
 157  158  extern int              disp_bound_anythreads(struct cpu *, int);
 158  159  extern int              disp_bound_partition(struct cpu *, int);
 159  160  extern void             disp_cpu_init(struct cpu *);
 160  161  extern void             disp_cpu_fini(struct cpu *);
 161  162  extern void             disp_cpu_inactive(struct cpu *);
 162  163  extern void             disp_adjust_unbound_pri(kthread_t *);
 163  164  extern void             resume(kthread_t *);
 164  165  extern void             resume_from_intr(kthread_t *);
 165  166  extern void             resume_from_zombie(kthread_t *)
 166  167                                  __NORETURN;
 167  168  extern void             disp_swapped_enq(kthread_t *);
 168  169  extern int              disp_anywork(void);
 169  170  
      171 +extern struct cpu       *disp_choose_best_cpu(void);
      172 +
 170  173  #define KPREEMPT_SYNC           (-1)
 171  174  #define kpreempt_disable()                              \
 172  175          {                                               \
 173  176                  curthread->t_preempt++;                 \
 174  177                  ASSERT(curthread->t_preempt >= 1);      \
 175  178          }
 176  179  #define kpreempt_enable()                               \
 177  180          {                                               \
 178  181                  ASSERT(curthread->t_preempt >= 1);      \
 179  182                  if (--curthread->t_preempt == 0 &&      \
 180  183                      CPU->cpu_kprunrun)                  \
 181  184                          kpreempt(KPREEMPT_SYNC);        \
 182  185          }
 183  186  
 184  187  #endif  /* _KERNEL */
 185  188  
      189 +#define CPU_IDLE_PRI (-1)
      190 +
 186  191  #ifdef  __cplusplus
 187  192  }
 188  193  #endif
 189  194  
 190  195  #endif  /* _SYS_DISP_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX