intel_idle driver not working

richy
richy New Member Posts: 5
edited March 2020 in UP Squared Linux

On my Up Squared with Pentium N4200 the intel_idle driver refuses to load with "intel_idle: Please enable MWAIT in BIOS SETUP"
Found that option Monitor/MWAIT in BIOS in CRB Mode and enabled it but that did not change anything, tested with kernel 4.19 and 5.5 using latest BIOS UPA1AM50.
Any suggestions?

Comments

  • DCleri
    DCleri Administrator, AAEON Posts: 1,213 admin

    Hi @richy

    We have added a procedure in our wiki: https://wiki.up-community.org/Enable_intel_idle

    Please give it a try and let us know if it works also for you

  • richy
    richy New Member Posts: 5

    Thx @DCleri

    but your procedure confuses me as it disables intel_idle and also limits acpi-idle to C1. Please correct me if i am wrong...

    intel_idle.max_cstate=0 processor.max_cstate=0 idle=mwait
    

    intel_idle.max_cstate=0 disables intel_idle completely

    intel_idle.max_cstate=	[KNL,HW,ACPI,X86]
    			0	disables intel_idle and fall back on acpi_idle.
    			1 to 9	specify maximum depth of C-state.
    

    References: https://github.com/torvalds/linux/blob/master/drivers/idle/intel_idle.c Line 60 / Line 1601-1604


    processor.max_cstate=0 silently sets processor.max_cstate to 1

    Reference: https://github.com/torvalds/linux/blob/master/drivers/acpi/processor_idle.c Line 719-720

    idle=mwait was removed in kernel 3.9, current documentation states:

    idle=		[X86]
    			Format: idle=poll, idle=halt, idle=nomwait
    			Poll forces a polling idle loop that can slightly
    			improve the performance of waking up a idle CPU, but
    			will use a lot of power and make the system run hot.
    			Not recommended.
    			idle=halt: Halt is forced to be used for CPU idle.
    			In such case C2/C3 won't be used again.
    			idle=nomwait: Disable mwait for CPU C-states
    

    Reference: https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt

  • DCleri
    DCleri Administrator, AAEON Posts: 1,213 admin
    edited April 2020

    Hi @richy

    Thanks for your feedback and additional findings.

    We will look into the boot parameters for intel_idle.max_cstate and processor.max_cstate

    Regarding the other part, I have found the following information:

    From: https://lwn.net/Articles/809178/

    +Kernel Command Line Options and Module Parameters
    +=================================================
    +
    +The *x86* architecture support code recognizes three kernel command line
    +options related to CPU idle time management: ``idle=poll``, ``idle=halt``,
    +and ``idle=nomwait``.  If any of them is present in the kernel command line, the
    +``MWAIT`` instruction is not allowed to be used, so the initialization of
    +``intel_idle`` will fail.
    

    And: https://patchwork.kernel.org/patch/2121711/

    Here we simplify the x86 native idle code by removing mwait_idle(),
    and the "idle=mwait" bootparam used to invoke it.
    
    After this change, kernels configured with
    (CONFIG_ACPI=n && CONFIG_INTEL_IDLE=n) when run on hardware
    that supports MWAIT will simply use HLT.  If MWAIT is desired
    on those systems, cpuidle and the cpuidle drivers above
    can be enabled.
    

    That means the "idle=mwait" is not needed or used in conjunction with intel_idle, but no other option should be set otherwise the driver would fail to load.

    We will review the options changes and come back to you.

  • richy
    richy New Member Posts: 5

    @DCleri said:
    And: https://patchwork.kernel.org/patch/2121711/

    Here we simplify the x86 native idle code by removing mwait_idle(),
    and the "idle=mwait" bootparam used to invoke it.
    
    After this change, kernels configured with
    (CONFIG_ACPI=n && CONFIG_INTEL_IDLE=n) when run on hardware
    that supports MWAIT will simply use HLT.  If MWAIT is desired
    on those systems, cpuidle and the cpuidle drivers above
    can be enabled.
    

    That means the "idle=mwait" is not needed or used in conjunction with intel_idle, but no other option should be set otherwise the driver would fail to load.

    yes, thats right :) - just to clarify my previous comment: MWAIT is not removed, just the bootparameter was removed and MWAIT will be used if you meet kernel configuration requirements.

    I attached the output of a tool "cpuid", maybe it is useful.

  • DCleri
    DCleri Administrator, AAEON Posts: 1,213 admin

    Thanks for the cpuid info.

    In case you might be interested, this is the command to detect which idle driver is used by the system:

    cat /sys/devices/system/cpu/cpuidle/current_driver

  • gvy
    gvy New Member Posts: 9

    Hi, i was just working with this yesterday. Configuring it like the wiki says (intel_idle.max_cstate=0 processor.max_cstate=0 idle=mwait) forces the N4200 clocks in my case to allways be on or above 1,2GHz.
    Without enabling this i would clock down to ~600MHz and be in C3 state according to Powertop.
    So question would be how to actually enable intel_idle and configure it for energy savings?

  • DCleri
    DCleri Administrator, AAEON Posts: 1,213 admin

    Hi @gvy,

    The information in the wiki have been updated: https://wiki.up-community.org/Enable_intel_idle

    In theory enabling mwait in the BIOS should be sufficient and the Operating System will automatically load the intel_idle driver.

    We are currently investigating as this is not happening on UP Squared and UP Core Plus.

  • richy
    richy New Member Posts: 5

    Already checked that, the current driver is acpi_idle. This allows to use states C1-C3.

  • gvy
    gvy New Member Posts: 9

    @richy said:
    Already checked that, the current driver is acpi_idle. This allows to use states C1-C3.

    But that works with and without MWAIT enabled. The idea is that the intel_idle driver, since it is been engineerd by Intel, gives better results than the more generic acpi_idle.
    Since I have 2 UP Squared's running 24/7 at very light load (mostly) I would like to save as much energy as possible.

  • richy
    richy New Member Posts: 5
  • DCleri
    DCleri Administrator, AAEON Posts: 1,213 admin

    Hi @richy

    Sorry for the late reply but we got an official answer from Intel only now.

    Unfortunately it seems that APL SoC has an unreliable Monitor/Mwait (SKU Bug) so it would cause long time boot or malfunctions if it is enabled under Linux (Intel specifically tested on Yocto).
    As by default the BIOS OS setting is configured as Intel Linux, MWAIT is disabled automatically.

    If you want really to set the CPUidle driver as intel_idle and enable the MWAIT in Linux, here's a way to do it:
    1. To enter BIOS setup, configure the OS Selection to Windows
    2. To enter CRB BIOS setup, configure the Monitor MWAIT to Enabled (CRB Advanced  CPU Configuration)

Privacy Policy