From nobody Mon Feb 9 01:45:25 2026 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 AB51F2E628 for ; Thu, 28 Nov 2024 00:55:57 +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=1732755359; cv=none; b=GMVXYP2AxqHUUWcbwPFyCUAZ1vt1lIPhuvCMTFM4kkj7HxoYk8FY35DojSb8Eexug1oz0oBoPExIUtNuLhR6giKvwO74rk6Va4OUVuZOTOPl2Vp4s61ACMC3U0wMdNVoG93Yeod77rAfR/jHBr2y9+PgJNLDR6FA7vn3Zkt6jn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732755359; c=relaxed/simple; bh=WNgn4lu1ApV1cGqCgEdQ8UELTIdxvWrpSXPjrrKh+zU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BLXoD7vF5BWLQRdFkuJDzd3drgPEgioahmwqzLG+zj3sqiee77mlvCrwLJJQqUr3r2pqY42GHsQ/56WhkJng/7ffzuFPcBTwr/bxXKeJQFsERwhHAVnZI+BLf2J94mursg9ABlpQvnGdYVlXN2b/EMlQojPiiyZnmxsVOBTwaP0= 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=RLmFgQLO; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RLmFgQLO" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2ea4291c177so273536a91.2 for ; Wed, 27 Nov 2024 16:55:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732755357; x=1733360157; 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=VnpBHLYkUch4fOHU4hkMVn/ClZoihkAVUxnB9ZaI9Pw=; b=RLmFgQLOx1T+u6XwqgMuR4WV6xZYBL7N1RNTWPkNLK6+3EK9CbRxbQnQ7h/GbLX/g+ DFjgd+VE/Uaf/2C+DEXgI9HniueFRX0267E+uP+5Ny+WHCnzCalSu//K7PjYzSc70nE+ t6l+1SS9FiX36Xt/4JaIpcrdfEkI3LxiT4SjCDIGt4/kBSdAPuwK3n9fzQX6BzQnn+DI zZhW1oKDTepUIrAurkqLmtChy8l1M1LnFaLkvAFs0Efm1LjACQTzRNAW3+k0kmBH64Il hi4OVR6L5am0FmrYMhDiu74ILHrqjxllrxnTojspjHXxsvNdYVPq7SnL4fmqo9Ad0pis j5bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732755357; x=1733360157; 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=VnpBHLYkUch4fOHU4hkMVn/ClZoihkAVUxnB9ZaI9Pw=; b=fu2RCEO42JOQ+SW1Nb/h1kWOmrd0SkMRqegeoFw+9KRkqhLHAZJarFNyQtB4GGUzAq HKgGzBi78eKlm/B4N/0GT8Eanf2szLqbSlMCNQ8QH/XR1FvldzS1JlTsKwxGhmfiq7Hn 9fBo4lTmOM6zOz/hB0rQ8kOPdS5A/UQ5efUnOquNby8RJO+AR0WxPqDGKJF60fGlwYEp wo2Qb+ha2/Lw7dZTcWjrdnkNg5cfLbvaJ3Mxqi/An+3lP2pJxnAnosWmVS/woq/x5sOa 4bZulhFxrsVxrIz2hA2WOoY0rS7mZMGIsgVQTEfXZJwJp39Qv9czuzQheRAFuvqCK5mA jk7w== X-Forwarded-Encrypted: i=1; AJvYcCWJJx/Jp0XrQeFMviXjZOAQsvjUEKx5KPWlNTIrMUGGNeoF6fiOTtmtKB36pNrVg+RniQAfq4NTci+r1/4=@vger.kernel.org X-Gm-Message-State: AOJu0YztBhI1ixMy4sYRd3TMux+p7uSpBr0AAAKjcJH0uW2z2/gUcKQq GhX/AH4vUaKPWJbEuTIEs0wcKzxwAvDnnBxJ4Nkx7mGRk7806lXLkdLerS9KtBL+K50wCM3Afp8 erA== X-Google-Smtp-Source: AGHT+IGNjVu9IbM8M8x4FgAf0ptLY31wfGw0nWSewj8xLv7iHu7ExU2Pbfe7utzxkDM6gVPdI3CzS8OquPA= X-Received: from pjbsc10.prod.google.com ([2002:a17:90b:510a:b0:2ea:d2de:f7ca]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90a:fe06:b0:2ea:83a0:4798 with SMTP id 98e67ed59e1d1-2ee08e9f0f7mr7211038a91.3.1732755357079; Wed, 27 Nov 2024 16:55:57 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 27 Nov 2024 16:55:35 -0800 In-Reply-To: <20241128005547.4077116-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: <20241128005547.4077116-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241128005547.4077116-5-seanjc@google.com> Subject: [PATCH v4 04/16] KVM: selftests: Check for a potential unhandled exception iff KVM_RUN succeeded From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , James Houghton , Muhammad Usama Anjum Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Don't check for an unhandled exception if KVM_RUN failed, e.g. if it returned errno=3DEFAULT, as reporting unhandled exceptions is done via a ucall, i.e. requires KVM_RUN to exit cleanly. Theoretically, checking for a ucall on a failed KVM_RUN could get a false positive, e.g. if there were stale data in vcpu->run from a previous exit. Reviewed-by: James Houghton Reviewed-by: Andrew Jones Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/lib/kvm_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/sel= ftests/kvm/lib/kvm_util.c index 480e3a40d197..33fefeb3ca44 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1648,7 +1648,8 @@ int _vcpu_run(struct kvm_vcpu *vcpu) rc =3D __vcpu_run(vcpu); } while (rc =3D=3D -1 && errno =3D=3D EINTR); =20 - assert_on_unhandled_exception(vcpu); + if (!rc) + assert_on_unhandled_exception(vcpu); =20 return rc; } --=20 2.47.0.338.g60cca15819-goog