Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1389221ybn; Wed, 25 Sep 2019 17:36:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYhaP1QZs9qVeYxf6jDdJmsUaMr1mq1QNUyXlDArgmow5luYTgXpfSzLZw+vy7cdsXuoQC X-Received: by 2002:a05:6402:68c:: with SMTP id f12mr763037edy.299.1569458173356; Wed, 25 Sep 2019 17:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569458173; cv=none; d=google.com; s=arc-20160816; b=oan4oEr9uSS4Q5BVDuCaUkgenxOU2SYnDrd2sEKjteDcx+pSvwx/6SM6dkezQTgeye EM8pGkFU9ocfat+R9IIgGdMtlZrx8sAh40XVm4iW6+Fdw/WX8oRCbNGPVLY5mTS+GRWK BeSRrVIYP2JcY4ZruWgXEeRtqHpLSBSEEnmqoio2cPA4Zexc7TFp2/2vgZlFbP6ZcKUC o1PVAVsTsGbTMJFm8Gr8keu0QeTgupVY3Am8LPSoedhqFyNjFfJinPXwYlUVoFxcnKZr 6ww1vjO+G+wKbYT0M8MOWyQ+ErsviPYtlRqFyOsCB8/RAdkNseX9HwB1CkZUrDoXxNFu IAbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Vuo/4TyymrIBy1sCtXiSUQCfpoKelGCIIhOTJSquO7M=; b=qCSUPQx9rqi0Bt93lVyqSJEdSC2OMskhXRVG+mz0RDSWyFLJOZ89gI6rCQdGLrbmVO /ykOnFj+pHeQTmr2xhIFjhTTb1re8ln66SyiSrDK0YDxFBJxh+5fAb6KYFFNiLILHXcM oGV81aaN0dmX1n7QU2MeMc8H7Z3g31OxbyHg65EqCbqelDxPKp5LO641x8opKHYcy/wV cLiVM+eeSnUdZhsPujHGO0l3bcNHdsF0KIvQffQVpcZz/D9EEvSbINPIviWsoKy2E+0b 82XKVBAUDblCA8jSm80mlyjWZQ2GdcJ0Cvetj4ymn2WeprUOAKYUS4so5QBZJzvqEzaL 0/nA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e14si414840eda.104.2019.09.25.17.35.49; Wed, 25 Sep 2019 17:36:13 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503374AbfIWWf2 (ORCPT + 99 others); Mon, 23 Sep 2019 18:35:28 -0400 Received: from mga07.intel.com ([134.134.136.100]:21994 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503353AbfIWWf2 (ORCPT ); Mon, 23 Sep 2019 18:35:28 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Sep 2019 15:35:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,542,1559545200"; d="scan'208";a="213480982" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.41]) by fmsmga004.fm.intel.com with ESMTP; 23 Sep 2019 15:35:26 -0700 Date: Mon, 23 Sep 2019 15:35:26 -0700 From: Sean Christopherson To: Andrea Arcangeli Cc: Paolo Bonzini , Vitaly Kuznetsov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Peter Xu , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/17] KVM: monolithic: x86: handle the request_immediate_exit variation Message-ID: <20190923223526.GQ18195@linux.intel.com> References: <20190920212509.2578-1-aarcange@redhat.com> <20190920212509.2578-4-aarcange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190920212509.2578-4-aarcange@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 20, 2019 at 05:24:55PM -0400, Andrea Arcangeli wrote: > request_immediate_exit is one of those few cases where the pointer to > function of the method isn't fixed at build time and it requires > special handling because hardware_setup() may override it at runtime. > > Signed-off-by: Andrea Arcangeli > --- > arch/x86/kvm/vmx/vmx_ops.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/vmx/vmx_ops.c b/arch/x86/kvm/vmx/vmx_ops.c > index cdcad73935d9..25d441432901 100644 > --- a/arch/x86/kvm/vmx/vmx_ops.c > +++ b/arch/x86/kvm/vmx/vmx_ops.c > @@ -498,7 +498,10 @@ int kvm_x86_ops_check_nested_events(struct kvm_vcpu *vcpu, bool external_intr) > > void kvm_x86_ops_request_immediate_exit(struct kvm_vcpu *vcpu) > { > - vmx_request_immediate_exit(vcpu); > + if (likely(enable_preemption_timer)) > + vmx_request_immediate_exit(vcpu); > + else > + __kvm_request_immediate_exit(vcpu); Rather than wrap this in VMX code, what if we instead take advantage of a monolithic module and add an inline to query enable_preemption_timer? That'd likely save a few CALL/RET/JMP instructions and eliminate __kvm_request_immediate_exit. E.g. something like: if (req_immediate_exit) { kvm_make_request(KVM_REQ_EVENT, vcpu); if (kvm_x86_has_request_immediate_exit()) kvm_x86_request_immediate_exit(vcpu); else smp_send_reschedule(vcpu->cpu); } > } > > void kvm_x86_ops_sched_in(struct kvm_vcpu *kvm, int cpu)