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>


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  *
  25  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.


  26  */
  27 
  28 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  29 /*        All Rights Reserved   */
  30 
  31 
  32 #ifndef _SYS_DISP_H
  33 #define _SYS_DISP_H
  34 
  35 #include <sys/priocntl.h>
  36 #include <sys/thread.h>
  37 #include <sys/class.h>
  38 
  39 #ifdef  __cplusplus
  40 extern "C" {
  41 #endif
  42 
  43 /*
  44  * The following is the format of a dispatcher queue entry.
  45  */


 134 extern void     (*disp_enq_thread)(struct cpu *, int);
 135 
 136 
 137 extern int              dispdeq(kthread_t *);
 138 extern void             dispinit(void);
 139 extern void             disp_add(sclass_t *);
 140 extern int              intr_active(struct cpu *, int);
 141 extern int              servicing_interrupt(void);
 142 extern void             preempt(void);
 143 extern void             setbackdq(kthread_t *);
 144 extern void             setfrontdq(kthread_t *);
 145 extern void             swtch(void);
 146 extern void             swtch_to(kthread_t *);
 147 extern void             swtch_from_zombie(void)
 148                                 __NORETURN;
 149 extern void             dq_sruninc(kthread_t *);
 150 extern void             dq_srundec(kthread_t *);
 151 extern void             cpu_rechoose(kthread_t *);
 152 extern void             cpu_surrender(kthread_t *);
 153 extern void             kpreempt(int);
 154 extern struct cpu       *disp_lowpri_cpu(struct cpu *, struct lgrp_ld *, pri_t,
 155                             struct cpu *);
 156 extern int              disp_bound_threads(struct cpu *, int);
 157 extern int              disp_bound_anythreads(struct cpu *, int);
 158 extern int              disp_bound_partition(struct cpu *, int);
 159 extern void             disp_cpu_init(struct cpu *);
 160 extern void             disp_cpu_fini(struct cpu *);
 161 extern void             disp_cpu_inactive(struct cpu *);
 162 extern void             disp_adjust_unbound_pri(kthread_t *);
 163 extern void             resume(kthread_t *);
 164 extern void             resume_from_intr(kthread_t *);
 165 extern void             resume_from_zombie(kthread_t *)
 166                                 __NORETURN;
 167 extern void             disp_swapped_enq(kthread_t *);
 168 extern int              disp_anywork(void);
 169 


 170 #define KPREEMPT_SYNC           (-1)
 171 #define kpreempt_disable()                              \
 172         {                                               \
 173                 curthread->t_preempt++;                      \
 174                 ASSERT(curthread->t_preempt >= 1);        \
 175         }
 176 #define kpreempt_enable()                               \
 177         {                                               \
 178                 ASSERT(curthread->t_preempt >= 1);        \
 179                 if (--curthread->t_preempt == 0 &&   \
 180                     CPU->cpu_kprunrun)                       \
 181                         kpreempt(KPREEMPT_SYNC);        \
 182         }
 183 
 184 #endif  /* _KERNEL */
 185 


 186 #ifdef  __cplusplus
 187 }
 188 #endif
 189 
 190 #endif  /* _SYS_DISP_H */


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  *
  25  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  26  *
  27  * Copyright 2018 Joyent, Inc.
  28  */
  29 
  30 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  31 /*        All Rights Reserved   */
  32 
  33 
  34 #ifndef _SYS_DISP_H
  35 #define _SYS_DISP_H
  36 
  37 #include <sys/priocntl.h>
  38 #include <sys/thread.h>
  39 #include <sys/class.h>
  40 
  41 #ifdef  __cplusplus
  42 extern "C" {
  43 #endif
  44 
  45 /*
  46  * The following is the format of a dispatcher queue entry.
  47  */


 136 extern void     (*disp_enq_thread)(struct cpu *, int);
 137 
 138 
 139 extern int              dispdeq(kthread_t *);
 140 extern void             dispinit(void);
 141 extern void             disp_add(sclass_t *);
 142 extern int              intr_active(struct cpu *, int);
 143 extern int              servicing_interrupt(void);
 144 extern void             preempt(void);
 145 extern void             setbackdq(kthread_t *);
 146 extern void             setfrontdq(kthread_t *);
 147 extern void             swtch(void);
 148 extern void             swtch_to(kthread_t *);
 149 extern void             swtch_from_zombie(void)
 150                                 __NORETURN;
 151 extern void             dq_sruninc(kthread_t *);
 152 extern void             dq_srundec(kthread_t *);
 153 extern void             cpu_rechoose(kthread_t *);
 154 extern void             cpu_surrender(kthread_t *);
 155 extern void             kpreempt(int);
 156 extern struct cpu       *disp_lowpri_cpu(struct cpu *, kthread_t *, pri_t);

 157 extern int              disp_bound_threads(struct cpu *, int);
 158 extern int              disp_bound_anythreads(struct cpu *, int);
 159 extern int              disp_bound_partition(struct cpu *, int);
 160 extern void             disp_cpu_init(struct cpu *);
 161 extern void             disp_cpu_fini(struct cpu *);
 162 extern void             disp_cpu_inactive(struct cpu *);
 163 extern void             disp_adjust_unbound_pri(kthread_t *);
 164 extern void             resume(kthread_t *);
 165 extern void             resume_from_intr(kthread_t *);
 166 extern void             resume_from_zombie(kthread_t *)
 167                                 __NORETURN;
 168 extern void             disp_swapped_enq(kthread_t *);
 169 extern int              disp_anywork(void);
 170 
 171 extern struct cpu       *disp_choose_best_cpu(void);
 172 
 173 #define KPREEMPT_SYNC           (-1)
 174 #define kpreempt_disable()                              \
 175         {                                               \
 176                 curthread->t_preempt++;                      \
 177                 ASSERT(curthread->t_preempt >= 1);        \
 178         }
 179 #define kpreempt_enable()                               \
 180         {                                               \
 181                 ASSERT(curthread->t_preempt >= 1);        \
 182                 if (--curthread->t_preempt == 0 &&   \
 183                     CPU->cpu_kprunrun)                       \
 184                         kpreempt(KPREEMPT_SYNC);        \
 185         }
 186 
 187 #endif  /* _KERNEL */
 188 
 189 #define CPU_IDLE_PRI (-1)
 190 
 191 #ifdef  __cplusplus
 192 }
 193 #endif
 194 
 195 #endif  /* _SYS_DISP_H */