14
14
* Copyright (c) 2006 Voltaire. All rights reserved.
15
15
* Copyright (c) 2007 Mellanox Technologies. All rights reserved.
16
16
* Copyright (c) 2010 IBM Corporation. All rights reserved.
17
- * Copyright (c) 2011-2016 Los Alamos National Security, LLC. All rights
17
+ * Copyright (c) 2011-2017 Los Alamos National Security, LLC. All rights
18
18
* reserved.
19
19
* Copyright (c) 2013 NVIDIA Corporation. All rights reserved.
20
20
* Copyright (c) 2016 Research Organization for Information Science
@@ -421,20 +421,29 @@ static int mca_rcache_grdma_deregister (mca_rcache_base_module_t *rcache,
421
421
return rc ;
422
422
}
423
423
424
+ struct gc_add_args_t {
425
+ void * base ;
426
+ size_t size ;
427
+ };
428
+ typedef struct gc_add_args_t gc_add_args_t ;
429
+
424
430
static int gc_add (mca_rcache_base_registration_t * grdma_reg , void * ctx )
425
431
{
426
432
mca_rcache_grdma_module_t * rcache_grdma = (mca_rcache_grdma_module_t * ) grdma_reg -> rcache ;
427
-
428
- /* unused */
429
- (void ) ctx ;
433
+ gc_add_args_t * args = (gc_add_args_t * ) ctx ;
430
434
431
435
if (grdma_reg -> flags & MCA_RCACHE_FLAGS_INVALID ) {
432
436
/* nothing more to do */
433
437
return OPAL_SUCCESS ;
434
438
}
435
439
436
- if (grdma_reg -> ref_count ) {
437
- /* attempted to remove an active registration */
440
+ if (grdma_reg -> ref_count && grdma_reg -> base == args -> base ) {
441
+ /* attempted to remove an active registration. to handle cases where part of
442
+ * an active registration has been unmapped we check if the bases match. this
443
+ * *hopefully* will suppress erroneously emitted errors. if we can't suppress
444
+ * the erroneous error in all cases then this check and return should be removed
445
+ * entirely. we are not required to give an error for a user freeing a buffer
446
+ * that is in-use by MPI. Its just a nice to have. */
438
447
return OPAL_ERROR ;
439
448
}
440
449
@@ -456,7 +465,8 @@ static int mca_rcache_grdma_invalidate_range (mca_rcache_base_module_t *rcache,
456
465
void * base , size_t size )
457
466
{
458
467
mca_rcache_grdma_module_t * rcache_grdma = (mca_rcache_grdma_module_t * ) rcache ;
459
- return mca_rcache_base_vma_iterate (rcache_grdma -> cache -> vma_module , base , size , gc_add , NULL );
468
+ gc_add_args_t args = {.base = base , .size = size };
469
+ return mca_rcache_base_vma_iterate (rcache_grdma -> cache -> vma_module , base , size , gc_add , & args );
460
470
}
461
471
462
472
/* Make sure this registration request is not stale. In other words, ensure
0 commit comments