Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) ==================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) Guest halt polling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) ==================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) The cpuidle_haltpoll driver, with the haltpoll governor, allows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) the guest vcpus to poll for a specified amount of time before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) halting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) This provides the following benefits to host side polling:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	1) The POLL flag is set while polling is performed, which allows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 	   a remote vCPU to avoid sending an IPI (and the associated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	   cost of handling the IPI) when performing a wakeup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	2) The VM-exit cost can be avoided.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) The downside of guest side polling is that polling is performed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) even with other runnable tasks in the host.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) The basic logic as follows: A global value, guest_halt_poll_ns,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) is configured by the user, indicating the maximum amount of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) time polling is allowed. This value is fixed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) Each vcpu has an adjustable guest_halt_poll_ns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) ("per-cpu guest_halt_poll_ns"), which is adjusted by the algorithm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) in response to events (explained below).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) Module Parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) The haltpoll governor has 5 tunable module parameters:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 1) guest_halt_poll_ns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) Maximum amount of time, in nanoseconds, that polling is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) performed before halting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) Default: 200000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 2) guest_halt_poll_shrink:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) Division factor used to shrink per-cpu guest_halt_poll_ns when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) wakeup event occurs after the global guest_halt_poll_ns.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) Default: 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 3) guest_halt_poll_grow:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) Multiplication factor used to grow per-cpu guest_halt_poll_ns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) when event occurs after per-cpu guest_halt_poll_ns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) but before global guest_halt_poll_ns.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) Default: 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 4) guest_halt_poll_grow_start:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) The per-cpu guest_halt_poll_ns eventually reaches zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) in case of an idle system. This value sets the initial
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) per-cpu guest_halt_poll_ns when growing. This can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) be increased from 10000, to avoid misses during the initial
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) growth stage:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 10k, 20k, 40k, ... (example assumes guest_halt_poll_grow=2).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) Default: 50000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 5) guest_halt_poll_allow_shrink:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) Bool parameter which allows shrinking. Set to N
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) to avoid it (per-cpu guest_halt_poll_ns will remain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) high once achieves global guest_halt_poll_ns value).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) Default: Y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) The module parameters can be set from the debugfs files in::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 	/sys/module/haltpoll/parameters/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) Further Notes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) =============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) - Care should be taken when setting the guest_halt_poll_ns parameter as a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)   large value has the potential to drive the cpu usage to 100% on a machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)   which would be almost entirely idle otherwise.