From patchwork Wed Aug 26 14:15:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 44037 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7QEBU7m011033 for ; Wed, 26 Aug 2009 14:11:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757444AbZHZOK0 (ORCPT ); Wed, 26 Aug 2009 10:10:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757411AbZHZOK0 (ORCPT ); Wed, 26 Aug 2009 10:10:26 -0400 Received: from ey-out-2122.google.com ([74.125.78.26]:18176 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757391AbZHZOKZ (ORCPT ); Wed, 26 Aug 2009 10:10:25 -0400 Received: by ey-out-2122.google.com with SMTP id 25so44629eya.19 for ; Wed, 26 Aug 2009 07:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=RzO1JGggBbz9uNnZsxqgr4eJaBTOwAa0TSO0EKhsmm4=; b=nzW4ezry46rEfRxeSIfMCF6WMeToh3UDWc6eeA7xNb0MojhSOcQVdxxGHT0BFB7oOe MDOh3/WxukMNhEA5eKA2JGAG2DSF0nvAxsyTFrqaxsbcv9WXyHvNAxp0DwqXwLN8lsD7 jQ7l9ucUDUBT7Gb8ZfXkhk6xBoAUAS2HEwPbg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=nEwDv46RD8oy8vhizL5J56gyip32xnA+b850AMUOJDtA60OUaDBhhsnS9EHGCixTlU +/Fu4huKgTPsxCfcJDZ6Mb1LCsgURpfkNxvYFwTb4jOTehC4szhk42tqU049bzzpZT3M VMRfbu6M5Lk9056FKqp70s7xdHzM44KFr4RV0= Received: by 10.210.112.1 with SMTP id k1mr7860423ebc.37.1251295826159; Wed, 26 Aug 2009 07:10:26 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 28sm72481eyg.42.2009.08.26.07.10.12 (version=SSLv3 cipher=RC4-MD5); Wed, 26 Aug 2009 07:10:13 -0700 (PDT) Message-ID: <4A95437C.2060707@gmail.com> Date: Wed, 26 Aug 2009 16:15:24 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Thunderbird/3.0b3 MIME-Version: 1.0 To: Avi Kivity CC: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 05/47] KVM: VMX: Optimize vmx_get_cpl() References: <1251282609-12835-1-git-send-email-avi@redhat.com> <1251282609-12835-6-git-send-email-avi@redhat.com> In-Reply-To: <1251282609-12835-6-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Op 26-08-09 12:29, Avi Kivity schreef: > Instead of calling vmx_get_segment() (which reads a whole bunch of > vmcs fields), read only the cs selector which contains the cpl. > > Signed-off-by: Avi Kivity Can't we also optimise cs_ss_rpl_check()? (Please review, untested.) ------------- >8 ---------------------- 8< -------------------- Instead of calling vmx_get_segment() (which reads a whole bunch of vmcs fields), read only the cs/ss selectors which contains the rpls. Signed-off-by: Roel Kluin --- -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 29f9129..5d8512a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1932,13 +1932,8 @@ static bool ldtr_valid(struct kvm_vcpu *vcpu) static bool cs_ss_rpl_check(struct kvm_vcpu *vcpu) { - struct kvm_segment cs, ss; - - vmx_get_segment(vcpu, &cs, VCPU_SREG_CS); - vmx_get_segment(vcpu, &ss, VCPU_SREG_SS); - - return ((cs.selector & SELECTOR_RPL_MASK) == - (ss.selector & SELECTOR_RPL_MASK)); + return ((vmcs_read16(GUEST_CS_SELECTOR) & SELECTOR_RPL_MASK) == + (vmcs_read16(GUEST_SS_SELECTOR) & SELECTOR_RPL_MASK)); } /*