From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [PATCH 0/3] Optimize STI; HLT while an interrupt is pending Date: Mon, 14 Feb 2011 16:42:14 +0200 Message-ID: <1297694537-9268-1-git-send-email-avi@redhat.com> To: Marcelo Tosatti , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:34903 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753636Ab1BNOma (ORCPT ); Mon, 14 Feb 2011 09:42:30 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1EEgUvr013930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 14 Feb 2011 09:42:30 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1EEgTCn005719 for ; Mon, 14 Feb 2011 09:42:29 -0500 Sender: kvm-owner@vger.kernel.org List-ID: If the guest executes the following code sequence CLI ... (interrupt becomes pending) STI HLT then we will exit on HLT, enter the guest, and exit immediately again on virtual interrupt pending. As this is wasteful, this patch set short circuits the whole operation to inject the interrupt immediately. (as I've seen this occur very rarely in ftrace, compared to what I saw before I wrote the patch, please don't apply patches 2 and 3 until I've had a chance to benchmark it) Avi Kivity (3): KVM: VMX: Cache CPU_BASED_VM_EXEC_CONTROL VMCS field KVM: VMX: Short circuit STI; HLT while an interrupt is pending KVM: SVM: Short circuit STI; HLT while an interrupt is pending arch/x86/kvm/svm.c | 9 +++++++ arch/x86/kvm/vmx.c | 69 ++++++++++++++++++++++++++++----------------------- 2 files changed, 47 insertions(+), 31 deletions(-)