X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fsvm%2Fsvm_common.h;h=c0581f2c29ab4d564ed6d99696230be6a0b7eb97;hb=87a8826d173c4e4ff3da3a613f19eb9a91673a75;hp=1f6d83c0a378b2db6201fed5b7664e858aafb0f5;hpb=3cdc25ffbaa572639f99e197172c568e4324bc03;p=vpp.git diff --git a/src/svm/svm_common.h b/src/svm/svm_common.h index 1f6d83c0a37..c0581f2c29a 100644 --- a/src/svm/svm_common.h +++ b/src/svm/svm_common.h @@ -20,6 +20,8 @@ #include #include +#include +#include #include #define SVM_VERSION ((1<<16) | 1) /* set to declare region ready. */ @@ -66,7 +68,7 @@ typedef struct svm_map_region_args_ { const char *root_path; /* NULL means use the truly global arena */ const char *name; - u64 baseva; + uword baseva; u64 size; u64 pvt_heap_size; uword flags; @@ -77,15 +79,29 @@ typedef struct svm_map_region_args_ int gid; } svm_map_region_args_t; +/* + * Memory mapped to high addresses for session/vppcom/vcl/etc... + */ +#if __WORDSIZE == 64 +#ifdef CLIB_SANITIZE_ADDR +#define HIGH_SEGMENT_BASEVA 0x300000000000 /* DO NOT CHANGE THIS: YOU'LL BREAK ASAN */ +#else /* CLIB_SANITIZE_ADDR */ +#define HIGH_SEGMENT_BASEVA (128ULL << 30) /* 128GB */ +#endif /* CLIB_SANITIZE_ADDR */ +#elif __WORDSIZE == 32 +#define HIGH_SEGMENT_BASEVA (3584UL << 20) /* 3.5GB */ +#else +#error "unknown __WORDSIZE" +#endif /* * Memory shared across all router instances. Packet buffers, etc * Base should be "out of the way," and size should be big enough to * cover everything we plan to put here. */ -#define SVM_GLOBAL_REGION_BASEVA 0x30000000 #define SVM_GLOBAL_REGION_SIZE (64<<20) #define SVM_GLOBAL_REGION_NAME "/global_vm" +u64 svm_get_global_region_base_va (); /* * Memory shared across individual router instances. @@ -105,16 +121,22 @@ typedef struct svm_subregion_t *subregions; /* subregion pool */ uword *name_hash; u8 *root_path; + int uid; + int gid; } svm_main_region_t; void *svm_region_find_or_create (svm_map_region_args_t * a); void svm_region_init (void); +void svm_region_init_mapped_region (svm_map_region_args_t * a, + svm_region_t * rp); int svm_region_init_chroot (const char *root_path); void svm_region_init_chroot_uid_gid (const char *root_path, int uid, int gid); void svm_region_init_args (svm_map_region_args_t * a); void svm_region_exit (void); +void svm_region_exit_client (void); void svm_region_unmap (void *rp_arg); +void svm_region_unmap_client (void *rp_arg); void svm_client_scan (const char *root_path); void svm_client_scan_this_region_nolock (svm_region_t * rp); u8 *shm_name_from_svm_map_region_args (svm_map_region_args_t * a);