Print this page
NEX-16970 assertion failed: ht->ht_valid_cnt >= 0, file: ../../i86pc/vm/htable.c, line: 1204
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>


   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 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 /*
  26  * Copyright (c) 2014 by Delphix. All rights reserved.

  27  */
  28 
  29 #ifndef _VM_HAT_I86_H
  30 #define _VM_HAT_I86_H
  31 
  32 
  33 #ifdef  __cplusplus
  34 extern "C" {
  35 #endif
  36 
  37 /*
  38  * VM - Hardware Address Translation management.
  39  *
  40  * This file describes the contents of the x86_64 HAT data structures.
  41  */
  42 #include <sys/types.h>
  43 #include <sys/t_lock.h>
  44 #include <sys/cpuvar.h>
  45 #include <sys/x_call.h>
  46 #include <vm/seg.h>


  70 #define VLP_SIZE        (VLP_NUM_PTES * sizeof (x86pte_t))
  71 #define TOP_LEVEL(h)    (((h)->hat_flags & HAT_VLP) ? VLP_LEVEL : mmu.max_level)
  72 #define VLP_COPY(fromptep, toptep) { \
  73         toptep[0] = fromptep[0]; \
  74         toptep[1] = fromptep[1]; \
  75         toptep[2] = fromptep[2]; \
  76         toptep[3] = fromptep[3]; \
  77 }
  78 
  79 /*
  80  * The hat struct exists for each address space.
  81  */
  82 struct hat {
  83         kmutex_t        hat_mutex;
  84         struct as       *hat_as;
  85         uint_t          hat_stats;
  86         pgcnt_t         hat_pages_mapped[MAX_PAGE_LEVEL + 1];
  87         pgcnt_t         hat_ism_pgcnt;
  88         cpuset_t        hat_cpus;
  89         uint16_t        hat_flags;

  90         htable_t        *hat_htable;    /* top level htable */
  91         struct hat      *hat_next;
  92         struct hat      *hat_prev;
  93         uint_t          hat_num_hash;   /* number of htable hash buckets */
  94         htable_t        **hat_ht_hash;  /* htable hash buckets */
  95         htable_t        *hat_ht_cached; /* cached free htables */
  96         x86pte_t        hat_vlp_ptes[VLP_NUM_PTES];
  97 #if defined(__amd64) && defined(__xpv)
  98         pfn_t           hat_user_ptable; /* alt top ptable for user mode */
  99 #endif
 100 };
 101 typedef struct hat hat_t;
 102 
 103 #define PGCNT_INC(hat, level)   \
 104         atomic_inc_ulong(&(hat)->hat_pages_mapped[level]);
 105 #define PGCNT_DEC(hat, level)   \
 106         atomic_dec_ulong(&(hat)->hat_pages_mapped[level]);
 107 
 108 /*
 109  * Flags for the hat_flags field




   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 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 /*
  26  * Copyright (c) 2014 by Delphix. All rights reserved.
  27  * Copyright 2019 Nexenta Systems, Inc.
  28  */
  29 
  30 #ifndef _VM_HAT_I86_H
  31 #define _VM_HAT_I86_H
  32 
  33 
  34 #ifdef  __cplusplus
  35 extern "C" {
  36 #endif
  37 
  38 /*
  39  * VM - Hardware Address Translation management.
  40  *
  41  * This file describes the contents of the x86_64 HAT data structures.
  42  */
  43 #include <sys/types.h>
  44 #include <sys/t_lock.h>
  45 #include <sys/cpuvar.h>
  46 #include <sys/x_call.h>
  47 #include <vm/seg.h>


  71 #define VLP_SIZE        (VLP_NUM_PTES * sizeof (x86pte_t))
  72 #define TOP_LEVEL(h)    (((h)->hat_flags & HAT_VLP) ? VLP_LEVEL : mmu.max_level)
  73 #define VLP_COPY(fromptep, toptep) { \
  74         toptep[0] = fromptep[0]; \
  75         toptep[1] = fromptep[1]; \
  76         toptep[2] = fromptep[2]; \
  77         toptep[3] = fromptep[3]; \
  78 }
  79 
  80 /*
  81  * The hat struct exists for each address space.
  82  */
  83 struct hat {
  84         kmutex_t        hat_mutex;
  85         struct as       *hat_as;
  86         uint_t          hat_stats;
  87         pgcnt_t         hat_pages_mapped[MAX_PAGE_LEVEL + 1];
  88         pgcnt_t         hat_ism_pgcnt;
  89         cpuset_t        hat_cpus;
  90         uint16_t        hat_flags;
  91         uint16_t        hat_unmaps;     /* stop hat being free'd during unmap */
  92         htable_t        *hat_htable;    /* top level htable */
  93         struct hat      *hat_next;
  94         struct hat      *hat_prev;
  95         uint_t          hat_num_hash;   /* number of htable hash buckets */
  96         htable_t        **hat_ht_hash;  /* htable hash buckets */
  97         htable_t        *hat_ht_cached; /* cached free htables */
  98         x86pte_t        hat_vlp_ptes[VLP_NUM_PTES];
  99 #if defined(__amd64) && defined(__xpv)
 100         pfn_t           hat_user_ptable; /* alt top ptable for user mode */
 101 #endif
 102 };
 103 typedef struct hat hat_t;
 104 
 105 #define PGCNT_INC(hat, level)   \
 106         atomic_inc_ulong(&(hat)->hat_pages_mapped[level]);
 107 #define PGCNT_DEC(hat, level)   \
 108         atomic_dec_ulong(&(hat)->hat_pages_mapped[level]);
 109 
 110 /*
 111  * Flags for the hat_flags field