kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI
@ 2015-10-30  0:09 Suresh Warrier
  2015-10-30  0:09 ` [PATCH 1/6] KVM: PPC: Book3S HV: Host-side RM data structures Suresh Warrier
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Suresh Warrier @ 2015-10-30  0:09 UTC (permalink / raw)
  To: kvm; +Cc: warrier, paulus, agraf, mpe

When the VCPU target of an H_IPI hypercall is not running
in the guest, we need to do a kick VCPU (wake the VCPU thread)
to make it runnable. The real-mode version of the H_IPI hypercall
cannot do this because it involves waking a sleeping thread.
Thus the hcall returns H_TOO_HARD which forces a switch back
to host so that the H_IPI call can be completed in virtual mode.
This has been found to cause a slowdown for many workloads like
YCSB MongoDB, small message networking, etc. 

This patch set optimizes the wakeup of the target VCPU by posting
a free core already running in the host to do the wakeup, thus
avoiding the switch to host and back. It requires maintaining a
bitmask of all the available cores in the system to indicate if
they are in the host or running in some guest. It also requires
the H_IPI hypercall to search for a free host core and send it a
new IPI message PPC_MSG_RM_HOST_ACTION after stashing away some
parameters like the pointer to VCPU for the IPI handler. Locks
are avoided by using atomic operations to save core state, to
find and reserve a core in the host, etc.

Note that it is possible for a guest to be destroyed and its
VCPUs freed before the IPI handler gets to run. This case is
handled by ensuring that any pending PPC_MSG_RM_HOST_ACTION
IPIs are completed before proceeding with freeing the VCPUs.

A tunable h_ipi_redirect is also included in the patch set to
disable the feature. 

This patch set depends upon patches to powerpc to increase the
number of supported IPI messages to 8 and which also defines
the PPC_MSG_RM_HOST_ACTION message.

Suresh Warrier (6):
  KVM: PPC: Book3S HV: Host-side RM data structures
  KVM: PPC: Book3S HV: Manage core host state
  KVM: PPC: Book3S HV: kvmppc_host_rm_ops - handle offlining CPUs
  KVM: PPC: Book3S HV: Host side kick VCPU when poked by real-mode KVM
  KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
  KVM: PPC: Book3S HV: Add tunable to control H_IPI redirection

 arch/powerpc/include/asm/kvm_ppc.h   |  33 +++++++
 arch/powerpc/kernel/smp.c            |  11 +++
 arch/powerpc/kvm/book3s_hv.c         | 166 +++++++++++++++++++++++++++++++++++
 arch/powerpc/kvm/book3s_hv_builtin.c |   3 +
 arch/powerpc/kvm/book3s_hv_rm_xics.c | 120 ++++++++++++++++++++++++-
 arch/powerpc/kvm/powerpc.c           |  10 +++
 6 files changed, 340 insertions(+), 3 deletions(-)

-- 
1.8.3.4


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/6] KVM: PPC: Book3S HV: Host-side RM data structures
  2015-10-30  0:09 [PATCH 0/6] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI Suresh Warrier
@ 2015-10-30  0:09 ` Suresh Warrier
  2015-10-30  0:09 ` [PATCH 2/6] KVM: PPC: Book3S HV: Manage core host state Suresh Warrier
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Suresh Warrier @ 2015-10-30  0:09 UTC (permalink / raw)
  To: kvm; +Cc: warrier, paulus, agraf, mpe

This patch defines the data structures to support the setting up
of host side operations while running in real mode in the guest,
and also the functions to allocate and free it.

The operations are for now limited to virtual XICS operations.
Currently, we have only defined one operation in the data
structure:
         - Wake up a VCPU sleeping in the host when it
           receives a virtual interrupt

The operations are assigned at the core level because PowerKVM
requires that the host run in SMT off mode. For each core,
we will need to manage its state atomically - where the state
is defined by:
1. Is the core running in the host?
2. Is there a Real Mode (RM) operation pending on the host?

Currently, core state is only managed at the whole-core level
even when the system is in split-core mode. This just limits
the number of free or "available" cores in the host to perform
any host-side operations.

The kvmppc_host_rm_core.rm_data allows any data to be passed by
KVM in real mode to the host core along with the operation to
be performed.

The kvmppc_host_rm_ops structure is allocated the very first time
a guest VM is started. Initial core state is also set - all online
cores are in the host. This structure is never deleted, not even
when there are no active guests. However, it needs to be freed
when the module is unloaded because the kvmppc_host_rm_ops_hv
can contain function pointers to kvm-hv.ko functions for the
different supported host operations.

Signed-off-by: Suresh Warrier <warrier@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/kvm_ppc.h   | 31 ++++++++++++++++
 arch/powerpc/kvm/book3s_hv.c         | 70 ++++++++++++++++++++++++++++++++++++
 arch/powerpc/kvm/book3s_hv_builtin.c |  3 ++
 3 files changed, 104 insertions(+)

diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index c6ef05b..47cd441 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -437,6 +437,8 @@ static inline int kvmppc_xics_enabled(struct kvm_vcpu *vcpu)
 {
 	return vcpu->arch.irq_type == KVMPPC_IRQ_XICS;
 }
+extern void kvmppc_alloc_host_rm_ops(void);
+extern void kvmppc_free_host_rm_ops(void);
 extern void kvmppc_xics_free_icp(struct kvm_vcpu *vcpu);
 extern int kvmppc_xics_create_icp(struct kvm_vcpu *vcpu, unsigned long server);
 extern int kvm_vm_ioctl_xics_irq(struct kvm *kvm, struct kvm_irq_level *args);
@@ -446,6 +448,8 @@ extern int kvmppc_xics_set_icp(struct kvm_vcpu *vcpu, u64 icpval);
 extern int kvmppc_xics_connect_vcpu(struct kvm_device *dev,
 			struct kvm_vcpu *vcpu, u32 cpu);
 #else
+static inline void kvmppc_alloc_host_rm_ops(void) {};
+static inline void kvmppc_free_host_rm_ops(void) {};
 static inline int kvmppc_xics_enabled(struct kvm_vcpu *vcpu)
 	{ return 0; }
 static inline void kvmppc_xics_free_icp(struct kvm_vcpu *vcpu) { }
@@ -459,6 +463,33 @@ static inline int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd)
 	{ return 0; }
 #endif
 
+/*
+ * Host-side operations we want to set up while running in real
+ * mode in the guest operating on the xics.
+ * Currently only VCPU wakeup is supported.
+ */
+
+union kvmppc_rm_state {
+	unsigned long raw;
+	struct {
+		u32 in_host;
+		u32 rm_action;
+	};
+};
+
+struct kvmppc_host_rm_core {
+	union kvmppc_rm_state rm_state;
+	void *rm_data;
+	char pad[112];
+};
+
+struct kvmppc_host_rm_ops {
+	struct kvmppc_host_rm_core	*rm_core;
+	void		(*vcpu_kick)(struct kvm_vcpu *vcpu);
+};
+
+extern struct kvmppc_host_rm_ops *kvmppc_host_rm_ops_hv;
+
 static inline unsigned long kvmppc_get_epr(struct kvm_vcpu *vcpu)
 {
 #ifdef CONFIG_KVM_BOOKE_HV
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 9c26c5a..9176e56 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -2967,6 +2967,73 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
 	goto out_srcu;
 }
 
+#ifdef CONFIG_KVM_XICS
+/*
+ * Allocate a per-core structure for managing state about which cores are
+ * running in the host versus the guest and for exchanging data between
+ * real mode KVM and CPU running in the host.
+ * This is only done for the first VM.
+ * The allocated structure stays even if all VMs have stopped.
+ * It is only freed when the kvm-hv module is unloaded.
+ * It's OK for this routine to fail, we just don't support host
+ * core operations like redirecting H_IPI wakeups.
+ */
+void kvmppc_alloc_host_rm_ops(void)
+{
+	struct kvmppc_host_rm_ops *ops;
+	unsigned long l_ops;
+	int cpu, core;
+	int size;
+
+	/* Not the first time here ? */
+	if (kvmppc_host_rm_ops_hv != NULL)
+		return;
+
+	ops = kzalloc(sizeof(struct kvmppc_host_rm_ops), GFP_KERNEL);
+	if (!ops)
+		return;
+
+	size = cpu_nr_cores() * sizeof(struct kvmppc_host_rm_core);
+	ops->rm_core = kzalloc(size, GFP_KERNEL);
+
+	if (!ops->rm_core) {
+		kfree(ops);
+		return;
+	}
+
+	for (cpu = 0; cpu < nr_cpu_ids; cpu += threads_per_core) {
+		if (!cpu_online(cpu))
+			continue;
+
+		core = cpu >> threads_shift;
+		ops->rm_core[core].rm_state.in_host = 1;
+	}
+
+	/*
+	 * Make the contents of the kvmppc_host_rm_ops structure visible
+	 * to other CPUs before we assign it to the global variable.
+	 * Do an atomic assignment (no locks used here), but if someone
+	 * beats us to it, just free our copy and return.
+	 */
+	smp_wmb();
+	l_ops = (unsigned long) ops;
+
+	if (cmpxchg64((unsigned long *)&kvmppc_host_rm_ops_hv, 0, l_ops)) {
+		kfree(ops->rm_core);
+		kfree(ops);
+	}
+}
+
+void kvmppc_free_host_rm_ops(void)
+{
+	if (kvmppc_host_rm_ops_hv) {
+		kfree(kvmppc_host_rm_ops_hv->rm_core);
+		kfree(kvmppc_host_rm_ops_hv);
+		kvmppc_host_rm_ops_hv = NULL;
+	}
+}
+#endif
+
 static int kvmppc_core_init_vm_hv(struct kvm *kvm)
 {
 	unsigned long lpcr, lpid;
@@ -2979,6 +3046,8 @@ static int kvmppc_core_init_vm_hv(struct kvm *kvm)
 		return -ENOMEM;
 	kvm->arch.lpid = lpid;
 
+	kvmppc_alloc_host_rm_ops();
+
 	/*
 	 * Since we don't flush the TLB when tearing down a VM,
 	 * and this lpid might have previously been used,
@@ -3212,6 +3281,7 @@ static int kvmppc_book3s_init_hv(void)
 
 static void kvmppc_book3s_exit_hv(void)
 {
+	kvmppc_free_host_rm_ops();
 	kvmppc_hv_ops = NULL;
 }
 
diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c
index fd7006b..5f0380d 100644
--- a/arch/powerpc/kvm/book3s_hv_builtin.c
+++ b/arch/powerpc/kvm/book3s_hv_builtin.c
@@ -283,3 +283,6 @@ void kvmhv_commence_exit(int trap)
 			kvmhv_interrupt_vcore(vc, ee);
 	}
 }
+
+struct kvmppc_host_rm_ops *kvmppc_host_rm_ops_hv;
+EXPORT_SYMBOL_GPL(kvmppc_host_rm_ops_hv);
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/6] KVM: PPC: Book3S HV: Manage core host state
  2015-10-30  0:09 [PATCH 0/6] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI Suresh Warrier
  2015-10-30  0:09 ` [PATCH 1/6] KVM: PPC: Book3S HV: Host-side RM data structures Suresh Warrier
