Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1193288lqt; Fri, 7 Jun 2024 10:28:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV0akCXD9DV5H/+iH8O+x1W+1iucMxObRF32U+UqYA2ohKLUV6ISYb4+djmgKJfa0hpn4NFI7kusmil5C1iCp9LuM4IdznkNU9ZRpgv9w== X-Google-Smtp-Source: AGHT+IE+Lr7dZQ9KUeAUtGdxLBLES0kEkeG1TI2MUMQQylgvtHTvk/3yQIgm0CmWmNpygGFs9uEA X-Received: by 2002:a17:903:22d2:b0:1f6:1a91:e744 with SMTP id d9443c01a7336-1f6d02e2f1bmr35933625ad.21.1717781305485; Fri, 07 Jun 2024 10:28:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717781305; cv=pass; d=google.com; s=arc-20160816; b=hEiGOmS/s8ZbS6A98BduemFBiocTdIGJwBbRSzADdyCv8miO76aJQlyXy5c005Hn9D ijmmE16qtZal0Pzhpew+GixCNjZPk7zWmMAC3BzP1XXtcr1VhYnUc6WFB9AXF7HcG92q Kwb1scdwS16+P2r4r0ILD+qQfMx2+R5ZpGE1DkcbUCxTIAqVu0VHpvvjs1fweseaphGs HuzO44ysQajA4FfF+Dt5YFSBVre2O8vpRIMszaDUCcZ3WXf8p1bQBDi8jCfP7yWrAuEW yfO68d+9NttO9DxyuCgSubm1Vz5PzK2WjHQPejjl/ArOWy2aW0zvzzieu707NVprJBh6 srnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :reply-to:dkim-signature; bh=imi/dSYgg4r8Xm2pV7Tc7IPLLCcd51djYuqB8UoSynw=; fh=nswb/1gh9Pk3Ps72BW8nmQnDqFjXfKK3nQ+oM049yFA=; b=KrqpL2WGimWbp+vK+NhS5okkHYmbfQUAdaAZ+RNV06go20n9ATg+PeeizpZPFDl+CH Hq29e2dPoenKnltRhiWh6oJdVLruxtfJHlp/hhcIm5cnxBXK3+kmtBtbObS9gw44Okuj z0t9ydRTlDQ8Xd6LQ4jJvMq6QfCSaPmEKNOHn/heVz9Dj+iiRM1FGZkHYbqdKIOo2ZCI qc6SRkxjgw/4ATCERGwOrVvwE5e3GfQRRpGp9uOhuUui/3Z8B6ZTfn9baPV4JJJUKBzL weQremtpUFMzRUI9soaDd6+DH9gUDUtFqWHeN47FHF3BZo7/HDWtTpnOwPGLG6j5Heek dpbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=gVhJSPCi; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-206545-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206545-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7d2f0dsi1604755ad.198.2024.06.07.10.28.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 10:28:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206545-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=gVhJSPCi; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-206545-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206545-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BA3092887B0 for ; Fri, 7 Jun 2024 17:28:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 93B5719ADBE; Fri, 7 Jun 2024 17:26:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gVhJSPCi" Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89BF519ADAE for ; Fri, 7 Jun 2024 17:26:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717781185; cv=none; b=DHe5ZG0AP725GkQmS0FKgFpHmMc5VDwT/PQWdhDwxORC43gAzVxP1gZUFkQMhPGJkgtwb3/YxVNsNXIIoS0OKEQv2da4ar+eW/5simUOg8SUXaMoFniSkUFxr3DrLkxogl/pAlMLB2+WYKFWLx9aYhcMKlLhZKa3cU9NmxGrXDI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717781185; c=relaxed/simple; bh=k3uT5XlI3ypHnkmLELkYUkwKaO/W0Vb6n7fa+JWmkAI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=HcvbHMDXGmS5jmpllb49BOXq0nvB0Jf9MHpN0G+SrlY0gtfblXMCXSGY4OuV6phlcLfsNb9p6IYWNkXuZ1pOfunC1cPZUS/5kIbtWaVk08S+dyfplpV3xQMf77Z8EbALULhvg2SL4aMlv/SrSpqLzpp7fASiw0CdMT3xOxCS/Hg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=gVhJSPCi; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2c1a9e8d3b0so1829738a91.0 for ; Fri, 07 Jun 2024 10:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717781184; x=1718385984; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=imi/dSYgg4r8Xm2pV7Tc7IPLLCcd51djYuqB8UoSynw=; b=gVhJSPCiy/xmMy+io9LvM3vlstRFcRXZ818xvTziOsyK6QYvglbT0rDny7t3DrIyEA A6QL7eAA2FLpDiUyOV4XSoyljaTYSQLi6VRrWmMzLFO7LZjHhky4w5rJbRdGA9EQn/XC Omb29/5HVAUEQbIA4b+fIRErJ8avBy+vJaJfh5G6t/cHJqhUchwVWvOzqTzl/E3MNLhD 70RGYEW8w0HQoNGver9ikXbephNn0SWmvIwiCzqNXsEgtoVPc+zh38w0ykLfmrUMwrrT zdzs7JtRSqEy8+h+ykSu97LEmLTaO+TBh+/Xs2TjKL2FbUBk7BsOpnKt2+c/5O2CjtT2 Cnlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717781184; x=1718385984; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=imi/dSYgg4r8Xm2pV7Tc7IPLLCcd51djYuqB8UoSynw=; b=ZFlkr6yPP3d3Lhr7QLQ/jlqvJXmoON7C04ww2l66bTJYEqNlgmknqGzycKS7bSo/4U kd6V/wOPqJQ95Uft25tNEOnfvrOu2Gl21jVIXOnp8rxQBEEwsQCMoD1DP+VKaUPq4Vp2 U9TO4HwHxh2gwJDM+psSBctB2k5ZALK2+cUsyHYhDs4Qfjee2RISootN3zeEfhFD+rT0 g/8yqnhRxAK0pEHyajEeKEJoR/t62gVVNCHqmIXmgV4Q7n3FWDwFfekFZTmJ1szn4GB7 qTaND6c7v85jaIQa6cJQnONDhBQ9NKxi3x4jGg6eaXRVSEd85sy0eOLsY4aavnLWpG+p RvOw== X-Forwarded-Encrypted: i=1; AJvYcCVIBw/29Z2wZk6UBBT9f6ckQyNbxMdFhqIF70Ex63GSTh1Q4CoEY3hK/ZnNe+Fey7DKeP2yfQAkq16tRFgf+07wqH7UDAOEjqlRFgrS X-Gm-Message-State: AOJu0YyHAqccSRJiEqOVT/YCKtnXCW9+4/Up7CGywAKsuzelESPf07YS rdngo770T1GkMPGmJm7BrXU/caDHxFPU2aydqL/BKOVur6VPaqXN4hDKsb5/lcGMijOoXj8nTdx +zQ== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90b:2752:b0:2bd:f679:24ac with SMTP id 98e67ed59e1d1-2c2bc790091mr8377a91.0.1717781183524; Fri, 07 Jun 2024 10:26:23 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 7 Jun 2024 10:26:09 -0700 In-Reply-To: <20240607172609.3205077-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240607172609.3205077-1-seanjc@google.com> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: <20240607172609.3205077-7-seanjc@google.com> Subject: [PATCH 6/6] KVM: x86: WARN if a vCPU gets a valid wakeup that KVM can't yet inject From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Maxim Levitsky , Jim Mattson Content-Type: text/plain; charset="UTF-8" WARN if a blocking vCPU is awaked by a valid wake event that KVM can't inject, e.g. because KVM needs to completed a nested VM-enter, or needs to re-inject an exception. For the nested VM-Enter case, KVM is supposed to clear "nested_run_pending" if L1 puts L2 into HLT, i.e. entering HLT "completes" the nested VM-Enter. And for already-injected exceptions, it should be impossible for the vCPU to be in a blocking state if a VM-Exit occurred while an exception was being vectored. Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 82442960b499..f6ace2bd7124 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11233,7 +11233,10 @@ static inline int vcpu_block(struct kvm_vcpu *vcpu) * causes a spurious wakeup from HLT). */ if (is_guest_mode(vcpu)) { - if (kvm_check_nested_events(vcpu) < 0) + int r = kvm_check_nested_events(vcpu); + + WARN_ON_ONCE(r == -EBUSY); + if (r < 0) return 0; } -- 2.45.2.505.gda0bf45e8d-goog