[PATCH v4 03/11] cxl: Allocate and release the SPA with the AFU

Ian Munsie imunsie at au1.ibm.com
Fri Aug 14 15:35:10 AEST 2015


Excerpts from Daniel Axtens's message of 2015-08-13 14:11:21 +1000:
> Previously the SPA was allocated and freed upon entering and leaving
> AFU-directed mode. This causes some issues for error recovery - contexts
> hold a pointer inside the SPA, and they may persist after the AFU has
> been detached.
> 
> We would ideally like to allocate the SPA when the AFU is allocated, and
> release it until the AFU is released. However, we don't know how big the
> SPA needs to be until we read the AFU descriptor.
> 
> Therefore, restructure the code:
> 
>  - Allocate the SPA only once, on the first attach.
> 
>  - Release the SPA only when the entire AFU is being released (not
>    detached). Guard the release with a NULL check, so we don't free
>    if it was never allocated (e.g. dedicated mode)

This is certainly an improvement, though in the long run I wonder if we
should consider making the contexts increase the refcount of the AFU so
that we can be sure that the AFU structure will outlive the contexts?

That would be a more significant rework though, and this patch is needed
either way and solves an immediate problem, so:

Acked-by: Ian Munsie <imunsie at au1.ibm.com>



More information about the Linuxppc-dev mailing list