On 11/01/2017 02:25 PM, Thomas Gleixner wrote:
>>      cr4 = this_cpu_read(cpu_tlbstate.cr4);
>> -    /* clear PGE */
>> -    native_write_cr4(cr4 & ~X86_CR4_PGE);
>> -    /* write old PGE again and flush TLBs */
>> +    /*
>> +     * This function is only called on systems that support X86_CR4_PGE
>> +     * and where always set X86_CR4_PGE.  Warn if we are called without
>> +     * PGE set.
>> +     */
>> +    WARN_ON_ONCE(!(cr4 & X86_CR4_PGE));
> Because if CR4_PGE is not set, this warning triggers. So this defeats the
> toggle mode you are implementing.

The warning is there because there is probably plenty of *other* stuff
that breaks if we have X86_FEATURE_PGE=1, but CR4.PGE=0.

The point of this was to make this function do the right thing no matter
what, but warn if it gets called in an unexpected way.

Reply via email to