08 Apr, 2020

1 commit


14 Mar, 2020

1 commit

  • Before commit 1328edca4a14 ("cpuidle-haltpoll: Enable kvm guest polling
    when dedicated physical CPUs are available") the cpuidle-haltpoll driver
    could also be used in scenarios when the host does not advertise the
    KVM_HINTS_REALTIME hint.

    While the behavior introduced by the aforementioned commit makes sense as
    the default there are cases where the old behavior is desired, for example,
    when other kernel changes triggered by presence by this hint are unwanted,
    for some workloads where the latency benefit from polling overweights the
    loss from idle CPU capacity that otherwise would be available, or just when
    running under older Qemu versions that lack this hint.

    Let's provide a typical "force" module parameter that allows restoring the
    old behavior.

    Signed-off-by: Maciej S. Szmigiero
    Reviewed-by: Marcelo Tosatti
    Signed-off-by: Rafael J. Wysocki

    Maciej S. Szmigiero
     

22 Oct, 2019

1 commit

  • Currenly haltpoll isn't aware of the 'idle=' override, the priority is
    'idle=poll' > haltpoll > 'idle=halt'. When 'idle=poll' is used, cpuidle
    driver is bypassed but current_driver in sys still shows 'haltpoll'.

    When 'idle=halt' is used, haltpoll takes precedence and makes
    'idle=halt' have no effect.

    Add a check to prevent the haltpoll driver from loading if 'idle=' is
    present.

    Signed-off-by: Zhenzhong Duan
    Co-developed-by: Joao Martins
    [ rjw: Subject ]
    Signed-off-by: Rafael J. Wysocki

    Zhenzhong Duan
     

11 Sep, 2019

4 commits

  • The downside of guest side polling is that polling is performed even
    with other runnable tasks in the host. However, even if poll in kvm
    can aware whether or not other runnable tasks in the same pCPU, it
    can still incur extra overhead in over-subscribe scenario. Now we can
    just enable guest polling when dedicated pCPUs are available.

    Acked-by: Paolo Bonzini
    Signed-off-by: Wanpeng Li
    Signed-off-by: Rafael J. Wysocki

    Wanpeng Li
     
  • cpuidle-haltpoll can be built as a module to allow optional late load.
    Given we are setting @owner to THIS_MODULE, cpuidle will attempt to grab a
    module reference every time a cpuidle_device is registered -- so
    essentially all online cpus get a reference.

    This prevents for the module to be unloaded later, which makes the
    module_exit callback entirely unused. Thus remove the @owner and allow
    module to be unloaded.

    Fixes: fa86ee90eb11 ("add cpuidle-haltpoll driver")
    Signed-off-by: Joao Martins
    Signed-off-by: Rafael J. Wysocki

    Joao Martins
     
  • When a user loads cpuidle-haltpoll on a non KVM guest the module will
    successfully load, even though idle driver registration didn't take
    place.

    We should instead return -ENODEV signaling the user that the driver can't
    be loaded, like other error paths in haltpoll_init(). An example of such
    error paths is when we return -EBUSY when attempting to register an idle
    driver when it had one already (e.g. intel_idle loads at boot and then we
    attempt to insert module cpuidle-haltpoll).

    Fixes: fa86ee90eb11 ("add cpuidle-haltpoll driver")
    Signed-off-by: Joao Martins
    Signed-off-by: Rafael J. Wysocki

    Joao Martins
     
  • Right now, guest current governors have the following ratings:

    * ladder -> 10
    * teo -> 19
    * menu -> 20
    * haltpoll -> 21
    * ladder + nohz=off -> 25

    haltpoll governor got introduced and it is now the default governor given
    its highest rating -- with ladder+nohz being the exception -- regardless of
    idle driver in the guest. An example of an undesirable case is x86 KVM
    guests with MWAIT which have intel_idle registered first, and consequently
    will have haltpoll be used as governor which would get limited to a poll
    state and state 1 and the other states wouldn't get used.

    To keep the previous defaults we decrease rating of governor to 9 (below
    current lowest rating) and thus rely on @governor switch on
    cpuidle_register_driver() to tie in haltpoll idle driver and governor
    together.

    Signed-off-by: Joao Martins
    Signed-off-by: Rafael J. Wysocki

    Joao Martins
     

03 Sep, 2019

1 commit

  • When cpus != maxcpus cpuidle-haltpoll will fail to register all vcpus
    past the online ones and thus fail to register the idle driver.
    This is because cpuidle_add_sysfs() will return with -ENODEV as a
    consequence from get_cpu_device() return no device for a non-existing
    CPU.

    Instead switch to cpuidle_register_driver() and manually register each
    of the present cpus through cpuhp_setup_state() callbacks and future
    ones that get onlined or offlined. This mimmics similar logic that
    intel_idle does.

    Fixes: fa86ee90eb11 ("add cpuidle-haltpoll driver")
    Signed-off-by: Joao Martins
    Signed-off-by: Boris Ostrovsky
    Reviewed-by: Marcelo Tosatti
    Signed-off-by: Rafael J. Wysocki

    Joao Martins
     

30 Jul, 2019

2 commits