[RFC 2/2] cxl: Mark context requiring global TLBIs

Frederic Barrat fbarrat at linux.vnet.ibm.com
Sun May 7 20:41:38 AEST 2017



Le 04/05/2017 à 09:39, Balbir Singh a écrit :
> On Wed, 2017-05-03 at 16:29 +0200, Frederic Barrat wrote:
>> The PSL needs to see all TLBI pertinent to the memory contexts used on
>> the cxl adapter. For the hash memory model, it was done by making all
>> TLBIs global as soon as the cxl driver is in us. For radix, we need
>> something similar, but we can refine and only convert to global the
>> invalidations for contexts actually used by the device.
>>
>> So mark the contexts being attached to the cxl adapter as requiring
>> global TLBIs.
>>
> <snip>
>> +#ifdef CONFIG_PPC_BOOK3S_64
>> +	if (ctx->mm)
>> +		mm_context_set_global_tlbi(&ctx->mm->context);
>
> Just curious and wondering
>
> Could we do mm_context_set_global_tlbi() before ->attach_process() that
> way we won't need atomic tests (set_bit() and test_bit())? May be a memory
> barrier would suffice. Not 100% sure, hence checking


You're right, I need to move mm_context_set_global_tlbi() before the 
attach and have a write memory barrier.
If the attach fails, then the context will still be marked for global 
TLBIs (some other driver may also set the bit for a different reason). 
But I would expect the life expectancy of a process designed to use an 
accelerator and failing to attach to be pretty short.

I still think we need the atomic set_bit() though, but that's really for 
the future and if somebody introduces new bits in the context 'flags'.

   Fred


> Balbir Singh.
>



More information about the Linuxppc-dev mailing list