@ 2015-10-30  0:09 ` Suresh Warrier
  2015-10-30  0:09 ` [PATCH 3/6] KVM: PPC: Book3S HV: kvmppc_host_rm_ops - handle offlining CPUs Suresh Warrier
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Suresh Warrier @ 2015-10-30  0:09 UTC (permalink / raw)
  To: kvm; +Cc: warrier, paulus, agraf, mpe

Update the core host state in kvmppc_host_rm_ops whenever
the primary thread of the core enters the guest or returns
back.

Signed-off-by: Suresh Warrier <warrier@linux.vnet.ibm.com>
---
 arch/powerpc/kvm/book3s_hv.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 9176e56..7a62aaa 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -2261,6 +2261,46 @@ static void post_guest_process(struct kvmppc_vcore *vc, bool is_master)
 }
 
 /*
+ * Clear core from the list of active host cores as we are about to
+ * enter the guest. Only do this if it is the primary thread of the
+ * core (not if a subcore) that is entering the guest.
+ */
+static inline void kvmppc_clear_host_core(int cpu)
+{
+	int core;
+
+	if (!kvmppc_host_rm_ops_hv || cpu_thread_in_core(cpu))
+		return;
+	/*
+	 * Memory barrier can be omitted here as we will do a smp_wmb()
+	 * later in kvmppc_start_thread and we need ensure that state is
+	 * visible to other CPUs only after we enter guest.
+	 */
+	core = cpu >> threads_shift;
+	kvmppc_host_rm_ops_hv->rm_core[core].rm_state.in_host = 0;
+}
+
+/*
+ * Advertise this core as an active host core since we exited the guest
+ * Only need to do this if it is the primary thread of the core that is
+ * exiting.
+ */
+static inline void kvmppc_set_host_core(int cpu)
+{
+	int core;
+
+	if (!kvmppc_host_rm_ops_hv || cpu_thread_in_core(cpu))
+		return;
+
+	/*
+	 * Memory barrier can be omitted here because we do a spin_unlock
+	 * immediately after this which provides the memory barrier.
+	 */
+	core = cpu >> threads_shift;
+	kvmppc_host_rm_ops_hv->rm_core[core].rm_state.in_host = 1;
+}
+
+/*
  * Run a set of guest threads on a physical core.
  * Called with vc->lock held.
  */
