[PATCH v3] cxl: Prevent adapter reset if an active context exists
Frederic Barrat
fbarrat at linux.vnet.ibm.com
Fri Oct 14 03:35:43 AEDT 2016
Hi Vaibhav,
Le 13/10/2016 à 13:08, Vaibhav Jain a écrit :
> This patch prevents resetting the cxl adapter via sysfs in presence of
> one or more active cxl_context on it. This protects against an
> unrecoverable error caused by PSL owning a dirty cache line even after
> reset and host tries to touch the same cache line. In case a force reset
> of the card is required irrespective of any active contexts, the int
> value -1 can be stored in the 'reset' sysfs attribute of the card.
>
> The patch introduces a new atomic_t member named contexts_num inside
> struct cxl that holds the number of active context attached to the card
> , which is checked against '0' before proceeding with the reset. To
> prevent against a race condition where a context is activated just after
> reset check is performed, the contexts_num is atomically set to '-1'
> after reset-check to indicate that no more contexts can be activated on
> the card anymore.
>
> Before activating a context we atomically test if contexts_num is
> non-negative and if so, increment its value by one. In case the value of
> contexts_num is negative then it indicates that the card is about to be
> reset and context activation is error-ed out at that point.
>
> Signed-off-by: Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
Looks good to me, thanks! And sorry, I could have saved you an iteration.
Reviewed-by: Frederic Barrat <fbarrat at linux.vnet.ibm.com>
Actually, I guess I'm supposed to do that now:
Acked-by: Frederic Barrat <fbarrat at linux.vnet.ibm.com>
Fred
More information about the Linuxppc-dev
mailing list