Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: PPC: Book3S HV: Add tunable to control H_IPI redirection

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>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Suresh E. Warrier and committed by
Paul Mackerras
520fe9c6 e17769eb

+16 -1
+1
arch/powerpc/include/asm/kvm_ppc.h
··· 464 464 extern int kvmppc_xics_connect_vcpu(struct kvm_device *dev, 465 465 struct kvm_vcpu *vcpu, u32 cpu); 466 466 extern void kvmppc_xics_ipi_action(void); 467 + extern int h_ipi_redirect; 467 468 #else 468 469 static inline void kvmppc_alloc_host_rm_ops(void) {}; 469 470 static inline void kvmppc_free_host_rm_ops(void) {};
+11
arch/powerpc/kvm/book3s_hv.c
··· 81 81 module_param(target_smt_mode, int, S_IRUGO | S_IWUSR); 82 82 MODULE_PARM_DESC(target_smt_mode, "Target threads per core (0 = max)"); 83 83 84 + #ifdef CONFIG_KVM_XICS 85 + static struct kernel_param_ops module_param_ops = { 86 + .set = param_set_int, 87 + .get = param_get_int, 88 + }; 89 + 90 + module_param_cb(h_ipi_redirect, &module_param_ops, &h_ipi_redirect, 91 + S_IRUGO | S_IWUSR); 92 + MODULE_PARM_DESC(h_ipi_redirect, "Redirect H_IPI wakeup to a free host core"); 93 + #endif 94 + 84 95 static void kvmppc_end_cede(struct kvm_vcpu *vcpu); 85 96 static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu); 86 97
+4 -1
arch/powerpc/kvm/book3s_hv_rm_xics.c
··· 24 24 25 25 #define DEBUG_PASSUP 26 26 27 + int h_ipi_redirect = 1; 28 + EXPORT_SYMBOL(h_ipi_redirect); 29 + 27 30 static void icp_rm_deliver_irq(struct kvmppc_xics *xics, struct kvmppc_icp *icp, 28 31 u32 new_irq); 29 32 ··· 151 148 cpu = vcpu->arch.thread_cpu; 152 149 if (cpu < 0 || cpu >= nr_cpu_ids) { 153 150 hcore = -1; 154 - if (kvmppc_host_rm_ops_hv) 151 + if (kvmppc_host_rm_ops_hv && h_ipi_redirect) 155 152 hcore = find_available_hostcore(XICS_RM_KICK_VCPU); 156 153 if (hcore != -1) { 157 154 icp_send_hcore_msg(hcore, vcpu);