@@ -2372,6 +2412,8 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)
 		}
 	}
 
+	kvmppc_clear_host_core(pcpu);
+
 	/* Start all the threads */
 	active = 0;
 	for (sub = 0; sub < core_info.n_subcores; ++sub) {
@@ -2468,6 +2510,8 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)
 			kvmppc_ipi_thread(pcpu + i);
 	}
 
+	kvmppc_set_host_core(pcpu);
+
 	spin_unlock(&vc->lock);
 
 	/* make sure updates to secondary vcpu structs are visible now */
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/6] KVM: PPC: Book3S HV: kvmppc_host_rm_ops - handle offlining CPUs
  2015-10-30  0:09 [PATCH 0/6] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI Suresh Warrier
  2015-10-30  0:09 ` [PATCH 1/6] KVM: PPC: Book3S HV: Host-side RM data structures Suresh Warrier
  2015-10-30  0:09 ` [PATCH 2/6] KVM: PPC: Book3S HV: Manage core host state Suresh Warrier
@ 2015-10-30  0:09 ` Suresh Warrier
  2015-10-30  0:09 ` [PATCH 4/6] KVM: PPC: Book3S HV: Host side kick VCPU when poked by real-mode KVM Suresh Warrier
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Suresh Warrier @ 2015-10-30  0:09 UTC (permalink / raw)
  To: kvm; +Cc: warrier, paulus, agraf, mpe

The kvmppc_host_rm_ops structure keeps track of which cores are
are in the host by maintaining a bitmask of active/runnable
online CPUs that have not entered the guest. This patch adds
support to manage the bitmask when a CPU is offlined or onlined
in the host.

Signed-off-by: Suresh Warrier <warrier@linux.vnet.ibm.com>
---
 arch/powerpc/kvm/book3s_hv.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 7a62aaa..390af5b 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -3012,6 +3012,36 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
 }
 
 #ifdef CONFIG_KVM_XICS
