powerpc/paravirt: Improve vcpu_is_preempted
authorSrikar Dronamraju <srikar@linux.vnet.ibm.com>
Thu, 19 Oct 2023 09:14:52 +0000 (14:44 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 19 Oct 2023 12:25:59 +0000 (23:25 +1100)
commitefce8422dd53fae6cdbd37741034ac4eb4730819
tree4cfb435563dad09f5d3e3f89d7210440354df577
parente08c43e6c3eb5d805b61d981f1e8286ee0dc6d1a
powerpc/paravirt: Improve vcpu_is_preempted

PowerVM Hypervisor dispatches on a whole core basis. In a shared LPAR, a
CPU from a core that is CEDED or preempted may have a larger latency. In
such a scenario, its preferable to choose a different CPU to run.

If one of the CPUs in the core is active, i.e neither CEDED nor
preempted, then consider this CPU as not preempted.

Also if any of the CPUs in the core has yielded but OS has not requested
CEDE or CONFER, then consider this CPU to be preempted.

Correct detection of preempted CPUs is important for detecting idle
CPUs/cores in task scheduler.

Tested-by: Aboorva Devarajan <aboorvad@linux.vnet.ibm.com>
Reviewed-by: Shrikanth Hegde <sshegde@linux.vnet.ibm.com>
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231019091452.95260-1-srikar@linux.vnet.ibm.com
arch/powerpc/include/asm/paravirt.h