Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2917853pxb; Fri, 8 Oct 2021 19:14:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuih+BnrhDjrnVn7tBKpbhI5NFCxajeuJPVrpmDwLeuDRH9lGvm5Lso1PwoWrawDe4GiB/ X-Received: by 2002:a17:90b:4c4a:: with SMTP id np10mr15891606pjb.233.1633745688590; Fri, 08 Oct 2021 19:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633745688; cv=none; d=google.com; s=arc-20160816; b=Vjn8cu4BaJVpIIkFZea58ubRYN18HhgY1CgJTBeNVffpeVpqSCn1/QgHLfAm3UuYb2 vwdBRuwaKO0J4wGVR6mjfdn/18zHJaaVaHJrRVyDXipdRmliRakWChiGDuODwNEnMM15 Q8NCS5zovZJ+cafZ6IEo/YBm1+BjRy/H8Bmf5uGFLvNYO/Z2aFtutr2+WR9opBJtZI/b SiUu1K/SAHKIA9Sqn6UHQyvKgbM9sygokyxD1op7NhlgjQC3044F9F7TM2DM3t9U/4yj tgXdG8O1vV+Qx7ZO62uGaOufa51DcYWscqbJm0de6v3L/ASDMt2M4/FouDM+fKE4CFBn UTZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:reply-to:dkim-signature; bh=w4L6vXRJ0maktiMAI5s6nCFzv55tjBmh5H3fVwAOt14=; b=tsDiKML/Zv+xmXek5rWOd4OsYzIx3tiyb6gb/gLPbm6Eozomu3iY5sqXPuWnjMwXuN qDWowoYORYo1KM2MhgREflScCKUq8dwJfwHQH7/qVej3mxgz6Rgg6w0ursaW0+Y0ERJF OtUukKyjSt4WeUHouj8UQnV2QveQ38QNPSWHmcAg7r3dVzSHsSO9zi8iLcmaGNo6tdvm 2eBKNRH5nUd4KDGlBqEb29rfBUr3nVhMe0rFUxqdZtYS1U/rtKuxBnwzHlVmXrOiZOql vX0kkNdDlQIWR+kRFAVYDxvykxeISox8GVz7YptXBoXnvW8xDd4IgD+V/ORW+OOgAtKm QDfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="X+K/y94D"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g11si1224664pfm.227.2021.10.08.19.14.35; Fri, 08 Oct 2021 19:14:48 -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=@google.com header.s=20210112 header.b="X+K/y94D"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244151AbhJICOm (ORCPT + 99 others); Fri, 8 Oct 2021 22:14:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244150AbhJICOl (ORCPT ); Fri, 8 Oct 2021 22:14:41 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B090C061762 for ; Fri, 8 Oct 2021 19:12:45 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id y16-20020a2586d0000000b005b752db8f97so14924104ybm.18 for ; Fri, 08 Oct 2021 19:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=w4L6vXRJ0maktiMAI5s6nCFzv55tjBmh5H3fVwAOt14=; b=X+K/y94DG3/b1JwgUiidlr5JeHnupRLaoGF9napckdwupzcFgHo7UhOu+eaY5Q3yog XhI0zkKhF5wkPh8Ydk25q+Y6isKLBL2UTcjGlPF0l4wc+szJzZ+JS+y62GUkYFglqcAv QEhhm2InfBVgcKeILtjC+nb523rb7ir7sFxAzKbiDvXJe9slv28lGTNA/1i2qVg+2ZxD lcB1g1dodHVQwinZspEr86T0h4e/T83A8dtpOzreXMAVzScFVYs7UuuVHgCR8Jaa9rV6 4SJDFMRK9BqcmV318zbEUoQPsVks4CsIxNiDejukWU0lQBj8XUkGo/6kRljZYzrdrmiZ JZig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=w4L6vXRJ0maktiMAI5s6nCFzv55tjBmh5H3fVwAOt14=; b=fcXVtcK3znGPaFn3XvBVXib6ckUiUAhBB4Wt0kdTBmKxZy5xAetYXYolx/JSe7cLee 2IN1Sjrr35lA3bzgLg9LIqNM+JtasjF3sk4lcno1iL/AW4KJLYgkHp7VnbZCZoRlWHOp uUU6rob11p4uHLvCcsBlTfiGn34GmXkiGjl54YqsmosDnh5O+2fbSS0zkbG2izK7b92p dUounJHvIMyuCzWPskzgILuKUI3SgJosEfJK/CweV6PVhe/mbGh7mUSmwr3PIOIXTcZW jmqcXAvZRuJtrS1Qvs7UxkZaU5/Euy3g9hCLjIlJkeMXBpIMjmq2D8qSEULmpiwvqWlC Nwog== X-Gm-Message-State: AOAM533u9t6IWOVN0OM46fYBbfXypBvD32QvWGZKT+gghe6zS3WVTBK+ SBKCtyyXswzwo72CP1cRDZ9ESXDBV64= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:90:200:e39b:6333:b001:cb]) (user=seanjc job=sendgmr) by 2002:a25:5ed6:: with SMTP id s205mr7850217ybb.31.1633745564156; Fri, 08 Oct 2021 19:12:44 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 8 Oct 2021 19:11:54 -0700 In-Reply-To: <20211009021236.4122790-1-seanjc@google.com> Message-Id: <20211009021236.4122790-2-seanjc@google.com> Mime-Version: 1.0 References: <20211009021236.4122790-1-seanjc@google.com> X-Mailer: git-send-email 2.33.0.882.g93a45727a2-goog Subject: [PATCH v2 01/43] KVM: VMX: Don't unblock vCPU w/ Posted IRQ if IRQs are disabled in guest From: Sean Christopherson To: 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 , Sean Christopherson , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Don't configure the wakeup handler when a vCPU is blocking with IRQs disabled, in which case any IRQ, posted or otherwise, should not be recognized and thus should not wake the vCPU. Fixes: bf9f6ac8d749 ("KVM: Update Posted-Interrupts Descriptor when vCPU is blocked") Signed-off-by: Sean Christopherson --- arch/x86/kvm/vmx/posted_intr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c index 5f81ef092bd4..3263056784f5 100644 --- a/arch/x86/kvm/vmx/posted_intr.c +++ b/arch/x86/kvm/vmx/posted_intr.c @@ -142,8 +142,9 @@ int pi_pre_block(struct kvm_vcpu *vcpu) struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu); if (!kvm_arch_has_assigned_device(vcpu->kvm) || - !irq_remapping_cap(IRQ_POSTING_CAP) || - !kvm_vcpu_apicv_active(vcpu)) + !irq_remapping_cap(IRQ_POSTING_CAP) || + !kvm_vcpu_apicv_active(vcpu) || + vmx_interrupt_blocked(vcpu)) return 0; WARN_ON(irqs_disabled()); -- 2.33.0.882.g93a45727a2-goog