From patchwork Mon Jul 9 17:05:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 1174161 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DDD4D40B22 for ; Mon, 9 Jul 2012 17:06:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752619Ab2GIRGA (ORCPT ); Mon, 9 Jul 2012 13:06:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53706 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752480Ab2GIRF7 (ORCPT ); Mon, 9 Jul 2012 13:05:59 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q69H5x6l027236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 9 Jul 2012 13:05:59 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q69H5mDJ016692; Mon, 9 Jul 2012 13:05:57 -0400 From: Avi Kivity To: Marcelo Tosatti Cc: kvm@vger.kernel.org Subject: [PATCH v3 5/6] KVM: Reorder KVM_REQ_EVENT to optimize processing Date: Mon, 9 Jul 2012 20:05:44 +0300 Message-Id: <1341853545-3023-6-git-send-email-avi@redhat.com> In-Reply-To: <1341853545-3023-1-git-send-email-avi@redhat.com> References: <1341853545-3023-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Since we now process events in order of their bit values, we need to keep KVM_REQ_EVENT last. This is so that if an event which may generate an interrupt (say, PMU) happens, we can process the generated KVM_REQ_EVENT before entering the critical section (and then aborting because vcpu->requests has KVM_REQ_EVENT set). Reorder the KVM_REQ_ definitions to make it so. Signed-off-by: Avi Kivity --- include/linux/kvm_host.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index e3c86f8..6d71058 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -62,13 +62,13 @@ #define KVM_REQ_CLOCK_UPDATE 8 #define KVM_REQ_KICK 9 #define KVM_REQ_DEACTIVATE_FPU 10 -#define KVM_REQ_EVENT 11 -#define KVM_REQ_APF_HALT 12 -#define KVM_REQ_STEAL_UPDATE 13 -#define KVM_REQ_NMI 14 -#define KVM_REQ_IMMEDIATE_EXIT 15 -#define KVM_REQ_PMU 16 -#define KVM_REQ_PMI 17 +#define KVM_REQ_APF_HALT 11 +#define KVM_REQ_STEAL_UPDATE 12 +#define KVM_REQ_NMI 13 +#define KVM_REQ_IMMEDIATE_EXIT 14 +#define KVM_REQ_PMU 15 +#define KVM_REQ_PMI 16 +#define KVM_REQ_EVENT 17 /* Keep after any req which can cause an interrupt */ #define KVM_USERSPACE_IRQ_SOURCE_ID 0