+static int kvmppc_cpu_notify(struct notifier_block *self, unsigned long action,
+			void *hcpu)
+{
+	unsigned long cpu = (long)hcpu;
+
+	switch (action) {
+	case CPU_UP_PREPARE:
+	case CPU_UP_PREPARE_FROZEN:
+		kvmppc_set_host_core(cpu);
+		break;
+
+#ifdef CONFIG_HOTPLUG_CPU
+	case CPU_DEAD:
+	case CPU_DEAD_FROZEN:
+	case CPU_UP_CANCELED:
+	case CPU_UP_CANCELED_FROZEN:
+		kvmppc_clear_host_core(cpu);
+		break;
+#endif
+	default:
+		break;
+	}
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block kvmppc_cpu_notifier = {
+	    .notifier_call = kvmppc_cpu_notify,
+};
+
 /*
  * Allocate a per-core structure for managing state about which cores are
  * running in the host versus the guest and for exchanging data between
@@ -3045,6 +3075,8 @@ void kvmppc_alloc_host_rm_ops(void)
 		return;
 	}
 
+	get_online_cpus();
+
 	for (cpu = 0; cpu < nr_cpu_ids; cpu += threads_per_core) {
 		if (!cpu_online(cpu))
 			continue;
@@ -3063,14 +3095,21 @@ void kvmppc_alloc_host_rm_ops(void)
 	l_ops = (unsigned long) ops;
 
 	if (cmpxchg64((unsigned long *)&kvmppc_host_rm_ops_hv, 0, l_ops)) {
+		put_online_cpus();
 		kfree(ops->rm_core);
 		kfree(ops);
+		return;
 	}
+
+	register_cpu_notifier(&kvmppc_cpu_notifier);
+
+	put_online_cpus();
 }
 
 void kvmppc_free_host_rm_ops(void)
 {
 	if (kvmppc_host_rm_ops_hv) {
+		unregister_cpu_notifier(&kvmppc_cpu_notifier);
 		kfree(kvmppc_host_rm_ops_hv->rm_core);
 		kfree(kvmppc_host_rm_ops_hv);
 		kvmppc_host_rm_ops_hv = NULL;
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/6] KVM: PPC: Book3S HV: Host side kick VCPU when poked by real-mode KVM
  2015-10-30  0:09 [PATCH 0/6] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI Suresh Warrier
                   ` (2 preceding siblings ...)
  2015-10-30  0:09 ` [PATCH 3/6] KVM: PPC: Book3S HV: kvmppc_host_rm_ops - handle offlining CPUs Suresh Warrier
@ 2015-10-30  0:09 ` Suresh Warrier
  2015-10-30  0:09 ` [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU Suresh Warrier
  2015-10-30  0:09 ` [PATCH 6/6] KVM: PPC: Book3S HV: Add tunable to control H_IPI redirection Suresh Warrier
  5 siblings, 0 replies; 13+ messages in thread
From: Suresh Warrier @ 2015-10-30  0:09 UTC (permalink / raw)
  To: kvm; +Cc: warrier, paulus, agraf, mpe

This patch adds the support for the kick VCPU operation for
kvmppc_host_rm_ops. The kvmppc_xics_ipi_action() function
provides the function to be invoked for a host side operation
when poked by the real mode KVM. This is initiated by KVM by
sending an IPI to any free host core.

KVM real mode must set the rm_action to XICS_RM_KICK_VCPU and
rm_data to point to the VCPU to be woken up before sending the IPI.
Note that we have allocated one kvmppc_host_rm_core structure
per core. The above values need to be set in the structure
corresponding to the core to which the IPI will be sent.

Signed-off-by: Suresh Warrier <warrier@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/kvm_ppc.h   |  1 +
 arch/powerpc/kvm/book3s_hv.c         |  2 ++
 arch/powerpc/kvm/book3s_hv_rm_xics.c | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+)

diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 47cd441..1b93519 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -447,6 +447,7 @@ extern u64 kvmppc_xics_get_icp(struct kvm_vcpu *vcpu);
 extern int kvmppc_xics_set_icp(struct kvm_vcpu *vcpu, u64 icpval);
 extern int kvmppc_xics_connect_vcpu(struct kvm_device *dev,
 			struct kvm_vcpu *vcpu, u32 cpu);
+extern void kvmppc_xics_ipi_action(void);
 #else
 static inline void kvmppc_alloc_host_rm_ops(void) {};
 static inline void kvmppc_free_host_rm_ops(void) {};
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 390af5b..80b1eb3 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -3085,6 +3085,8 @@ void kvmppc_alloc_host_rm_ops(void)
 		ops->rm_core[core].rm_state.in_host = 1;
 	}
 
+	ops->vcpu_kick = kvmppc_fast_vcpu_kick_hv;
+
 	/*
 	 * Make the contents of the kvmppc_host_rm_ops structure visible
 	 * to other CPUs before we assign it to the global variable.
diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c
index 24f5807..43ffbfe 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_xics.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c
@@ -17,6 +17,7 @@
 #include <asm/xics.h>
 #include <asm/debug.h>
 #include <asm/synch.h>
+#include <asm/cputhreads.h>
 #include <asm/ppc-opcode.h>
 
 #include "book3s_xics.h"
@@ -623,3 +624,38 @@ int kvmppc_rm_h_eoi(struct kvm_vcpu *vcpu, unsigned long xirr)
  bail:
 	return check_too_hard(xics, icp);
 }
+
+/*  --- Non-real mode XICS-related built-in routines ---  */
+
+/**
+ * Host Operations poked by RM KVM
+ */
+static void rm_host_ipi_action(int action, void *data)
+{
+	switch (action) {
+	case XICS_RM_KICK_VCPU:
+		kvmppc_host_rm_ops_hv->vcpu_kick(data);
+		break;
+	default:
+		WARN(1, "Unexpected rm_action=%d data=%p\n", action, data);
+		break;
+	}
+
+}
+
+void kvmppc_xics_ipi_action(void)
+{
+	int core;
+	unsigned int cpu = smp_processor_id();
+	struct kvmppc_host_rm_core *rm_corep;
+
+	core = cpu >> threads_shift;
+	rm_corep = &kvmppc_host_rm_ops_hv->rm_core[core];
+
+	if (rm_corep->rm_data) {
+		rm_host_ipi_action(rm_corep->rm_state.rm_action,
+							rm_corep->rm_data);
+		rm_corep->rm_data = NULL;
+		rm_corep->rm_state.rm_action = 0;
+	}
+}
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
  2015-10-30  0:09 [PATCH 0/6] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI Suresh Warrier
                   ` (3 preceding siblings ...)
  2015-10-30  0:09 ` [PATCH 4/6] KVM: PPC: Book3S HV: Host side kick VCPU when poked by real-mode KVM Suresh Warrier
@ 2015-10-30  0:09 ` Suresh Warrier
  2015-10-30  4:52   ` kbuild test robot
  2015-10-30  9:23   ` kbuild test robot
  2015-10-30  0:09 ` [PATCH 6/6] KVM: PPC: Book3S HV: Add tunable to control H_IPI redirection Suresh Warrier
  5 siblings, 2 replies; 13+ messages in thread
From: Suresh Warrier @ 2015-10-30  0:09 UTC (permalink / raw)
  To: kvm; +Cc: warrier, paulus, agraf, mpe

This patch adds support to real-mode KVM to search for a core
running in the host partition and send it an IPI message with
VCPU to be woken. This avoids having to switch to the host
partition to complete an H_IPI hypercall when the VCPU which
is the target of the the H_IPI is not loaded (is not running
in the guest).

The patch also includes the support in the IPI handler running
in the host to do the wakeup by calling kvmppc_xics_ipi_action
for the PPC_MSG_RM_HOST_ACTION message.

When a guest is being destroyed, we need to ensure that there
are no pending IPIs waiting to wake up a VCPU before we free
the VCPUs of the guest. This is accomplished by:
- Forces a PPC_MSG_CALL_FUNCTION IPI to be completed by all CPUs
  before freeing any VCPUs in kvm_arch_destroy_vm()
- Any PPC_MSG_RM_HOST_ACTION messages must be executed first
  before any other PPC_MSG_CALL_FUNCTION messages

Signed-off-by: Suresh Warrier <warrier@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/smp.c            | 11 +++++
 arch/powerpc/kvm/book3s_hv_rm_xics.c | 81 ++++++++++++++++++++++++++++++++++--
 arch/powerpc/kvm/powerpc.c           | 10 +++++
 3 files changed, 99 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 8c07bfad..8958c2a 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -280,6 +280,17 @@ irqreturn_t smp_ipi_demux(void)
 
 	do {
 		all = xchg(&info->messages, 0);
+#if defined(CONFIG_KVM_XICS) && defined(CONFIG_KVM_BOOK3S_HV_POSSIBLE)
+		/*
+		 * Must check for PPC_MSG_RM_HOST_ACTION messages
+		 * before PPC_MSG_CALL_FUNCTION messages because when
+		 * a VM is destroyed, we call kick_all_cpus_sync()
+		 * to ensure that any pending PPC_MSG_RM_HOST_ACTION
+		 * messages have completed before we free any VCPUs.
+		 */
+		if (all & IPI_MESSAGE(PPC_MSG_RM_HOST_ACTION))
+			kvmppc_xics_ipi_action();
+#endif
 		if (all & IPI_MESSAGE(PPC_MSG_CALL_FUNCTION))
 			generic_smp_call_function_interrupt();
 		if (all & IPI_MESSAGE(PPC_MSG_RESCHEDULE))
diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c
index 43ffbfe..b8d6403 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_xics.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c
@@ -51,11 +51,70 @@ static void ics_rm_check_resend(struct kvmppc_xics *xics,
 
 /* -- ICP routines -- */
 
+/*
+ * We start the search from our current CPU Id in the core map
+ * and go in a circle until we get back to our ID looking for a
+ * core that is running in host context and that hasn't already
+ * been targeted for another rm_host_ops.
+ *
+ * In the future, could consider using a fairer algorithm (one
+ * that distributes the IPIs better)
+ *
+ * Returns -1, if no CPU could be found in the host
+ * Else, returns a CPU Id which has been reserved for use
+ */
+static inline int grab_next_hostcore(int start,
+		struct kvmppc_host_rm_core *rm_core, int max, int action)
+{
+	bool success;
+	int core;
+	union kvmppc_rm_state old, new;
+
+	for (core = start + 1; core < max; core++)  {
+		old = new = READ_ONCE(rm_core[core].rm_state);
+
+		if (!old.in_host || old.rm_action)
+			continue;
+
+		/* Try to grab this host core if not taken already. */
+		new.rm_action = action;
+
+		success = cmpxchg64(&rm_core[core].rm_state.raw,
+						old.raw, new.raw) == old.raw;
+		if (success) {
+			/*
+			 * Make sure that the store to the rm_action is made
+			 * visible before we return to caller (and the
+			 * subsequent store to rm_data) to synchronize with
+			 * the IPI handler.
+			 */
+			smp_wmb();
+			return core;
+		}
+	}
+
+	return -1;
+}
+
+static inline int find_available_hostcore(int action)
+{
+	int core;
+	int my_core = smp_processor_id() >> threads_shift;
+	struct kvmppc_host_rm_core *rm_core = kvmppc_host_rm_ops_hv->rm_core;
+
+	core = grab_next_hostcore(my_core, rm_core, cpu_nr_cores(), action);
+	if (core == -1)
+		core = grab_next_hostcore(core, rm_core, my_core, action);
+
+	return core;
+}
+
 static void icp_rm_set_vcpu_irq(struct kvm_vcpu *vcpu,
 				struct kvm_vcpu *this_vcpu)
 {
 	struct kvmppc_icp *this_icp = this_vcpu->arch.icp;
 	int cpu;
+	int hcore, hcpu;
 
 	/* Mark the target VCPU as having an interrupt pending */
 	vcpu->stat.queue_intr++;
@@ -67,11 +126,25 @@ static void icp_rm_set_vcpu_irq(struct kvm_vcpu *vcpu,
 		return;
 	}
 
-	/* Check if the core is loaded, if not, too hard */
+	/*
+	 * Check if the core is loaded,
+	 * if not, find an available host core to post to wake the VCPU,
+	 * if we can't find one, set up state to eventually return too hard.
+	 */
 	cpu = vcpu->arch.thread_cpu;
 	if (cpu < 0 || cpu >= nr_cpu_ids) {
-		this_icp->rm_action |= XICS_RM_KICK_VCPU;
-		this_icp->rm_kick_target = vcpu;
+		hcore = -1;
+		if (kvmppc_host_rm_ops_hv)
+			hcore = find_available_hostcore(XICS_RM_KICK_VCPU);
+		if (hcore != -1) {
+			hcpu = hcore << threads_shift;
+			kvmppc_host_rm_ops_hv->rm_core[hcore].rm_data = vcpu;
+			smp_muxed_ipi_rm_message_pass(hcpu,
+						PPC_MSG_RM_HOST_ACTION);
+		} else {
+			this_icp->rm_action |= XICS_RM_KICK_VCPU;
+			this_icp->rm_kick_target = vcpu;
+		}
 		return;
 	}
 
@@ -655,7 +728,9 @@ void kvmppc_xics_ipi_action(void)
 	if (rm_corep->rm_data) {
 		rm_host_ipi_action(rm_corep->rm_state.rm_action,
 							rm_corep->rm_data);
+		/* Order these stores against the real mode KVM */
 		rm_corep->rm_data = NULL;
+		smp_wmb();
 		rm_corep->rm_state.rm_action = 0;
 	}
 }
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 2e51289..67de02d 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -437,6 +437,16 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
 	unsigned int i;
 	struct kvm_vcpu *vcpu;
 
+#ifdef CONFIG_KVM_XICS
+	/*
+	 * We call kick_all_cpus_sync() to ensure that all
+	 * CPUs have executed any pending IPIs before we
+	 * continue and free VCPUs structures below.
+	 */
+	if (is_kvmppc_hv_enabled(kvm))
+		kick_all_cpus_sync();
+#endif
+
 	kvm_for_each_vcpu(i, vcpu, kvm)
 		kvm_arch_vcpu_free(vcpu);
 
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/6] KVM: PPC: Book3S HV: Add tunable to control H_IPI redirection
  2015-10-30  0:09 [PATCH 0/6] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI Suresh Warrier
                   ` (4 preceding siblings ...)
  2015-10-30  0:09 ` [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU Suresh Warrier
@ 2015-10-30  0:09 ` Suresh Warrier
  5 siblings, 0 replies; 13+ messages in thread
From: Suresh Warrier @ 2015-10-30  0:09 UTC (permalink / raw)
  To: kvm; +Cc: warrier, paulus, agraf, mpe

Redirecting the wakeup of a VCPU from the H_IPI hypercall to
a core running in the host is usually a good idea, most workloads
seemed to benefit. However, in one heavily interrupt-driven SMT1
workload, some regression was observed. This patch adds a kvm_hv
module parameter called h_ipi_redirect to control this feature.

The default value for this tunable is 1 - that is enable the feature.

Signed-off-by: Suresh Warrier <warrier@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/kvm_ppc.h   |  1 +
 arch/powerpc/kvm/book3s_hv.c         | 11 +++++++++++
 arch/powerpc/kvm/book3s_hv_rm_xics.c |  5 ++++-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 1b93519..29d1442 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -448,6 +448,7 @@ extern int kvmppc_xics_set_icp(struct kvm_vcpu *vcpu, u64 icpval);
 extern int kvmppc_xics_connect_vcpu(struct kvm_device *dev,
 			struct kvm_vcpu *vcpu, u32 cpu);
 extern void kvmppc_xics_ipi_action(void);
+extern int h_ipi_redirect;
 #else
 static inline void kvmppc_alloc_host_rm_ops(void) {};
 static inline void kvmppc_free_host_rm_ops(void) {};
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 80b1eb3..20b2598 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -81,6 +81,17 @@ static int target_smt_mode;
 module_param(target_smt_mode, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(target_smt_mode, "Target threads per core (0 = max)");
 
+#ifdef CONFIG_KVM_XICS
+static struct kernel_param_ops module_param_ops = {
+	.set = param_set_int,
+	.get = param_get_int,
+};
+
+module_param_cb(h_ipi_redirect, &module_param_ops, &h_ipi_redirect,
+							S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(h_ipi_redirect, "Redirect H_IPI wakeup to a free host core");
+#endif
+
 static void kvmppc_end_cede(struct kvm_vcpu *vcpu);
 static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu);
 
diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c
index b8d6403..b162f41 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_xics.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c
@@ -24,6 +24,9 @@
 
 #define DEBUG_PASSUP
 
+int h_ipi_redirect = 1;
+EXPORT_SYMBOL(h_ipi_redirect);
+
 static void icp_rm_deliver_irq(struct kvmppc_xics *xics, struct kvmppc_icp *icp,
 			    u32 new_irq);
 
@@ -134,7 +137,7 @@ static void icp_rm_set_vcpu_irq(struct kvm_vcpu *vcpu,
 	cpu = vcpu->arch.thread_cpu;
 	if (cpu < 0 || cpu >= nr_cpu_ids) {
 		hcore = -1;
-		if (kvmppc_host_rm_ops_hv)
+		if (kvmppc_host_rm_ops_hv && h_ipi_redirect)
 			hcore = find_available_hostcore(XICS_RM_KICK_VCPU);
 		if (hcore != -1) {
 			hcpu = hcore << threads_shift;
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
  2015-10-30  0:09 ` [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU Suresh Warrier
@ 2015-10-30  4:52   ` kbuild test robot
  2015-10-30 15:16     ` Suresh E. Warrier
  2015-10-30  9:23   ` kbuild test robot
  1 sibling, 1 reply; 13+ messages in thread
From: kbuild test robot @ 2015-10-30  4:52 UTC (permalink / raw)
  To: Suresh Warrier; +Cc: kbuild-all, kvm, warrier, paulus, agraf, mpe

[-- Attachment #1: Type: text/plain, Size: 1893 bytes --]

Hi Suresh,

[auto build test ERROR on kvm/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Suresh-Warrier/KVM-PPC-Book3S-HV-Optimize-wakeup-VCPU-from-H_IPI/20151030-081329
config: powerpc-defconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=powerpc 

All errors (new ones prefixed by >>):

   arch/powerpc/kvm/book3s_hv_rm_xics.c: In function 'icp_rm_set_vcpu_irq':
>> arch/powerpc/kvm/book3s_hv_rm_xics.c:142:4: error: implicit declaration of function 'smp_muxed_ipi_rm_message_pass' [-Werror=implicit-function-declaration]
       smp_muxed_ipi_rm_message_pass(hcpu,
       ^
   arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: error: 'PPC_MSG_RM_HOST_ACTION' undeclared (first use in this function)
          PPC_MSG_RM_HOST_ACTION);
          ^
   arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: note: each undeclared identifier is reported only once for each function it appears in
   cc1: all warnings being treated as errors

vim +/smp_muxed_ipi_rm_message_pass +142 arch/powerpc/kvm/book3s_hv_rm_xics.c

   136			hcore = -1;
   137			if (kvmppc_host_rm_ops_hv)
   138				hcore = find_available_hostcore(XICS_RM_KICK_VCPU);
   139			if (hcore != -1) {
   140				hcpu = hcore << threads_shift;
   141				kvmppc_host_rm_ops_hv->rm_core[hcore].rm_data = vcpu;
 > 142				smp_muxed_ipi_rm_message_pass(hcpu,
   143							PPC_MSG_RM_HOST_ACTION);
   144			} else {
   145				this_icp->rm_action |= XICS_RM_KICK_VCPU;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 21511 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
  2015-10-30  0:09 ` [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU Suresh Warrier
  2015-10-30  4:52   ` kbuild test robot
@ 2015-10-30  9:23   ` kbuild test robot
  1 sibling, 0 replies; 13+ messages in thread
From: kbuild test robot @ 2015-10-30  9:23 UTC (permalink / raw)
  To: Suresh Warrier; +Cc: kbuild-all, kvm, warrier, paulus, agraf, mpe

[-- Attachment #1: Type: text/plain, Size: 2760 bytes --]

Hi Suresh,

[auto build test ERROR on kvm/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Suresh-Warrier/KVM-PPC-Book3S-HV-Optimize-wakeup-VCPU-from-H_IPI/20151030-081329
config: powerpc-defconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=powerpc 

All errors (new ones prefixed by >>):

   arch/powerpc/kernel/smp.c: In function 'smp_ipi_demux':
>> arch/powerpc/kernel/smp.c:261:25: error: 'PPC_MSG_RM_HOST_ACTION' undeclared (first use in this function)
      if (all & IPI_MESSAGE(PPC_MSG_RM_HOST_ACTION))
                            ^
   arch/powerpc/kernel/smp.c:239:41: note: in definition of macro 'IPI_MESSAGE'
    #define IPI_MESSAGE(A) (1 << (24 - 8 * (A)))
                                            ^
   arch/powerpc/kernel/smp.c:261:25: note: each undeclared identifier is reported only once for each function it appears in
      if (all & IPI_MESSAGE(PPC_MSG_RM_HOST_ACTION))
                            ^
   arch/powerpc/kernel/smp.c:239:41: note: in definition of macro 'IPI_MESSAGE'
    #define IPI_MESSAGE(A) (1 << (24 - 8 * (A)))
                                            ^
--
   arch/powerpc/kvm/book3s_hv_rm_xics.c: In function 'icp_rm_set_vcpu_irq':
   arch/powerpc/kvm/book3s_hv_rm_xics.c:142:4: error: implicit declaration of function 'smp_muxed_ipi_rm_message_pass' [-Werror=implicit-function-declaration]
       smp_muxed_ipi_rm_message_pass(hcpu,
       ^
>> arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: error: 'PPC_MSG_RM_HOST_ACTION' undeclared (first use in this function)
          PPC_MSG_RM_HOST_ACTION);
          ^
   arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: note: each undeclared identifier is reported only once for each function it appears in
   cc1: all warnings being treated as errors

vim +/PPC_MSG_RM_HOST_ACTION +261 arch/powerpc/kernel/smp.c

   255			 * Must check for PPC_MSG_RM_HOST_ACTION messages
   256			 * before PPC_MSG_CALL_FUNCTION messages because when
   257			 * a VM is destroyed, we call kick_all_cpus_sync()
   258			 * to ensure that any pending PPC_MSG_RM_HOST_ACTION
   259			 * messages have completed before we free any VCPUs.
   260			 */
 > 261			if (all & IPI_MESSAGE(PPC_MSG_RM_HOST_ACTION))
   262				kvmppc_xics_ipi_action();
   263	#endif
   264			if (all & IPI_MESSAGE(PPC_MSG_CALL_FUNCTION))

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 21511 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
  2015-10-30  4:52   ` kbuild test robot
@ 2015-10-30 15:16     ` Suresh E. Warrier
  2015-11-02  2:51       ` [kbuild-all] " Fengguang Wu
  0 siblings, 1 reply; 13+ messages in thread
From: Suresh E. Warrier @ 2015-10-30 15:16 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, kvm, paulus, agraf, mpe

This patch set depends upon a previous patch set that I had submitted to
linux-ppc. The URL for that is:

https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-October/135794.html

-suresh

On 10/29/2015 11:52 PM, kbuild test robot wrote:
> Hi Suresh,
> 
> [auto build test ERROR on kvm/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
> 
> url:    https://github.com/0day-ci/linux/commits/Suresh-Warrier/KVM-PPC-Book3S-HV-Optimize-wakeup-VCPU-from-H_IPI/20151030-081329
> config: powerpc-defconfig (attached as .config)
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=powerpc 
> 
> All errors (new ones prefixed by >>):
> 
>    arch/powerpc/kvm/book3s_hv_rm_xics.c: In function 'icp_rm_set_vcpu_irq':
>>> arch/powerpc/kvm/book3s_hv_rm_xics.c:142:4: error: implicit declaration of function 'smp_muxed_ipi_rm_message_pass' [-Werror=implicit-function-declaration]
>        smp_muxed_ipi_rm_message_pass(hcpu,
>        ^
>    arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: error: 'PPC_MSG_RM_HOST_ACTION' undeclared (first use in this function)
>           PPC_MSG_RM_HOST_ACTION);
>           ^
>    arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: note: each undeclared identifier is reported only once for each function it appears in
>    cc1: all warnings being treated as errors
> 
> vim +/smp_muxed_ipi_rm_message_pass +142 arch/powerpc/kvm/book3s_hv_rm_xics.c
> 
>    136			hcore = -1;
>    137			if (kvmppc_host_rm_ops_hv)
>    138				hcore = find_available_hostcore(XICS_RM_KICK_VCPU);
>    139			if (hcore != -1) {
>    140				hcpu = hcore << threads_shift;
>    141				kvmppc_host_rm_ops_hv->rm_core[hcore].rm_data = vcpu;
>  > 142				smp_muxed_ipi_rm_message_pass(hcpu,
>    143							PPC_MSG_RM_HOST_ACTION);
>    144			} else {
>    145				this_icp->rm_action |= XICS_RM_KICK_VCPU;
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [kbuild-all] [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
  2015-10-30 15:16     ` Suresh E. Warrier
@ 2015-11-02  2:51       ` Fengguang Wu
  2015-11-02 22:10         ` Suresh E. Warrier
  0 siblings, 1 reply; 13+ messages in thread
From: Fengguang Wu @ 2015-11-02  2:51 UTC (permalink / raw)
  To: Suresh E. Warrier; +Cc: paulus, kbuild-all, kvm, agraf

Hi Suresh,

Sorry for the noise!

Do you have a git tree that the robot can monitor and test?

In this case of one patchset depending on another, there is no chance
for the robot to do valid testing based on emailed patches.

Thanks,
Fengguang

On Fri, Oct 30, 2015 at 10:16:06AM -0500, Suresh E. Warrier wrote:
> This patch set depends upon a previous patch set that I had submitted to
> linux-ppc. The URL for that is:
> 
> https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-October/135794.html
> 
> -suresh
> 
> On 10/29/2015 11:52 PM, kbuild test robot wrote:
> > Hi Suresh,
> > 
> > [auto build test ERROR on kvm/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
> > 
> > url:    https://github.com/0day-ci/linux/commits/Suresh-Warrier/KVM-PPC-Book3S-HV-Optimize-wakeup-VCPU-from-H_IPI/20151030-081329
> > config: powerpc-defconfig (attached as .config)
> > reproduce:
> >         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # save the attached .config to linux build tree
> >         make.cross ARCH=powerpc 
> > 
> > All errors (new ones prefixed by >>):
> > 
> >    arch/powerpc/kvm/book3s_hv_rm_xics.c: In function 'icp_rm_set_vcpu_irq':
> >>> arch/powerpc/kvm/book3s_hv_rm_xics.c:142:4: error: implicit declaration of function 'smp_muxed_ipi_rm_message_pass' [-Werror=implicit-function-declaration]
> >        smp_muxed_ipi_rm_message_pass(hcpu,
> >        ^
> >    arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: error: 'PPC_MSG_RM_HOST_ACTION' undeclared (first use in this function)
> >           PPC_MSG_RM_HOST_ACTION);
> >           ^
> >    arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: note: each undeclared identifier is reported only once for each function it appears in
> >    cc1: all warnings being treated as errors
> > 
> > vim +/smp_muxed_ipi_rm_message_pass +142 arch/powerpc/kvm/book3s_hv_rm_xics.c
> > 
> >    136			hcore = -1;
> >    137			if (kvmppc_host_rm_ops_hv)
> >    138				hcore = find_available_hostcore(XICS_RM_KICK_VCPU);
> >    139			if (hcore != -1) {
> >    140				hcpu = hcore << threads_shift;
> >    141				kvmppc_host_rm_ops_hv->rm_core[hcore].rm_data = vcpu;
> >  > 142				smp_muxed_ipi_rm_message_pass(hcpu,
> >    143							PPC_MSG_RM_HOST_ACTION);
> >    144			} else {
> >    145				this_icp->rm_action |= XICS_RM_KICK_VCPU;
> > 
> > ---
> > 0-DAY kernel test infrastructure                Open Source Technology Center
> > https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> > 
> 
> _______________________________________________
> kbuild-all mailing list
> kbuild-all@lists.01.org
> https://lists.01.org/mailman/listinfo/kbuild-all

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [kbuild-all] [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
  2015-11-02  2:51       ` [kbuild-all] " Fengguang Wu
@ 2015-11-02 22:10         ` Suresh E. Warrier
  2015-11-02 22:46           ` Michael Ellerman
  0 siblings, 1 reply; 13+ messages in thread
From: Suresh E. Warrier @ 2015-11-02 22:10 UTC (permalink / raw)
  To: Fengguang Wu; +Cc: paulus, kbuild-all, kvm, agraf

Hi Fengguang,

I understand the problem.

I will send you the URL for the powerpc git tree once my patches
are pulled in so that we can then pass that to the robot.

Thanks.
-suresh

On 11/01/2015 08:51 PM, Fengguang Wu wrote:
> Hi Suresh,
> 
> Sorry for the noise!
> 
> Do you have a git tree that the robot can monitor and test?
> 
> In this case of one patchset depending on another, there is no chance
> for the robot to do valid testing based on emailed patches.
> 
> Thanks,
> Fengguang
> 
> On Fri, Oct 30, 2015 at 10:16:06AM -0500, Suresh E. Warrier wrote:
>> This patch set depends upon a previous patch set that I had submitted to
>> linux-ppc. The URL for that is:
>>
>> https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-October/135794.html
>>
>> -suresh
>>
>> On 10/29/2015 11:52 PM, kbuild test robot wrote:
>>> Hi Suresh,
>>>
>>> [auto build test ERROR on kvm/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
>>>
>>> url:    https://github.com/0day-ci/linux/commits/Suresh-Warrier/KVM-PPC-Book3S-HV-Optimize-wakeup-VCPU-from-H_IPI/20151030-081329
>>> config: powerpc-defconfig (attached as .config)
>>> reproduce:
>>>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>>>         chmod +x ~/bin/make.cross
>>>         # save the attached .config to linux build tree
>>>         make.cross ARCH=powerpc 
>>>
>>> All errors (new ones prefixed by >>):
>>>
>>>    arch/powerpc/kvm/book3s_hv_rm_xics.c: In function 'icp_rm_set_vcpu_irq':
>>>>> arch/powerpc/kvm/book3s_hv_rm_xics.c:142:4: error: implicit declaration of function 'smp_muxed_ipi_rm_message_pass' [-Werror=implicit-function-declaration]
>>>        smp_muxed_ipi_rm_message_pass(hcpu,
>>>        ^
>>>    arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: error: 'PPC_MSG_RM_HOST_ACTION' undeclared (first use in this function)
>>>           PPC_MSG_RM_HOST_ACTION);
>>>           ^
>>>    arch/powerpc/kvm/book3s_hv_rm_xics.c:143:7: note: each undeclared identifier is reported only once for each function it appears in
>>>    cc1: all warnings being treated as errors
>>>
>>> vim +/smp_muxed_ipi_rm_message_pass +142 arch/powerpc/kvm/book3s_hv_rm_xics.c
>>>
>>>    136			hcore = -1;
>>>    137			if (kvmppc_host_rm_ops_hv)
>>>    138				hcore = find_available_hostcore(XICS_RM_KICK_VCPU);
>>>    139			if (hcore != -1) {
>>>    140				hcpu = hcore << threads_shift;
>>>    141				kvmppc_host_rm_ops_hv->rm_core[hcore].rm_data = vcpu;
>>>  > 142				smp_muxed_ipi_rm_message_pass(hcpu,
>>>    143							PPC_MSG_RM_HOST_ACTION);
>>>    144			} else {
>>>    145				this_icp->rm_action |= XICS_RM_KICK_VCPU;
>>>
>>> ---
>>> 0-DAY kernel test infrastructure                Open Source Technology Center
>>> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
>>>
>>
>> _______________________________________________
>> kbuild-all mailing list
>> kbuild-all@lists.01.org
>> https://lists.01.org/mailman/listinfo/kbuild-all
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [kbuild-all] [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU
  2015-11-02 22:10         ` Suresh E. Warrier
@ 2015-11-02 22:46           ` Michael Ellerman
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Ellerman @ 2015-11-02 22:46 UTC (permalink / raw)
  To: Suresh E. Warrier, Fengguang Wu; +Cc: paulus, kbuild-all, kvm, agraf

On Mon, 2015-11-02 at 16:10 -0600, Suresh E. Warrier wrote:

> Hi Fengguang,
> 
> I understand the problem.
> 
> I will send you the URL for the powerpc git tree once my patches
> are pulled in so that we can then pass that to the robot.

The robot already knows about the powerpc next tree.

It chose the KVM tree because of your subject line.

Sending a series to one tree (KVM) that depends on a series in another tree
(powerpc) is always problematic, even for humans, so the robot is not really at
fault here.

cheers


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-11-02 22:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-30  0:09 [PATCH 0/6] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI Suresh Warrier
2015-10-30  0:09 ` [PATCH 1/6] KVM: PPC: Book3S HV: Host-side RM data structures Suresh Warrier
2015-10-30  0:09 ` [PATCH 2/6] KVM: PPC: Book3S HV: Manage core host state Suresh Warrier
2015-10-30  0:09 ` [PATCH 3/6] KVM: PPC: Book3S HV: kvmppc_host_rm_ops - handle offlining CPUs Suresh Warrier
2015-10-30  0:09 ` [PATCH 4/6] KVM: PPC: Book3S HV: Host side kick VCPU when poked by real-mode KVM Suresh Warrier
2015-10-30  0:09 ` [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU Suresh Warrier
2015-10-30  4:52   ` kbuild test robot
2015-10-30 15:16     ` Suresh E. Warrier
2015-11-02  2:51       ` [kbuild-all] " Fengguang Wu
2015-11-02 22:10         ` Suresh E. Warrier
2015-11-02 22:46           ` Michael Ellerman
2015-10-30  9:23   ` kbuild test robot
2015-10-30  0:09 ` [PATCH 6/6] KVM: PPC: Book3S HV: Add tunable to control H_IPI redirection Suresh Warrier

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).