On 09/05/2015 15:28, Konstantin Belousov wrote:
> +void
> +acpi_cpu_idle_mwait(uint32_t mwait_hint)
> +{
> +     int *state;
> +
> +     state = (int *)PCPU_PTR(monitorbuf);
> +     /*
> +      * XXXKIB.  Software coordination mode should be supported,
> +      * but all Intel CPUs provide hardware coordination.
> +      */
> +     cpu_monitor(state, 0, 0);
> +     cpu_mwait(MWAIT_INTRBREAK, mwait_hint);
> +}
> +

Kostik,

it's been a while since I studied this code, so please pardon me if I am asking
something obvious or silly.

I wonder why this function does not set 'state' before monitor + mwait.
As far as I can see, all other idling functions do that.  And cpu_idle_wakeup()
compares the state to STATE_MWAIT before changing it.

So, I am concerned that if the state happens to be anything other than
STATE_MWAIT when acpi_cpu_idle_mwait() is called, then cpu_idle_wakeup() won't
wake up the idled CPU.  It seems that if the state is not STATE_SLEEPING then an
IPI won't be sent either.  Actually, that leaves STATE_RUNNING is the only
problematic case, but that's probably the state that the CPU would have before
idling.

-- 
Andriy Gapon
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to