From: Khalid Aziz <khalid.aziz@xxxxxxxxxx> Date: Wed, 30 Aug 2017 16:27:54 -0600 >>> +#define arch_calc_vm_prot_bits(prot, pkey) >>> sparc_calc_vm_prot_bits(prot) >>> +static inline unsigned long sparc_calc_vm_prot_bits(unsigned long >>> prot) >>> +{ >>> + if (prot & PROT_ADI) { >>> + struct pt_regs *regs; >>> + >>> + if (!current->mm->context.adi) { >>> + regs = task_pt_regs(current); >>> + regs->tstate |= TSTATE_MCDE; >>> + current->mm->context.adi = true; >> If a process is multi-threaded when it enables ADI on some memory for >> the first time, TSTATE_MCDE will only be set for the calling thread >> and it will not be possible to enable it for the other threads. >> One possible way to handle this is to enable TSTATE_MCDE for all user >> threads when they are initialized if adi_capable() returns true. >> > > Or set TSTATE_MCDE unconditionally here by removing "if > (!current->mm->context.adi)"? I think you have to make "ADI enabled" a property of the mm_struct. Then you can broadcast to mm->cpu_vm_mask a per-cpu interrupt that updates regs->tstate of a thread using 'mm' is currently executing. And in the context switch code you set TSTATE_MCDE if it's not set already. That should cover all threaded case. -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html