root/opal/mca/rcache/base/rcache_base_vma.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2007 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  *
  14  * Copyright (c) 2006      Voltaire. All rights reserved.
  15  * Copyright (c) 2009      IBM Corporation.  All rights reserved.
  16  * Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights
  17  *                         reserved.
  18  *
  19  * $COPYRIGHT$
  20  *
  21  * Additional copyrights may follow
  22  *
  23  * $HEADER$
  24  */
  25 
  26 /**
  27  * @file
  28  * Registration cache VMA lookup
  29  */
  30 
  31 #ifndef MCA_RCACHE_BASE_VMA_H
  32 #define MCA_RCACHE_BASE_VMA_H
  33 
  34 #include "opal_config.h"
  35 #include "opal/class/opal_list.h"
  36 #include "opal/class/opal_interval_tree.h"
  37 #include "opal/class/opal_lifo.h"
  38 
  39 BEGIN_C_DECLS
  40 
  41 struct mca_rcache_base_registration_t;
  42 
  43 struct mca_rcache_base_vma_module_t {
  44     opal_object_t super;
  45     opal_interval_tree_t tree;
  46     opal_list_t vma_list;
  47     opal_lifo_t vma_gc_lifo;
  48     size_t reg_cur_cache_size;
  49     opal_mutex_t vma_lock;
  50 };
  51 typedef struct mca_rcache_base_vma_module_t mca_rcache_base_vma_module_t;
  52 
  53 OBJ_CLASS_DECLARATION(mca_rcache_base_vma_module_t);
  54 
  55 mca_rcache_base_vma_module_t *mca_rcache_base_vma_module_alloc (void);
  56 
  57 int mca_rcache_base_vma_find (mca_rcache_base_vma_module_t *vma_module, void *addr,
  58                               size_t size, struct mca_rcache_base_registration_t **reg);
  59 
  60 int mca_rcache_base_vma_find_all (mca_rcache_base_vma_module_t *vma_module, void *addr,
  61                                   size_t size, struct mca_rcache_base_registration_t **regs,
  62                                   int reg_cnt);
  63 
  64 int mca_rcache_base_vma_insert (mca_rcache_base_vma_module_t *vma_module,
  65                                 struct mca_rcache_base_registration_t *registration,
  66                                 size_t limit);
  67 
  68 int mca_rcache_base_vma_delete (mca_rcache_base_vma_module_t *vma_module,
  69                                 struct mca_rcache_base_registration_t *registration);
  70 
  71 void mca_rcache_base_vma_dump_range (mca_rcache_base_vma_module_t *vma_module,
  72                                      unsigned char *base, size_t size, char *msg);
  73 
  74 /**
  75  * Iterate over registrations in the specified range.
  76  *
  77  * @param[in] vma_module  vma tree
  78  * @param[in] base        base address of region
  79  * @param[in] size        size of region
  80  * @param[in] partial_ok  partial overlap of range is ok
  81  * @param[in] callback_fn function to call for each matching registration handle
  82  * @param[in] ctx         callback context
  83  *
  84  * The callback will be made with the vma lock held. This is a recursive lock so
  85  * it is still safe to call any vma functions on this vma_module. Keep in mind it
  86  * is only safe to call mca_rcache_base_vma_delete() on the supplied registration
  87  * from the callback. The iteration will terminate if the callback returns anything
  88  * other than OPAL_SUCCESS.
  89  */
  90 int mca_rcache_base_vma_iterate (mca_rcache_base_vma_module_t *vma_module,
  91                                  unsigned char *base, size_t size, bool partial_ok,
  92                                  int (*callback_fn) (struct mca_rcache_base_registration_t *, void *),
  93                                  void *ctx);
  94 
  95 size_t mca_rcache_base_vma_size (mca_rcache_base_vma_module_t *vma_module);
  96 
  97 END_C_DECLS
  98 
  99 #endif /* MCA_RCACHE_BASE_VMA_H */

/* [<][>][^][v][top][bottom][index][help] */