From: kernelfans@gmail.com
To: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org
Cc: Paul Mackerras <paulus@samba.org>, Alexander Graf <agraf@suse.de>
Subject: [RFC 08/11] powerpc: kvm: add a flag in vcore to sync primary with secondry hwthread
Date: Thu, 16 Oct 2014 15:29:57 -0400 [thread overview]
Message-ID: <1413487800-7162-9-git-send-email-kernelfans@gmail.com> (raw)
In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com>
The secondary thread can only jump back to host until primary has set
up the env. Add host_ready field in kvm_vcore to sync this action.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/kvm_host.h | 3 +++
arch/powerpc/kernel/asm-offsets.c | 3 +++
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 11 ++++++++++-
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 9a3355e..1310e03 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -305,6 +305,9 @@ struct kvmppc_vcore {
u32 arch_compat;
ulong pcr;
ulong dpdes; /* doorbell state (POWER8) */
+#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY
+ u8 host_ready;
+#endif
void *mpp_buffer; /* Micro Partition Prefetch buffer */
bool mpp_buffer_is_valid;
};
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 0faa8fe..9c04ac2 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -562,6 +562,9 @@ int main(void)
DEFINE(VCORE_LPCR, offsetof(struct kvmppc_vcore, lpcr));
DEFINE(VCORE_PCR, offsetof(struct kvmppc_vcore, pcr));
DEFINE(VCORE_DPDES, offsetof(struct kvmppc_vcore, dpdes));
+#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY
+ DEFINE(VCORE_HOST_READY, offsetof(struct kvmppc_vcore, host_ready));
+#endif
DEFINE(VCPU_SLB_E, offsetof(struct kvmppc_slb, orige));
DEFINE(VCPU_SLB_V, offsetof(struct kvmppc_slb, origv));
DEFINE(VCPU_SLB_SIZE, sizeof(struct kvmppc_slb));
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 254038b..89ea16c 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -351,7 +351,11 @@ kvm_do_nap:
kvm_secondary_exit_trampoline:
/* all register is free to use, later kvmppc_secondary_stopper_exit set up them*/
- //loop-wait for the primary to signal that host env is ready
+ /* wait until the primary to set up host env */
+ ld r5, HSTATE_KVM_VCORE(r13)
+ ld r0, VCORE_HOST_READY(r5)
+ cmp r0, //primary is ready?
+ bne kvm_secondary_exit_trampoline
LOAD_REG_ADDR(r5, kvmppc_secondary_stopper_exit)
/* fixme, load msr from lpaca stack */
@@ -1821,6 +1825,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
li r0, KVM_GUEST_MODE_NONE
stb r0, HSTATE_IN_GUEST(r13)
+#ifdef PPCKVM_ENABLE_SECONDARY
+ /* signal the secondary that host env is ready */
+ li r0, 1
+ stb r0, VCORE_HOST_READY(r5)
+#endif
ld r0, 112+PPC_LR_STKOFF(r1)
addi r1, r1, 112
mtlr r0
--
1.8.3.1
next prev parent reply other threads:[~2014-10-16 7:26 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-16 19:29 [RFC 00/11]: powerKVM, release the compute power of secondary hwthread on host kernelfans
2014-10-16 19:29 ` [RFC 01/11] sched: introduce sys_cpumask in tsk to adapt asymmetric system kernelfans
2014-11-12 9:22 ` Srikar Dronamraju
2014-11-18 5:07 ` Liu ping fan
2014-10-16 19:29 ` [RFC 02/11] powerpc: kvm: ensure vcpu-thread run only on primary hwthread kernelfans
2014-11-12 10:17 ` Srikar Dronamraju
2014-10-16 19:29 ` [RFC 03/11] powerpc: kvm: add interface to control kvm function on a core kernelfans
2014-10-27 4:04 ` Preeti U Murthy
2014-11-18 5:17 ` Liu ping fan
2014-11-12 13:01 ` Srikar Dronamraju
2014-10-16 19:29 ` [RFC 04/11] powerpc: kvm: introduce a kthread on primary thread to anti tickless kernelfans
2014-10-27 4:45 ` Preeti U Murthy
2014-11-18 5:24 ` Liu ping fan
2014-10-16 19:29 ` [RFC 05/11] sched: introduce stop_cpus_async() to schedule special tsk on cpu kernelfans
2014-10-16 19:29 ` [RFC 06/11] powerpc: kvm: introduce online in paca to indicate whether cpu is needed by host kernelfans
2014-10-27 5:32 ` Preeti U Murthy
2014-11-18 5:29 ` Liu ping fan
2014-10-16 19:29 ` [RFC 07/11] powerpc: kvm: the stopper func to cease secondary hwthread kernelfans
2014-10-22 7:12 ` Preeti U Murthy
2014-10-27 6:07 ` Preeti U Murthy
2014-10-16 19:29 ` kernelfans [this message]
2014-10-27 6:28 ` [RFC 08/11] powerpc: kvm: add a flag in vcore to sync primary with secondry hwthread Preeti U Murthy
2014-10-16 19:29 ` [RFC 09/11] powerpc: kvm: handle time base on secondary hwthread kernelfans
2014-10-27 6:40 ` Preeti U Murthy
2014-11-18 5:43 ` Liu ping fan
2014-10-16 19:29 ` [RFC 10/11] powerpc: kvm: on_primary_thread() force the secondary threads into NAP mode kernelfans
2014-10-16 19:30 ` [RFC 11/11] powerpc: kvm: Kconfig add an option for enabling secondary hwthread kernelfans
2014-10-27 6:44 ` Preeti U Murthy
2014-11-18 5:47 ` Liu ping fan
2014-11-18 17:54 ` [RFC 00/11]: powerKVM, release the compute power of secondary hwthread on host Alexander Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1413487800-7162-9-git-send-email-kernelfans@gmail.com \
--to=kernelfans@gmail.com \
--cc=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).