On Thu, 23 Mar 2017, Peter Zijlstra wrote:
> On Thu, Mar 23, 2017 at 11:25:49AM -0700, [email protected] wrote:
> > +   for_each_possible_cpu(cpu) {
> > +           rdmsrl_on_cpu(cpu, MSR_IA32_DEBUGCTLMSR, &debugctlmsr);
> > +           if (val)
> > +                   wrmsrl_on_cpu(cpu, MSR_IA32_DEBUGCTLMSR, debugctlmsr | 
> > DEBUGCTLMSR_FREEZE_WHILE_SMM);
> > +           else
> > +                   wrmsrl_on_cpu(cpu, MSR_IA32_DEBUGCTLMSR, debugctlmsr & 
> > ~DEBUGCTLMSR_FREEZE_WHILE_SMM);
> > +   }
> 
> No; that's just disgusting. Also {rd,wr}msr_on_cpu() should die, exactly
> because people end up writing crap like this.

Aside of that this is completely broken against other users of DEBUGCTLMSR
because it's not atomic vs. the other modifications.

Thanks,

        tglx





Reply via email to