Skip to content

RFC : powerKVM, release the compute power of secondary hwthread on host

[email protected] kvm-ppc linuxppc-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest11 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11sched: introduce sys_cpumask in tsk to adapt asymmetric systeminclude/linux/init_task.h include/linux/sched.h kernel/sched/core.c+15 -22 replies
2/11powerpc: kvm: ensure vcpu-thread run only on primary hwthreadarch/powerpc/include/asm/kvm_host.h arch/powerpc/kvm/book3s_hv.c+20 -01 reply
3/11powerpc: kvm: add interface to control kvm function on a corearch/powerpc/kernel/sysfs.c arch/powerpc/sysdev/xics/xics-common.c+51 -03 replies
4/11powerpc: kvm: introduce a kthread on primary thread to anti ticklessarch/powerpc/kernel/sysfs.c+3 -12 replies
5/11sched: introduce stop_cpus_async() to schedule special tsk on cpuinclude/linux/stop_machine.h kernel/stop_machine.c+22 -50 replies
6/11powerpc: kvm: introduce online in paca to indicate whether cpu is needed by hostarch/powerpc/include/asm/paca.h arch/powerpc/kernel/asm-offsets.c arch/powerpc/kernel/smp.c +1 more+21 -02 replies
7/11powerpc: kvm: the stopper func to cease secondary hwthreadarch/powerpc/kvm/book3s_hv.c arch/powerpc/kvm/book3s_hv_rmhandlers.S+49 -02 replies
8/11powerpc: kvm: add a flag in vcore to sync primary with secondry hwthreadarch/powerpc/include/asm/kvm_host.h arch/powerpc/kernel/asm-offsets.c arch/powerpc/kvm/book3s_hv_rmhandlers.S+16 -11 reply
9/11powerpc: kvm: handle time base on secondary hwthreadarch/powerpc/kvm/book3s_hv_rmhandlers.S+6 -02 replies
10/11powerpc: kvm: on_primary_thread() force the secondary threads into NAP modearch/powerpc/kvm/book3s_hv.c+7 -00 replies
11/11powerpc: kvm: Kconfig add an option for enabling secondary hwthreadarch/powerpc/kvm/Kconfig+4 -02 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 00/11]: powerKVM, release the compute power of secondary hwthread on host

Nowadays, when running powerKVM(book3s, hv mode), we should make the secondary hwthread offline. Which means that if we run misc tsks other than dedicated KVM (e.g mix java and KVM), we will lose the compute power of the secondary hwthread on host env.

This series aim to make the powerpc adaptive to the misc tsks on host.
( This series is just a sketch, with some broken patch. Sorry to bring up it in a hurry,
I am afraid that I am on the wrong direction too far. So I hope I can get some advice and feedback in advance. I will go on the work on the "place holder" patch if my idea is reasonable.

Please consider the code as the explaining of my idea.
)

The internal:
-1.To enter guest, the primary hwthread schedule stopper func on the secondary to bring them into NAP mode.
The proto will be:
cpu1 cpuX
stop_cpus_async()
bring cpuX to a special state
signal flag and trapped
check for flag
set up guest env and ipi cpuX
-2.When exit to host, the secondary hardcode to jmp back to the stopper func, i.e back to host.

Drawbacks that I can think so far:
-1. increase the sched interval on secondary but the schduler do NOT know it.(can it cause problem?) -2. lose some presice of hrtime on secondary hwthread for host.(To avoid the primary
has too small time slice, we need to impose a threshold,so we may lose the presice)

Any suggestion? Thanks!

Liu Ping Fan (11):
sched: introduce sys_cpumask in tsk to adapt asymmetric system
powerpc: kvm: ensure vcpu-thread run only on primary hwthread
powerpc: kvm: add interface to control kvm function on a core
powerpc: kvm: introduce a kthread on primary thread to anti tickless
sched: introduce stop_cpus_async() to schedule special tsk on cpu
powerpc: kvm: introduce online in paca to indicate whether cpu is
needed by host
powerpc: kvm: the stopper func to cease secondary hwthread
powerpc: kvm: add a flag in vcore to sync primary with secondry
hwthread
powerpc: kvm: handle time base on secondary hwthread
powerpc: kvm: on_primary_thread() force the secondary threads into NAP
mode
powerpc: kvm: Kconfig add an option for enabling secondary hwthread

 arch/powerpc/include/asm/kvm_host.h     |  6 ++++
 arch/powerpc/include/asm/paca.h         |  3 ++
 arch/powerpc/kernel/asm-offsets.c       |  6 ++++
 arch/powerpc/kernel/smp.c               |  3 ++
 arch/powerpc/kernel/sysfs.c             | 41 ++++++++++++++++++++++
 arch/powerpc/kvm/Kconfig                |  4 +++
 arch/powerpc/kvm/book3s_hv.c            | 39 +++++++++++++++++++++
 arch/powerpc/kvm/book3s_hv_rmhandlers.S | 61 +++++++++++++++++++++++++++++++++
 arch/powerpc/sysdev/xics/xics-common.c  | 12 +++++++
 include/linux/init_task.h               |  1 +
 include/linux/sched.h                   |  6 ++++
 include/linux/stop_machine.h            |  2 ++
 kernel/sched/core.c                     | 10 ++++--
 kernel/stop_machine.c                   | 25 +++++++++++---
 14 files changed, 212 insertions(+), 7 deletions(-)
Signature · 1 line
1.8.3.1