Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp16492ybx; Mon, 4 Nov 2019 15:03:02 -0800 (PST) X-Google-Smtp-Source: APXvYqxsx30PqbRo1f61L5dHpcj6O2UMACfWwiQ7IFABZ3wZo+G2WQvZiYyIIuiHEtJo7b3K5TgO X-Received: by 2002:a50:fd03:: with SMTP id i3mr32768763eds.70.1572908582765; Mon, 04 Nov 2019 15:03:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572908582; cv=none; d=google.com; s=arc-20160816; b=ABxTOqnKISSoUauDcl/ZnA4zMGznCJYNcqApNNqqxR1CMOMSki0+Pw+vLrRS3/eZ7J oKxWDWGGLTsIdmyFaeqHO76UsjYAIi5AVJZVBV1nYusBtpxUdRtukFEZ/WbgfsikF+Wu iESRaAeGx5MPXc6ffJyGAgrfKwYBWH4r0i15KLZu2GgvsY6euHlsX9ZgDefb4UDYFrIQ 5LV6eubtYUswdN4yrZVA4lObG4zi3zQoeb6ULz5h+R+Kwf134dmHc7C62TzNEzhVUPC8 /2qzrzCCC8MVhoLJs+RJkYqzEDfd/vjYepSIiNaRG21WSFlx1Yk9c0yCQOTmeGQX9rgm pmAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XbUNPv4e7X64k+IbDW//r7wDmNNY6cewcDMc0XpI9XA=; b=WvwWf4d60bTv/LwRb1mc5oovP/EhVO2nxkv3Ay9D1uJh78A8WA6M38UbG7KTtEokBg t5Ibt9jO6HQjAqVbSgAqAhG6afMRId+gBuxjoOLgwhlPd8xD7KAJZGqyU9x0aVUDVc0G LsyhhgZ/vW/jO6bUmrXzw0c7kkCCqzVh+xsGG/pugbjl13nWDKQoPl+R7VeSbohpCKZb CPia0MpmTngka0Vv6+VzGjmSDhqk9bjiMb2FymTKAtwVFmFTNDjBjTCQari84Dm4bsbM HXwqtktmDZvToRQ/W3wXxgfjDbWwQH65Y1oL0paV/nfsp8fzr1BC7KVL/wgkkBp/oZnk Kj5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dO7gRYSy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y9si1522672ejp.175.2019.11.04.15.02.39; Mon, 04 Nov 2019 15:03:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dO7gRYSy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730360AbfKDXAv (ORCPT + 99 others); Mon, 4 Nov 2019 18:00:51 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:29411 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730097AbfKDXAP (ORCPT ); Mon, 4 Nov 2019 18:00:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572908414; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XbUNPv4e7X64k+IbDW//r7wDmNNY6cewcDMc0XpI9XA=; b=dO7gRYSybAMFOVtzY+DwlOUrC0DCa3fiwUD67OC1GcRJ55poxNATcVaMw7mb1PeePrqRG+ 2Sl6JbPqef8b7OGJNXwIrqJ7EA8JOXFo1chWPmWXVkquuuN4d3tPc0yf7lUOYMtmd9T50o +qT2kHSs8zL0IpifDcrKUuvGMBn7ACQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-406-frA79sqPNlGS8-Tl3rHR6w-1; Mon, 04 Nov 2019 18:00:10 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5FC441800DFB; Mon, 4 Nov 2019 23:00:09 +0000 (UTC) Received: from mail (ovpn-121-157.rdu2.redhat.com [10.10.121.157]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37B3119C58; Mon, 4 Nov 2019 23:00:09 +0000 (UTC) From: Andrea Arcangeli To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Paolo Bonzini , Vitaly Kuznetsov , Sean Christopherson Subject: [PATCH 10/13] KVM: x86: optimize more exit handlers in vmx.c Date: Mon, 4 Nov 2019 17:59:58 -0500 Message-Id: <20191104230001.27774-11-aarcange@redhat.com> In-Reply-To: <20191104230001.27774-1-aarcange@redhat.com> References: <20191104230001.27774-1-aarcange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: frA79sqPNlGS8-Tl3rHR6w-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eliminate wasteful call/ret non RETPOLINE case and unnecessary fentry dynamic tracing hooking points. Signed-off-by: Andrea Arcangeli --- arch/x86/kvm/vmx/vmx.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 222467b2040e..a6afa5f4a01c 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -4694,7 +4694,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu= ) =09return 0; } =20 -static int handle_external_interrupt(struct kvm_vcpu *vcpu) +static __always_inline int handle_external_interrupt(struct kvm_vcpu *vcpu= ) { =09++vcpu->stat.irq_exits; =09return 1; @@ -4965,21 +4965,6 @@ void kvm_x86_set_dr7(struct kvm_vcpu *vcpu, unsigned= long val) =09vmcs_writel(GUEST_DR7, val); } =20 -static int handle_cpuid(struct kvm_vcpu *vcpu) -{ -=09return kvm_emulate_cpuid(vcpu); -} - -static int handle_rdmsr(struct kvm_vcpu *vcpu) -{ -=09return kvm_emulate_rdmsr(vcpu); -} - -static int handle_wrmsr(struct kvm_vcpu *vcpu) -{ -=09return kvm_emulate_wrmsr(vcpu); -} - static int handle_tpr_below_threshold(struct kvm_vcpu *vcpu) { =09kvm_apic_update_ppr(vcpu); @@ -4996,11 +4981,6 @@ static int handle_interrupt_window(struct kvm_vcpu *= vcpu) =09return 1; } =20 -static int handle_halt(struct kvm_vcpu *vcpu) -{ -=09return kvm_emulate_halt(vcpu); -} - static int handle_vmcall(struct kvm_vcpu *vcpu) { =09return kvm_emulate_hypercall(vcpu); @@ -5548,11 +5528,11 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vc= pu *vcpu) =3D { =09[EXIT_REASON_IO_INSTRUCTION] =3D handle_io, =09[EXIT_REASON_CR_ACCESS] =3D handle_cr, =09[EXIT_REASON_DR_ACCESS] =3D handle_dr, -=09[EXIT_REASON_CPUID] =3D handle_cpuid, -=09[EXIT_REASON_MSR_READ] =3D handle_rdmsr, -=09[EXIT_REASON_MSR_WRITE] =3D handle_wrmsr, +=09[EXIT_REASON_CPUID] =3D kvm_emulate_cpuid, +=09[EXIT_REASON_MSR_READ] =3D kvm_emulate_rdmsr, +=09[EXIT_REASON_MSR_WRITE] =3D kvm_emulate_wrmsr, =09[EXIT_REASON_PENDING_INTERRUPT] =3D handle_interrupt_window, -=09[EXIT_REASON_HLT] =3D handle_halt, +=09[EXIT_REASON_HLT] =3D kvm_emulate_halt, =09[EXIT_REASON_INVD]=09=09 =3D handle_invd, =09[EXIT_REASON_INVLPG]=09=09 =3D handle_invlpg, =09[EXIT_REASON_RDPMC] =3D handle_rdpmc,