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 64615C433EF for ; Tue, 16 Nov 2021 16:08:03 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id D6139619FA for ; Tue, 16 Nov 2021 16:08:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D6139619FA Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.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 6622D4B139; Tue, 16 Nov 2021 11:08:02 -0500 (EST) 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=@google.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 jjR21DcyHmgp; Tue, 16 Nov 2021 11:08:00 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id ECC064B13D; Tue, 16 Nov 2021 11:08:00 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 49A074B134 for ; Tue, 16 Nov 2021 11:07:59 -0500 (EST) 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 ogYBn7bewvqp for ; Tue, 16 Nov 2021 11:07:53 -0500 (EST) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 302094B130 for ; Tue, 16 Nov 2021 11:07:53 -0500 (EST) Received: by mail-pl1-f179.google.com with SMTP id u17so17782756plg.9 for ; Tue, 16 Nov 2021 08:07:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Z2AKx61/RhCe2zs5ofLjhqQARlhS43Ifv8qiPWwvU8w=; b=lcsOSKJZX1HW4dBg29cw5mdeiwWY+loBeYbsQV+z2/nV6RWvDRujp8jkar1j2iKk7Z Q7kDkSiVYol/fAQwYbdXz6fN2IlDQoEEG233LaBBpiKOliI+F4QJNkSO/vk84Grwjsg1 xgisig77vEEa4Zd5OSZNhbkVEv6fJSGPJYnEKhE6p2XLpvSYq3J4gQzmDevLkU5rdnAI rP9CME4bIKDfKmH+iv15W2ZbpFgsMSUMaP9zPM2kyOtgds+U6deVQ6MfC7qosULoTu5/ vwD7KCMHs8C2lB+vzVYl7as7WrWnO4BfhRzOPbRRQhhHWPUHJLeuyWBsJIHbOy9ux35U p6vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Z2AKx61/RhCe2zs5ofLjhqQARlhS43Ifv8qiPWwvU8w=; b=4kli6DT6rZr2N480BEcklWusnj6oJhBBwRGK7JmHUHgMgp/GW6jZOhhEFHA+zxRWmf bOFFWSSWxhveohlBeS+Rh7zckCpQlAopRyUkX+17P5Yu3xkSLNEeKzhiPLXw1y5x3uAD Ky/+rdmrcTC8d2OGom7NP2vWkrTWKzi3tZyytvSwdPg9yabz2wsvi1NLqZwC/oMQ/T2R iMZlDEOwhBvKTrWiRVO/WTOAj8QWauZodsCKU2r6U4i6QEeW2rXx94ClpbX1/oKITgX0 qQXdLIIqMWBTGrRDU41e1lPR+rl+sz9aKp1tjFueLs6rT2adZMSbI2ZPkiwNMiIrRMt0 LBSA== X-Gm-Message-State: AOAM530FKMETMyBWPHDhFBluqwm9ZEz92bVi1LMfDhpQ4HFtJ6RZtcly FCFzkuGYDxLlXoi35JURZ58v8Q== X-Google-Smtp-Source: ABdhPJxU6duTqsrTks/nV5OrQqCjn8t+5rodqO/OPYPZOkqch8j1M2u2I4szhAM4KHA4Nd8M6EsWPg== X-Received: by 2002:a17:902:7890:b0:143:c4f7:59e6 with SMTP id q16-20020a170902789000b00143c4f759e6mr22206936pll.87.1637078871989; Tue, 16 Nov 2021 08:07:51 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id lt5sm2725151pjb.43.2021.11.16.08.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Nov 2021 08:07:51 -0800 (PST) Date: Tue, 16 Nov 2021 16:07:47 +0000 From: Sean Christopherson To: Paolo Bonzini Subject: Re: [PATCH 4/5] KVM: x86: Use kvm_get_vcpu() instead of open-coded access Message-ID: References: <20211105192101.3862492-1-maz@kernel.org> <20211105192101.3862492-5-maz@kernel.org> <330eb780-1963-ac1f-aaad-908346112f28@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <330eb780-1963-ac1f-aaad-908346112f28@redhat.com> Cc: Juergen Gross , Anup Patel , Janosch Frank , kvm@vger.kernel.org, Christian Borntraeger , Marc Zyngier , Huacai Chen , David Hildenbrand , linux-mips@vger.kernel.org, Nicholas Piggin , Atish Patra , Aleksandar Markovic , Paul Mackerras , Michael Ellerman , kernel-team@android.com, Claudio Imbrenda , linuxppc-dev@lists.ozlabs.org, kvmarm@lists.cs.columbia.edu 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 Tue, Nov 16, 2021, Paolo Bonzini wrote: > On 11/5/21 21:03, Sean Christopherson wrote: > > But I think even that is flawed, as APICv can be dynamically deactivated and > > re-activated while the VM is running, and I don't see a path that re-updates > > the IRTE when APICv is re-activated. So I think a more conservative check is > > needed, e.g. > > > > diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c > > index 5f81ef092bd4..6cf5b2e86118 100644 > > --- a/arch/x86/kvm/vmx/posted_intr.c > > +++ b/arch/x86/kvm/vmx/posted_intr.c > > @@ -272,7 +272,7 @@ int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq, > > > > if (!kvm_arch_has_assigned_device(kvm) || > > !irq_remapping_cap(IRQ_POSTING_CAP) || > > - !kvm_vcpu_apicv_active(kvm->vcpus[0])) > > + !irqchip_in_kernel(kvm) || !enable_apicv) > > return 0; > > > > idx = srcu_read_lock(&kvm->irq_srcu); > > What happens then if pi_pre_block is called and the IRTE denotes a posted > interrupt? > > I might be wrong, but it seems to me that you have to change all of the > occurrences this way. As soon as enable_apicv is set, you need to go > through the POSTED_INTR_WAKEUP_VECTOR just in case. Sorry, I didn't grok that at all. All occurences of what? _______________________________________________ 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 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 5EDEDC433F5 for ; Tue, 16 Nov 2021 16:08:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B325613DB for ; Tue, 16 Nov 2021 16:08:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238905AbhKPQLg (ORCPT ); Tue, 16 Nov 2021 11:11:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238910AbhKPQKv (ORCPT ); Tue, 16 Nov 2021 11:10:51 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C16BEC0613B9 for ; Tue, 16 Nov 2021 08:07:52 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id iq11so16135278pjb.3 for ; Tue, 16 Nov 2021 08:07:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Z2AKx61/RhCe2zs5ofLjhqQARlhS43Ifv8qiPWwvU8w=; b=lcsOSKJZX1HW4dBg29cw5mdeiwWY+loBeYbsQV+z2/nV6RWvDRujp8jkar1j2iKk7Z Q7kDkSiVYol/fAQwYbdXz6fN2IlDQoEEG233LaBBpiKOliI+F4QJNkSO/vk84Grwjsg1 xgisig77vEEa4Zd5OSZNhbkVEv6fJSGPJYnEKhE6p2XLpvSYq3J4gQzmDevLkU5rdnAI rP9CME4bIKDfKmH+iv15W2ZbpFgsMSUMaP9zPM2kyOtgds+U6deVQ6MfC7qosULoTu5/ vwD7KCMHs8C2lB+vzVYl7as7WrWnO4BfhRzOPbRRQhhHWPUHJLeuyWBsJIHbOy9ux35U p6vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Z2AKx61/RhCe2zs5ofLjhqQARlhS43Ifv8qiPWwvU8w=; b=q4uW75DV71c3AZzFSeJoT0CRCsV7i/vFH9T0NU61/CWfA/1Zi9J5eJWAwBwn4XjqSB mCBycmAYjDQjM/pUmZR15YJ2MmSskh34OLuWNVAhgyTD+v4R9ymtRIbZawtIpEa1saCp EqnQrbqqnnuY7KP+ZNiUNfheaK4ljFFkLnsFcHBGNRzCPtXJsbp+zefFKPxq5Iu6VhqM oS07h6gEWi4Rn9ne9rprCbYyilZjkSa7Cp+2FLhQTQAvm4YOoERpEhn4gkHaLeXB04Hi htQ/GQxqao/wbtyv6+vmTNAp/3uysc140A3Ujgj65MrSUaEeKCUzE1a5P80TeBejDlLG /XqQ== X-Gm-Message-State: AOAM531asxF3Ts+yCZMfIO1UG3SwroDU+XHX0uD3kFSkyKiQRYpiQ2/a 5emtdhzCfWSjjKIGB9Qmrfj2jw== X-Google-Smtp-Source: ABdhPJxU6duTqsrTks/nV5OrQqCjn8t+5rodqO/OPYPZOkqch8j1M2u2I4szhAM4KHA4Nd8M6EsWPg== X-Received: by 2002:a17:902:7890:b0:143:c4f7:59e6 with SMTP id q16-20020a170902789000b00143c4f759e6mr22206936pll.87.1637078871989; Tue, 16 Nov 2021 08:07:51 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id lt5sm2725151pjb.43.2021.11.16.08.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Nov 2021 08:07:51 -0800 (PST) Date: Tue, 16 Nov 2021 16:07:47 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: Marc Zyngier , kvm@vger.kernel.org, linux-mips@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linuxppc-dev@lists.ozlabs.org, Huacai Chen , Aleksandar Markovic , Anup Patel , Atish Patra , Christian Borntraeger , Janosch Frank , David Hildenbrand , Claudio Imbrenda , Juergen Gross , Nicholas Piggin , Paul Mackerras , Michael Ellerman , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH 4/5] KVM: x86: Use kvm_get_vcpu() instead of open-coded access Message-ID: References: <20211105192101.3862492-1-maz@kernel.org> <20211105192101.3862492-5-maz@kernel.org> <330eb780-1963-ac1f-aaad-908346112f28@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <330eb780-1963-ac1f-aaad-908346112f28@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org On Tue, Nov 16, 2021, Paolo Bonzini wrote: > On 11/5/21 21:03, Sean Christopherson wrote: > > But I think even that is flawed, as APICv can be dynamically deactivated and > > re-activated while the VM is running, and I don't see a path that re-updates > > the IRTE when APICv is re-activated. So I think a more conservative check is > > needed, e.g. > > > > diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c > > index 5f81ef092bd4..6cf5b2e86118 100644 > > --- a/arch/x86/kvm/vmx/posted_intr.c > > +++ b/arch/x86/kvm/vmx/posted_intr.c > > @@ -272,7 +272,7 @@ int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq, > > > > if (!kvm_arch_has_assigned_device(kvm) || > > !irq_remapping_cap(IRQ_POSTING_CAP) || > > - !kvm_vcpu_apicv_active(kvm->vcpus[0])) > > + !irqchip_in_kernel(kvm) || !enable_apicv) > > return 0; > > > > idx = srcu_read_lock(&kvm->irq_srcu); > > What happens then if pi_pre_block is called and the IRTE denotes a posted > interrupt? > > I might be wrong, but it seems to me that you have to change all of the > occurrences this way. As soon as enable_apicv is set, you need to go > through the POSTED_INTR_WAKEUP_VECTOR just in case. Sorry, I didn't grok that at all. All occurences of what? 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 9069FC433FE for ; Tue, 16 Nov 2021 16:08:40 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 E898661929 for ; Tue, 16 Nov 2021 16:08:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E898661929 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HtrZt3zjqz3c7m for ; Wed, 17 Nov 2021 03:08:38 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=lcsOSKJZ; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=google.com (client-ip=2607:f8b0:4864:20::636; helo=mail-pl1-x636.google.com; envelope-from=seanjc@google.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=lcsOSKJZ; dkim-atps=neutral Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HtrZ76S9fz2yMc for ; Wed, 17 Nov 2021 03:07:58 +1100 (AEDT) Received: by mail-pl1-x636.google.com with SMTP id q17so17782092plr.11 for ; Tue, 16 Nov 2021 08:07:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Z2AKx61/RhCe2zs5ofLjhqQARlhS43Ifv8qiPWwvU8w=; b=lcsOSKJZX1HW4dBg29cw5mdeiwWY+loBeYbsQV+z2/nV6RWvDRujp8jkar1j2iKk7Z Q7kDkSiVYol/fAQwYbdXz6fN2IlDQoEEG233LaBBpiKOliI+F4QJNkSO/vk84Grwjsg1 xgisig77vEEa4Zd5OSZNhbkVEv6fJSGPJYnEKhE6p2XLpvSYq3J4gQzmDevLkU5rdnAI rP9CME4bIKDfKmH+iv15W2ZbpFgsMSUMaP9zPM2kyOtgds+U6deVQ6MfC7qosULoTu5/ vwD7KCMHs8C2lB+vzVYl7as7WrWnO4BfhRzOPbRRQhhHWPUHJLeuyWBsJIHbOy9ux35U p6vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Z2AKx61/RhCe2zs5ofLjhqQARlhS43Ifv8qiPWwvU8w=; b=ZKczXbtMcCsD9VyVgQCeD2gYpGMk+Zquio76pSAN5H44FrvlY+Y5PBVOv2uF0L5DeF Z3E0v/d+MG8e+fc8mUhH6rYmr5jHT5Pxnd9L+MQx9jqkWGDZFp4rZx3lTJTsF2Vr49Ys mjUhHXETi0dUXj60ahsmgOvThFm19AcLIVlTcJokd5PYlpQG8DYTitxKu6obD0h1yZb9 p7aYdYawH+WoeDZp3tPaYLNxXYs6+/kPPLUypE1q+mAvwGSZSqsVC/ZWjBbQvK+wV9nm UI3yeqnjQnSIEEq5hf0KtyOfFvtTN2gbbH1W+lqst4CG5HsRaqBIRFZiYXtc/Iw/+m/6 adrA== X-Gm-Message-State: AOAM530JbPxBWGaFDHmb5RPvOCPdSpYzZgHThwI0t13QxFG6TKHxZMvw Stk+BpS6RCSSPBhRa646cBDynQ== X-Google-Smtp-Source: ABdhPJxU6duTqsrTks/nV5OrQqCjn8t+5rodqO/OPYPZOkqch8j1M2u2I4szhAM4KHA4Nd8M6EsWPg== X-Received: by 2002:a17:902:7890:b0:143:c4f7:59e6 with SMTP id q16-20020a170902789000b00143c4f759e6mr22206936pll.87.1637078871989; Tue, 16 Nov 2021 08:07:51 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id lt5sm2725151pjb.43.2021.11.16.08.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Nov 2021 08:07:51 -0800 (PST) Date: Tue, 16 Nov 2021 16:07:47 +0000 From: Sean Christopherson To: Paolo Bonzini Subject: Re: [PATCH 4/5] KVM: x86: Use kvm_get_vcpu() instead of open-coded access Message-ID: References: <20211105192101.3862492-1-maz@kernel.org> <20211105192101.3862492-5-maz@kernel.org> <330eb780-1963-ac1f-aaad-908346112f28@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <330eb780-1963-ac1f-aaad-908346112f28@redhat.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Alexandru Elisei , Anup Patel , Janosch Frank , kvm@vger.kernel.org, Christian Borntraeger , Marc Zyngier , Huacai Chen , David Hildenbrand , linux-mips@vger.kernel.org, Nicholas Piggin , Atish Patra , Aleksandar Markovic , Paul Mackerras , James Morse , kernel-team@android.com, Claudio Imbrenda , linuxppc-dev@lists.ozlabs.org, kvmarm@lists.cs.columbia.edu, Suzuki K Poulose Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, Nov 16, 2021, Paolo Bonzini wrote: > On 11/5/21 21:03, Sean Christopherson wrote: > > But I think even that is flawed, as APICv can be dynamically deactivated and > > re-activated while the VM is running, and I don't see a path that re-updates > > the IRTE when APICv is re-activated. So I think a more conservative check is > > needed, e.g. > > > > diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c > > index 5f81ef092bd4..6cf5b2e86118 100644 > > --- a/arch/x86/kvm/vmx/posted_intr.c > > +++ b/arch/x86/kvm/vmx/posted_intr.c > > @@ -272,7 +272,7 @@ int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq, > > > > if (!kvm_arch_has_assigned_device(kvm) || > > !irq_remapping_cap(IRQ_POSTING_CAP) || > > - !kvm_vcpu_apicv_active(kvm->vcpus[0])) > > + !irqchip_in_kernel(kvm) || !enable_apicv) > > return 0; > > > > idx = srcu_read_lock(&kvm->irq_srcu); > > What happens then if pi_pre_block is called and the IRTE denotes a posted > interrupt? > > I might be wrong, but it seems to me that you have to change all of the > occurrences this way. As soon as enable_apicv is set, you need to go > through the POSTED_INTR_WAKEUP_VECTOR just in case. Sorry, I didn't grok that at all. All occurences of what?