Add a function that will dump out the contents of the memory registration cache.
Useful for debugging any rcache issues. This commit was SVN r29189.
Этот коммит содержится в:
родитель
74d1278f48
Коммит
440632b57f
@ -54,6 +54,8 @@ typedef int (*mca_rcache_base_module_delete_fn_t)(
|
||||
typedef int (*mca_rcache_base_module_clean_fn_t)(
|
||||
struct mca_rcache_base_module_t* rcache);
|
||||
|
||||
typedef void (*mca_rcache_base_module_dump_range_fn_t)(
|
||||
struct mca_rcache_base_module_t* rcache, unsigned char* addr, size_t size);
|
||||
|
||||
/**
|
||||
* finalize
|
||||
@ -88,6 +90,7 @@ struct mca_rcache_base_module_t {
|
||||
mca_rcache_base_module_delete_fn_t rcache_delete;
|
||||
mca_rcache_base_module_clean_fn_t rcache_clean;
|
||||
mca_rcache_base_module_finalize_fn_t rcache_finalize;
|
||||
mca_rcache_base_module_dump_range_fn_t rcache_dump_range;
|
||||
opal_mutex_t lock;
|
||||
};
|
||||
typedef struct mca_rcache_base_module_t mca_rcache_base_module_t;
|
||||
|
@ -40,6 +40,7 @@ void mca_rcache_vma_module_init( mca_rcache_vma_module_t* rcache ) {
|
||||
rcache->base.rcache_delete = mca_rcache_vma_delete;
|
||||
rcache->base.rcache_clean = mca_rcache_vma_clean;
|
||||
rcache->base.rcache_finalize = mca_rcache_vma_finalize;
|
||||
rcache->base.rcache_dump_range = mca_rcache_vma_dump_range;
|
||||
OBJ_CONSTRUCT(&rcache->base.lock, opal_mutex_t);
|
||||
mca_rcache_vma_tree_init(rcache);
|
||||
}
|
||||
@ -171,3 +172,10 @@ int mca_rcache_vma_clean(struct mca_rcache_base_module_t* rcache)
|
||||
void mca_rcache_vma_finalize(struct mca_rcache_base_module_t* rcache)
|
||||
{
|
||||
}
|
||||
|
||||
void mca_rcache_vma_dump_range(struct mca_rcache_base_module_t* rcache,
|
||||
unsigned char *base, size_t size)
|
||||
{
|
||||
mca_rcache_vma_module_t *vma_rcache = (struct mca_rcache_vma_module_t*) rcache;
|
||||
mca_rcache_vma_tree_dump_range(vma_rcache, base, size);
|
||||
}
|
||||
|
@ -82,6 +82,10 @@ void mca_rcache_vma_module_init(mca_rcache_vma_module_t *rcache);
|
||||
|
||||
void mca_rcache_vma_finalize(struct mca_rcache_base_module_t*);
|
||||
|
||||
void mca_rcache_vma_dump_range(struct mca_rcache_base_module_t *rcache,
|
||||
unsigned char* addr, size_t size);
|
||||
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* MCA_RCACHE_VMA_H */
|
||||
|
@ -532,3 +532,48 @@ int mca_rcache_vma_tree_delete(mca_rcache_vma_module_t* vma_rcache,
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Dump out rcache entries within a range of memory. Useful for debugging. */
|
||||
void mca_rcache_vma_tree_dump_range(mca_rcache_vma_module_t *vma_rcache,
|
||||
unsigned char *base, size_t size)
|
||||
{
|
||||
unsigned char * bound = base + size -1;
|
||||
mca_mpool_base_registration_t *reg;
|
||||
|
||||
if(opal_list_get_size(&vma_rcache->vma_list) == 0) {
|
||||
opal_output(0, "rcache is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
opal_output(0, "Dumping rcache entries");
|
||||
do {
|
||||
mca_rcache_vma_t *vma;
|
||||
opal_list_item_t *item;
|
||||
vma = (mca_rcache_vma_t*)
|
||||
ompi_rb_tree_find_with(&vma_rcache->rb_tree, base,
|
||||
mca_rcache_vma_tree_node_compare_closest);
|
||||
|
||||
if(NULL == vma) {
|
||||
/* base is bigger than any registered memory */
|
||||
break;
|
||||
}
|
||||
|
||||
if(base < (unsigned char*)vma->start) {
|
||||
base = (unsigned char*)vma->start;
|
||||
continue;
|
||||
}
|
||||
|
||||
opal_output(0, " vma: base=%p, bound=%p, size=%d", (void *)vma->start, (void *)vma->end,
|
||||
(int)(vma->end - vma->start + 1));
|
||||
for(item = opal_list_get_first(&vma->reg_list);
|
||||
item != opal_list_get_end(&vma->reg_list);
|
||||
item = opal_list_get_next(item)) {
|
||||
mca_rcache_vma_reg_list_item_t *vma_item;
|
||||
vma_item = (mca_rcache_vma_reg_list_item_t*)item;
|
||||
reg = vma_item->reg;
|
||||
opal_output(0, " reg: base=%p, bound=%p, alloc_base=%p, ref_count=%d, flags=0x%x",
|
||||
reg->base, reg->bound, reg->alloc_base, reg->ref_count, reg->flags);
|
||||
}
|
||||
base = (unsigned char *)vma->end + 1;
|
||||
} while(bound >= base);
|
||||
}
|
||||
|
@ -99,5 +99,12 @@ int mca_rcache_vma_tree_delete(
|
||||
*/
|
||||
void mca_rcache_vma_destroy(mca_rcache_vma_t *vma);
|
||||
|
||||
/*
|
||||
* Dump out the contents of the rcache for debugging.
|
||||
*/
|
||||
void mca_rcache_vma_tree_dump_range(mca_rcache_vma_module_t *vma_rcache,
|
||||
unsigned char *base, size_t size);
|
||||
|
||||
|
||||
#endif /* MCA_RCACHE_VMA_TREE_H */
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user