From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16073C433FE for ; Wed, 27 Oct 2021 14:10:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED14860EC0 for ; Wed, 27 Oct 2021 14:10:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238114AbhJ0ONT (ORCPT ); Wed, 27 Oct 2021 10:13:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22939 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238108AbhJ0ONP (ORCPT ); Wed, 27 Oct 2021 10:13:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635343850; 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=cVoa83Mt37o7LxzLcjDlhV+CHKfwNHfJj/XpdkZn+wM=; b=d308hwnv7O0t+sslPO+fxl/hQlG8c3iNdqeNNE6UPmyW2xOBrD9jAm5wI6adYhIugAbD+u 3lwJWGeqdwbgOF9VH7UIoNFBNhcAHvvf2q8NWWYhonIMhax88y9pcnicQQ3nzaZgfSy80F cZJ6/STI7aNlm6TIRgaz9AT+Sf0t9DM= 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-450-HHU7zf4COr2mtmPfjcXavw-1; Wed, 27 Oct 2021 10:10:45 -0400 X-MC-Unique: HHU7zf4COr2mtmPfjcXavw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A6B619251DC; Wed, 27 Oct 2021 14:10:24 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id C89B45DF36; Wed, 27 Oct 2021 14:10:07 +0000 (UTC) Message-ID: <363479dd55760979da208cacf015a6f7fe2afd69.camel@redhat.com> Subject: Re: [PATCH v2 12/43] KVM: x86: Tweak halt emulation helper names to free up kvm_vcpu_halt() From: Maxim Levitsky To: Sean Christopherson , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Atish Patra , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , Oliver Upton , Jing Zhang Date: Wed, 27 Oct 2021 17:10:06 +0300 In-Reply-To: <20211009021236.4122790-13-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-13-seanjc@google.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > Rename a variety of HLT-related helpers to free up the function name > "kvm_vcpu_halt" for future use in generic KVM code, e.g. to differentiate > between "block" and "halt". > > No functional change intended. > > Reviewed-by: David Matlack > Signed-off-by: Sean Christopherson > --- > arch/x86/include/asm/kvm_host.h | 2 +- > arch/x86/kvm/vmx/nested.c | 2 +- > arch/x86/kvm/vmx/vmx.c | 4 ++-- > arch/x86/kvm/x86.c | 13 +++++++------ > 4 files changed, 11 insertions(+), 10 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 7aafc27ce7a9..328103a520d3 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -1689,7 +1689,7 @@ int kvm_emulate_monitor(struct kvm_vcpu *vcpu); > int kvm_fast_pio(struct kvm_vcpu *vcpu, int size, unsigned short port, int in); > int kvm_emulate_cpuid(struct kvm_vcpu *vcpu); > int kvm_emulate_halt(struct kvm_vcpu *vcpu); > -int kvm_vcpu_halt(struct kvm_vcpu *vcpu); > +int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu); > int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu); > int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu); > > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c > index af1bbb73430a..d0237a441feb 100644 > --- a/arch/x86/kvm/vmx/nested.c > +++ b/arch/x86/kvm/vmx/nested.c > @@ -3619,7 +3619,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) > !(nested_cpu_has(vmcs12, CPU_BASED_INTR_WINDOW_EXITING) && > (vmcs12->guest_rflags & X86_EFLAGS_IF))) { > vmx->nested.nested_run_pending = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); > } > break; > case GUEST_ACTIVITY_WAIT_SIPI: > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 1c8b2b6e7ed9..5517893f12fc 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -4741,7 +4741,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, > if (kvm_emulate_instruction(vcpu, 0)) { > if (vcpu->arch.halt_request) { > vcpu->arch.halt_request = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); Could you elaborate on why you choose _noskip suffix? As far as I see, kvm_vcpu_halt just calls __kvm_vcpu_halt with new VCPU run state/exit reason, which is used only when local apic is not in the kernel (which is these days not that supported configuration). Other user of __kvm_vcpu_halt is something SEV related. Best regards, Maxim Levitsky > } > return 1; > } > @@ -5415,7 +5415,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) > > if (vcpu->arch.halt_request) { > vcpu->arch.halt_request = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); > } > > /* > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 4a52a08707de..9c23ae1d483d 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -8649,7 +8649,7 @@ void kvm_arch_exit(void) > #endif > } > > -static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason) > +static int __kvm_emulate_halt(struct kvm_vcpu *vcpu, int state, int reason) > { > ++vcpu->stat.halt_exits; > if (lapic_in_kernel(vcpu)) { > @@ -8661,11 +8661,11 @@ static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason) > } > } > > -int kvm_vcpu_halt(struct kvm_vcpu *vcpu) > +int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu) > { > - return __kvm_vcpu_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT); > + return __kvm_emulate_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT); > } > -EXPORT_SYMBOL_GPL(kvm_vcpu_halt); > +EXPORT_SYMBOL_GPL(kvm_emulate_halt_noskip); > > int kvm_emulate_halt(struct kvm_vcpu *vcpu) > { > @@ -8674,7 +8674,7 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu) > * TODO: we might be squashing a GUESTDBG_SINGLESTEP-triggered > * KVM_EXIT_DEBUG here. > */ > - return kvm_vcpu_halt(vcpu) && ret; > + return kvm_emulate_halt_noskip(vcpu) && ret; > } > EXPORT_SYMBOL_GPL(kvm_emulate_halt); > > @@ -8682,7 +8682,8 @@ int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu) > { > int ret = kvm_skip_emulated_instruction(vcpu); > > - return __kvm_vcpu_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD, KVM_EXIT_AP_RESET_HOLD) && ret; > + return __kvm_emulate_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD, > + KVM_EXIT_AP_RESET_HOLD) && ret; > } > EXPORT_SYMBOL_GPL(kvm_emulate_ap_reset_hold); > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D603C433EF for ; Wed, 27 Oct 2021 14:11:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC9BA60EFE for ; Wed, 27 Oct 2021 14:11:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CC9BA60EFE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=udjkzssT6sZwr0pqyw/e1kPOpKlvKZEthKFQ6D2jF9A=; b=zVQ/4XarqofB3O IdmelPNzB5OuPTCoKkNVlRHawHOdM3knyiu28yXhBNbErf+H8Jx9iCIC+hteP4g7xhmAsaoR7Vqok 7oBgHOA1q6z0DW3EmZEp07kIRWQ9v6qXVtg3fw8bX87hL2OlgMiz9e74lXXzdAV53mN44Scbmopvo rLn/hiIfjCve4KTVPH/9csEy+1T72vXXVIOHAs8+/Ped14myELpJSY9BY/+uICSBdt2Z+B3X5EnBA Vb+9diOvpL/PqJRrXhoHfqESBjITut2HQ1WL30o7R0H3Tg2R2lTQ+rO7L5mrZuWf7X0PAHbHpuXvN xXbS1CERanrHw3sH2eTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfjdv-0054WF-26; Wed, 27 Oct 2021 14:11:03 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfjdi-0054Ss-Vt for linux-riscv@lists.infradead.org; Wed, 27 Oct 2021 14:10:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635343850; 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=cVoa83Mt37o7LxzLcjDlhV+CHKfwNHfJj/XpdkZn+wM=; b=d308hwnv7O0t+sslPO+fxl/hQlG8c3iNdqeNNE6UPmyW2xOBrD9jAm5wI6adYhIugAbD+u 3lwJWGeqdwbgOF9VH7UIoNFBNhcAHvvf2q8NWWYhonIMhax88y9pcnicQQ3nzaZgfSy80F cZJ6/STI7aNlm6TIRgaz9AT+Sf0t9DM= 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-450-HHU7zf4COr2mtmPfjcXavw-1; Wed, 27 Oct 2021 10:10:45 -0400 X-MC-Unique: HHU7zf4COr2mtmPfjcXavw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A6B619251DC; Wed, 27 Oct 2021 14:10:24 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id C89B45DF36; Wed, 27 Oct 2021 14:10:07 +0000 (UTC) Message-ID: <363479dd55760979da208cacf015a6f7fe2afd69.camel@redhat.com> Subject: Re: [PATCH v2 12/43] KVM: x86: Tweak halt emulation helper names to free up kvm_vcpu_halt() From: Maxim Levitsky To: Sean Christopherson , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Atish Patra , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , Oliver Upton , Jing Zhang Date: Wed, 27 Oct 2021 17:10:06 +0300 In-Reply-To: <20211009021236.4122790-13-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-13-seanjc@google.com> User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211027_071051_121314_1175002E X-CRM114-Status: GOOD ( 21.25 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > Rename a variety of HLT-related helpers to free up the function name > "kvm_vcpu_halt" for future use in generic KVM code, e.g. to differentiate > between "block" and "halt". > > No functional change intended. > > Reviewed-by: David Matlack > Signed-off-by: Sean Christopherson > --- > arch/x86/include/asm/kvm_host.h | 2 +- > arch/x86/kvm/vmx/nested.c | 2 +- > arch/x86/kvm/vmx/vmx.c | 4 ++-- > arch/x86/kvm/x86.c | 13 +++++++------ > 4 files changed, 11 insertions(+), 10 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 7aafc27ce7a9..328103a520d3 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -1689,7 +1689,7 @@ int kvm_emulate_monitor(struct kvm_vcpu *vcpu); > int kvm_fast_pio(struct kvm_vcpu *vcpu, int size, unsigned short port, int in); > int kvm_emulate_cpuid(struct kvm_vcpu *vcpu); > int kvm_emulate_halt(struct kvm_vcpu *vcpu); > -int kvm_vcpu_halt(struct kvm_vcpu *vcpu); > +int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu); > int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu); > int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu); > > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c > index af1bbb73430a..d0237a441feb 100644 > --- a/arch/x86/kvm/vmx/nested.c > +++ b/arch/x86/kvm/vmx/nested.c > @@ -3619,7 +3619,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) > !(nested_cpu_has(vmcs12, CPU_BASED_INTR_WINDOW_EXITING) && > (vmcs12->guest_rflags & X86_EFLAGS_IF))) { > vmx->nested.nested_run_pending = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); > } > break; > case GUEST_ACTIVITY_WAIT_SIPI: > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 1c8b2b6e7ed9..5517893f12fc 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -4741,7 +4741,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, > if (kvm_emulate_instruction(vcpu, 0)) { > if (vcpu->arch.halt_request) { > vcpu->arch.halt_request = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); Could you elaborate on why you choose _noskip suffix? As far as I see, kvm_vcpu_halt just calls __kvm_vcpu_halt with new VCPU run state/exit reason, which is used only when local apic is not in the kernel (which is these days not that supported configuration). Other user of __kvm_vcpu_halt is something SEV related. Best regards, Maxim Levitsky > } > return 1; > } > @@ -5415,7 +5415,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) > > if (vcpu->arch.halt_request) { > vcpu->arch.halt_request = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); > } > > /* > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 4a52a08707de..9c23ae1d483d 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -8649,7 +8649,7 @@ void kvm_arch_exit(void) > #endif > } > > -static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason) > +static int __kvm_emulate_halt(struct kvm_vcpu *vcpu, int state, int reason) > { > ++vcpu->stat.halt_exits; > if (lapic_in_kernel(vcpu)) { > @@ -8661,11 +8661,11 @@ static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason) > } > } > > -int kvm_vcpu_halt(struct kvm_vcpu *vcpu) > +int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu) > { > - return __kvm_vcpu_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT); > + return __kvm_emulate_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT); > } > -EXPORT_SYMBOL_GPL(kvm_vcpu_halt); > +EXPORT_SYMBOL_GPL(kvm_emulate_halt_noskip); > > int kvm_emulate_halt(struct kvm_vcpu *vcpu) > { > @@ -8674,7 +8674,7 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu) > * TODO: we might be squashing a GUESTDBG_SINGLESTEP-triggered > * KVM_EXIT_DEBUG here. > */ > - return kvm_vcpu_halt(vcpu) && ret; > + return kvm_emulate_halt_noskip(vcpu) && ret; > } > EXPORT_SYMBOL_GPL(kvm_emulate_halt); > > @@ -8682,7 +8682,8 @@ int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu) > { > int ret = kvm_skip_emulated_instruction(vcpu); > > - return __kvm_vcpu_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD, KVM_EXIT_AP_RESET_HOLD) && ret; > + return __kvm_emulate_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD, > + KVM_EXIT_AP_RESET_HOLD) && ret; > } > EXPORT_SYMBOL_GPL(kvm_emulate_ap_reset_hold); > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FEDEC433EF for ; Wed, 27 Oct 2021 14:12:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6AD9660E0B for ; Wed, 27 Oct 2021 14:12:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6AD9660E0B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=noZkbDdoDRH3FN6llF2WsRrEril323LJVFrmri6H0KU=; b=bjo4JKMX4pWnzF 2Au7fvSQwdU/ixL/cni4f72SntFFzwLB+hBkcO9ekwXLgzRF8Lzw41yOdSPw2/VaBkWbWzfiB0AV5 viZ4C/7vjhdTL/223ENTWGnsOwrAUgxYka44S+5Kiet8/S/SAJ2d/xHTIhp4KOlLANT95Zbdaussd 39STAvbheSUqQBSb4UvRnBWXbeNImXGDk+MlwYptpKbUbn00B3a0vWm4H35JuAedqi+foiED5BxxU /B1MXjJOMmvhQryZAgbGVxKJIk8V/00MRWyrL2xOOoayv6JC7/YFqmMSddfEPKzGiNNC8aL+de5Vw XgVP5EM0v5Zx2FSyiFqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfjdk-0054Tn-Ig; Wed, 27 Oct 2021 14:10:52 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfjdh-0054SV-70 for linux-arm-kernel@lists.infradead.org; Wed, 27 Oct 2021 14:10:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635343848; 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=cVoa83Mt37o7LxzLcjDlhV+CHKfwNHfJj/XpdkZn+wM=; b=NnzVwUEhtgr3TedfiSMqVp6NoruZnJVJi1PCKYRgq79ssWc8WI07JmLqTh8UT6MlbAoSxR 2arbjHMN/N8GUX/u42Z8Z6r+b+t9DwGuNuFtixke67oUc84zaBuX6I2S6pQkoNEKG8/UN5 i4+49O3ryuXck+AZQyv0B3lJieoP57Q= 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-450-HHU7zf4COr2mtmPfjcXavw-1; Wed, 27 Oct 2021 10:10:45 -0400 X-MC-Unique: HHU7zf4COr2mtmPfjcXavw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A6B619251DC; Wed, 27 Oct 2021 14:10:24 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id C89B45DF36; Wed, 27 Oct 2021 14:10:07 +0000 (UTC) Message-ID: <363479dd55760979da208cacf015a6f7fe2afd69.camel@redhat.com> Subject: Re: [PATCH v2 12/43] KVM: x86: Tweak halt emulation helper names to free up kvm_vcpu_halt() From: Maxim Levitsky To: Sean Christopherson , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Atish Patra , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , Oliver Upton , Jing Zhang Date: Wed, 27 Oct 2021 17:10:06 +0300 In-Reply-To: <20211009021236.4122790-13-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-13-seanjc@google.com> User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211027_071049_362322_1DCAB659 X-CRM114-Status: GOOD ( 21.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > Rename a variety of HLT-related helpers to free up the function name > "kvm_vcpu_halt" for future use in generic KVM code, e.g. to differentiate > between "block" and "halt". > > No functional change intended. > > Reviewed-by: David Matlack > Signed-off-by: Sean Christopherson > --- > arch/x86/include/asm/kvm_host.h | 2 +- > arch/x86/kvm/vmx/nested.c | 2 +- > arch/x86/kvm/vmx/vmx.c | 4 ++-- > arch/x86/kvm/x86.c | 13 +++++++------ > 4 files changed, 11 insertions(+), 10 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 7aafc27ce7a9..328103a520d3 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -1689,7 +1689,7 @@ int kvm_emulate_monitor(struct kvm_vcpu *vcpu); > int kvm_fast_pio(struct kvm_vcpu *vcpu, int size, unsigned short port, int in); > int kvm_emulate_cpuid(struct kvm_vcpu *vcpu); > int kvm_emulate_halt(struct kvm_vcpu *vcpu); > -int kvm_vcpu_halt(struct kvm_vcpu *vcpu); > +int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu); > int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu); > int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu); > > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c > index af1bbb73430a..d0237a441feb 100644 > --- a/arch/x86/kvm/vmx/nested.c > +++ b/arch/x86/kvm/vmx/nested.c > @@ -3619,7 +3619,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) > !(nested_cpu_has(vmcs12, CPU_BASED_INTR_WINDOW_EXITING) && > (vmcs12->guest_rflags & X86_EFLAGS_IF))) { > vmx->nested.nested_run_pending = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); > } > break; > case GUEST_ACTIVITY_WAIT_SIPI: > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 1c8b2b6e7ed9..5517893f12fc 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -4741,7 +4741,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, > if (kvm_emulate_instruction(vcpu, 0)) { > if (vcpu->arch.halt_request) { > vcpu->arch.halt_request = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); Could you elaborate on why you choose _noskip suffix? As far as I see, kvm_vcpu_halt just calls __kvm_vcpu_halt with new VCPU run state/exit reason, which is used only when local apic is not in the kernel (which is these days not that supported configuration). Other user of __kvm_vcpu_halt is something SEV related. Best regards, Maxim Levitsky > } > return 1; > } > @@ -5415,7 +5415,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) > > if (vcpu->arch.halt_request) { > vcpu->arch.halt_request = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); > } > > /* > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 4a52a08707de..9c23ae1d483d 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -8649,7 +8649,7 @@ void kvm_arch_exit(void) > #endif > } > > -static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason) > +static int __kvm_emulate_halt(struct kvm_vcpu *vcpu, int state, int reason) > { > ++vcpu->stat.halt_exits; > if (lapic_in_kernel(vcpu)) { > @@ -8661,11 +8661,11 @@ static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason) > } > } > > -int kvm_vcpu_halt(struct kvm_vcpu *vcpu) > +int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu) > { > - return __kvm_vcpu_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT); > + return __kvm_emulate_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT); > } > -EXPORT_SYMBOL_GPL(kvm_vcpu_halt); > +EXPORT_SYMBOL_GPL(kvm_emulate_halt_noskip); > > int kvm_emulate_halt(struct kvm_vcpu *vcpu) > { > @@ -8674,7 +8674,7 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu) > * TODO: we might be squashing a GUESTDBG_SINGLESTEP-triggered > * KVM_EXIT_DEBUG here. > */ > - return kvm_vcpu_halt(vcpu) && ret; > + return kvm_emulate_halt_noskip(vcpu) && ret; > } > EXPORT_SYMBOL_GPL(kvm_emulate_halt); > > @@ -8682,7 +8682,8 @@ int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu) > { > int ret = kvm_skip_emulated_instruction(vcpu); > > - return __kvm_vcpu_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD, KVM_EXIT_AP_RESET_HOLD) && ret; > + return __kvm_emulate_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD, > + KVM_EXIT_AP_RESET_HOLD) && ret; > } > EXPORT_SYMBOL_GPL(kvm_emulate_ap_reset_hold); > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C543C433FE for ; Wed, 27 Oct 2021 16:50:01 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 16BD5610A6 for ; Wed, 27 Oct 2021 16:50:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 16BD5610A6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id ADF014B172; Wed, 27 Oct 2021 12:50:00 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@redhat.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NF8r-D75wEdC; Wed, 27 Oct 2021 12:49:59 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id EA2DF4B1AD; Wed, 27 Oct 2021 12:49:57 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 06A784B0B4 for ; Wed, 27 Oct 2021 10:10:52 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pcC+p59u7TOd for ; Wed, 27 Oct 2021 10:10:48 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 7A9AE40256 for ; Wed, 27 Oct 2021 10:10:48 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635343848; 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=cVoa83Mt37o7LxzLcjDlhV+CHKfwNHfJj/XpdkZn+wM=; b=NnzVwUEhtgr3TedfiSMqVp6NoruZnJVJi1PCKYRgq79ssWc8WI07JmLqTh8UT6MlbAoSxR 2arbjHMN/N8GUX/u42Z8Z6r+b+t9DwGuNuFtixke67oUc84zaBuX6I2S6pQkoNEKG8/UN5 i4+49O3ryuXck+AZQyv0B3lJieoP57Q= 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-450-HHU7zf4COr2mtmPfjcXavw-1; Wed, 27 Oct 2021 10:10:45 -0400 X-MC-Unique: HHU7zf4COr2mtmPfjcXavw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A6B619251DC; Wed, 27 Oct 2021 14:10:24 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id C89B45DF36; Wed, 27 Oct 2021 14:10:07 +0000 (UTC) Message-ID: <363479dd55760979da208cacf015a6f7fe2afd69.camel@redhat.com> Subject: Re: [PATCH v2 12/43] KVM: x86: Tweak halt emulation helper names to free up kvm_vcpu_halt() From: Maxim Levitsky To: Sean Christopherson , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini Date: Wed, 27 Oct 2021 17:10:06 +0300 In-Reply-To: <20211009021236.4122790-13-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-13-seanjc@google.com> User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mailman-Approved-At: Wed, 27 Oct 2021 12:49:56 -0400 Cc: Wanpeng Li , kvm@vger.kernel.org, David Hildenbrand , linux-kernel@vger.kernel.org, Atish Patra , linux-riscv@lists.infradead.org, Claudio Imbrenda , kvmarm@lists.cs.columbia.edu, Joerg Roedel , kvm-ppc@vger.kernel.org, David Matlack , linux-arm-kernel@lists.infradead.org, Jim Mattson , Cornelia Huck , linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org, Vitaly Kuznetsov X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > Rename a variety of HLT-related helpers to free up the function name > "kvm_vcpu_halt" for future use in generic KVM code, e.g. to differentiate > between "block" and "halt". > > No functional change intended. > > Reviewed-by: David Matlack > Signed-off-by: Sean Christopherson > --- > arch/x86/include/asm/kvm_host.h | 2 +- > arch/x86/kvm/vmx/nested.c | 2 +- > arch/x86/kvm/vmx/vmx.c | 4 ++-- > arch/x86/kvm/x86.c | 13 +++++++------ > 4 files changed, 11 insertions(+), 10 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 7aafc27ce7a9..328103a520d3 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -1689,7 +1689,7 @@ int kvm_emulate_monitor(struct kvm_vcpu *vcpu); > int kvm_fast_pio(struct kvm_vcpu *vcpu, int size, unsigned short port, int in); > int kvm_emulate_cpuid(struct kvm_vcpu *vcpu); > int kvm_emulate_halt(struct kvm_vcpu *vcpu); > -int kvm_vcpu_halt(struct kvm_vcpu *vcpu); > +int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu); > int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu); > int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu); > > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c > index af1bbb73430a..d0237a441feb 100644 > --- a/arch/x86/kvm/vmx/nested.c > +++ b/arch/x86/kvm/vmx/nested.c > @@ -3619,7 +3619,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) > !(nested_cpu_has(vmcs12, CPU_BASED_INTR_WINDOW_EXITING) && > (vmcs12->guest_rflags & X86_EFLAGS_IF))) { > vmx->nested.nested_run_pending = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); > } > break; > case GUEST_ACTIVITY_WAIT_SIPI: > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 1c8b2b6e7ed9..5517893f12fc 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -4741,7 +4741,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, > if (kvm_emulate_instruction(vcpu, 0)) { > if (vcpu->arch.halt_request) { > vcpu->arch.halt_request = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); Could you elaborate on why you choose _noskip suffix? As far as I see, kvm_vcpu_halt just calls __kvm_vcpu_halt with new VCPU run state/exit reason, which is used only when local apic is not in the kernel (which is these days not that supported configuration). Other user of __kvm_vcpu_halt is something SEV related. Best regards, Maxim Levitsky > } > return 1; > } > @@ -5415,7 +5415,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) > > if (vcpu->arch.halt_request) { > vcpu->arch.halt_request = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); > } > > /* > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 4a52a08707de..9c23ae1d483d 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -8649,7 +8649,7 @@ void kvm_arch_exit(void) > #endif > } > > -static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason) > +static int __kvm_emulate_halt(struct kvm_vcpu *vcpu, int state, int reason) > { > ++vcpu->stat.halt_exits; > if (lapic_in_kernel(vcpu)) { > @@ -8661,11 +8661,11 @@ static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason) > } > } > > -int kvm_vcpu_halt(struct kvm_vcpu *vcpu) > +int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu) > { > - return __kvm_vcpu_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT); > + return __kvm_emulate_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT); > } > -EXPORT_SYMBOL_GPL(kvm_vcpu_halt); > +EXPORT_SYMBOL_GPL(kvm_emulate_halt_noskip); > > int kvm_emulate_halt(struct kvm_vcpu *vcpu) > { > @@ -8674,7 +8674,7 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu) > * TODO: we might be squashing a GUESTDBG_SINGLESTEP-triggered > * KVM_EXIT_DEBUG here. > */ > - return kvm_vcpu_halt(vcpu) && ret; > + return kvm_emulate_halt_noskip(vcpu) && ret; > } > EXPORT_SYMBOL_GPL(kvm_emulate_halt); > > @@ -8682,7 +8682,8 @@ int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu) > { > int ret = kvm_skip_emulated_instruction(vcpu); > > - return __kvm_vcpu_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD, KVM_EXIT_AP_RESET_HOLD) && ret; > + return __kvm_emulate_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD, > + KVM_EXIT_AP_RESET_HOLD) && ret; > } > EXPORT_SYMBOL_GPL(kvm_emulate_ap_reset_hold); > _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxim Levitsky Date: Wed, 27 Oct 2021 14:10:06 +0000 Subject: Re: [PATCH v2 12/43] KVM: x86: Tweak halt emulation helper names to free up kvm_vcpu_halt() Message-Id: <363479dd55760979da208cacf015a6f7fe2afd69.camel@redhat.com> List-Id: References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-13-seanjc@google.com> In-Reply-To: <20211009021236.4122790-13-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Sean Christopherson , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Atish Patra , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , Oliver Upton , Jing Zhang On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > Rename a variety of HLT-related helpers to free up the function name > "kvm_vcpu_halt" for future use in generic KVM code, e.g. to differentiate > between "block" and "halt". > > No functional change intended. > > Reviewed-by: David Matlack > Signed-off-by: Sean Christopherson > --- > arch/x86/include/asm/kvm_host.h | 2 +- > arch/x86/kvm/vmx/nested.c | 2 +- > arch/x86/kvm/vmx/vmx.c | 4 ++-- > arch/x86/kvm/x86.c | 13 +++++++------ > 4 files changed, 11 insertions(+), 10 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 7aafc27ce7a9..328103a520d3 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -1689,7 +1689,7 @@ int kvm_emulate_monitor(struct kvm_vcpu *vcpu); > int kvm_fast_pio(struct kvm_vcpu *vcpu, int size, unsigned short port, int in); > int kvm_emulate_cpuid(struct kvm_vcpu *vcpu); > int kvm_emulate_halt(struct kvm_vcpu *vcpu); > -int kvm_vcpu_halt(struct kvm_vcpu *vcpu); > +int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu); > int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu); > int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu); > > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c > index af1bbb73430a..d0237a441feb 100644 > --- a/arch/x86/kvm/vmx/nested.c > +++ b/arch/x86/kvm/vmx/nested.c > @@ -3619,7 +3619,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) > !(nested_cpu_has(vmcs12, CPU_BASED_INTR_WINDOW_EXITING) && > (vmcs12->guest_rflags & X86_EFLAGS_IF))) { > vmx->nested.nested_run_pending = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); > } > break; > case GUEST_ACTIVITY_WAIT_SIPI: > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 1c8b2b6e7ed9..5517893f12fc 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -4741,7 +4741,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, > if (kvm_emulate_instruction(vcpu, 0)) { > if (vcpu->arch.halt_request) { > vcpu->arch.halt_request = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); Could you elaborate on why you choose _noskip suffix? As far as I see, kvm_vcpu_halt just calls __kvm_vcpu_halt with new VCPU run state/exit reason, which is used only when local apic is not in the kernel (which is these days not that supported configuration). Other user of __kvm_vcpu_halt is something SEV related. Best regards, Maxim Levitsky > } > return 1; > } > @@ -5415,7 +5415,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) > > if (vcpu->arch.halt_request) { > vcpu->arch.halt_request = 0; > - return kvm_vcpu_halt(vcpu); > + return kvm_emulate_halt_noskip(vcpu); > } > > /* > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 4a52a08707de..9c23ae1d483d 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -8649,7 +8649,7 @@ void kvm_arch_exit(void) > #endif > } > > -static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason) > +static int __kvm_emulate_halt(struct kvm_vcpu *vcpu, int state, int reason) > { > ++vcpu->stat.halt_exits; > if (lapic_in_kernel(vcpu)) { > @@ -8661,11 +8661,11 @@ static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason) > } > } > > -int kvm_vcpu_halt(struct kvm_vcpu *vcpu) > +int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu) > { > - return __kvm_vcpu_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT); > + return __kvm_emulate_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT); > } > -EXPORT_SYMBOL_GPL(kvm_vcpu_halt); > +EXPORT_SYMBOL_GPL(kvm_emulate_halt_noskip); > > int kvm_emulate_halt(struct kvm_vcpu *vcpu) > { > @@ -8674,7 +8674,7 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu) > * TODO: we might be squashing a GUESTDBG_SINGLESTEP-triggered > * KVM_EXIT_DEBUG here. > */ > - return kvm_vcpu_halt(vcpu) && ret; > + return kvm_emulate_halt_noskip(vcpu) && ret; > } > EXPORT_SYMBOL_GPL(kvm_emulate_halt); > > @@ -8682,7 +8682,8 @@ int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu) > { > int ret = kvm_skip_emulated_instruction(vcpu); > > - return __kvm_vcpu_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD, KVM_EXIT_AP_RESET_HOLD) && ret; > + return __kvm_emulate_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD, > + KVM_EXIT_AP_RESET_HOLD) && ret; > } > EXPORT_SYMBOL_GPL(kvm_emulate_ap_reset_hold); >