Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754087AbcJNSVi (ORCPT ); Fri, 14 Oct 2016 14:21:38 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33101 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752259AbcJNSVg (ORCPT ); Fri, 14 Oct 2016 14:21:36 -0400 From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: rkrcmar@redhat.com, yang.zhang.wz@gmail.com, feng.wu@intel.com, mst@redhat.com Subject: [PATCH 0/5] KVM: x86: cleanup and minimal speedup for APICv Date: Fri, 14 Oct 2016 20:21:26 +0200 Message-Id: <1476469291-5039-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1569 Lines: 37 On some benchmarks (e.g. netperf with ioeventfd disabled), APICv posted interrupts turn out to be slower than interrupt injection via KVM_REQ_EVENT. These patches save 40 cycles on kvm-unit-tests "inl" tests (1-2%), but I suspect the effect is bigger on workloads that inject interrupts heavily. Patches 1-2 are micro-optimization of the APICv vmentry code. The interesting one is patch 3. The aim is for APICv to not use KVM_REQ_EVENT at all for interrupts, therefore turning APICv's weakness (having to look at PIR on every vmentry) into a strength (because checking PIR.ON is cheaper than processing KVM_REQ_EVENT). I find that the new code overall makes more sense than the old one, and I like that more of the logic is contained within vmx_deliver_posted_interrupt and vmx_sync_pir_to_irr. KVM_REQ_EVENT did protect from mistakes, so the new code is more delicate, but I still prefer that to duct tape. :) Patches 4 and 5 are other cleanups. Paolo Paolo Bonzini (5): KVM: x86: avoid atomic operations on APICv vmentry KVM: x86: do not scan IRR twice on APICv vmentry KVM: x86: do not use KVM_REQ_EVENT for APICv interrupt injection KVM: x86: remove unnecessary sync_pir_to_irr KVM: vmx: clear pending interrupts on KVM_SET_LAPIC arch/x86/kvm/lapic.c | 45 +++++++++++++++++++++++++++++---------------- arch/x86/kvm/lapic.h | 4 ++-- arch/x86/kvm/vmx.c | 44 ++++++++++++++++++++++++++++++++------------ arch/x86/kvm/x86.c | 45 +++++++++++++++++++++++++-------------------- 4 files changed, 88 insertions(+), 50 deletions(-) -- 1.8.3.1