Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1357050ybz; Wed, 22 Apr 2020 19:27:58 -0700 (PDT) X-Google-Smtp-Source: APiQypLzqjLCKZ7XeeZinPeTfsjcnoP9i2ah4tmIV8p10uKjoNnEXpBd8urujB9T/sQEiYV4d6tT X-Received: by 2002:a17:906:ecb8:: with SMTP id qh24mr891515ejb.299.1587608877865; Wed, 22 Apr 2020 19:27:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587608877; cv=none; d=google.com; s=arc-20160816; b=0uBJIgMo/UruIBqdHcZ4gYh09QPedseN+9BSP5HO/+0OOllcq6d8gOZXFJJummp4dx 8oqBIa+UtiS6kGLXoqHtL3xTFf7tjM5Z7XjSvz8mbtx2ESBxeoUHfEFgdWte5alYjVrP vViVP6t7D/Wdc5wdrJWFpAbsElsX3DC8s07QqrlgcaQ7x7f7aZaz5tPOteaw0SrZxUTc 7JM11P4oeTyZaq7IGlGgoWdisS9UXZ7S4jLBugpm0Y737K1zxbnhcWllzxCcSDSXkOhk +39mxDtfY2izAYcScpEh03M163LCnF56kuBz/y9zJO7S0wR+Q0jW/KfOQps1Lzyjgmzh Fyyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=iPo8ST12lpddSPS+f+otOYnjSV4W9eWgTk9U2rmg7Qs=; b=fEUgQPnaW2XjwxmcIFmIC4hTYc9nXvyPoaVPNaMBPu7Epwjt8fzxJFe1LDt+qh9ew9 VA3oXOt81i+Niars1mw2xVyPQMyyJVVW2FHUIYBG+7tRrXDX5GEEPYbxEDGyf/V+DPrG QsNxB4AHF297C7SezsBnvS68SDPIx+wDFMRl3tx1Cv/3I3hdnug3m9TRL6t4MrXDQyo+ /AGRJ2zGZUVlnIkwuuuMp8XmkH7i07L/XSC6+kACCszi6j6a3+0KLCI+abu0BTLtCOsV HYHZPYnM1CUuv6Cx4JBvBPehpzlYNnQYuK+sVPYTdln+2A/RBdFmU4fcPQCZ6m4Irx6B xpZg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si494166edq.326.2020.04.22.19.27.35; Wed, 22 Apr 2020 19:27:57 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726667AbgDWC0P (ORCPT + 99 others); Wed, 22 Apr 2020 22:26:15 -0400 Received: from mga06.intel.com ([134.134.136.31]:33067 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726593AbgDWC0A (ORCPT ); Wed, 22 Apr 2020 22:26:00 -0400 IronPort-SDR: i70pUQgADsbrDYLQ4Bh5sIuKyU04zlTLzoRRYl9Pv/EDnZWNA1La6nFinqFOSVXinSlVqClG/N RUmjbLOUohBw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2020 19:25:55 -0700 IronPort-SDR: oB3KKJgN9AQTijfc1cV6lgRQhpSpEjBpSgpDWQYRur6awFonFIcrhzg3jvnBC3QbpqwrR+LD8/ iSWA8uflepOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,305,1583222400"; d="scan'208";a="259273961" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.202]) by orsmga006.jf.intel.com with ESMTP; 22 Apr 2020 19:25:54 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Upton , Peter Shier Subject: [PATCH 10/13] KVM: x86: WARN on injected+pending exception even in nested case Date: Wed, 22 Apr 2020 19:25:47 -0700 Message-Id: <20200423022550.15113-11-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200423022550.15113-1-sean.j.christopherson@intel.com> References: <20200423022550.15113-1-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org WARN if a pending exception is coincident with an injected exception before calling check_nested_events() so that the WARN will fire even if inject_pending_event() bails early because check_nested_events() detects the conflict. Bailing early isn't problematic (quite the opposite), but suppressing the WARN is undesirable as it could mask a bug elsewhere in KVM. Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 6af873b7e0ae..7c49a7dc601f 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -7693,6 +7693,9 @@ static int inject_pending_event(struct kvm_vcpu *vcpu) kvm_x86_ops.set_irq(vcpu); } + WARN_ON_ONCE(vcpu->arch.exception.injected && + vcpu->arch.exception.pending); + /* * Call check_nested_events() even if we reinjected a previous event * in order for caller to determine if it should require immediate-exit @@ -7711,7 +7714,6 @@ static int inject_pending_event(struct kvm_vcpu *vcpu) vcpu->arch.exception.has_error_code, vcpu->arch.exception.error_code); - WARN_ON_ONCE(vcpu->arch.exception.injected); vcpu->arch.exception.pending = false; vcpu->arch.exception.injected = true; -- 2.26.0