Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2418903pxb; Sun, 31 Oct 2021 15:34:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/OwuCwzWx95Zgy4jcSALirNgvteDk4N236badMwcbXFuod8K2lWFX/1PfVRae5gPl2upu X-Received: by 2002:a17:907:7f8b:: with SMTP id qk11mr31055533ejc.238.1635719699585; Sun, 31 Oct 2021 15:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635719699; cv=none; d=google.com; s=arc-20160816; b=NBOl+QTQJGGCvGYNQLYDUwPH42unSV3iO8GAgJZkW7yE746SauuoLWbUIfbZNHVZTN gUZrYfouvCH0h7AgFmCff+WGd1k+r4SVJiy34xmrs1kFz+VDUIci+FbNVyKA0BnzvxWj 1SfQqdmbRQPTlKOGxnZ3VQIJPYV+/O911UvYHWDWM6gfT1Tw3IFo5CPBx6iz+yFBdIxW 0+zCWc+4br3XcsI/ehjVMKsxccuaxDQsJxRa/wRMYf4ZYdqEeU3jF0JHSoQJwNeYF+/K Y6lhSABaLtpL9WSd/vo7a9mEi7DbZeB8CBGl65mTePZkVbQO98N9QsAx8OwuUhidyOKG pLeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=vjQhiLyEbEDnD4Y2r5pZNoATO4AoPvr4JeskA/KrBlI=; b=tSqVZIQ+tzBpp6rUgjyfX5wwnxRG31gUWxrwuEab+Qk5zVJywDE+nOtEV1DW26qDIY efy4EGkIAQw0SXb3noVccRh6NZxoA5K44/4uPIAwwVV6Fa/+dy3h4QNi0+pg8F1xNtsk 6e/D3vBm78bojQ4Q3tU/acAE5DyyqX3gq6cVY1TYPLfFq2CpKcQD0pQFiApWpPpzYMZO INt88IFsXgQprwiNq/P0mm5Wjo29IMELJgN0CfOBPCkiOkta73Mw4gCazaGVCesLn2de y00LtnyXFXNVVFxsAWKFr+BQkzP8Usu12YNjydYDuoKBINv4kFVSC7lVh+5oinOEPogE DR2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y2zPxUie; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id q23si19984302ejr.192.2021.10.31.15.34.35; Sun, 31 Oct 2021 15:34:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y2zPxUie; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230309AbhJaWdT (ORCPT + 99 others); Sun, 31 Oct 2021 18:33:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30026 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230025AbhJaWdS (ORCPT ); Sun, 31 Oct 2021 18:33:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635719445; 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=vjQhiLyEbEDnD4Y2r5pZNoATO4AoPvr4JeskA/KrBlI=; b=Y2zPxUiePWrYoTYNkf85cU0LvFN3JXlQW9deZq2gban7dWU0w1rIOWlv35DTW1U5IHJ0eJ pJqKu4c9sye9V6Aufmv8dcFVzLPC0NTl9GW/WPPrdNaCgZm7FZ+0JNPDdlW9ph2xPd2Dwk IaF6QRXofsbs8EUZwUqFuXc09CLyLRk= 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-240-e9ofhHeAOOizUfULmvajlw-1; Sun, 31 Oct 2021 18:30:42 -0400 X-MC-Unique: e9ofhHeAOOizUfULmvajlw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB52D18125C0; Sun, 31 Oct 2021 22:30:38 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8110517155; Sun, 31 Oct 2021 22:30:08 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 42/43] KVM: VMX: Fold fallback path into triggering posted IRQ helper 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: Mon, 01 Nov 2021 00:30:07 +0200 In-Reply-To: <20211009021236.4122790-43-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-43-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.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > Move the fallback "wake_up" path into the helper to trigger posted > interrupt helper now that the nested and non-nested paths are identical. Nit: I think you refer to patch 41 here, but I think that nested and non nested paths were identical before as well, so this patch could be done without patch 41 as well. Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky > > No functional change intended. > > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/vmx/vmx.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index f505fee3cf5c..b0d97cf18c34 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -3927,7 +3927,7 @@ static void vmx_msr_filter_changed(struct kvm_vcpu *vcpu) > pt_update_intercept_for_msr(vcpu); > } > > -static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu, > +static inline void kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu, > int pi_vec) > { > #ifdef CONFIG_SMP > @@ -3958,10 +3958,15 @@ static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu, > */ > > apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), pi_vec); > - return true; > + return; > } > #endif > - return false; > + /* > + * The vCPU isn't in the guest; wake the vCPU in case it is blocking, > + * otherwise do nothing as KVM will grab the highest priority pending > + * IRQ via ->sync_pir_to_irr() in vcpu_enter_guest(). > + */ > + kvm_vcpu_wake_up(vcpu); > } > > static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, > @@ -3984,8 +3989,7 @@ static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, > */ > kvm_make_request(KVM_REQ_EVENT, vcpu); > /* the PIR and ON have been set by L1. */ > - if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_NESTED_VECTOR)) > - kvm_vcpu_wake_up(vcpu); > + kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_NESTED_VECTOR); > return 0; > } > return -1; > @@ -4022,9 +4026,7 @@ static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) > * guaranteed to see PID.ON=1 and sync the PIR to IRR if triggering a > * posted interrupt "fails" because vcpu->mode != IN_GUEST_MODE. > */ > - if (!kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_VECTOR)) > - kvm_vcpu_wake_up(vcpu); > - > + kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_VECTOR); > return 0; > } >