Re: [PATCH v3 2/5] x86/umwait: Initialize umwait control values

From: Andy Lutomirski
Date: Thu May 30 2019 - 17:09:29 EST


On Fri, May 24, 2019 at 5:05 PM Fenghua Yu <fenghua.yu@xxxxxxxxx> wrote:
>
> umwait or tpause allows processor to enter a light-weight
> power/performance optimized state (C0.1 state) or an improved
> power/performance optimized state (C0.2 state) for a period
> specified by the instruction or until the system time limit or until
> a store to the monitored address range in umwait.
>
> IA32_UMWAIT_CONTROL MSR register allows kernel to enable/disable C0.2
> on the processor and set maximum time the processor can reside in
> C0.1 or C0.2.
>
> By default C0.2 is enabled so the user wait instructions can enter the
> C0.2 state to save more power with slower wakeup time.
>
> Default maximum umwait time is 100000 cycles. A later patch provides
> a sysfs interface to adjust this value.

Reviewed-by: Andy Lutomirski <luto@xxxxxxxxxx>

with the caveat that we should really clean up our CPU init code to
have a function like cpu_prepare_for_user_code() that is called on all
CPUs after every boot, resume, etc before running user code. This
would subsume syscall_init().

--Andy